Re: [PATCH] tests: use "returns_" rather than explicit comparison with "
From:
Pádraig Brady
Subject:
Re: [PATCH] tests: use "returns_" rather than explicit comparison with "$?"
Date:
Sun, 13 Nov 2016 12:11:21 +0000
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0
On 13/11/16 02:38, Jim Meyering wrote:
> I noticed many tests that compare directly with "$?". However, we now
> have the "returns_" function (from init.sh) that can be used to make
> the resulting code a little less error-prone: all on one line/stmt, it
> is harder to accidentally insert code that accidentally clobbers "$?".
>
> Here's an example of what most of these changes look like:
>
> -ls -l --time-style=XX > out 2> err
> -test $? = 2 || fail=1
> +returns_ 2 ls -l --time-style=XX > out 2> err || fail=1
>
Nice cleanup. All look good.
thanks,
Pádraig