gnupic: Re: [gnupic] gputils regression tests


Previous by date: 11 Jun 2007 17:01:07 +0100 gputils regression tests, David Barnett
Next by date: 11 Jun 2007 17:01:07 +0100 Re: [gnupic] gputils regression tests, David Barnett
Previous in thread:
Next in thread: 11 Jun 2007 17:01:07 +0100 Re: [gnupic] gputils regression tests, David Barnett

Subject: Re: [gnupic] gputils regression tests
From: Ralph Corderoy ####@####.####
Date: 11 Jun 2007 17:01:07 +0100
Message-Id: <20070611160044.D291A14892E@blake.inputplus.co.uk>

Hi David,

> The conditional to test for a failure is something like this:
> 
>  if ! test $tested=$passed then;
>    return 1
>  fi

"something like this"?  What is it precisely?  I don't have access to
the source at the moment.

> Maybe some bash guru can fill me in on what "test $a=$b" actually
> tests, but apparently "test 1=2" returns true.  For that problem, I
> can easily change the test to:
> 
>  if (($tested==$passed)) then;

You're then making it something other than a Bourne shell script.  I
think you need to see test(1) and consider

    $ test 1 = 1 && echo yes
    yes
    $ test 1 = 2 && echo yes
    $ test 1 -eq 1 && echo yes
    yes
    $ test 1 -eq 2 && echo yes
    $ test 1 = '  1' && echo yes
    $ test 1 -eq '  1' && echo yes
    yes
    $ test foo && echo yes
    yes
    $ test '' && echo yes
    $ test 1=2 && echo yes
    yes

bearing in mind `=' is string equality, `-eq' is a numeric comparison,
and if only one argument is given it's true if it isn't empty.

It could well be there's no problem if they've written something like

    if test "$a" = "$b"; then

Or it could well be there is a problem and you've found it.  :-)

Cheers,


Ralph.


Previous by date: 11 Jun 2007 17:01:07 +0100 gputils regression tests, David Barnett
Next by date: 11 Jun 2007 17:01:07 +0100 Re: [gnupic] gputils regression tests, David Barnett
Previous in thread:
Next in thread: 11 Jun 2007 17:01:07 +0100 Re: [gnupic] gputils regression tests, David Barnett


Powered by ezmlm-browse 0.20.