@matheusbsbs / matheus-bagliano / commits / b9f3bde150
Fork 0

t1200: further modernize test script style

Instead of using bare "cmp", use "test_cmp". Output when the test is run with a -v option becomes easier to diagnose when something goes wrong because on saner platforms test_cmp uses "diff -u". There is no need to put an extra backslash to a line that ends with a '|' (i.e. the upstream of a pipe). Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Nov 6, 2009 at 22:47 UTC b9f3bde150a1be1e2adfb2834caaf415dd7b72ef
1 file changed +18 -18
t/t1200-tutorial.sh
+18 -18
@@ -33,12 +33,12 @@ EOF
33
34 test_expect_success 'git diff-files -p' '
35 git diff-files -p > diff.output &&
36 - cmp diff.expect diff.output
36 + test_cmp diff.expect diff.output
37 '
38
39 test_expect_success 'git diff' '
40 git diff > diff.output &&
41 - cmp diff.expect diff.output
41 + test_cmp diff.expect diff.output
42 '
43
44 test_expect_success 'tree' '
@@ -51,12 +51,12 @@ test_expect_success 'git diff-index -p HEAD' '
51 commit=$(echo "Initial commit" | git commit-tree $tree) &&
52 git update-ref HEAD $commit &&
53 git diff-index -p HEAD > diff.output &&
54 - cmp diff.expect diff.output
54 + test_cmp diff.expect diff.output
55 '
56
57 test_expect_success 'git diff HEAD' '
58 git diff HEAD > diff.output &&
59 - cmp diff.expect diff.output
59 + test_cmp diff.expect diff.output
60 '
61
62 cat > whatchanged.expect << EOF
@@ -83,21 +83,21 @@ index 0000000..557db03
83 EOF
84
85 test_expect_success 'git whatchanged -p --root' '
86 - git whatchanged -p --root | \
86 + git whatchanged -p --root |
87 sed -e "1s/^\(.\{7\}\).\{40\}/\1VARIABLE/" \
88 -e "2,3s/^\(.\{8\}\).*$/\1VARIABLE/" \
89 > whatchanged.output &&
90 - cmp whatchanged.expect whatchanged.output
90 + test_cmp whatchanged.expect whatchanged.output
91 '
92
93 test_expect_success 'git tag my-first-tag' '
94 git tag my-first-tag &&
95 - cmp .git/refs/heads/master .git/refs/tags/my-first-tag
95 + test_cmp .git/refs/heads/master .git/refs/tags/my-first-tag
96 '
97
98 test_expect_success 'git checkout -b mybranch' '
99 git checkout -b mybranch &&
100 - cmp .git/refs/heads/master .git/refs/heads/mybranch
100 + test_cmp .git/refs/heads/master .git/refs/heads/mybranch
101 '
102
103 cat > branch.expect <<EOF
@@ -107,7 +107,7 @@ EOF
107
108 test_expect_success 'git branch' '
109 git branch > branch.output &&
110 - cmp branch.expect branch.output
110 + test_cmp branch.expect branch.output
111 '
112
113 test_expect_success 'git resolve now fails' '
@@ -144,7 +144,7 @@ test_expect_success 'git show-branch' '
144 git commit -m "Merge work in mybranch" -i hello &&
145 git show-branch --topo-order --more=1 master mybranch \
146 > show-branch.output &&
147 - cmp show-branch.expect show-branch.output
147 + test_cmp show-branch.expect show-branch.output
148 '
149
150 cat > resolve.expect << EOF
@@ -157,9 +157,9 @@ EOF
157
158 test_expect_success 'git resolve' '
159 git checkout mybranch &&
160 - git merge -m "Merge upstream changes." master | \
160 + git merge -m "Merge upstream changes." master |
161 sed -e "1s/[0-9a-f]\{7\}/VARIABLE/g" >resolve.output &&
162 - cmp resolve.expect resolve.output
162 + test_cmp resolve.expect resolve.output
163 '
164
165 cat > show-branch2.expect << EOF
@@ -171,7 +171,7 @@ EOF
171
172 test_expect_success 'git show-branch (part 2)' '
173 git show-branch --topo-order master mybranch > show-branch2.output &&
174 - cmp show-branch2.expect show-branch2.output
174 + test_cmp show-branch2.expect show-branch2.output
175 '
176
177 cat > show-branch3.expect << EOF
@@ -186,7 +186,7 @@ EOF
186 test_expect_success 'git show-branch (part 3)' '
187 git show-branch --topo-order --more=2 master mybranch \
188 > show-branch3.output &&
189 - cmp show-branch3.expect show-branch3.output
189 + test_cmp show-branch3.expect show-branch3.output
190 '
191
192 test_expect_success 'rewind to "Some fun." and "Some work."' '
@@ -207,7 +207,7 @@ EOF
207
208 test_expect_success 'git show-branch (part 4)' '
209 git show-branch --topo-order > show-branch4.output &&
210 - cmp show-branch4.expect show-branch4.output
210 + test_cmp show-branch4.expect show-branch4.output
211 '
212
213 test_expect_success 'manual merge' '
@@ -227,7 +227,7 @@ EOF
227
228 test_expect_success 'git ls-files --stage' '
229 git ls-files --stage > ls-files.output &&
230 - cmp ls-files.expect ls-files.output
230 + test_cmp ls-files.expect ls-files.output
231 '
232
233 cat > ls-files-unmerged.expect << EOF
@@ -238,7 +238,7 @@ EOF
238
239 test_expect_success 'git ls-files --unmerged' '
240 git ls-files --unmerged > ls-files-unmerged.output &&
241 - cmp ls-files-unmerged.expect ls-files-unmerged.output
241 + test_cmp ls-files-unmerged.expect ls-files-unmerged.output
242 '
243
244 test_expect_success 'git-merge-index' '
@@ -247,7 +247,7 @@ test_expect_success 'git-merge-index' '
247
248 test_expect_success 'git ls-files --stage (part 2)' '
249 git ls-files --stage > ls-files.output2 &&
250 - cmp ls-files.expect ls-files.output2
250 + test_cmp ls-files.expect ls-files.output2
251 '
252
253 test_expect_success 'git repack' 'git repack'