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>
This commit is contained in:
parent
e4d671c6a6
commit
11489a6539
@ -87,13 +87,8 @@ test_expect_success 'setup expected' '
|
|||||||
EOF
|
EOF
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'setup fake editor' '
|
|
||||||
>fake_editor.sh &&
|
|
||||||
chmod a+x fake_editor.sh &&
|
|
||||||
test_set_editor "$(pwd)/fake_editor.sh"
|
|
||||||
'
|
|
||||||
|
|
||||||
test_expect_success 'dummy edit works' '
|
test_expect_success 'dummy edit works' '
|
||||||
|
test_set_editor : &&
|
||||||
(echo e; echo a) | git add -p &&
|
(echo e; echo a) | git add -p &&
|
||||||
git diff > diff &&
|
git diff > diff &&
|
||||||
test_cmp expected diff
|
test_cmp expected diff
|
||||||
@ -110,12 +105,10 @@ test_expect_success 'setup patch' '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'setup fake editor' '
|
test_expect_success 'setup fake editor' '
|
||||||
echo "#!$SHELL_PATH" >fake_editor.sh &&
|
write_script "fake_editor.sh" <<-\EOF &&
|
||||||
cat >>fake_editor.sh <<-\EOF &&
|
|
||||||
mv -f "$1" oldpatch &&
|
mv -f "$1" oldpatch &&
|
||||||
mv -f patch "$1"
|
mv -f patch "$1"
|
||||||
EOF
|
EOF
|
||||||
chmod a+x fake_editor.sh &&
|
|
||||||
test_set_editor "$(pwd)/fake_editor.sh"
|
test_set_editor "$(pwd)/fake_editor.sh"
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -302,18 +295,12 @@ test_expect_success 'deleting an empty file' '
|
|||||||
|
|
||||||
test_expect_success 'split hunk setup' '
|
test_expect_success 'split hunk setup' '
|
||||||
git reset --hard &&
|
git reset --hard &&
|
||||||
for i in 10 20 30 40 50 60
|
test_write_lines 10 20 30 40 50 60 >test &&
|
||||||
do
|
|
||||||
echo $i
|
|
||||||
done >test &&
|
|
||||||
git add test &&
|
git add test &&
|
||||||
test_tick &&
|
test_tick &&
|
||||||
git commit -m test &&
|
git commit -m test &&
|
||||||
|
|
||||||
for i in 10 15 20 21 22 23 24 30 40 50 60
|
test_write_lines 10 15 20 21 22 23 24 30 40 50 60 >test
|
||||||
do
|
|
||||||
echo $i
|
|
||||||
done >test
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'split hunk "add -p (edit)"' '
|
test_expect_success 'split hunk "add -p (edit)"' '
|
||||||
@ -334,17 +321,7 @@ test_expect_success 'split hunk "add -p (edit)"' '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_failure 'split hunk "add -p (no, yes, edit)"' '
|
test_expect_failure 'split hunk "add -p (no, yes, edit)"' '
|
||||||
cat >test <<-\EOF &&
|
test_write_lines 5 10 20 21 30 31 40 50 60 >test &&
|
||||||
5
|
|
||||||
10
|
|
||||||
20
|
|
||||||
21
|
|
||||||
30
|
|
||||||
31
|
|
||||||
40
|
|
||||||
50
|
|
||||||
60
|
|
||||||
EOF
|
|
||||||
git reset &&
|
git reset &&
|
||||||
# test sequence is s(plit), n(o), y(es), e(dit)
|
# test sequence is s(plit), n(o), y(es), e(dit)
|
||||||
# q n q q is there to make sure we exit at the end.
|
# q n q q is there to make sure we exit at the end.
|
||||||
|
Loading…
Reference in New Issue
Block a user