Re: [PATCH 3/3] t7406: make a test_must_fail call fail for the right reason
On Tue, Aug 7, 2018 at 2:07 AM, SZEDER Gábor wrote: >> A test making use of test_must_fail was failing like this: >> fatal: ambiguous argument '|': unknown revision or path not in the working >> tree. >> when the intent was to verify that a specific string was not found >> in the output of the git diff command, i.e. that grep returned >> non-zero. Fix the test to do that. >> >> Signed-off-by: Elijah Newren >> --- >> t/t7406-submodule-update.sh | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh >> index c8971abd07..f65049ec73 100755 >> --- a/t/t7406-submodule-update.sh >> +++ b/t/t7406-submodule-update.sh >> @@ -603,7 +603,8 @@ test_expect_success 'submodule update - update=none in >> .git/config but --checkou >>git diff --name-only >out && >>grep submodule out && >>git submodule update --checkout && >> - test_must_fail git diff --name-only \| grep submodule && >> + git diff --name-only >out && >> + ! grep submodule out && >>(cd submodule && >> test_must_fail compare_head > > May I suggest a while-at-it cleanup? :) I think while-at-it-cleanups have become the primary purpose of this series. :-) > Here 'test_must_fail' is used in front of a shell function, which > should be written as '! compare_head', and indeed in all other places > in this test script it's written that way. Good catch; I'll fix it up. In fact, there's also one other test_must_fail in front of a non-git command inside t7406, so I'll fix that up while at it too.
Re: [PATCH 3/3] t7406: make a test_must_fail call fail for the right reason
> A test making use of test_must_fail was failing like this: > fatal: ambiguous argument '|': unknown revision or path not in the working > tree. > when the intent was to verify that a specific string was not found > in the output of the git diff command, i.e. that grep returned > non-zero. Fix the test to do that. > > Signed-off-by: Elijah Newren > --- > t/t7406-submodule-update.sh | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh > index c8971abd07..f65049ec73 100755 > --- a/t/t7406-submodule-update.sh > +++ b/t/t7406-submodule-update.sh > @@ -603,7 +603,8 @@ test_expect_success 'submodule update - update=none in > .git/config but --checkou >git diff --name-only >out && >grep submodule out && >git submodule update --checkout && > - test_must_fail git diff --name-only \| grep submodule && > + git diff --name-only >out && > + ! grep submodule out && >(cd submodule && > test_must_fail compare_head May I suggest a while-at-it cleanup? :) Here 'test_must_fail' is used in front of a shell function, which should be written as '! compare_head', and indeed in all other places in this test script it's written that way. >) && > -- > 2.18.0.548.gd57a518419 > >
[PATCH 3/3] t7406: make a test_must_fail call fail for the right reason
A test making use of test_must_fail was failing like this: fatal: ambiguous argument '|': unknown revision or path not in the working tree. when the intent was to verify that a specific string was not found in the output of the git diff command, i.e. that grep returned non-zero. Fix the test to do that. Signed-off-by: Elijah Newren --- t/t7406-submodule-update.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh index c8971abd07..f65049ec73 100755 --- a/t/t7406-submodule-update.sh +++ b/t/t7406-submodule-update.sh @@ -603,7 +603,8 @@ test_expect_success 'submodule update - update=none in .git/config but --checkou git diff --name-only >out && grep submodule out && git submodule update --checkout && -test_must_fail git diff --name-only \| grep submodule && +git diff --name-only >out && +! grep submodule out && (cd submodule && test_must_fail compare_head ) && -- 2.18.0.548.gd57a518419