From 9f488411284608260cf5b449f2bcc87d35d0a18d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 10 May 2025 20:56:07 +0200 Subject: =?UTF-8?q?Fix=20parser=20indentation=20check=20after=20=E2=80=98e?= =?UTF-8?q?xport=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/asset/definition/basic.et | 22 ++++++++++++++++++++++ test/asset/parser/indent.et | 41 +++++++++++++++++++++++++++++++++++++++++ test/script/definition.et | 18 ++++++++++++++++++ test/script/parser.et | 8 +++++++- 4 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 test/asset/definition/basic.et create mode 100644 test/asset/parser/indent.et create mode 100644 test/script/definition.et (limited to 'test') diff --git a/test/asset/definition/basic.et b/test/asset/definition/basic.et new file mode 100644 index 0000000..6ae248e --- /dev/null +++ b/test/asset/definition/basic.et @@ -0,0 +1,22 @@ +def expr_def = 4 + +def fun_expr_def (x) = x + 5 + +def test_def (n): + shell as p on n: + echo $expr_def + + expect from p: + /4/ + +def fun_test_def (n) first x: + shell as p on n: + echo ${expr_def + x} + + expect from p: + /${4 + x}/ + +test Test: + node n + test_def (n) + fun_test_def (n) first 7 diff --git a/test/asset/parser/indent.et b/test/asset/parser/indent.et new file mode 100644 index 0000000..01c4dd8 --- /dev/null +++ b/test/asset/parser/indent.et @@ -0,0 +1,41 @@ +def x1s: + wait + +def x2s: + wait + +def x4s: + wait + +def x8s: + wait + +def x16s: + wait + +def x1t: + wait + +def x2t: + wait + +export def e1s: + wait + +export def e2s: + wait + +export def e4s: + wait + +export def e8s: + wait + +export def e16s: + wait + +export def e1t: + wait + +export def e2t: + wait diff --git a/test/script/definition.et b/test/script/definition.et new file mode 100644 index 0000000..d2da737 --- /dev/null +++ b/test/script/definition.et @@ -0,0 +1,18 @@ +module definition + +asset scripts: + path: ../asset/definition + +test Definition: + spawn as p + with p: + send "load ${scripts.path}/basic.et" + expect /load-done/ + + send "run Test" + expect /child-stdout p 4/ + expect /match p 4/ + expect /child-stdout p 11/ + expect /match p 11/ + expect /(.*)/ capture done + guard (done == "run-done") diff --git a/test/script/parser.et b/test/script/parser.et index ee99989..554e345 100644 --- a/test/script/parser.et +++ b/test/script/parser.et @@ -1,7 +1,13 @@ module parser -test ModuleNotFound: +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/ -- cgit v1.2.3