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>
Matthieu Moy committed
Feb 25, 2016 at 09:59 UTC
f07fc9e753746cc4d7e57212f558106782e7bfa4
1 file changed
+35
-31
t/t4001-diff-rename.sh
+35
-31
@@ -9,21 +9,40 @@ test_description='Test rename detection in diff engine.
9
. ./test-lib.sh
10
. "$TEST_DIRECTORY"/diff-lib.sh
11
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
46
'
47
48
test_expect_success \
@@ -43,22 +62,7 @@ test_expect_success \
62
test_expect_success \
63
'git diff-index -p -M after rename and editing.' \
64
'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
+
66
67
test_expect_success \
68
'validate the output.' \