t/t3300-funny-names: change from skip_all=* to prereq skip
Change this test to skip test with test prerequisites, and to do setup work in tests. This improves the skipped statistics on platforms where the test isn't run. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Aug 11, 2010 at 19:04 UTC
e1697cc5b5d765f0544b370ccdb87145cdfd91fc
1 file changed
+60
-22
t/t3300-funny-names.sh
+60
-22
@@ -24,19 +24,25 @@ EOF
24
cat 2>/dev/null >"$p1" "$p0"
25
echo 'Foo Bar Baz' >"$p2"
26
27
-test -f "$p1" && cmp "$p0" "$p1" || {
27
+if test -f "$p1" && cmp "$p0" "$p1"
28
+then
29
+ test_set_prereq TABS_IN_FILENAMES
30
+else
31
# since FAT/NTFS does not allow tabs in filenames, skip this test
29
- skip_all='Your filesystem does not allow tabs in filenames, test skipped.'
30
- test_done
31
-}
32
+ say 'Your filesystem does not allow tabs in filenames'
33
+fi
34
35
+test_expect_success TABS_IN_FILENAMES 'setup expect' "
36
echo 'just space
37
no-funny' >expected
35
-test_expect_success 'git ls-files no-funny' \
38
+"
39
+
40
+test_expect_success TABS_IN_FILENAMES 'git ls-files no-funny' \
41
'git update-index --add "$p0" "$p2" &&
42
git ls-files >current &&
43
test_cmp expected current'
44
45
+test_expect_success TABS_IN_FILENAMES 'setup expect' '
46
t0=`git write-tree`
47
echo "$t0" >t0
48
@@ -45,18 +51,24 @@ just space
51
no-funny
52
"tabs\t,\" (dq) and spaces"
53
EOF
48
-test_expect_success 'git ls-files with-funny' \
54
+'
55
+
56
+test_expect_success TABS_IN_FILENAMES 'git ls-files with-funny' \
57
'git update-index --add "$p1" &&
58
git ls-files >current &&
59
test_cmp expected current'
60
61
+test_expect_success TABS_IN_FILENAMES 'setup expect' "
62
echo 'just space
63
no-funny
55
-tabs ," (dq) and spaces' >expected
56
-test_expect_success 'git ls-files -z with-funny' \
64
+tabs ,\" (dq) and spaces' >expected
65
+"
66
+
67
+test_expect_success TABS_IN_FILENAMES 'git ls-files -z with-funny' \
68
'git ls-files -z | perl -pe y/\\000/\\012/ >current &&
69
test_cmp expected current'
70
71
+test_expect_success TABS_IN_FILENAMES 'setup expect' '
72
t1=`git write-tree`
73
echo "$t1" >t1
74
@@ -65,60 +77,78 @@ just space
77
no-funny
78
"tabs\t,\" (dq) and spaces"
79
EOF
68
-test_expect_success 'git ls-tree with funny' \
80
+'
81
+
82
+test_expect_success TABS_IN_FILENAMES 'git ls-tree with funny' \
83
'git ls-tree -r $t1 | sed -e "s/^[^ ]* //" >current &&
84
test_cmp expected current'
85
86
+test_expect_success TABS_IN_FILENAMES 'setup expect' '
87
cat > expected <<\EOF
88
A "tabs\t,\" (dq) and spaces"
89
EOF
75
-test_expect_success 'git diff-index with-funny' \
90
+'
91
+
92
+test_expect_success TABS_IN_FILENAMES 'git diff-index with-funny' \
93
'git diff-index --name-status $t0 >current &&
94
test_cmp expected current'
95
79
-test_expect_success 'git diff-tree with-funny' \
96
+test_expect_success TABS_IN_FILENAMES 'git diff-tree with-funny' \
97
'git diff-tree --name-status $t0 $t1 >current &&
98
test_cmp expected current'
99
100
+test_expect_success TABS_IN_FILENAMES 'setup expect' "
101
echo 'A
84
-tabs ," (dq) and spaces' >expected
85
-test_expect_success 'git diff-index -z with-funny' \
102
+tabs ,\" (dq) and spaces' >expected
103
+"
104
+
105
+test_expect_success TABS_IN_FILENAMES 'git diff-index -z with-funny' \
106
'git diff-index -z --name-status $t0 | perl -pe y/\\000/\\012/ >current &&
107
test_cmp expected current'
108
89
-test_expect_success 'git diff-tree -z with-funny' \
109
+test_expect_success TABS_IN_FILENAMES 'git diff-tree -z with-funny' \
110
'git diff-tree -z --name-status $t0 $t1 | perl -pe y/\\000/\\012/ >current &&
111
test_cmp expected current'
112
113
+test_expect_success TABS_IN_FILENAMES 'setup expect' '
114
cat > expected <<\EOF
115
CNUM no-funny "tabs\t,\" (dq) and spaces"
116
EOF
96
-test_expect_success 'git diff-tree -C with-funny' \
117
+'
118
+
119
+test_expect_success TABS_IN_FILENAMES 'git diff-tree -C with-funny' \
120
'git diff-tree -C --find-copies-harder --name-status \
121
$t0 $t1 | sed -e 's/^C[0-9]*/CNUM/' >current &&
122
test_cmp expected current'
123
124
+test_expect_success TABS_IN_FILENAMES 'setup expect' '
125
cat > expected <<\EOF
126
RNUM no-funny "tabs\t,\" (dq) and spaces"
127
EOF
104
-test_expect_success 'git diff-tree delete with-funny' \
128
+'
129
+
130
+test_expect_success TABS_IN_FILENAMES 'git diff-tree delete with-funny' \
131
'git update-index --force-remove "$p0" &&
132
git diff-index -M --name-status \
133
$t0 | sed -e 's/^R[0-9]*/RNUM/' >current &&
134
test_cmp expected current'
135
136
+test_expect_success TABS_IN_FILENAMES 'setup expect' '
137
cat > expected <<\EOF
138
diff --git a/no-funny "b/tabs\t,\" (dq) and spaces"
139
similarity index NUM%
140
rename from no-funny
141
rename to "tabs\t,\" (dq) and spaces"
142
EOF
116
-test_expect_success 'git diff-tree delete with-funny' \
143
+'
144
+
145
+test_expect_success TABS_IN_FILENAMES 'git diff-tree delete with-funny' \
146
'git diff-index -M -p $t0 |
147
sed -e "s/index [0-9]*%/index NUM%/" >current &&
148
test_cmp expected current'
149
121
-chmod +x "$p1"
150
+test_expect_success TABS_IN_FILENAMES 'setup expect' '
151
+chmod +x "$p1" &&
152
cat > expected <<\EOF
153
diff --git a/no-funny "b/tabs\t,\" (dq) and spaces"
154
old mode 100644
@@ -127,31 +157,39 @@ similarity index NUM%
157
rename from no-funny
158
rename to "tabs\t,\" (dq) and spaces"
159
EOF
130
-test_expect_success 'git diff-tree delete with-funny' \
160
+'
161
+
162
+test_expect_success TABS_IN_FILENAMES 'git diff-tree delete with-funny' \
163
'git diff-index -M -p $t0 |
164
sed -e "s/index [0-9]*%/index NUM%/" >current &&
165
test_cmp expected current'
166
167
+test_expect_success TABS_IN_FILENAMES 'setup expect' '
168
cat >expected <<\EOF
169
"tabs\t,\" (dq) and spaces"
170
1 files changed, 0 insertions(+), 0 deletions(-)
171
EOF
139
-test_expect_success 'git diff-tree rename with-funny applied' \
172
+'
173
+
174
+test_expect_success TABS_IN_FILENAMES 'git diff-tree rename with-funny applied' \
175
'git diff-index -M -p $t0 |
176
git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
177
test_cmp expected current'
178
179
+test_expect_success TABS_IN_FILENAMES 'setup expect' '
180
cat > expected <<\EOF
181
no-funny
182
"tabs\t,\" (dq) and spaces"
183
2 files changed, 3 insertions(+), 3 deletions(-)
184
EOF
149
-test_expect_success 'git diff-tree delete with-funny applied' \
185
+'
186
+
187
+test_expect_success TABS_IN_FILENAMES 'git diff-tree delete with-funny applied' \
188
'git diff-index -p $t0 |
189
git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
190
test_cmp expected current'
191
154
-test_expect_success 'git apply non-git diff' \
192
+test_expect_success TABS_IN_FILENAMES 'git apply non-git diff' \
193
'git diff-index -p $t0 |
194
sed -ne "/^[-+@]/p" |
195
git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&