Skip to content

Commit 2ec2021

Browse files
dschogitster
authored andcommitted
t1300-repo-config: make it resilient to being run via 'sh -x'
One way to diagnose broken regression tests is to run the test script using 'sh -x t... -i -v' to find out which call actually demonstrates the symptom. Hence it is pretty counterproductive if the test script behaves differently when being run via 'sh -x', in particular when using test_cmp or test_i18ncmp on redirected stderr. A more recent way "sh tXXXX -i -v -x" has the same issue. So let's use test_i18ngrep (as suggested by Jonathan Nieder) instead of test_cmp/test_i18ncmp to verify that stderr looks as expected. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5ca6b7b commit 2ec2021

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

t/t1300-repo-config.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -699,17 +699,13 @@ test_expect_success 'invalid unit' '
699699
echo 1auto >expect &&
700700
git config aninvalid.unit >actual &&
701701
test_cmp expect actual &&
702-
cat >expect <<-\EOF &&
703-
fatal: bad numeric config value '\''1auto'\'' for '\''aninvalid.unit'\'' in file .git/config: invalid unit
704-
EOF
705702
test_must_fail git config --int --get aninvalid.unit 2>actual &&
706-
test_i18ncmp expect actual
703+
test_i18ngrep "bad numeric config value .1auto. for .aninvalid.unit. in file .git/config: invalid unit" actual
707704
'
708705

709706
test_expect_success 'invalid stdin config' '
710-
echo "fatal: bad config line 1 in standard input " >expect &&
711707
echo "[broken" | test_must_fail git config --list --file - >output 2>&1 &&
712-
test_cmp expect output
708+
test_i18ngrep "bad config line 1 in standard input" output
713709
'
714710

715711
cat > expect << EOF

0 commit comments

Comments
 (0)