Skip to content

Commit c1e02b2

Browse files
j6tgitster
authored andcommitted
t3700-add: fix dependence on stdout and stderr buffering
One test case checked the stdout and stderr of 'git add' by constructing a single 'expect' file that contained both streams. But when the command runs, the order of stdout and stderr output is unpredictable because it depends on how the streams are buffered. At least on Windows, the buffering is different from what the test case expected. Hence, check the two output texts separately. Signed-off-by: Johannes Sixt <[email protected]> Acked-by: Jens Lehmann <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 938791c commit c1e02b2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

t/t3700-add.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,17 +272,20 @@ test_expect_success 'git add --dry-run of non-existing file' "
272272
echo \"fatal: pathspec 'ignored-file' did not match any files\" | test_cmp - actual
273273
"
274274

275-
cat >expect <<EOF
275+
cat >expect.err <<\EOF
276276
The following paths are ignored by one of your .gitignore files:
277277
ignored-file
278278
Use -f if you really want to add them.
279279
fatal: no files added
280+
EOF
281+
cat >expect.out <<\EOF
280282
add 'track-this'
281283
EOF
282284

283285
test_expect_success 'git add --dry-run --ignore-missing of non-existing file' '
284-
test_must_fail git add --dry-run --ignore-missing track-this ignored-file >actual 2>&1 &&
285-
test_cmp expect actual
286+
test_must_fail git add --dry-run --ignore-missing track-this ignored-file >actual.out 2>actual.err &&
287+
test_cmp expect.out actual.out &&
288+
test_cmp expect.err actual.err
286289
'
287290

288291
test_done

0 commit comments

Comments
 (0)