From 82ebb0b6ec7470cab96a013d3d719c109003ef83 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 12 Mar 2008 17:36:36 -0400 Subject: 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 Signed-off-by: Junio C Hamano --- t/t5512-ls-remote.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 't/t5512-ls-remote.sh') diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh index 6ec5f7c48b..c0dc94909b 100755 --- a/t/t5512-ls-remote.sh +++ b/t/t5512-ls-remote.sh @@ -24,28 +24,28 @@ test_expect_success setup ' test_expect_success 'ls-remote --tags .git' ' git ls-remote --tags .git >actual && - diff -u expected.tag actual + test_cmp expected.tag actual ' test_expect_success 'ls-remote .git' ' git ls-remote .git >actual && - diff -u expected.all actual + test_cmp expected.all actual ' test_expect_success 'ls-remote --tags self' ' git ls-remote --tags self >actual && - diff -u expected.tag actual + test_cmp expected.tag actual ' test_expect_success 'ls-remote self' ' git ls-remote self >actual && - diff -u expected.all actual + test_cmp expected.all actual ' -- cgit v1.2.3 From f69e836fab2b634281d92a0d304de4d768e479cc Mon Sep 17 00:00:00 2001 From: Bryan Donlan Date: Sun, 4 May 2008 01:37:59 -0400 Subject: Fix tests breaking when checkout path contains shell metacharacters This fixes the remainder of the issues where the test script itself is at fault for failing when the git checkout path contains whitespace or other shell metacharacters. The majority of git svn tests used the idiom test_expect_success "title" "test script using $svnrepo" These were changed to have the test script in single-quotes: test_expect_success "title" 'test script using "$svnrepo"' which unfortunately makes the patch appear larger than it really is. One consequence of this change is that in the verbose test output the value of $svnrepo (and in some cases other variables, too) is no longer expanded, i.e. previously we saw * expecting success: test script using /path/to/git/t/trash/svnrepo but now it is: * expecting success: test script using "$svnrepo" Signed-off-by: Bryan Donlan Signed-off-by: Junio C Hamano --- t/t5512-ls-remote.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/t5512-ls-remote.sh') diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh index c0dc94909b..1dd8eed5bb 100755 --- a/t/t5512-ls-remote.sh +++ b/t/t5512-ls-remote.sh @@ -17,7 +17,7 @@ test_expect_success setup ' git show-ref -d | sed -e "s/ / /" ) >expected.all && - git remote add self $(pwd)/.git + git remote add self "$(pwd)/.git" ' -- cgit v1.2.3