Re: [PATCH] Use exit 1 instead of die when req_Root fails.
- From
- Lars Hjemli <hjemli@gmail.com>
- Date
- Oct 17, 2007, 19:27 UTC
- Message-ID
- <8c5c35580710171227o45c6b113ve10f293a4505bab5@mail.gmail.com>
- In-Reply-To
- <8B2F7666-DCEB-4D58-ACFE-F40587CD415D@silverinsanity.com>
On 10/17/07, Brian Gernhardt <benji@silverinsanity.com> wrote:
Show 17 quoted lines
> I wish I got this much attention the first time I tried to get this > problem fixed. ;-) > > On Oct 17, 2007, at 11:39 AM, Lars Hjemli wrote: > > > This makes me wonder: what about all the other instances of die() in > > git-cvsserver? Or in any of the other perl scripts, for that matter? > > Should they all be fixed, or is it this particular test that is wrong? > > The reason this comes up is because t/test-lib.sh:test_expect_failure > () thinks codes > 128 (or negative values if you want to look at it > that way) are bad tests. I believe this is because many shells use > these codes to indicate things like "command not found" or other > probably unexpected failures. > > Other than that, does it matter what die() returns, as long as it's > non-zero?
My point exactly ;-)
If the test is changed to use 'test_expect_success' in the same way as 'req_Root failure (relative pathname)' does it, the test no longer depends on the exact exit-code returned by die().
IMHO this is much better future-proofing than replacing die() with print()/exit 1 whenever one of these tests fails.
-- larsh