git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Rast <trast@student.ethz.ch>
To: <git@vger.kernel.org>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>
Subject: [PATCH] t0000: quote TAP snippets in test code
Date: Thu, 13 Jan 2011 12:30:23 +0100	[thread overview]
Message-ID: <7f14b9991e1c2fe20257c4102ec6b54be6e720c8.1294918219.git.trast@student.ethz.ch> (raw)

t0000 contains two snippets of actual test output.  This causes
problems when passing -v to the test[*]: the test infrastructure
echoes the tests before running them, and the TAP parser then sees
this test output and concludes that two tests failed and that the TAP
output was badly formatted.

Guard against this by quoting the output in the source.

[*] either by running 'make smoke' with GIT_TEST_OPTS=-v, or with
prove ./t0000-basic.sh :: -v

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
 t/t0000-basic.sh |   36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index 2f7002a..8deec75 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -80,11 +80,11 @@ EOF
     chmod +x passing-todo.sh &&
     ./passing-todo.sh >out 2>err &&
     ! test -s err &&
-cat >expect <<EOF &&
-ok 1 - pretend we have fixed a known breakage # TODO known breakage
-# fixed 1 known breakage(s)
-# passed all 1 test(s)
-1..1
+sed -e 's/^> //' >expect <<EOF &&
+> ok 1 - pretend we have fixed a known breakage # TODO known breakage
+> # fixed 1 known breakage(s)
+> # passed all 1 test(s)
+> 1..1
 EOF
     test_cmp expect out)
 "
@@ -164,19 +164,19 @@ EOF
     test_must_fail ./failing-cleanup.sh >out 2>err &&
     ! test -s err &&
     ! test -f \"trash directory.failing-cleanup/clean-after-failure\" &&
-sed -e 's/Z$//' >expect <<\EOF &&
-not ok - 1 tests clean up even after a failure
-#	Z
-#	    touch clean-after-failure &&
-#	    test_when_finished rm clean-after-failure &&
-#	    (exit 1)
-#	Z
-not ok - 2 failure to clean up causes the test to fail
-#	Z
-#	    test_when_finished \"(exit 2)\"
-#	Z
-# failed 2 among 2 test(s)
-1..2
+sed -e 's/Z$//' -e 's/^> //' >expect <<\EOF &&
+> not ok - 1 tests clean up even after a failure
+> #	Z
+> #	    touch clean-after-failure &&
+> #	    test_when_finished rm clean-after-failure &&
+> #	    (exit 1)
+> #	Z
+> not ok - 2 failure to clean up causes the test to fail
+> #	Z
+> #	    test_when_finished \"(exit 2)\"
+> #	Z
+> # failed 2 among 2 test(s)
+> 1..2
 EOF
     test_cmp expect out)
 "
-- 
1.7.4.rc1.309.g58aa0

                 reply	other threads:[~2011-01-13 11:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7f14b9991e1c2fe20257c4102ec6b54be6e720c8.1294918219.git.trast@student.ethz.ch \
    --to=trast@student.ethz.ch \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).