summaryrefslogtreecommitdiff
path: root/t/t3300-funny-names.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-05-23 22:28:56 -0700
committerJunio C Hamano <gitster@pobox.com>2008-05-24 00:01:56 -0700
commit3af828634fa5bdbca1b2061a81df8b3fa73b0d34 (patch)
treef4d4a50e8c1686b3ecd796a09f98cc6ca13bc907 /t/t3300-funny-names.sh
parent998b912927281a871e8d379e2b3a4385c775c4fe (diff)
downloadgit-3af828634fa5bdbca1b2061a81df8b3fa73b0d34.tar.gz
tests: do not use implicit "git diff --no-index"
As a general principle, we should not use "git diff" to validate the results of what git command that is being tested has done. We would not know if we are testing the command in question, or locating a bug in the cute hack of "git diff --no-index". Rather use test_cmp for that purpose. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3300-funny-names.sh')
-rwxr-xr-xt/t3300-funny-names.sh30
1 files changed, 15 insertions, 15 deletions
diff --git a/t/t3300-funny-names.sh b/t/t3300-funny-names.sh
index 24a00a9df1..0574ef1f10 100755
--- a/t/t3300-funny-names.sh
+++ b/t/t3300-funny-names.sh
@@ -35,7 +35,7 @@ no-funny' >expected
test_expect_success 'git ls-files no-funny' \
'git update-index --add "$p0" "$p2" &&
git ls-files >current &&
- git diff expected current'
+ test_cmp expected current'
t0=`git write-tree`
echo "$t0" >t0
@@ -48,14 +48,14 @@ EOF
test_expect_success 'git ls-files with-funny' \
'git update-index --add "$p1" &&
git ls-files >current &&
- git diff expected current'
+ test_cmp expected current'
echo 'just space
no-funny
tabs ," (dq) and spaces' >expected
test_expect_success 'git ls-files -z with-funny' \
'git ls-files -z | perl -pe y/\\000/\\012/ >current &&
- git diff expected current'
+ test_cmp expected current'
t1=`git write-tree`
echo "$t1" >t1
@@ -67,28 +67,28 @@ no-funny
EOF
test_expect_success 'git ls-tree with funny' \
'git ls-tree -r $t1 | sed -e "s/^[^ ]* //" >current &&
- git diff expected current'
+ test_cmp expected current'
cat > expected <<\EOF
A "tabs\t,\" (dq) and spaces"
EOF
test_expect_success 'git diff-index with-funny' \
'git diff-index --name-status $t0 >current &&
- git diff expected current'
+ test_cmp expected current'
test_expect_success 'git diff-tree with-funny' \
'git diff-tree --name-status $t0 $t1 >current &&
- git diff expected current'
+ test_cmp expected current'
echo 'A
tabs ," (dq) and spaces' >expected
test_expect_success 'git diff-index -z with-funny' \
'git diff-index -z --name-status $t0 | perl -pe y/\\000/\\012/ >current &&
- git diff expected current'
+ test_cmp expected current'
test_expect_success 'git diff-tree -z with-funny' \
'git diff-tree -z --name-status $t0 $t1 | perl -pe y/\\000/\\012/ >current &&
- git diff expected current'
+ test_cmp expected current'
cat > expected <<\EOF
CNUM no-funny "tabs\t,\" (dq) and spaces"
@@ -96,7 +96,7 @@ EOF
test_expect_success 'git diff-tree -C with-funny' \
'git diff-tree -C --find-copies-harder --name-status \
$t0 $t1 | sed -e 's/^C[0-9]*/CNUM/' >current &&
- git diff expected current'
+ test_cmp expected current'
cat > expected <<\EOF
RNUM no-funny "tabs\t,\" (dq) and spaces"
@@ -105,7 +105,7 @@ test_expect_success 'git diff-tree delete with-funny' \
'git update-index --force-remove "$p0" &&
git diff-index -M --name-status \
$t0 | sed -e 's/^R[0-9]*/RNUM/' >current &&
- git diff expected current'
+ test_cmp expected current'
cat > expected <<\EOF
diff --git a/no-funny "b/tabs\t,\" (dq) and spaces"
@@ -116,7 +116,7 @@ EOF
test_expect_success 'git diff-tree delete with-funny' \
'git diff-index -M -p $t0 |
sed -e "s/index [0-9]*%/index NUM%/" >current &&
- git diff expected current'
+ test_cmp expected current'
chmod +x "$p1"
cat > expected <<\EOF
@@ -130,7 +130,7 @@ EOF
test_expect_success 'git diff-tree delete with-funny' \
'git diff-index -M -p $t0 |
sed -e "s/index [0-9]*%/index NUM%/" >current &&
- git diff expected current'
+ test_cmp expected current'
cat >expected <<\EOF
"tabs\t,\" (dq) and spaces"
@@ -139,7 +139,7 @@ EOF
test_expect_success 'git diff-tree rename with-funny applied' \
'git diff-index -M -p $t0 |
git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
- git diff expected current'
+ test_cmp expected current'
cat > expected <<\EOF
no-funny
@@ -149,12 +149,12 @@ EOF
test_expect_success 'git diff-tree delete with-funny applied' \
'git diff-index -p $t0 |
git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
- git diff expected current'
+ test_cmp expected current'
test_expect_success 'git apply non-git diff' \
'git diff-index -p $t0 |
sed -ne "/^[-+@]/p" |
git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
- git diff expected current'
+ test_cmp expected current'
test_done