Tests: use test_cmp instead of diff where possible
Several old tests were written before test_cmp was introduced, convert these to test_cmp. If were are at it, fix the order of the arguments where necessary to make expected come first, so the command shows how the test result deviates from the correct output. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
dcb11263bc
commit
188c3827c1
@ -127,7 +127,7 @@ cat >expected <<\EOF
|
|||||||
EOF
|
EOF
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'validate git ls-files output for a known tree.' \
|
'validate git ls-files output for a known tree.' \
|
||||||
'diff current expected'
|
'test_cmp expected current'
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'writing tree out with git write-tree.' \
|
'writing tree out with git write-tree.' \
|
||||||
@ -147,7 +147,7 @@ cat >expected <<\EOF
|
|||||||
EOF
|
EOF
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'git ls-tree output for a known tree.' \
|
'git ls-tree output for a known tree.' \
|
||||||
'diff current expected'
|
'test_cmp expected current'
|
||||||
|
|
||||||
# This changed in ls-tree pathspec change -- recursive does
|
# This changed in ls-tree pathspec change -- recursive does
|
||||||
# not show tree nodes anymore.
|
# not show tree nodes anymore.
|
||||||
@ -166,7 +166,7 @@ cat >expected <<\EOF
|
|||||||
EOF
|
EOF
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'git ls-tree -r output for a known tree.' \
|
'git ls-tree -r output for a known tree.' \
|
||||||
'diff current expected'
|
'test_cmp expected current'
|
||||||
|
|
||||||
# But with -r -t we can have both.
|
# But with -r -t we can have both.
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
@ -187,7 +187,7 @@ cat >expected <<\EOF
|
|||||||
EOF
|
EOF
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'git ls-tree -r output for a known tree.' \
|
'git ls-tree -r output for a known tree.' \
|
||||||
'diff current expected'
|
'test_cmp expected current'
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'writing partial tree out with git write-tree --prefix.' \
|
'writing partial tree out with git write-tree --prefix.' \
|
||||||
|
@ -40,6 +40,6 @@ test_expect_success \
|
|||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'compare commit' \
|
'compare commit' \
|
||||||
'diff expected commit'
|
'test_cmp expected commit'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
@ -137,7 +137,7 @@ $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000
|
|||||||
EOF
|
EOF
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
"verifying $m's log" \
|
"verifying $m's log" \
|
||||||
"diff expect .git/logs/$m"
|
"test_cmp expect .git/logs/$m"
|
||||||
rm -rf .git/$m .git/logs expect
|
rm -rf .git/$m .git/logs expect
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
@ -168,7 +168,7 @@ $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 +0000
|
|||||||
EOF
|
EOF
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
"verifying $m's log" \
|
"verifying $m's log" \
|
||||||
'diff expect .git/logs/$m'
|
'test_cmp expect .git/logs/$m'
|
||||||
rm -f .git/$m .git/logs/$m expect
|
rm -f .git/$m .git/logs/$m expect
|
||||||
|
|
||||||
git update-ref $m $D
|
git update-ref $m $D
|
||||||
@ -272,7 +272,7 @@ $h_FIXED $h_MERGED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151100 +0000 c
|
|||||||
EOF
|
EOF
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'git commit logged updates' \
|
'git commit logged updates' \
|
||||||
"diff expect .git/logs/$m"
|
"test_cmp expect .git/logs/$m"
|
||||||
unset h_TEST h_OTHER h_FIXED h_MERGED
|
unset h_TEST h_OTHER h_FIXED h_MERGED
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
|
@ -42,7 +42,7 @@ test_expect_success \
|
|||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'git ls-files --others should pick up symlinks.' \
|
'git ls-files --others should pick up symlinks.' \
|
||||||
'diff output expected1'
|
'test_cmp expected1 output'
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'git ls-files --others --directory to show output.' \
|
'git ls-files --others --directory to show output.' \
|
||||||
@ -51,6 +51,6 @@ test_expect_success \
|
|||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'git ls-files --others --directory should not get confused.' \
|
'git ls-files --others --directory should not get confused.' \
|
||||||
'diff output expected2'
|
'test_cmp expected2 output'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
@ -75,7 +75,7 @@ EOF
|
|||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'validate git ls-files -k output.' \
|
'validate git ls-files -k output.' \
|
||||||
'diff .output .expected'
|
'test_cmp .expected .output'
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'git ls-files -m to show modified files.' \
|
'git ls-files -m to show modified files.' \
|
||||||
@ -91,6 +91,6 @@ EOF
|
|||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'validate git ls-files -m output.' \
|
'validate git ls-files -m output.' \
|
||||||
'diff .output .expected'
|
'test_cmp .expected .output'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
@ -76,7 +76,7 @@ test_expect_success \
|
|||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'git archive vs. git tar-tree' \
|
'git archive vs. git tar-tree' \
|
||||||
'diff b.tar b2.tar'
|
'test_cmp b.tar b2.tar'
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'git archive in a bare repo' \
|
'git archive in a bare repo' \
|
||||||
@ -96,12 +96,12 @@ test_expect_success \
|
|||||||
"$TAR" xf b.tar -C extract a/a &&
|
"$TAR" xf b.tar -C extract a/a &&
|
||||||
test-chmtime -v +0 extract/a/a |cut -f 1 >b.mtime &&
|
test-chmtime -v +0 extract/a/a |cut -f 1 >b.mtime &&
|
||||||
echo "1117231200" >expected.mtime &&
|
echo "1117231200" >expected.mtime &&
|
||||||
diff expected.mtime b.mtime'
|
test_cmp expected.mtime b.mtime'
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'git get-tar-commit-id' \
|
'git get-tar-commit-id' \
|
||||||
'git get-tar-commit-id <b.tar >b.commitid &&
|
'git get-tar-commit-id <b.tar >b.commitid &&
|
||||||
diff .git/$(git symbolic-ref HEAD) b.commitid'
|
test_cmp .git/$(git symbolic-ref HEAD) b.commitid'
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'extract tar archive' \
|
'extract tar archive' \
|
||||||
@ -110,7 +110,7 @@ test_expect_success \
|
|||||||
test_expect_success \
|
test_expect_success \
|
||||||
'validate filenames' \
|
'validate filenames' \
|
||||||
'(cd b/a && find .) | sort >b.lst &&
|
'(cd b/a && find .) | sort >b.lst &&
|
||||||
diff a.lst b.lst'
|
test_cmp a.lst b.lst'
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'validate file contents' \
|
'validate file contents' \
|
||||||
@ -127,7 +127,7 @@ test_expect_success \
|
|||||||
test_expect_success \
|
test_expect_success \
|
||||||
'validate filenames with prefix' \
|
'validate filenames with prefix' \
|
||||||
'(cd c/prefix/a && find .) | sort >c.lst &&
|
'(cd c/prefix/a && find .) | sort >c.lst &&
|
||||||
diff a.lst c.lst'
|
test_cmp a.lst c.lst'
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'validate file contents with prefix' \
|
'validate file contents with prefix' \
|
||||||
@ -148,8 +148,8 @@ test_expect_success \
|
|||||||
'validate substfile contents' \
|
'validate substfile contents' \
|
||||||
'git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \
|
'git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \
|
||||||
>f/a/substfile1.expected &&
|
>f/a/substfile1.expected &&
|
||||||
diff f/a/substfile1.expected f/a/substfile1 &&
|
test_cmp f/a/substfile1.expected f/a/substfile1 &&
|
||||||
diff a/substfile2 f/a/substfile2
|
test_cmp a/substfile2 f/a/substfile2
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
@ -160,8 +160,8 @@ test_expect_success \
|
|||||||
'validate substfile contents from archive with prefix' \
|
'validate substfile contents from archive with prefix' \
|
||||||
'git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \
|
'git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \
|
||||||
>g/prefix/a/substfile1.expected &&
|
>g/prefix/a/substfile1.expected &&
|
||||||
diff g/prefix/a/substfile1.expected g/prefix/a/substfile1 &&
|
test_cmp g/prefix/a/substfile1.expected g/prefix/a/substfile1 &&
|
||||||
diff a/substfile2 g/prefix/a/substfile2
|
test_cmp a/substfile2 g/prefix/a/substfile2
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
@ -194,7 +194,7 @@ test_expect_success \
|
|||||||
test_expect_success \
|
test_expect_success \
|
||||||
'validate filenames' \
|
'validate filenames' \
|
||||||
'(cd d/a && find .) | sort >d.lst &&
|
'(cd d/a && find .) | sort >d.lst &&
|
||||||
diff a.lst d.lst'
|
test_cmp a.lst d.lst'
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'validate file contents' \
|
'validate file contents' \
|
||||||
@ -211,7 +211,7 @@ test_expect_success \
|
|||||||
test_expect_success \
|
test_expect_success \
|
||||||
'validate filenames with prefix' \
|
'validate filenames with prefix' \
|
||||||
'(cd e/prefix/a && find .) | sort >e.lst &&
|
'(cd e/prefix/a && find .) | sort >e.lst &&
|
||||||
diff a.lst e.lst'
|
test_cmp a.lst e.lst'
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'validate file contents with prefix' \
|
'validate file contents with prefix' \
|
||||||
|
@ -88,7 +88,7 @@ cat >expected <<\EOF
|
|||||||
EOF
|
EOF
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'Verify commandline' \
|
'Verify commandline' \
|
||||||
'diff commandline1 expected'
|
'test_cmp expected commandline1'
|
||||||
|
|
||||||
cat >expected-show-all-headers <<\EOF
|
cat >expected-show-all-headers <<\EOF
|
||||||
0001-Second.patch
|
0001-Second.patch
|
||||||
|
Loading…
Reference in New Issue
Block a user