@@ -87,13 +87,8 @@ test_expect_success 'setup expected' '
87
87
EOF
88
88
'
89
89
90
- test_expect_success ' setup fake editor' '
91
- >fake_editor.sh &&
92
- chmod a+x fake_editor.sh &&
93
- test_set_editor "$(pwd)/fake_editor.sh"
94
- '
95
-
96
90
test_expect_success ' dummy edit works' '
91
+ test_set_editor : &&
97
92
(echo e; echo a) | git add -p &&
98
93
git diff > diff &&
99
94
test_cmp expected diff
@@ -110,12 +105,10 @@ test_expect_success 'setup patch' '
110
105
'
111
106
112
107
test_expect_success ' setup fake editor' '
113
- echo "#!$SHELL_PATH" >fake_editor.sh &&
114
- cat >>fake_editor.sh <<-\EOF &&
108
+ write_script "fake_editor.sh" <<-\EOF &&
115
109
mv -f "$1" oldpatch &&
116
110
mv -f patch "$1"
117
111
EOF
118
- chmod a+x fake_editor.sh &&
119
112
test_set_editor "$(pwd)/fake_editor.sh"
120
113
'
121
114
@@ -302,18 +295,12 @@ test_expect_success 'deleting an empty file' '
302
295
303
296
test_expect_success ' split hunk setup' '
304
297
git reset --hard &&
305
- for i in 10 20 30 40 50 60
306
- do
307
- echo $i
308
- done >test &&
298
+ test_write_lines 10 20 30 40 50 60 >test &&
309
299
git add test &&
310
300
test_tick &&
311
301
git commit -m test &&
312
302
313
- for i in 10 15 20 21 22 23 24 30 40 50 60
314
- do
315
- echo $i
316
- done >test
303
+ test_write_lines 10 15 20 21 22 23 24 30 40 50 60 >test
317
304
'
318
305
319
306
test_expect_success ' split hunk "add -p (edit)"' '
@@ -334,17 +321,7 @@ test_expect_success 'split hunk "add -p (edit)"' '
334
321
'
335
322
336
323
test_expect_failure ' split hunk "add -p (no, yes, edit)"' '
337
- cat >test <<-\EOF &&
338
- 5
339
- 10
340
- 20
341
- 21
342
- 30
343
- 31
344
- 40
345
- 50
346
- 60
347
- EOF
324
+ test_write_lines 5 10 20 21 30 31 40 50 60 >test &&
348
325
git reset &&
349
326
# test sequence is s(plit), n(o), y(es), e(dit)
350
327
# q n q q is there to make sure we exit at the end.
0 commit comments