mirror of
https://github.com/git/git.git
synced 2024-11-29 21:15:15 +08:00
82ebb0b6ec
Many scripts compare actual and expected output using "diff -u". This is nicer than "cmp" because the output shows how the two differ. However, not all versions of diff understand -u, leading to unnecessary test failure. This adds a test_cmp function to the test scripts and switches all "diff -u" invocations to use it. The function uses the contents of "$GIT_TEST_CMP" to compare its arguments; the default is "diff -u". On systems with a less-capable diff, you can do: GIT_TEST_CMP=cmp make test Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
34 lines
560 B
Bash
Executable File
34 lines
560 B
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description='ignore CR in CRLF sequence while computing similiarity'
|
|
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success setup '
|
|
|
|
cat ../t0022-crlf-rename.sh >sample &&
|
|
git add sample &&
|
|
|
|
test_tick &&
|
|
git commit -m Initial &&
|
|
|
|
sed -e "s/\$/
|
|
/" ../t0022-crlf-rename.sh >elpmas &&
|
|
git add elpmas &&
|
|
rm -f sample &&
|
|
|
|
test_tick &&
|
|
git commit -a -m Second
|
|
|
|
'
|
|
|
|
test_expect_success 'diff -M' '
|
|
|
|
git diff-tree -M -r --name-status HEAD^ HEAD |
|
|
sed -e "s/R[0-9]*/RNUM/" >actual &&
|
|
echo "RNUM sample elpmas" >expect &&
|
|
test_cmp expect actual
|
|
|
|
'
|
|
|
|
test_done
|