I think that the original code is faulty, therefore I deduced the probable function from the output messages.
We could do with some input from the O/P .
Interesting point in the Open Group posting about "test" with an "and" clause when the first parameter is "!" and the second parameter is blank. Not come across the problem myself but the point is valid.
My point about [[ was badly worded. It was about removing the distinction between [[ and [ with view to removing [[ completely. Similarly "test" as an external commmand was to be depreciated.
Interestingly the current proposal has backed down on this one.
See "rationale" in this link:
test
This wasn't the only place I have read about [[ by far. I take a mild interest because of historic trouble with [[ and ]] being external commands and some painful diagnostics of badly written Conditional Expressions.
If a unix comes out with a Shell which is too diverse I will just recommend that we do not purchase.