This gets us better output when the line count is incorrect, which will
help debugging test failures.

Signed-off-by: John Keeping <[email protected]>
---
 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


_______________________________________________
cgit mailing list
[email protected]
http://hjemli.net/mailman/listinfo/cgit

Reply via email to