summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-08-25 20:44:58 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2026-08-25 21:34:47 +0200
commit91dc336f67231bb4f6f06d217e316fc02cd1bfc5 (patch)
tree7147a359bb2d82c58e0c05cfd5ff1313c274d653 /test
parentb515ae37932b800b69df3ded320e4b673ee23cea (diff)
Test: refactor Praser test with helper functionsHEADmaster
Diffstat (limited to 'test')
-rw-r--r--test/script/parser.et33
1 files changed, 18 insertions, 15 deletions
diff --git a/test/script/parser.et b/test/script/parser.et
index 908431e..a4e4e2f 100644
--- a/test/script/parser.et
+++ b/test/script/parser.et
@@ -3,20 +3,23 @@ module parser
asset scripts:
path: ../asset/parser
-test Parser:
- spawn as p
- with p:
- send "load non-existing-file.et"
- expect /load-failed file-not-found .*/
-
- send "load ${scripts.path}/indent.et"
- expect /load-done/
+def expect_load_success using p of file:
+ guard (file /= "") # TODO: forces (file :: String)
+ send "load ${scripts.path}/$file.et" to p
+ expect /load-([a-z-]+).*/ from p capture done
+ guard (done == "done")
- send "load ${scripts.path}/function.et"
- expect /load-done/
+def expect_load_failure using p of file giving error:
+ guard (file /= "") # TODO: forces (file :: String)
+ send "load ${scripts.path}/$file.et" to p
+ expect /load-([a-z-]+) ([a-z-]+).*/ from p capture done, msg
+ guard (done == "failed")
+ guard (msg == error)
- send "load ${scripts.path}/function-fail.et"
- expect /load-failed parse-error/
-
- send "load ${scripts.path}/tags.et"
- expect /load-done/
+test Parser:
+ spawn as p
+ expect_load_failure using p of "non-existing-file" giving "file-not-found"
+ expect_load_success using p of "indent"
+ expect_load_success using p of "function"
+ expect_load_failure using p of "function-fail" giving "parse-error"
+ expect_load_success using p of "tags"