hush: fix a bunch of obscure while/until/continue bugs
function old new delta run_list 1159 1214 +55 done_pipe 106 123 +17 done_command 86 98 +12 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 84/0) Total: 84 bytes
This commit is contained in:
1
shell/hush_test/hush-misc/continue2.right
Normal file
1
shell/hush_test/hush-misc/continue2.right
Normal file
@@ -0,0 +1 @@
|
||||
Ok:1
|
3
shell/hush_test/hush-misc/continue2.tests
Normal file
3
shell/hush_test/hush-misc/continue2.tests
Normal file
@@ -0,0 +1,3 @@
|
||||
e=''
|
||||
(while test $e && exit 1; true; do e=1; continue; done)
|
||||
echo Ok:$?
|
2
shell/hush_test/hush-misc/continue3.right
Normal file
2
shell/hush_test/hush-misc/continue3.right
Normal file
@@ -0,0 +1,2 @@
|
||||
0
|
||||
0
|
3
shell/hush_test/hush-misc/continue3.tests
Normal file
3
shell/hush_test/hush-misc/continue3.tests
Normal file
@@ -0,0 +1,3 @@
|
||||
# Test that "continue" does affect exitcode (sets to 0)
|
||||
e=''
|
||||
while echo $?; test $e && exit; true; do e=1; false; continue; done
|
3
shell/hush_test/hush-misc/until1.right
Normal file
3
shell/hush_test/hush-misc/until1.right
Normal file
@@ -0,0 +1,3 @@
|
||||
1
|
||||
1
|
||||
Ok:0
|
11
shell/hush_test/hush-misc/until1.tests
Normal file
11
shell/hush_test/hush-misc/until1.tests
Normal file
@@ -0,0 +1,11 @@
|
||||
x=1
|
||||
until test "$x" = 4; do echo $x; x=4; done
|
||||
|
||||
# We had a bug in multi-line form
|
||||
x=1
|
||||
until test "$x" = 4; do
|
||||
echo $x
|
||||
x=4
|
||||
done
|
||||
|
||||
echo Ok:$?
|
2
shell/hush_test/hush-misc/while2.right
Normal file
2
shell/hush_test/hush-misc/while2.right
Normal file
@@ -0,0 +1,2 @@
|
||||
Hello
|
||||
OK:0
|
2
shell/hush_test/hush-misc/while2.tests
Normal file
2
shell/hush_test/hush-misc/while2.tests
Normal file
@@ -0,0 +1,2 @@
|
||||
while echo Hello; false; do echo NOT SHOWN; done
|
||||
echo OK:$?
|
@@ -46,7 +46,7 @@ do_test()
|
||||
test -x "$x" || continue
|
||||
name="${x%%.tests}"
|
||||
test -f "$name.right" || continue
|
||||
# echo Running test: "$name.right"
|
||||
# echo Running test: "$x"
|
||||
{
|
||||
"$THIS_SH" "./$x" >"$name.xx" 2>&1
|
||||
diff -u "$name.xx" "$name.right" >"../$1-$x.fail" && rm -f "$name.xx" "../$1-$x.fail"
|
||||
|
Reference in New Issue
Block a user