Added some tests for the while
This commit is contained in:
parent
00c0064f51
commit
ffc35acdc3
|
@ -294,6 +294,16 @@ func TestBuiltins_While(t *testing.T) {
|
||||||
set x (add $x 1)
|
set x (add $x 1)
|
||||||
}
|
}
|
||||||
echo "done"`, want: "done\n(nil)\n"},
|
echo "done"`, want: "done\n(nil)\n"},
|
||||||
|
{desc: "iterate while true with pipeline", expr: `
|
||||||
|
set x 0
|
||||||
|
while (lt $x 5) {
|
||||||
|
echo $x
|
||||||
|
set x (add $x 1)
|
||||||
|
if (ge $x 3) {
|
||||||
|
break "Ahh"
|
||||||
|
}
|
||||||
|
} | echo " was the break"
|
||||||
|
echo "done"`, want: "0\n1\n2\nAhh was the break\ndone\n(nil)\n"},
|
||||||
{desc: "iterate for ever with break 1", expr: `
|
{desc: "iterate for ever with break 1", expr: `
|
||||||
set x 0
|
set x 0
|
||||||
while {
|
while {
|
||||||
|
|
Loading…
Reference in a new issue