Subject: Re: test is not posix
From: Peter Stephenson <[email-masked]>
To: [email-masked]
Date: Thu, 21 Jan 2016 12:41:13 +0000
List-Id: Zsh Workers List <zsh-workers.zsh.org>

On Thu, 21 Jan 2016 00:46:47 +0100
Martijn Dekker <[email-masked]> wrote:
> Trek schreef op 20-01-16 om 22:06:
> > with zsh called as sh:
> > 
> >   $ zsh/sh -c 'test -n "!" && echo ok'
> >   zsh:test:1: too many arguments
> 
> I think this might be the same bug that I reported back in May with
>   test -n '('
> and
>   test -n ')'
> http://www.zsh.org/mla/workers/2015/msg01225.html

Yes, we now have tests for the following cases.  It's trivial to add more
if you can think of any that might be problematic.

pws

  test -z \( || print Not zero 1
  test -z \< || print Not zero 2
  test -n \( && print Not zero 3
  test -n \) && print Not zero 4
  [ -n \> ] && print Not zero 5
  [ -n \! ] && print Not zero 6
0:test with two arguments and a token
>Not zero 1
>Not zero 2
>Not zero 3
>Not zero 4
>Not zero 5
>Not zero 6