git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] t6300-for-each-ref: fix "more than one quoting style" tests
@ 2018-02-13  0:36 SZEDER Gábor
  2018-02-13 22:22 ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: SZEDER Gábor @ 2018-02-13  0:36 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, SZEDER Gábor

'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>
---

Those tests were like this since ancient times, c9ecf4f12a
(for-each-ref: Fix quoting style constants., 2007-12-06).


 t/t6300-for-each-ref.sh | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index c128dfc579..295d1475bd 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -373,11 +373,8 @@ test_expect_success 'Quoting style: tcl' '
 
 for i in "--perl --shell" "-s --python" "--python --tcl" "--tcl --perl"; do
 	test_expect_success "more than one quoting style: $i" "
-		git for-each-ref $i 2>&1 | (read line &&
-		case \$line in
-		\"error: more than one quoting style\"*) : happy;;
-		*) false
-		esac)
+		test_must_fail git for-each-ref $i 2>err &&
+		grep '^error: more than one quoting style' err
 	"
 done
 
-- 
2.16.1.181.g4b60b0bfb6


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-15 17:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-13  0:36 [PATCH] t6300-for-each-ref: fix "more than one quoting style" tests SZEDER Gábor
2018-02-13 22:22 ` Jeff King
2018-02-15 16:39   ` SZEDER Gábor
2018-02-15 16:52     ` Jeff King
2018-02-15 17:41       ` SZEDER Gábor

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).