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

t0020: don't use `test_must_fail has_cr`

The test_must_fail function should only be used for git commands since we should assume that external commands work sanely. Since has_cr() just wraps a tr and grep pipeline, replace `test_must_fail has_cr` with `! has_cr`. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Denton Liu committed Dec 20, 2019 at 10:15 UTC f6041abdcd7bfefed1cbe14cbe221f0e848cbec4
1 file changed +9 -9
t/t0020-crlf.sh
+9 -9
@@ -159,8 +159,8 @@ test_expect_success 'checkout with autocrlf=input' '
159 rm -f tmp one dir/two three &&
160 git config core.autocrlf input &&
161 git read-tree --reset -u HEAD &&
162 - test_must_fail has_cr one &&
163 - test_must_fail has_cr dir/two &&
162 + ! has_cr one &&
163 + ! has_cr dir/two &&
164 git update-index -- one dir/two &&
165 test "$one" = $(git hash-object --stdin <one) &&
166 test "$two" = $(git hash-object --stdin <dir/two) &&
@@ -237,9 +237,9 @@ test_expect_success '.gitattributes says two is binary' '
237 git config core.autocrlf true &&
238 git read-tree --reset -u HEAD &&
239
240 - test_must_fail has_cr dir/two &&
240 + ! has_cr dir/two &&
241 verbose has_cr one &&
242 - test_must_fail has_cr three
242 + ! has_cr three
243 '
244
245 test_expect_success '.gitattributes says two is input' '
@@ -248,7 +248,7 @@ test_expect_success '.gitattributes says two is input' '
248 echo "two crlf=input" >.gitattributes &&
249 git read-tree --reset -u HEAD &&
250
251 - test_must_fail has_cr dir/two
251 + ! has_cr dir/two
252 '
253
254 test_expect_success '.gitattributes says two and three are text' '
@@ -270,7 +270,7 @@ test_expect_success 'in-tree .gitattributes (1)' '
270 rm -rf tmp one dir .gitattributes patch.file three &&
271 git read-tree --reset -u HEAD &&
272
273 - test_must_fail has_cr one &&
273 + ! has_cr one &&
274 verbose has_cr three
275 '
276
@@ -280,7 +280,7 @@ test_expect_success 'in-tree .gitattributes (2)' '
280 git read-tree --reset HEAD &&
281 git checkout-index -f -q -u -a &&
282
283 - test_must_fail has_cr one &&
283 + ! has_cr one &&
284 verbose has_cr three
285 '
286
@@ -291,7 +291,7 @@ test_expect_success 'in-tree .gitattributes (3)' '
291 git checkout-index -u .gitattributes &&
292 git checkout-index -u one dir/two three &&
293
294 - test_must_fail has_cr one &&
294 + ! has_cr one &&
295 verbose has_cr three
296 '
297
@@ -302,7 +302,7 @@ test_expect_success 'in-tree .gitattributes (4)' '
302 git checkout-index -u one dir/two three &&
303 git checkout-index -u .gitattributes &&
304
305 - test_must_fail has_cr one &&
305 + ! has_cr one &&
306 verbose has_cr three
307 '
308