test: am of empty patch should not succeed
authorJonathan Nieder <jrnieder@gmail.com>
Sat, 14 Apr 2012 04:48:13 +0000 (23:48 -0500)
committerJunio C Hamano <gitster@pobox.com>
Sat, 14 Apr 2012 23:17:12 +0000 (16:17 -0700)
The "git am empty" test uses the construct

git am empty-file && false || :

which unconditionally returns true.  Use test_must_fail instead, which
also has the benefit of noticing if "git am" has segfaulted.

While at it, tighten the test to check that the diagnostic appears on
stderr and not stdout.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t4150-am.sh

index ebb4a26..cdafd7e 100755 (executable)
@@ -525,7 +525,7 @@ test_expect_success 'am empty-file does not infloop' '
        git reset --hard &&
        touch empty-file &&
        test_tick &&
-       { git am empty-file > actual 2>&1 && false || :; } &&
+       test_must_fail git am empty-file 2>actual &&
        echo Patch format detection failed. >expected &&
        test_i18ncmp expected actual
 '