t3701: use test_write_lines and write_script
Simplify things slightly by using the above helpers. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood committed
Feb 19, 2018 at 11:29 UTC
11489a6539b8840ae18b9a5c7e6dd602e8f28209
1 file changed
+5
-28
t/t3701-add-interactive.sh
+5
-28
@@ -87,13 +87,8 @@ test_expect_success 'setup expected' '
87
EOF
88
'
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
-
90
test_expect_success 'dummy edit works' '
91
+ test_set_editor : &&
92
(echo e; echo a) | git add -p &&
93
git diff > diff &&
94
test_cmp expected diff
@@ -110,12 +105,10 @@ test_expect_success 'setup patch' '
105
'
106
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 &&
109
mv -f "$1" oldpatch &&
110
mv -f patch "$1"
111
EOF
118
- chmod a+x fake_editor.sh &&
112
test_set_editor "$(pwd)/fake_editor.sh"
113
'
114
@@ -302,18 +295,12 @@ test_expect_success 'deleting an empty file' '
295
296
test_expect_success 'split hunk setup' '
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 &&
299
git add test &&
300
test_tick &&
301
git commit -m test &&
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
304
'
305
306
test_expect_success 'split hunk "add -p (edit)"' '
@@ -334,17 +321,7 @@ test_expect_success 'split hunk "add -p (edit)"' '
321
'
322
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 &&
325
git reset &&
326
# test sequence is s(plit), n(o), y(es), e(dit)
327
# q n q q is there to make sure we exit at the end.