summaryrefslogtreecommitdiff
path: root/t/t0030-stripspace.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/t0030-stripspace.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/t0030-stripspace.sh')
-rwxr-xr-xt/t0030-stripspace.sh156
1 files changed, 78 insertions, 78 deletions
diff --git a/t/t0030-stripspace.sh b/t/t0030-stripspace.sh
index 3ecdd6626a..ccb0a3cb61 100755
--- a/t/t0030-stripspace.sh
+++ b/t/t0030-stripspace.sh
@@ -16,96 +16,96 @@ test_expect_success \
'long lines without spaces should be unchanged' '
echo "$ttt" >expect &&
git stripspace <expect >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
echo "$ttt$ttt" >expect &&
git stripspace <expect >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
echo "$ttt$ttt$ttt" >expect &&
git stripspace <expect >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
echo "$ttt$ttt$ttt$ttt" >expect &&
git stripspace <expect >actual &&
- git diff expect actual
+ test_cmp expect actual
'
test_expect_success \
'lines with spaces at the beginning should be unchanged' '
echo "$sss$ttt" >expect &&
git stripspace <expect >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
echo "$sss$sss$ttt" >expect &&
git stripspace <expect >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
echo "$sss$sss$sss$ttt" >expect &&
git stripspace <expect >actual &&
- git diff expect actual
+ test_cmp expect actual
'
test_expect_success \
'lines with intermediate spaces should be unchanged' '
echo "$ttt$sss$ttt" >expect &&
git stripspace <expect >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
echo "$ttt$sss$sss$ttt" >expect &&
git stripspace <expect >actual &&
- git diff expect actual
+ test_cmp expect actual
'
test_expect_success \
'consecutive blank lines should be unified' '
printf "$ttt\n\n$ttt\n" > expect &&
printf "$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt$ttt\n\n$ttt\n" > expect &&
printf "$ttt$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt$ttt$ttt\n\n$ttt\n" > expect &&
printf "$ttt$ttt$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n\n$ttt\n" > expect &&
printf "$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n\n$ttt$ttt\n" > expect &&
printf "$ttt\n\n\n\n\n$ttt$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n\n$ttt$ttt$ttt\n" > expect &&
printf "$ttt\n\n\n\n\n$ttt$ttt$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n\n$ttt\n" > expect &&
printf "$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt$ttt\n\n$ttt\n" > expect &&
printf "$ttt$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt$ttt$ttt\n\n$ttt\n" > expect &&
printf "$ttt$ttt$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n\n$ttt\n" > expect &&
printf "$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n\n$ttt$ttt\n" > expect &&
printf "$ttt\n\t\n \n\n \t\t\n$ttt$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n\n$ttt$ttt$ttt\n" > expect &&
printf "$ttt\n\t\n \n\n \t\t\n$ttt$ttt$ttt\n" | git stripspace >actual &&
- git diff expect actual
+ test_cmp expect actual
'
test_expect_success \
@@ -113,114 +113,114 @@ test_expect_success \
> expect &&
printf "\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "\n\n\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$sss\n$sss\n$sss\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$sss$sss\n$sss\n\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "\n$sss\n$sss$sss\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$sss$sss$sss$sss\n\n\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "\n$sss$sss$sss$sss\n\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "\n\n$sss$sss$sss$sss\n" | git stripspace >actual &&
- git diff expect actual
+ test_cmp expect actual
'
test_expect_success \
'consecutive blank lines at the beginning should be removed' '
printf "$ttt\n" > expect &&
printf "\n$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n" > expect &&
printf "\n\n\n$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt$ttt\n" > expect &&
printf "\n\n\n$ttt$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt$ttt$ttt\n" > expect &&
printf "\n\n\n$ttt$ttt$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt$ttt$ttt$ttt\n" > expect &&
printf "\n\n\n$ttt$ttt$ttt$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n" > expect &&
printf "$sss\n$sss\n$sss\n$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "\n$sss\n$sss$sss\n$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$sss$sss\n$sss\n\n$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$sss$sss$sss\n\n\n$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "\n$sss$sss$sss\n\n$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "\n\n$sss$sss$sss\n$ttt\n" | git stripspace >actual &&
- git diff expect actual
+ test_cmp expect actual
'
test_expect_success \
'consecutive blank lines at the end should be removed' '
printf "$ttt\n" > expect &&
printf "$ttt\n\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n" > expect &&
printf "$ttt\n\n\n\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt$ttt\n" > expect &&
printf "$ttt$ttt\n\n\n\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt$ttt$ttt\n" > expect &&
printf "$ttt$ttt$ttt\n\n\n\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt$ttt$ttt$ttt\n" > expect &&
printf "$ttt$ttt$ttt$ttt\n\n\n\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n" > expect &&
printf "$ttt\n$sss\n$sss\n$sss\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n\n$sss\n$sss$sss\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n$sss$sss\n$sss\n\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n$sss$sss$sss\n\n\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n\n$sss$sss$sss\n\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n\n\n$sss$sss$sss\n" | git stripspace >actual &&
- git diff expect actual
+ test_cmp expect actual
'
test_expect_success \
@@ -257,27 +257,27 @@ test_expect_success \
'text plus spaces without newline should show the correct lines' '
printf "$ttt\n" >expect &&
printf "$ttt$sss" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n" >expect &&
printf "$ttt$sss$sss" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n" >expect &&
printf "$ttt$sss$sss$sss" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt$ttt\n" >expect &&
printf "$ttt$ttt$sss" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt$ttt\n" >expect &&
printf "$ttt$ttt$sss$sss" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt$ttt$ttt\n" >expect &&
printf "$ttt$ttt$ttt$sss" | git stripspace >actual &&
- git diff expect actual
+ test_cmp expect actual
'
test_expect_success \
@@ -294,27 +294,27 @@ test_expect_success \
'text plus spaces at end should be cleaned and newline must remain' '
echo "$ttt" >expect &&
echo "$ttt$sss" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
echo "$ttt" >expect &&
echo "$ttt$sss$sss" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
echo "$ttt" >expect &&
echo "$ttt$sss$sss$sss" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
echo "$ttt$ttt" >expect &&
echo "$ttt$ttt$sss" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
echo "$ttt$ttt" >expect &&
echo "$ttt$ttt$sss$sss" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
echo "$ttt$ttt$ttt" >expect &&
echo "$ttt$ttt$ttt$sss" | git stripspace >actual &&
- git diff expect actual
+ test_cmp expect actual
'
# spaces only:
@@ -324,19 +324,19 @@ test_expect_success \
printf "" >expect &&
echo | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
echo "$sss" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
echo "$sss$sss" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
echo "$sss$sss$sss" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
echo "$sss$sss$sss$sss" | git stripspace >actual &&
- git diff expect actual
+ test_cmp expect actual
'
test_expect_success \
@@ -353,43 +353,43 @@ test_expect_success \
printf "" >expect &&
printf "" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$sss$sss" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$sss$sss$sss" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$sss$sss$sss$sss" | git stripspace >actual &&
- git diff expect actual
+ test_cmp expect actual
'
test_expect_success \
'consecutive text lines should be unchanged' '
printf "$ttt$ttt\n$ttt\n" >expect &&
printf "$ttt$ttt\n$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n$ttt$ttt\n$ttt\n" >expect &&
printf "$ttt\n$ttt$ttt\n$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n$ttt\n$ttt\n$ttt$ttt\n" >expect &&
printf "$ttt\n$ttt\n$ttt\n$ttt$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n$ttt\n\n$ttt$ttt\n$ttt\n" >expect &&
printf "$ttt\n$ttt\n\n$ttt$ttt\n$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt$ttt\n\n$ttt\n$ttt$ttt\n" >expect &&
printf "$ttt$ttt\n\n$ttt\n$ttt$ttt\n" | git stripspace >actual &&
- git diff expect actual &&
+ test_cmp expect actual &&
printf "$ttt\n$ttt$ttt\n\n$ttt\n" >expect &&
printf "$ttt\n$ttt$ttt\n\n$ttt\n" | git stripspace >actual &&
- git diff expect actual
+ test_cmp expect actual
'
test_expect_success 'strip comments, too' '