t6300-for-each-ref: fix "more than one quoting style" tests
'git for-each-ref' should error out when invoked with more than one quoting style options. The tests checking this have two issues: - They run 'git for-each-ref' upstream of a pipe, hiding its exit code, thus don't actually checking that 'git for-each-ref' exits with error code. - They check the error message in a rather roundabout way. Ensure that 'git for-each-ref' exits with an error code using the 'test_must_fail' helper function, and check its error message by grepping its saved standard error. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor committed
Feb 13, 2018 at 01:36 UTC
2708ef4af6ed60b89e93de72673e7b785b93d760
1 file changed
+2
-5
t/t6300-for-each-ref.sh
+2
-5
@@ -373,11 +373,8 @@ test_expect_success 'Quoting style: tcl' '
373
374
for i in "--perl --shell" "-s --python" "--python --tcl" "--tcl --perl"; do
375
test_expect_success "more than one quoting style: $i" "
376
- git for-each-ref $i 2>&1 | (read line &&
377
- case \$line in
378
- \"error: more than one quoting style\"*) : happy;;
379
- *) false
380
- esac)
376
+ test_must_fail git for-each-ref $i 2>err &&
377
+ grep '^error: more than one quoting style' err
378
"
379
done
380