From: "SZEDER Gábor" <szeder@ira.uka.de>
To: git@vger.kernel.org
Cc: "Felipe Contreras" <felipe.contreras@gmail.com>,
"Jeff King" <peff@peff.net>,
"Jonathan Nieder" <jrnieder@gmail.com>,
"Junio C Hamano" <gitster@pobox.com>,
"SZEDER Gábor" <szeder@ira.uka.de>
Subject: [PATCH 1/7] completion: make the 'basic' test more tester-friendly
Date: Sat, 17 Nov 2012 12:05:47 +0100 [thread overview]
Message-ID: <1353150353-29874-2-git-send-email-szeder@ira.uka.de> (raw)
In-Reply-To: <1353150353-29874-1-git-send-email-szeder@ira.uka.de>
The 'basic' test uses 'grep -q' to filter the resulting possible
completion words while looking for the presence or absence of certain
git commands, and relies on grep's exit status to indicate a failure.
This works fine as long as there are no errors. However, in case of a
failure it doesn't give any indication whatsoever about the reason of
the failure, i.e. which condition failed.
To make testers' life easier provide some output about the failed
condition: store the results of the filtering in a file and compare
its contents to the expected results by the good old test_cmp helper.
However, to actually get output from test_cmp in case of an error we
must make sure that test_cmp is always executed. Since in case of an
error grep's exit code aborts the test immediately, before running the
subsequent test_cmp, do the filtering using sed instead of grep.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
t/t9902-completion.sh | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 8fa025f9..b56759f7 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -158,14 +158,22 @@ test_expect_success '__gitcomp - suffix' '
test_expect_success 'basic' '
run_completion "git \"\"" &&
# built-in
- grep -q "^add \$" out &&
+ echo "add " >expected &&
+ sed -n "/^add \$/p" out >out2 &&
+ test_cmp expected out2 &&
# script
- grep -q "^filter-branch \$" out &&
+ echo "filter-branch " >expected &&
+ sed -n "/^filter-branch \$/p" out >out2 &&
+ test_cmp expected out2 &&
# plumbing
- ! grep -q "^ls-files \$" out &&
+ >expected &&
+ sed -n "/^ls-files \$/p" out >out2 &&
+ test_cmp expected out2 &&
run_completion "git f" &&
- ! grep -q -v "^f" out
+ >expected &&
+ sed -n "/^[^f]/p" out >out2 &&
+ test_cmp expected out2
'
test_expect_success 'double dash "git" itself' '
--
1.8.0.220.g4d14ece
next prev parent reply other threads:[~2012-11-17 11:06 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-17 11:05 [PATCH 0/7] completion: fix expansion issues with compgen SZEDER Gábor
2012-11-17 11:05 ` SZEDER Gábor [this message]
2012-11-17 23:00 ` [PATCH 1/7] completion: make the 'basic' test more tester-friendly Jonathan Nieder
2012-11-18 9:38 ` Felipe Contreras
2012-11-18 9:39 ` Felipe Contreras
2012-11-17 11:05 ` [PATCH 2/7] completion: fix args of run_completion() test helper SZEDER Gábor
2012-11-17 23:02 ` Jonathan Nieder
2012-11-18 8:48 ` Felipe Contreras
2012-11-17 11:05 ` [PATCH 3/7] completion: add tests for the __gitcomp_nl() completion helper function SZEDER Gábor
2012-11-17 23:31 ` Jonathan Nieder
2012-11-18 8:53 ` Felipe Contreras
2012-11-17 11:05 ` [PATCH 4/7] completion: add tests for invalid variable name among completion words SZEDER Gábor
2012-11-17 23:40 ` Jonathan Nieder
2012-11-18 8:34 ` Felipe Contreras
2012-11-18 8:34 ` Felipe Contreras
2012-11-17 11:05 ` [PATCH 5/7] completion: fix expansion issues in __gitcomp_nl() SZEDER Gábor
2012-11-17 11:50 ` Felipe Contreras
2012-11-17 14:14 ` SZEDER Gábor
2012-11-17 19:08 ` Felipe Contreras
2012-11-17 19:28 ` Felipe Contreras
2012-11-18 0:55 ` Felipe Contreras
2012-11-18 0:58 ` Felipe Contreras
2012-11-17 11:05 ` [PATCH 6/7] completion: fix expansion issue in __gitcomp() SZEDER Gábor
2012-11-17 11:39 ` Felipe Contreras
2012-11-17 14:09 ` SZEDER Gábor
2012-11-17 11:05 ` [PATCH 7/7] completion: remove the now unused __gitcomp_1() internal helper function SZEDER Gábor
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=1353150353-29874-2-git-send-email-szeder@ira.uka.de \
--to=szeder@ira.uka.de \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=peff@peff.net \
/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).