Skip to content

Commit 93f8604

Browse files
rybakgitster
authored andcommitted
t1300: check stderr for "ignores pairs" tests
Tests "git config ignores pairs ..." in t1300-config.sh validate that "git config" ignores various kinds of supplied pairs of environment variables GIT_CONFIG_KEY_* GIT_CONFIG_VALUE_* depending on GIT_CONFIG_COUNT. By "ignores" here we mean that "git config" abides by the value of environment variable GIT_CONFIG_COUNT and doesn't use key-value pairs outside of the supplied GIT_CONFIG_COUNT when trying to produce a value for config key "pair.one". These tests also validate that "git config" doesn't complain about mismatched environment variables to standard error. This is validated by redirecting the standard error to a file called "error" and asserting that it is empty. However, two of these tests incorrectly redirect to standard output while calling the file "error", and test 'git config ignores pairs exceeding count' doesn't validate standard error at all. Fix these tests by redirecting standard error to file "error" and asserting its emptiness. Signed-off-by: Andrei Rybak <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f7f9a83 commit 93f8604

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

t/t1300-config.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,24 +1462,25 @@ test_expect_success 'git config ignores pairs exceeding count' '
14621462
GIT_CONFIG_COUNT=1 \
14631463
GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \
14641464
GIT_CONFIG_KEY_1="pair.two" GIT_CONFIG_VALUE_1="value" \
1465-
git config --get-regexp "pair.*" >actual &&
1465+
git config --get-regexp "pair.*" >actual 2>error &&
14661466
cat >expect <<-EOF &&
14671467
pair.one value
14681468
EOF
1469-
test_cmp expect actual
1469+
test_cmp expect actual &&
1470+
test_must_be_empty error
14701471
'
14711472

14721473
test_expect_success 'git config ignores pairs with zero count' '
14731474
test_must_fail env \
14741475
GIT_CONFIG_COUNT=0 GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \
1475-
git config pair.one >error &&
1476+
git config pair.one 2>error &&
14761477
test_must_be_empty error
14771478
'
14781479

14791480
test_expect_success 'git config ignores pairs with empty count' '
14801481
test_must_fail env \
14811482
GIT_CONFIG_COUNT= GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \
1482-
git config pair.one >error &&
1483+
git config pair.one 2>error &&
14831484
test_must_be_empty error
14841485
'
14851486

0 commit comments

Comments
 (0)