[Solved] Ignoring belowdisplayshortskip or belowdisplayskip at the end of an environment: how to do it?

Colas Asks: Ignoring belowdisplayshortskip or belowdisplayskip at the end of an environment: how to do it?
I would like to ignore belowdisplayshortskip or belowdisplayskip when it is at the end of a given environment.

In the MWE below, I am looking for a command lookedForCommand that delete the extra space avec [ ... ] in the third occurence of begin{test} ... end{test} but not in the second.

Is it possible? If yes, how to do it?

Thanks

Code:
documentclass{article}

setlength{parindent}{0pt}

deflookedForCommand{}

newenvironment{test}{bigskip xxxxxxxxxxxxxxxxxxxx smallskippar}{lookedForCommandparsmallskip xxxxxxxxxxxxxxxxxxxx bigskip}

begin{document}

begin{test}
We know that $1+1=2$.
end{test}

begin{test}
We know that [1+1=2]
and $1+2=3$.
end{test}

begin{test}
We know that [1+1=2.]
end{test}

end{document}


enter image description here

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.