Thread View: linux.kernel.git
2 messages
2 total messages
Started by Hardik Kumar
Wed, 28 Oct 2026 10:23
[PATCH v2] t/t1467: use test_must_fail in place of NOT operator
Author: Hardik Kumar
Date: Wed, 28 Oct 2026 10:23
Date: Wed, 28 Oct 2026 10:23
36 lines
12574 bytes
12574 bytes
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> --- Changes in v2: - Refactor commit message - Link to v1: https://lore.kernel.org/r/20261028-refs-rename-test-fail-v1-1-b7458ca62149@gmail.com --- t/t1467-refs-rename.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t1467-refs-rename.sh b/t/t1467-refs-rename.sh index 2b28be75c8..b7d290d05b 100755 --- a/t/t1467-refs-rename.sh +++ b/t/t1467-refs-rename.sh @@ -88,7 +88,7 @@ test_expect_success 'rename with symbolic ref fails' ' 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 ) ' --- base-commit: 37b3475fb530c14109211faca33716a173db61ed change-id: 20261028-refs-rename-test-fail-ec7a8fa74e54
Re: [PATCH v2] t/t1467: use test_must_fail in place of NOT operator
Author: Junio C Hamano
Date: Wed, 28 Oct 2026 16:47
Date: Wed, 28 Oct 2026 16:47
40 lines
13974 bytes
13974 bytes
Hardik Kumar <hardikxk@gmail.com> writes: > 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> > --- > Changes in v2: > - Refactor commit message > - Link to v1: https://lore.kernel.org/r/20261028-refs-rename-test-fail-v1-1-b7458ca62149@gmail.com > --- > t/t1467-refs-rename.sh | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Will queue. Thanks. > diff --git a/t/t1467-refs-rename.sh b/t/t1467-refs-rename.sh > index 2b28be75c8..b7d290d05b 100755 > --- a/t/t1467-refs-rename.sh > +++ b/t/t1467-refs-rename.sh > @@ -88,7 +88,7 @@ test_expect_success 'rename with symbolic ref fails' ' > 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 > ) > ' > > --- > base-commit: 37b3475fb530c14109211faca33716a173db61ed > change-id: 20261028-refs-rename-test-fail-ec7a8fa74e54
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads