t/t1467: use test_must_fail in place of NOT operator Replace the "not" (!) operator with `test_must_fail` for refs-rename test. The use of `test_must_fail` is preferred over not (!) operator because it ensures that the command fails gracefully. If the command crashes (e.g. a segfault) or is killed by a signal, the failure is handled correctly by `test_must_fail` which will fail the test whereas the `!` operator would silently accept the crash as an expected failure. Signed-off-by: Hardik Kumar <hardikxk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff --git a/t/t1467-refs-rename.sh b/t/t1467-refs-rename.sh index 2b28be7..b7d290d 100755 --- a/t/t1467-refs-rename.sh +++ b/t/t1467-refs-rename.sh
@@ -88,7 +88,7 @@ A=$(git rev-parse A) && git refs create refs/heads/target $A && git symbolic-ref refs/heads/symref refs/heads/target && - ! git refs rename refs/heads/symref refs/heads/renamed 2>err && + test_must_fail git refs rename refs/heads/symref refs/heads/renamed 2>err && test_grep "is a symbolic ref, .* not supported" err ) '