author | Jonathan Nieder <jrnieder@gmail.com> | |
Sun, 31 Oct 2010 07:33:50 +0000 (02:33 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 9 Nov 2010 22:47:17 +0000 (14:47 -0800) | ||
commit | fb3340a6a7a956debcac92cd21cbcaea0928048e | |
tree | 2668194283dd1a8bc51d072c91ee0898f59f4927 | tree | snapshot |
parent | 2dec68cf8fec760930c3bc9d13beb17e381d70a3 | commit | diff |
test-lib: introduce test_line_count to measure files
Some tests check their output with code like the following:
test "$(git ls-files -u B | wc -l)" -eq 3 || {
echo "BAD: should have left stages for B"
return 1
}
The verbose failure condition is used because test, unlike
diff, does not print any useful information about the
nature of the failure when it fails.
Introduce a test_line_count function to help. If used like
git ls-files -u B >output &&
test_line_count -eq 3 output
it will produce output like
test_line_count: line count for output !-eq 3
100644 b023018cabc396e7692c70bbf5784a93d3f738ab 2 hi.c
100644 45b983be36b73c0788dc9cbcb76cbb80fc7bb057 3 hi.c
on failure.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Some tests check their output with code like the following:
test "$(git ls-files -u B | wc -l)" -eq 3 || {
echo "BAD: should have left stages for B"
return 1
}
The verbose failure condition is used because test, unlike
diff, does not print any useful information about the
nature of the failure when it fails.
Introduce a test_line_count function to help. If used like
git ls-files -u B >output &&
test_line_count -eq 3 output
it will produce output like
test_line_count: line count for output !-eq 3
100644 b023018cabc396e7692c70bbf5784a93d3f738ab 2 hi.c
100644 45b983be36b73c0788dc9cbcb76cbb80fc7bb057 3 hi.c
on failure.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/README | diff | blob | history | |
t/test-lib.sh | diff | blob | history |