aboutsummaryrefslogtreecommitdiff
path: root/tests/variable
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-11-20 18:30:22 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-11-20 18:30:22 +0200
commitd57d929b5a927bdd1d6f2ee9e2887892148fdbb0 (patch)
tree12d0ab9b7f72f7016fe08cce78d6e92d21ca2a3d /tests/variable
parent389f0fe004c205cdee9d7f9f7a4c880055bfb285 (diff)
Add test for prerequisite-specific variables
Diffstat (limited to 'tests/variable')
-rw-r--r--tests/variable/prerequisite-specific/buildfile5
-rw-r--r--tests/variable/prerequisite-specific/testscript71
2 files changed, 76 insertions, 0 deletions
diff --git a/tests/variable/prerequisite-specific/buildfile b/tests/variable/prerequisite-specific/buildfile
new file mode 100644
index 0000000..e16519c
--- /dev/null
+++ b/tests/variable/prerequisite-specific/buildfile
@@ -0,0 +1,5 @@
+# file : tests/variable/prerequisite-specific/buildfile
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+./: test{testscript} $b
diff --git a/tests/variable/prerequisite-specific/testscript b/tests/variable/prerequisite-specific/testscript
new file mode 100644
index 0000000..c4993f2
--- /dev/null
+++ b/tests/variable/prerequisite-specific/testscript
@@ -0,0 +1,71 @@
+# file : tests/variable/prerequisite-specific/testscript
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include ../../common.test
+
+# There is currently no support for expanding prerequisite-specific variables
+# (since there is no way to id a prerequisite) so we use dump.
+#
+
+: basic
+:
+$* <<EOI 2>>/~%EOE%
+dir{x}: fox = FOX
+dir{x}: dir{a}: foo = FOO
+dir{x}: dir{b}: fox += FOX
+dir{x}: dir{c}: bar = [bool] true
+dump dir{x}
+EOI
+<stdin>:5:1: dump:
+% dir\{.+/x/\}:%
+ {
+ fox = FOX
+ }
+% dir\{.+/x/\}: .+:dir\{a/\}:%
+ {
+ foo = FOO
+ }
+% dir\{.+/x/\}: .+:dir\{b/\}:%
+ {
+ fox = FOX FOX
+ }
+% dir\{.+/x/\}: .+:dir\{c/\}:%
+ {
+ bar = [bool] true
+ }
+EOE
+
+: multiple
+:
+$* <<EOI 2>>/~%EOE%
+dir{x} dir{y}: dir{a} dir{b}: foo = FOO
+dump dir{x} dir{y}
+EOI
+<stdin>:2:1: dump:
+% dir\{.+/x/\}: .+:dir\{a/\}:%
+ {
+ foo = FOO
+ }
+% dir\{.+/x/\}: .+:dir\{b/\}:%
+ {
+ foo = FOO
+ }
+
+% dir\{.+/y/\}: .+:dir\{a/\}:%
+ {
+ foo = FOO
+ }
+% dir\{.+/y/\}: .+:dir\{b/\}:%
+ {
+ foo = FOO
+ }
+EOE
+
+: expect-assignment
+:
+$* <<EOI 2>>EOE != 0
+dir{x}: dir{a}:
+EOI
+<stdin>:1:16: error: expected name instead of <newline>
+EOE