summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-09-04 19:25:09 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2026-09-05 21:41:39 +0200
commita9439b66ad8f7a8f4ba079a47ecfe1e76c2abc4b (patch)
tree7ef225d63462349b8f5708cdceecc9010734e60a /test
parentc2c89cf5308ea5c490a4fe150cffc72ed09c4c1c (diff)
Expression expansion for shell arguments
Changelog: Lists can now be dollar-expanded in the shell interpreter to provide list of shell command arguments.
Diffstat (limited to 'test')
-rw-r--r--test/asset/shell/expansion.et13
-rw-r--r--test/script/shell.et17
2 files changed, 30 insertions, 0 deletions
diff --git a/test/asset/shell/expansion.et b/test/asset/shell/expansion.et
new file mode 100644
index 0000000..050efba
--- /dev/null
+++ b/test/asset/shell/expansion.et
@@ -0,0 +1,13 @@
+test Test:
+ node n
+
+ let str = "some string"
+ let int = 2
+ let num = 4.5
+ let list = [ "a b", "c d", "e", "f" ]
+ let ilist = [ 1 .. 5 ]
+
+ shell on n as sh:
+ echo A $str B $int $num C
+ echo D $list E
+ echo F $ilist G
diff --git a/test/script/shell.et b/test/script/shell.et
index 3384353..4dca4a2 100644
--- a/test/script/shell.et
+++ b/test/script/shell.et
@@ -180,3 +180,20 @@ test ShellLogic:
expect /run-test-result NegateNothing failed/
expect /run-done 1 0 0 1/
flush
+
+
+test ShellVariableExpansion:
+ spawn as p
+ with p:
+ send "load ${scripts.path}/expansion.et"
+ local:
+ expect /(load-.*)/ capture done
+ guard (done == "load-done")
+
+ send "run Test"
+ expect /child-stdout sh A some string B 2 4.5 C/
+ expect /child-stdout sh D a b c d e f E/
+ expect /child-stdout sh F 1 2 3 4 5 G/
+ expect /run-test-result Test done/
+ expect /run-done 1 1 0 0/
+ flush