Skip to content

Commit be86fb3

Browse files
peffgitster
authored andcommitted
t0020: use test_* helpers instead of hand-rolled messages
These tests are not wrong, but it is much shorter and more idiomatic to say "verbose" or "test_must_fail" rather than printing our own messages on failure. Likewise, there is no need to say "happy" at the end of a test; the test suite takes care of that. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c6587bd commit be86fb3

File tree

1 file changed

+5
-33
lines changed

1 file changed

+5
-33
lines changed

t/t0020-crlf.sh

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ test_expect_success setup '
3535
for w in Some extra lines here; do echo $w; done >>one &&
3636
git diff >patch.file &&
3737
patched=$(git hash-object --stdin <one) &&
38-
git read-tree --reset -u HEAD &&
39-
40-
echo happy.
38+
git read-tree --reset -u HEAD
4139
'
4240

4341
test_expect_success 'safecrlf: autocrlf=input, all CRLF' '
@@ -225,29 +223,9 @@ test_expect_success '.gitattributes says two is binary' '
225223
git config core.autocrlf true &&
226224
git read-tree --reset -u HEAD &&
227225
228-
if has_cr dir/two
229-
then
230-
echo "Huh?"
231-
false
232-
else
233-
: happy
234-
fi &&
235-
236-
if has_cr one
237-
then
238-
: happy
239-
else
240-
echo "Huh?"
241-
false
242-
fi &&
243-
244-
if has_cr three
245-
then
246-
echo "Huh?"
247-
false
248-
else
249-
: happy
250-
fi
226+
test_must_fail has_cr dir/two &&
227+
verbose has_cr one &&
228+
test_must_fail has_cr three
251229
'
252230

253231
test_expect_success '.gitattributes says two is input' '
@@ -256,13 +234,7 @@ test_expect_success '.gitattributes says two is input' '
256234
echo "two crlf=input" >.gitattributes &&
257235
git read-tree --reset -u HEAD &&
258236
259-
if has_cr dir/two
260-
then
261-
echo "Huh?"
262-
false
263-
else
264-
: happy
265-
fi
237+
test_must_fail has_cr dir/two
266238
'
267239

268240
test_expect_success '.gitattributes says two and three are text' '

0 commit comments

Comments
 (0)