diff options
author | Jeff King <peff@peff.net> | 2008-03-12 17:36:36 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-03-13 00:57:52 -0700 |
commit | 82ebb0b6ec7470cab96a013d3d719c109003ef83 (patch) | |
tree | 8796598a518e972881afd729215c265924c04ddf /t/t9116-git-svn-log.sh | |
parent | b4ce54fc61e7c76e2d7f47c34733f0f0bbb6c4cd (diff) | |
download | git-82ebb0b6ec7470cab96a013d3d719c109003ef83.tar.gz |
add test_cmp function for test scripts
Many scripts compare actual and expected output using
"diff -u". This is nicer than "cmp" because the output shows
how the two differ. However, not all versions of diff
understand -u, leading to unnecessary test failure.
This adds a test_cmp function to the test scripts and
switches all "diff -u" invocations to use it. The function
uses the contents of "$GIT_TEST_CMP" to compare its
arguments; the default is "diff -u".
On systems with a less-capable diff, you can do:
GIT_TEST_CMP=cmp make test
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9116-git-svn-log.sh')
-rwxr-xr-x | t/t9116-git-svn-log.sh | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh index 902ed4145d..e1e8bdf0e3 100755 --- a/t/t9116-git-svn-log.sh +++ b/t/t9116-git-svn-log.sh @@ -55,74 +55,74 @@ printf 'r1 \nr2 \nr4 \n' > expected-range-r1-r2-r4 test_expect_success 'test ascending revision range' " git reset --hard trunk && - git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r1-r2-r4 - + git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2-r4 - " printf 'r4 \nr2 \nr1 \n' > expected-range-r4-r2-r1 test_expect_success 'test descending revision range' " git reset --hard trunk && - git svn log -r 4:1 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r4-r2-r1 - + git svn log -r 4:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4-r2-r1 - " printf 'r1 \nr2 \n' > expected-range-r1-r2 test_expect_success 'test ascending revision range with unreachable revision' " git reset --hard trunk && - git svn log -r 1:3 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r1-r2 - + git svn log -r 1:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r1-r2 - " printf 'r2 \nr1 \n' > expected-range-r2-r1 test_expect_success 'test descending revision range with unreachable revision' " git reset --hard trunk && - git svn log -r 3:1 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r2-r1 - + git svn log -r 3:1 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2-r1 - " printf 'r2 \n' > expected-range-r2 test_expect_success 'test ascending revision range with unreachable upper boundary revision and 1 commit' " git reset --hard trunk && - git svn log -r 2:3 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r2 - + git svn log -r 2:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 - " test_expect_success 'test descending revision range with unreachable upper boundary revision and 1 commit' " git reset --hard trunk && - git svn log -r 3:2 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r2 - + git svn log -r 3:2 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r2 - " printf 'r4 \n' > expected-range-r4 test_expect_success 'test ascending revision range with unreachable lower boundary revision and 1 commit' " git reset --hard trunk && - git svn log -r 3:4 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r4 - + git svn log -r 3:4 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 - " test_expect_success 'test descending revision range with unreachable lower boundary revision and 1 commit' " git reset --hard trunk && - git svn log -r 4:3 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r4 - + git svn log -r 4:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 - " printf -- '------------------------------------------------------------------------\n' > expected-separator test_expect_success 'test ascending revision range with unreachable boundary revisions and no commits' " git reset --hard trunk && - git svn log -r 5:6 | diff -u expected-separator - + git svn log -r 5:6 | test_cmp expected-separator - " test_expect_success 'test descending revision range with unreachable boundary revisions and no commits' " git reset --hard trunk && - git svn log -r 6:5 | diff -u expected-separator - + git svn log -r 6:5 | test_cmp expected-separator - " test_expect_success 'test ascending revision range with unreachable boundary revisions and 1 commit' " git reset --hard trunk && - git svn log -r 3:5 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r4 - + git svn log -r 3:5 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 - " test_expect_success 'test descending revision range with unreachable boundary revisions and 1 commit' " git reset --hard trunk && - git svn log -r 5:3 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r4 - + git svn log -r 5:3 | grep '^r[0-9]' | cut -d'|' -f1 | test_cmp expected-range-r4 - " test_done |