diff options
Diffstat (limited to 'test')
30 files changed, 927 insertions, 0 deletions
diff --git a/test/asset/list/concat.et b/test/asset/list/concat.et new file mode 100644 index 0000000..c669a78 --- /dev/null +++ b/test/asset/list/concat.et @@ -0,0 +1,38 @@ +test Test: + let list1 = [ 1 ] + let list2 = [ 2, 3 ] + let empty = [ ] + + node n + + let c1 = concat [[ 1 ]] + for i in c1: + shell on n: + echo "c1 $i" + local: + shell on n: + echo "c1-end" + + let c2 = concat [[ 1 ], [], empty] + for i in c2: + shell on n: + echo "c2 $i" + local: + shell on n: + echo "c2-end" + + let c3 = concat [ list1, list2, [ 6, 5 ], list2 ] + for i in c3: + shell on n: + echo "c3 $i" + local: + shell on n: + echo "c3-end" + + let c4 = list1 ++ list2 ++ [ 6, 5 ] ++ list2 + for i in c4: + shell on n: + echo "c4 $i" + local: + shell on n: + echo "c4-end" diff --git a/test/asset/output/flush.et b/test/asset/output/flush.et new file mode 100644 index 0000000..0051dfd --- /dev/null +++ b/test/asset/output/flush.et @@ -0,0 +1,13 @@ +test Test: + node n + shell on n as p: + echo a + echo b + echo c + echo d + echo e + with p: + expect /e/ + flush matching /[b-z]/ + expect /.*/ + expect /.*/ timeout 0.0 diff --git a/test/asset/output/ignore.et b/test/asset/output/ignore.et new file mode 100644 index 0000000..cc70e3b --- /dev/null +++ b/test/asset/output/ignore.et @@ -0,0 +1,20 @@ +test Test: + node n + shell on n as p: + echo a + echo b + echo c + echo d + grep -q . + echo e + echo F + echo g + echo H + with p: + expect /d/ + ignore matching /[b-z]/ + send "x" + expect /.*/ + expect /H/ + expect /F/ + expect /.*/ timeout 0.0 diff --git a/test/asset/parser/function-fail.et b/test/asset/parser/function-fail.et new file mode 100644 index 0000000..59ac3b0 --- /dev/null +++ b/test/asset/parser/function-fail.et @@ -0,0 +1,2 @@ +test Test: + guard 1 == 1 diff --git a/test/asset/parser/function.et b/test/asset/parser/function.et new file mode 100644 index 0000000..2a096b9 --- /dev/null +++ b/test/asset/parser/function.et @@ -0,0 +1,16 @@ +def f (x) and y = (x + y) + 1 + +def g (x) and y = (x + (y+1)) + +test Test: + guard (1 == 1) + guard (1 /= 2) + let x = 2 + guard (x == x) + guard (x /= 1) + guard (x /= x + 1) + + guard (f 1 and 2 == 4) + guard (f 1 and 2 == g 1 and 2) + guard (f 1 and (g 2 and 3) == g 1 and 2 + 4) + guard (f (10 + g and 1 1) and (g 2 and 3) == g 1 and 2 + 10 +6) diff --git a/test/asset/parser/tags.et b/test/asset/parser/tags.et new file mode 100644 index 0000000..3e06e44 --- /dev/null +++ b/test/asset/parser/tags.et @@ -0,0 +1,20 @@ +tag SomeTag + +tag OtherTag + +test First: + tag: SomeTag + tag: OtherTag + let x = 1 + local: + let y = 1 + +test Second: + tag: SomeTag + + local: + let x = 1 + +test Third: + local: + let x = 1 diff --git a/test/asset/run-fail/bool.et b/test/asset/run-fail/bool.et new file mode 100644 index 0000000..1608a08 --- /dev/null +++ b/test/asset/run-fail/bool.et @@ -0,0 +1,3 @@ +test Test: + node n + guard (True == False) diff --git a/test/asset/run-fail/command-ignore.et b/test/asset/run-fail/command-ignore.et new file mode 100644 index 0000000..9622782 --- /dev/null +++ b/test/asset/run-fail/command-ignore.et @@ -0,0 +1,13 @@ +test Test: + node n + shell on n as p: + cat + + send "a" to p + send "b" to p + send "x" to p + expect /x/ from p + ignore from p + + multiply_timeout by 0.0 + expect /.*/ from p diff --git a/test/asset/run-success/bool.et b/test/asset/run-success/bool.et new file mode 100644 index 0000000..7121cc0 --- /dev/null +++ b/test/asset/run-success/bool.et @@ -0,0 +1,7 @@ +test Test: + node n + guard (True == True) + guard (False == False) + guard (False /= True) + guard ((1 == 1) == True) + guard ((1 == 0) == False) diff --git a/test/asset/run-success/command-flush.et b/test/asset/run-success/command-flush.et new file mode 100644 index 0000000..8c5f7b8 --- /dev/null +++ b/test/asset/run-success/command-flush.et @@ -0,0 +1,30 @@ +def expect_next from p (str): + expect /(.*)/ from p capture line + guard (line == str) + +test Test: + node n + shell on n as p: + cat + + send "a1" to p + send "b" to p + send "x" to p + expect /x/ from p + + flush from p matching /a.*/ + send "a2" to p + send "c" to p + + expect_next "b" from p + expect_next "a2" from p + expect_next "c" from p + + send "d" to p + send "e" to p + send "f" to p + send "x" to p + expect /x/ from p + flush from p + send "g" to p + expect_next "g" from p diff --git a/test/asset/run-success/command-ignore.et b/test/asset/run-success/command-ignore.et new file mode 100644 index 0000000..dc950d1 --- /dev/null +++ b/test/asset/run-success/command-ignore.et @@ -0,0 +1,39 @@ +def expect_next from p (str): + expect /(.*)/ from p capture line + guard (line == str) + +test Test: + node n + shell on n as p: + cat + + send "a" to p + send "b" to p + send "x" to p + expect /x/ from p + + ignore from p matching /a/ + send "a" to p + send "c" to p + + expect_next "b" from p + expect_next "c" from p + + send "a" to p + send "b" to p + with p: + send "c" + ignore matching /[bcd]/ + send "d" + send "e" + expect_next "e" from p + + send "a" to p + send "b" to p + local: + send "c" to p + send "d" to p + + expect_next "b" from p + expect_next "c" from p + expect_next "d" from p diff --git a/test/asset/run/callstack.et b/test/asset/run/callstack.et new file mode 100644 index 0000000..36eb401 --- /dev/null +++ b/test/asset/run/callstack.et @@ -0,0 +1,41 @@ +test AG: + let x = 1 + guard (x == 0) + +test AE: + spawn as p + let x = 2 + expect /$x/ from p timeout 0.0 + +def fg: + let x = 1 + guard (x == 0) + +test BG: + fg + +def gg (x): + let y = 2 + guard (x == y) + +test CG: + let z = 3 + gg (z) + +def fe on p: + let x = 1 + expect /$x/ from p timeout 0.0 + +test BE: + spawn as p + fe on p + +def ge (x) on p: + guard (x /= 0) + let y = 2 + expect /$x $y/ from p timeout 0.0 + +test CE: + spawn as p + let z = 3 + ge (z) on p diff --git a/test/asset/run/echo.et b/test/asset/run/echo.et new file mode 100644 index 0000000..9950d7b --- /dev/null +++ b/test/asset/run/echo.et @@ -0,0 +1,4 @@ +test ExpectEcho: + spawn as p + send "abcdef" to p + expect /abcdef/ from p diff --git a/test/asset/run/erebos-tester-select1.yaml b/test/asset/run/erebos-tester-select1.yaml new file mode 100644 index 0000000..62e0ead --- /dev/null +++ b/test/asset/run/erebos-tester-select1.yaml @@ -0,0 +1,2 @@ +tests: ./tags.et +exclude: B diff --git a/test/asset/run/erebos-tester-select2.yaml b/test/asset/run/erebos-tester-select2.yaml new file mode 100644 index 0000000..52310be --- /dev/null +++ b/test/asset/run/erebos-tester-select2.yaml @@ -0,0 +1,8 @@ +tests: ./tags.et +select: + - T2 + - A + - B +exclude: + - A1 + - C diff --git a/test/asset/run/erebos-tester.yaml b/test/asset/run/erebos-tester.yaml new file mode 100644 index 0000000..937ca97 --- /dev/null +++ b/test/asset/run/erebos-tester.yaml @@ -0,0 +1,2 @@ +tests: ./scripts/**/*.et +tool: ./tools/tool diff --git a/test/asset/run/sysinfo.et b/test/asset/run/sysinfo.et new file mode 100644 index 0000000..1b9f6aa --- /dev/null +++ b/test/asset/run/sysinfo.et @@ -0,0 +1,12 @@ +test SysInfo: + node n + spawn on n as p1 + with p1: + send "network-info" + expect /ip ${n.ifname} ${n.ip}/ + + spawn as p2 + guard (p2.node.ip /= p1.node.ip) + with p2: + send "network-info" + expect /ip ${n.ifname} ${p2.node.ip}/ diff --git a/test/asset/run/tags.et b/test/asset/run/tags.et new file mode 100644 index 0000000..b1433fa --- /dev/null +++ b/test/asset/run/tags.et @@ -0,0 +1,38 @@ +export tag A +export tag B +export tag C + +test T1: + guard True + +test T2: + guard True + +test A1: + tag: A + guard True + +test A2: + tag: A + guard True + +test B1: + tag: B + guard True + +test B2: + tag: B + guard True + +test C1: + tag: C + guard True + +test C2: + tag: C + guard True + +test BC: + tag: B + tag: C + guard True diff --git a/test/asset/run/tools/echo.sh b/test/asset/run/tools/echo.sh new file mode 100755 index 0000000..53b1eae --- /dev/null +++ b/test/asset/run/tools/echo.sh @@ -0,0 +1,2 @@ +#!/bin/sh +cat diff --git a/test/asset/run/tools/sysinfo.sh b/test/asset/run/tools/sysinfo.sh new file mode 100755 index 0000000..38591f4 --- /dev/null +++ b/test/asset/run/tools/sysinfo.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +while read cmd; do + case "$cmd" in + network-info) + ip -o addr show | sed -e 's/[0-9]*: \([a-z0-9]*\).*inet6\? \([0-9a-f:.]*\).*/ip \1 \2/' + ;; + esac +done diff --git a/test/asset/run/trivial.et b/test/asset/run/trivial.et new file mode 100644 index 0000000..0b2e878 --- /dev/null +++ b/test/asset/run/trivial.et @@ -0,0 +1,7 @@ +test AlwaysSucceeds: + node n + guard (1 == 1) + +test AlwaysFails: + node n + guard (1 == 0) diff --git a/test/asset/shell/echo.et b/test/asset/shell/echo.et new file mode 100644 index 0000000..1e48cac --- /dev/null +++ b/test/asset/shell/echo.et @@ -0,0 +1,25 @@ +test Echo: + node n + let echo_str = "echo" + let space_str = "a b" + + shell on n as sh: + echo a b c + echo "a b c" + echo 'a b d' + echo a b " c d" + + /bin/echo "abcd" xyz + "echo" a"a" "b"c d + $echo_str b $echo_str c + + echo "$space_str" + echo $space_str + echo '$space_str' + + echo \$ \" \\ + echo "\""\""a" + echo "'" '"' '\\\' "\\" + echo a\ b\ \ c + + echo \" \' \\ \$ \# \| \> \< \; \[ \] \{ \} \( \) \* \? \~ \& \! diff --git a/test/asset/shell/pipe.et b/test/asset/shell/pipe.et new file mode 100644 index 0000000..a00360a --- /dev/null +++ b/test/asset/shell/pipe.et @@ -0,0 +1,25 @@ +test Pipe: + node n + shell on n as sh: + echo abcd | grep -o '[bc]*' + echo abcd | grep -o '[bcd]*' | grep -o '[ab]*' + + +test Redirect: + node n + shell on n as sh: + echo a > file + echo b > file + echo c >> file + echo x + cat file + echo y + cat < file + echo z + +test PipeRedirect: + node n + shell on n as sh: + echo abcdefghi | grep -o '[b-h]*' | grep -o '[a-g]*' > file + cat < file | grep -o '[acegi]' | cat > file2 + cat file2 - < file diff --git a/test/asset/shell/spawn.et b/test/asset/shell/spawn.et new file mode 100644 index 0000000..9d48e72 --- /dev/null +++ b/test/asset/shell/spawn.et @@ -0,0 +1,13 @@ +test ShellTrue: + node n + shell on n: + true + + shell on n as sh: + true + + +test ShellFalse: + node n + shell on n as sh: + false diff --git a/test/script/definition.et b/test/script/definition.et index d2da737..45951cd 100644 --- a/test/script/definition.et +++ b/test/script/definition.et @@ -10,9 +10,12 @@ test Definition: expect /load-done/ send "run Test" + expect /global-info - Starting test ‘Test’/ expect /child-stdout p 4/ expect /match p 4/ expect /child-stdout p 11/ expect /match p 11/ + expect /run-test-result Test (.*)/ capture result + guard (result == "done") expect /(.*)/ capture done guard (done == "run-done") diff --git a/test/script/list.et b/test/script/list.et new file mode 100644 index 0000000..4b493a5 --- /dev/null +++ b/test/script/list.et @@ -0,0 +1,42 @@ +module list + +asset scripts: + path: ../asset/list + +def expect_next_stdout (what) from p: + expect /child-stdout shell (.*)/ from p capture line + guard (line == what) + + +test ListConcat: + spawn as p + with p: + send "load ${scripts.path}/concat.et" + expect /load-done/ + + send "run Test" + expect_next_stdout from p: + "c1 1" + "c1-end" + "c2 1" + "c2-end" + "c3 1" + "c3 2" + "c3 3" + "c3 6" + "c3 5" + "c3 2" + "c3 3" + "c3-end" + "c4 1" + "c4 2" + "c4 3" + "c4 6" + "c4 5" + "c4 2" + "c4 3" + "c4-end" + local: + expect /run-test-result Test (.*)/ capture result + guard (result == "done") + expect /run-done/ diff --git a/test/script/output.et b/test/script/output.et new file mode 100644 index 0000000..f210490 --- /dev/null +++ b/test/script/output.et @@ -0,0 +1,57 @@ +module output + +asset scripts: + path: ../asset/output + +test FlushOutput: + spawn as p + with p: + send "load ${scripts.path}/flush.et" + expect /load-done/ + + send "run Test" + expect /child-stdout p a/ + expect /child-stdout p b/ + expect /child-stdout p c/ + expect /child-stdout p d/ + expect /child-stdout p e/ + expect /match p e/ + expect /ignored p b/ + expect /ignored p c/ + expect /ignored p d/ + expect /match p a/ + expect /match-fail expect.*/ + + expect /run-test-result Test (.*)/ capture result + guard (result == "failed") + expect /run-done/ + +test IgnoreOutput: + spawn as p + with p: + send "load ${scripts.path}/ignore.et" + expect /load-done/ + + send "run Test" + expect /child-stdout p a/ + expect /child-stdout p b/ + expect /child-stdout p c/ + expect /child-stdout p d/ + expect /child-stdin p x/ + expect /child-stdout p e/ + expect /child-stdout p F/ + expect /child-stdout p g/ + expect /child-stdout p H/ + expect /match p d/ + expect /ignored p b/ + expect /ignored p c/ + expect /match p a/ + expect /ignored p e/ + expect /match p H/ + expect /ignored p g/ + expect /match p F/ + expect /match-fail expect.*/ + + expect /run-test-result Test (.*)/ capture result + guard (result == "failed") + expect /run-done/ diff --git a/test/script/parser.et b/test/script/parser.et index 554e345..908431e 100644 --- a/test/script/parser.et +++ b/test/script/parser.et @@ -11,3 +11,12 @@ test Parser: send "load ${scripts.path}/indent.et" expect /load-done/ + + send "load ${scripts.path}/function.et" + expect /load-done/ + + send "load ${scripts.path}/function-fail.et" + expect /load-failed parse-error/ + + send "load ${scripts.path}/tags.et" + expect /load-done/ diff --git a/test/script/run.et b/test/script/run.et new file mode 100644 index 0000000..87218c0 --- /dev/null +++ b/test/script/run.et @@ -0,0 +1,327 @@ +module run + +asset scripts: + path: ../asset/run + +asset scripts_success: + path: ../asset/run-success + +asset scripts_fail: + path: ../asset/run-fail + + +test TrivialRun: + spawn as p + with p: + send "load ${scripts.path}/trivial.et" + expect /load-done/ + + send "run AlwaysSucceeds" + local: + expect /run-test-result AlwaysSucceeds (.*)/ capture result + guard (result == "done") + expect /run-done/ + + send "run AlwaysFails" + local: + expect /match-fail .*/ + expect /run-test-result AlwaysFails (.*)/ capture result + guard (result == "failed") + expect /run-done/ + + +test SimpleRun: + let should_succeed = [ "bool", "command-flush", "command-ignore" ] + let should_fail = [ "bool", "command-ignore" ] + spawn as p + + with p: + for file in should_succeed: + send "load ${scripts_success.path}/$file.et" + local: + expect /(load-.*)/ capture done + guard (done == "load-done") + flush + + send "run Test" + local: + expect /run-test-result Test (.*)/ capture result + guard (result == "done") + expect /run-done/ + flush + + for file in should_fail: + send "load ${scripts_fail.path}/$file.et" + local: + expect /(load-.*)/ capture done + guard (done == "load-done") + flush + + send "run Test" + local: + expect /run-test-result Test (.*)/ capture result + guard (result == "failed") + expect /run-done/ + flush + + +test RunConfig: + node n + local: + shell on n: + cp ${scripts.path}/erebos-tester.yaml . + mkdir tools + cp ${scripts.path}/tools/echo.sh ./tools/tool + mkdir scripts + cp ${scripts.path}/trivial.et ./scripts/ + cp ${scripts.path}/echo.et ./scripts/ + + spawn as p on n + + with p: + send "load-config" + expect /load-config-done/ + send "run *" + expect /run-test-result AlwaysSucceeds done/ + expect /run-test-result AlwaysFails failed/ + expect /child-stdin p abcdef/ + expect /child-stdout p abcdef/ + expect /match p abcdef/ + expect /run-test-result ExpectEcho done/ + expect /run-done/ + + +test GetSysInfo: + node n + local: + shell on n: + cp ${scripts.path}/erebos-tester.yaml . + mkdir tools + cp ${scripts.path}/tools/sysinfo.sh ./tools/tool + mkdir scripts + cp ${scripts.path}/sysinfo.et ./scripts/ + + spawn as p on n + + with p: + send "load-config" + expect /load-config-done/ + send "run SysInfo" + expect /run-done/ + + +test CallStack: + spawn as p + with p: + send "load ${scripts.path}/callstack.et" + expect /load-done/ + + send "run AG" + expect /match-fail guard failed/ + expect /match-fail-line .*\/callstack.et:3:5: .*/ + expect /match-fail-var x 1/ + local: + expect /(match-fail-.*)/ capture done + guard (done == "match-fail-done") + local: + expect /run-test-result AG (.*)/ capture result + guard (result == "failed") + expect /run-done/ + flush + + send "run AE" + expect /match-fail expect failed/ + expect /match-fail-line .*\/callstack.et:8:5: .*/ + expect /match-fail-var x 2/ + local: + expect /(match-fail-.*)/ capture done + guard (done == "match-fail-done") + local: + expect /run-test-result AE (.*)/ capture result + guard (result == "failed") + expect /run-done/ + flush + + send "run BG" + expect /match-fail guard failed/ + expect /match-fail-line .*\/callstack.et:12:5: .*/ + expect /match-fail-var x 1/ + expect /match-fail-line .*\/callstack.et:15:5: .*/ + local: + expect /(match-fail-.*)/ capture done + guard (done == "match-fail-done") + local: + expect /run-test-result BG (.*)/ capture result + guard (result == "failed") + expect /run-done/ + flush + + send "run CG" + expect /match-fail guard failed/ + expect /match-fail-line .*\/callstack.et:19:5: .*/ + expect /match-fail-var x 3/ + expect /match-fail-var y 2/ + expect /match-fail-line .*\/callstack.et:23:5: .*/ + expect /match-fail-var z 3/ + local: + expect /(match-fail-.*)/ capture done + guard (done == "match-fail-done") + local: + expect /run-test-result CG (.*)/ capture result + guard (result == "failed") + expect /run-done/ + flush + + send "run BE" + expect /match-fail expect failed/ + expect /match-fail-line .*\/callstack.et:27:5: .*/ + expect /match-fail-var x 1/ + expect /match-fail-line .*\/callstack.et:31:5: .*/ + expect /match-fail-var p <process:p#[0-9]+>/ + local: + expect /(match-fail-.*)/ capture done + guard (done == "match-fail-done") + local: + expect /run-test-result BE (.*)/ capture result + guard (result == "failed") + expect /run-done/ + flush + + send "run CE" + expect /match-fail expect failed/ + expect /match-fail-line .*\/callstack.et:36:5: .*/ + expect /match-fail-var x 3/ + expect /match-fail-var y 2/ + expect /match-fail-line .*\/callstack.et:41:5: .*/ + expect /match-fail-var p <process:p#[0-9]+>/ + expect /match-fail-var z 3/ + local: + expect /(match-fail-.*)/ capture done + guard (done == "match-fail-done") + local: + expect /run-test-result CE (.*)/ capture result + guard (result == "failed") + expect /run-done/ + flush + + +test RunTag: + spawn as p + with p: + send "load ${scripts.path}/tags.et" + local: + expect /(load-.*)/ capture done + guard (done == "load-done") + flush + + send "run A" + local: + expect /run-test-result A1 (.*)/ capture result + guard (result == "done") + local: + expect /run-test-result A2 (.*)/ capture result + guard (result == "done") + local: + expect /run-(.*)/ capture done + guard (done == "done") + + send "run B C" + local: + expect /run-test-result B1 (.*)/ capture result + guard (result == "done") + local: + expect /run-test-result B2 (.*)/ capture result + guard (result == "done") + local: + expect /run-test-result C1 (.*)/ capture result + guard (result == "done") + local: + expect /run-test-result C2 (.*)/ capture result + guard (result == "done") + local: + expect /run-test-result BC (.*)/ capture result + guard (result == "done") + local: + expect /run-(.*)/ capture done + guard (done == "done") + + +test RunTagExclude: + spawn as p + with p: + send "load ${scripts.path}/tags.et" + local: + expect /(load-.*)/ capture done + guard (done == "load-done") + flush + + send "run * ^A ^C ^T2 ^B1" + local: + expect /run-test-result T1 (.*)/ capture result + guard (result == "done") + local: + expect /run-test-result B2 (.*)/ capture result + guard (result == "done") + local: + expect /run-(.*)/ capture done + guard (done == "done") + + send "run T1 B1 A C ^B ^A1" + local: + expect /run-test-result T1 (.*)/ capture result + guard (result == "done") + local: + expect /run-test-result A2 (.*)/ capture result + guard (result == "done") + local: + expect /run-test-result C1 (.*)/ capture result + guard (result == "done") + local: + expect /run-test-result C2 (.*)/ capture result + guard (result == "done") + local: + expect /run-(.*)/ capture done + guard (done == "done") + + +test RunExcludeConfig1: + node n + local: + shell on n: + cp ${scripts.path}/erebos-tester-select1.yaml erebos-tester.yaml + cp ${scripts.path}/tags.et . + + spawn as p on n + with p: + send "load-config" + expect /load-config-done/ + send "run *" + expect /run-test-result T1 done/ + expect /run-test-result T2 done/ + expect /run-test-result A1 done/ + expect /run-test-result A2 done/ + expect /run-test-result C1 done/ + expect /run-test-result C2 done/ + local: + expect /run-(.*)/ capture done + guard (done == "done") + +test RunExcludeConfig2: + node n + local: + shell on n: + cp ${scripts.path}/erebos-tester-select2.yaml erebos-tester.yaml + cp ${scripts.path}/tags.et . + + spawn as p on n + with p: + send "load-config" + expect /load-config-done/ + send "run *" + expect /run-test-result T2 done/ + expect /run-test-result A2 done/ + expect /run-test-result B1 done/ + expect /run-test-result B2 done/ + local: + expect /run-(.*)/ capture done + guard (done == "done") diff --git a/test/script/shell.et b/test/script/shell.et new file mode 100644 index 0000000..00826c8 --- /dev/null +++ b/test/script/shell.et @@ -0,0 +1,100 @@ +asset scripts: + path: ../asset/shell + + +test ShellSpawn: + spawn as p + with p: + send "load ${scripts.path}/spawn.et" + local: + expect /(load-.*)/ capture done + guard (done == "load-done") + flush + + send "run *" + expect /run-test-result ShellTrue done/ + expect /child-fail sh failed at: .*: false/ + expect /child-fail sh exit code: 1/ + expect /run-test-result ShellFalse failed/ + expect /run-done/ + + +def expect_next_stdout from p (expected): + expect from p /child-stdout sh (.*)/ capture line + guard (line == expected) + +test ShellEcho: + spawn as p + with p: + send "load ${scripts.path}/echo.et" + local: + expect /(load-.*)/ capture done + guard (done == "load-done") + flush + + send "run *" + + expect_next_stdout from p: + "a b c" + "a b c" + "a b d" + "a b c d" + + "abcd xyz" + "aa bc d" + "b echo c" + + "a b" + "a b" + "\$space_str" + + "\$ \" \\" + "\"\"a" + "' \" \\\\\\ \\" + "a b c" + + "\" ' \\ \$ # | > < ; [ ] { } ( ) * ? ~ & !" + + with p: + expect /run-test-result Echo done/ + expect /run-done/ + + +test ShellPipe: + spawn as p + with p: + send "load ${scripts.path}/pipe.et" + local: + expect /(load-.*)/ capture done + guard (done == "load-done") + flush + + send "run *" + + expect_next_stdout from p: + "bc" + "b" + with p: + expect /run-test-result Pipe done/ + + expect_next_stdout from p: + "x" + "b" + "c" + "y" + "b" + "c" + "z" + with p: + expect /run-test-result Redirect done/ + + expect_next_stdout from p: + "c" + "e" + "g" + "bcdefg" + with p: + expect /run-test-result PipeRedirect done/ + + with p: + expect /run-done/ |