summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/asset/run/echo.et4
-rw-r--r--test/asset/run/erebos-tester.yaml2
-rwxr-xr-xtest/asset/run/tools/echo.sh2
-rw-r--r--test/asset/run/trivial.et7
-rw-r--r--test/script/run.et47
5 files changed, 62 insertions, 0 deletions
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.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/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/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/script/run.et b/test/script/run.et
new file mode 100644
index 0000000..103a3e1
--- /dev/null
+++ b/test/script/run.et
@@ -0,0 +1,47 @@
+module run
+
+asset scripts:
+ path: ../asset/run
+
+test TrivialRun:
+ spawn as p
+ with p:
+ send "load ${scripts.path}/trivial.et"
+ expect /load-done/
+
+ send "run AlwaysSucceeds"
+ local:
+ expect /(run-.*)/ capture done
+ guard (done == "run-done")
+
+ send "run AlwaysFails"
+ local:
+ expect /match-fail .*/
+ expect /(run-.*)/ capture done
+ guard (done == "run-failed")
+
+
+test RunConfig:
+ node n
+ shell on n:
+ cp ${scripts.path}/erebos-tester.yaml .
+ mkdir tools
+ cp ${scripts.path}/tools/echo.sh ./tools/tool
+ mkdir scripts
+ # TODO: it seems that namespaces are not properly cleaned up after the failed test
+ #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-all"
+ #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-all-done/