@@ -87,13 +87,8 @@ test_expect_success 'setup expected' '
8787 EOF
8888'
8989
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-
9690test_expect_success ' dummy edit works' '
91+ test_set_editor : &&
9792 (echo e; echo a) | git add -p &&
9893 git diff > diff &&
9994 test_cmp expected diff
@@ -110,12 +105,10 @@ test_expect_success 'setup patch' '
110105'
111106
112107test_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 &&
115109 mv -f "$1" oldpatch &&
116110 mv -f patch "$1"
117111 EOF
118- chmod a+x fake_editor.sh &&
119112 test_set_editor "$(pwd)/fake_editor.sh"
120113'
121114
@@ -302,18 +295,12 @@ test_expect_success 'deleting an empty file' '
302295
303296test_expect_success ' split hunk setup' '
304297 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 &&
309299 git add test &&
310300 test_tick &&
311301 git commit -m test &&
312302
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
317304'
318305
319306test_expect_success ' split hunk "add -p (edit)"' '
@@ -334,17 +321,7 @@ test_expect_success 'split hunk "add -p (edit)"' '
334321'
335322
336323test_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 &&
348325 git reset &&
349326 # test sequence is s(plit), n(o), y(es), e(dit)
350327 # q n q q is there to make sure we exit at the end.
0 commit comments