aboutsummaryrefslogtreecommitdiff
path: root/tests/test
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2022-09-23 20:08:47 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2022-09-28 19:07:50 +0300
commit1c60c97b6b05cbee7e106fae6d8582382cbe4b7c (patch)
treeee389ea12fbe0dcecd39c32fd39fcb6c754af45a /tests/test
parent744e8215261fbf81b9348d115d4916a9c88b52cc (diff)
Add support for 'for' loop first form (for x:...) in script
Diffstat (limited to 'tests/test')
-rw-r--r--tests/test/script/runner/for.testscript42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/test/script/runner/for.testscript b/tests/test/script/runner/for.testscript
new file mode 100644
index 0000000..21042e5
--- /dev/null
+++ b/tests/test/script/runner/for.testscript
@@ -0,0 +1,42 @@
+# File : tests/test/script/runner/for.testscript
+# license : MIT; see accompanying LICENSE file
+
+.include ../common.testscript
+
+: form-1
+:
+: for x: ...
+:
+{
+ : basics
+ :
+ $c <<EOI && $b >>EOO
+ for x: a b
+ echo "$x" >|
+ end
+ EOI
+ a
+ b
+ EOO
+
+ : test-options
+ :
+ $c <<EOI && $b >>~%EOO%
+ for test.options: -a -b
+ echo $* >|
+ end
+ EOI
+ %.+ -a%
+ %.+ -b%
+ EOO
+
+ : special-var
+ :
+ $c <<EOI && $b 2>>EOE != 0
+ for *: -a -b
+ echo $* >|
+ end
+ EOI
+ testscript:1:5: error: attempt to set '*' variable directly
+ EOE
+}