Skip to content

Commit f07fc9e

Browse files
moygitster
authored andcommitted
t4001-diff-rename: wrap file creations in a test
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 62df1e6 commit f07fc9e

File tree

1 file changed

+35
-31
lines changed

1 file changed

+35
-31
lines changed

t/t4001-diff-rename.sh

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,40 @@ test_description='Test rename detection in diff engine.
99
. ./test-lib.sh
1010
. "$TEST_DIRECTORY"/diff-lib.sh
1111

12-
echo >path0 'Line 1
13-
Line 2
14-
Line 3
15-
Line 4
16-
Line 5
17-
Line 6
18-
Line 7
19-
Line 8
20-
Line 9
21-
Line 10
22-
line 11
23-
Line 12
24-
Line 13
25-
Line 14
26-
Line 15
12+
test_expect_success 'setup' '
13+
cat >path0 <<-\EOF &&
14+
Line 1
15+
Line 2
16+
Line 3
17+
Line 4
18+
Line 5
19+
Line 6
20+
Line 7
21+
Line 8
22+
Line 9
23+
Line 10
24+
line 11
25+
Line 12
26+
Line 13
27+
Line 14
28+
Line 15
29+
EOF
30+
cat >expected <<-\EOF
31+
diff --git a/path0 b/path1
32+
rename from path0
33+
rename to path1
34+
--- a/path0
35+
+++ b/path1
36+
@@ -8,7 +8,7 @@ Line 7
37+
Line 8
38+
Line 9
39+
Line 10
40+
-line 11
41+
+Line 11
42+
Line 12
43+
Line 13
44+
Line 14
45+
EOF
2746
'
2847

2948
test_expect_success \
@@ -43,22 +62,7 @@ test_expect_success \
4362
test_expect_success \
4463
'git diff-index -p -M after rename and editing.' \
4564
'git diff-index -p -M $tree >current'
46-
cat >expected <<\EOF
47-
diff --git a/path0 b/path1
48-
rename from path0
49-
rename to path1
50-
--- a/path0
51-
+++ b/path1
52-
@@ -8,7 +8,7 @@ Line 7
53-
Line 8
54-
Line 9
55-
Line 10
56-
-line 11
57-
+Line 11
58-
Line 12
59-
Line 13
60-
Line 14
61-
EOF
65+
6266

6367
test_expect_success \
6468
'validate the output.' \

0 commit comments

Comments
 (0)