From: David Aguilar <davvid@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git ML <git@vger.kernel.org>,
Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH 1/2] t7800: simplify basic usage test
Date: Tue, 7 Feb 2017 01:16:59 -0800 [thread overview]
Message-ID: <20170207091700.20156-1-davvid@gmail.com> (raw)
Use "test_line_count" instead of "wc -l", use "git -C" instead of a
subshell, and use test_expect_code when calling difftool. Ease
debugging by capturing output into temporary files.
Suggested-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
This patch applies on top of js/difftool-builtin in next
"difftool: fix bug when printing usage"
t/t7800-difftool.sh | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index 21e2ac4ad6..97bae54d83 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -24,16 +24,15 @@ prompt_given ()
}
test_expect_success 'basic usage requires no repo' '
- lines=$(git difftool -h | grep ^usage: | wc -l) &&
- test "$lines" -eq 1 &&
+ test_expect_code 129 git difftool -h >output &&
+ grep ^usage: output &&
# create a ceiling directory to prevent Git from finding a repo
mkdir -p not/repo &&
- ceiling="$PWD/not" &&
- lines=$(cd not/repo &&
- GIT_CEILING_DIRECTORIES="$ceiling" git difftool -h |
- grep ^usage: | wc -l) &&
- test "$lines" -eq 1 &&
- rmdir -p not/repo
+ test_when_finished rm -r not &&
+ test_expect_code 129 \
+ env GIT_CEILING_DIRECTORIES="$(pwd)/not" \
+ git -C not/repo difftool -h >output &&
+ grep ^usage: output
'
# Create a file on master and change it on branch
--
2.12.0.rc0.228.g6c028b8e94
next reply other threads:[~2017-02-07 9:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-07 9:16 David Aguilar [this message]
2017-02-07 9:17 ` [PATCH 2/2] t7800: replace "wc -l" with test_line_count David Aguilar
2017-02-07 12:02 ` Johannes Schindelin
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=20170207091700.20156-1-davvid@gmail.com \
--to=davvid@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johannes.schindelin@gmx.de \
/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).