On Sun, Oct 31, 2010 at 08:33, Jonathan Nieder [off-list ref] wrote:
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
In an earlier thread I suggested an interface like:
test_line_count 3 "git ls-files -u B"
But I like yours much better. Ack.