From: john at keeping.me.uk (John Keeping)
Subject: [PATCH 11/12] tests: use test_line_count where appropriate
Date: Mon, 8 Apr 2013 20:12:40 +0100 [thread overview]
Message-ID: <6eebda6c22774432a9cba0d0493f4f640940267a.1365448308.git.john@keeping.me.uk> (raw)
In-Reply-To: <cover.1365448308.git.john@keeping.me.uk>
This gets us better output when the line count is incorrect, which will
help debugging test failures.
Signed-off-by: John Keeping <john at keeping.me.uk>
---
tests/t0020-validate-cache.sh | 9 ++++++---
tests/t0107-snapshot.sh | 14 +++++++-------
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/tests/t0020-validate-cache.sh b/tests/t0020-validate-cache.sh
index 135b24d..1910b47 100755
--- a/tests/t0020-validate-cache.sh
+++ b/tests/t0020-validate-cache.sh
@@ -20,7 +20,8 @@ test_expect_success 'verify cache-size=0' '
cgit_url "bar/log" &&
cgit_url "bar/diff" &&
cgit_url "bar/patch" &&
- test 0 -eq $(ls cache | wc -l)
+ ls cache >output &&
+ test_line_count = 0 output
'
test_expect_success 'verify cache-size=1' '
@@ -40,7 +41,8 @@ test_expect_success 'verify cache-size=1' '
cgit_url "bar/log" &&
cgit_url "bar/diff" &&
cgit_url "bar/patch" &&
- test 1 -eq $(ls cache | wc -l)
+ ls cache >output &&
+ test_line_count = 1 output
'
test_expect_success 'verify cache-size=1021' '
@@ -60,7 +62,8 @@ test_expect_success 'verify cache-size=1021' '
cgit_url "bar/log" &&
cgit_url "bar/diff" &&
cgit_url "bar/patch" &&
- test 13 -eq $(ls cache | wc -l)
+ ls cache >output &&
+ test_line_count = 13 output
'
test_done
diff --git a/tests/t0107-snapshot.sh b/tests/t0107-snapshot.sh
index e244968..4fbe45e 100755
--- a/tests/t0107-snapshot.sh
+++ b/tests/t0107-snapshot.sh
@@ -29,13 +29,13 @@ test_expect_success 'untar' '
'
test_expect_success 'count files' '
- c=$(ls -1 master/ | wc -l) &&
- test $c = 5
+ ls master/ >output &&
+ test_line_count = 5 output
'
test_expect_success 'verify untarred file-5' '
grep "^5$" master/file-5 &&
- test $(cat master/file-5 | wc -l) = 1
+ test_line_count = 1 master/file-5
'
test_expect_success 'get foo/snapshot/master.zip' '
@@ -64,13 +64,13 @@ test_expect_success 'unzip' '
'
test_expect_success 'count files (zip)' '
- c=$(ls -1 master/ | wc -l) &&
- test $c = 5
+ ls master/ >output &&
+ test_line_count = 5 output
'
test_expect_success 'verify unzipped file-5' '
- grep "^5$" master/file-5 &&
- test $(cat master/file-5 | wc -l) = 1
+ grep "^5$" master/file-5 &&
+ test_line_count = 1 master/file-5
'
test_done
--
1.8.2.694.ga76e9c3.dirty
next prev parent reply other threads:[~2013-04-08 19:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-08 19:12 [PATCH 00/12] Test improvements john
2013-04-08 19:12 ` [PATCH 01/12] tests: use Git test functions directly john
2013-04-08 19:12 ` [PATCH 02/12] tests: don't let Git's test-lib create a repository john
2013-04-08 19:12 ` [PATCH 03/12] tests: remove prepare_tests john
2013-04-08 19:12 ` [PATCH 04/12] t0001: don't setup test repositories john
2013-04-08 19:12 ` [PATCH 05/12] tests/.gitignore: update for using Git's test infrastructure john
2013-04-08 19:12 ` [PATCH 06/12] tests: remove "trash" directory john
2013-04-08 19:12 ` [PATCH 07/12] tests: put cgit onto $PATH john
2013-04-08 19:12 ` [PATCH 08/12] .gitignore: tighten cgit ignore expression john
2013-04-08 19:12 ` [PATCH 09/12] tests: add Valgrind support john
2013-04-08 19:23 ` Jason
2013-04-08 19:12 ` [PATCH 10/12] t0001: use test_cmp instead of 'diff -u' john
2013-04-08 19:12 ` john [this message]
2013-04-08 19:12 ` [PATCH 12/12] tests: use test_create_repo instead of "git init" john
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=6eebda6c22774432a9cba0d0493f4f640940267a.1365448308.git.john@keeping.me.uk \
--to=cgit@lists.zx2c4.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).