aboutsummaryrefslogtreecommitdiff
path: root/tests/variable
diff options
context:
space:
mode:
Diffstat (limited to 'tests/variable')
-rw-r--r--tests/variable/override/testscript76
-rw-r--r--tests/variable/private/buildfile4
-rw-r--r--tests/variable/private/testscript46
-rw-r--r--tests/variable/target-specific/testscript14
-rw-r--r--tests/variable/target-type-pattern-specific/testscript19
5 files changed, 116 insertions, 43 deletions
diff --git a/tests/variable/override/testscript b/tests/variable/override/testscript
index 0c8ef5b..7b973c0 100644
--- a/tests/variable/override/testscript
+++ b/tests/variable/override/testscript
@@ -8,18 +8,18 @@
{
: value-version
:
- $* x+=01 y+=01 <<EOI >>EOO
- x = [string] 0
- print $x
+ $* p.x+=01 p.y+=01 <<EOI >>EOO
+ p.x = [string] 0
+ print $p.x
- x = [uint64] 1
- print $x
+ p.x = [uint64] 1
+ print $p.x
- y = 0
- print $y
+ p.y = 0
+ print $p.y
- [uint64] y = [null]
- print $y
+ [uint64] p.y = [null]
+ print $p.y
EOI
001
2
@@ -29,21 +29,21 @@
: value-position
:
- $* x+=01 <<EOI >>EOO
- x = [string] 0
+ $* p.x+=01 <<EOI >>EOO
+ p.x = [string] 0
- print $x
+ print $p.x
dir/
{
- print $x
+ print $p.x
}
- dir/ x = [uint64] 1
+ dir/ p.x = [uint64] 1
- print $x
+ print $p.x
dir/
{
- print $x
+ print $p.x
}
EOI
@@ -59,17 +59,19 @@
: Test overriding cached target type/pattern-specific prepend/append
:
{
- $* x+=X <<EOI >>EOO
- x = 0
- file{*}: x += a
+ $* p.x+=X <<EOI >>EOO
+ p.x = 0
+ file{*}: p.x += a
- print $(file{foo}:x)
+ file{foo}:
- x = 1 # Should invalidate both caches.
- print $(file{foo}:x)
+ print $(file{foo}:p.x)
- file{*}: x += b # Should invalidate both caches.
- print $(file{foo}:x)
+ p.x = 1 # Should invalidate both caches.
+ print $(file{foo}:p.x)
+
+ file{*}: p.x += b # Should invalidate both caches.
+ print $(file{foo}:p.x)
EOI
0 a X
1 a X
@@ -82,24 +84,24 @@
{
: after
:
- $* x=1 x+=2 x=+0 <<EOI >>EOO
- print $x
+ $* p.x=1 p.x+=2 p.x=+0 <<EOI >>EOO
+ print $p.x
EOI
0 1 2
EOO
: before
:
- $* x+=2 x=+0 x=1 <<EOI >>EOO
- print $x
+ $* p.x+=2 p.x=+0 p.x=1 <<EOI >>EOO
+ print $p.x
EOI
1
EOO
: both
:
- $* x=+0 x=1 x+=2 <<EOI >>EOO
- print $x
+ $* p.x=+0 p.x=1 p.x+=2 <<EOI >>EOO
+ print $p.x
EOI
1 2
EOO
@@ -110,9 +112,9 @@
{
: assign
:
- $* x=0 !y=0 x=1 !y=1 <<EOI >>EOO
- print $x
- print $y
+ $* p.x=0 !p.y=0 p.x=1 !p.y=1 <<EOI >>EOO
+ print $p.x
+ print $p.y
EOI
1
1
@@ -120,16 +122,16 @@
: append
:
- $* x=0 x+=1 x+=2 <<EOI >>EOO
- print $x
+ $* p.x=0 p.x+=1 p.x+=2 <<EOI >>EOO
+ print $p.x
EOI
0 1 2
EOO
: prepend
:
- $* x=2 x=+1 x=+0 <<EOI >>EOO
- print $x
+ $* p.x=2 p.x=+1 p.x=+0 <<EOI >>EOO
+ print $p.x
EOI
0 1 2
EOO
diff --git a/tests/variable/private/buildfile b/tests/variable/private/buildfile
new file mode 100644
index 0000000..3b0d20c
--- /dev/null
+++ b/tests/variable/private/buildfile
@@ -0,0 +1,4 @@
+# file : tests/variable/private/buildfile
+# license : MIT; see accompanying LICENSE file
+
+./: testscript $b
diff --git a/tests/variable/private/testscript b/tests/variable/private/testscript
new file mode 100644
index 0000000..ddb78fd
--- /dev/null
+++ b/tests/variable/private/testscript
@@ -0,0 +1,46 @@
+# file : tests/variable/private/testscript
+# license : MIT; see accompanying LICENSE file
+
+# Test public/private variable mode.
+
+buildfile = true
+test.arguments = 'noop(../)'
+
+.include ../../common.testscript
+
++cat <<EOI >=build/bootstrap.build
+project = test
+amalgamation =
+subprojects = subproj
+
+using install
+EOI
++cat <<EOI >=buildfile
+[string] foo = abc
+print $type($foo) $foo
+
+subproj/: install = false
+print $type($(subproj/: install)) $(subproj/: install)
+
+include subproj/
+EOI
+
+: subproj
+:
+mkdir build;
+cat <<EOI >=build/bootstrap.build;
+project = subporj
+EOI
+cat <<EOI >=buildfile;
+[uint64] foo = 0123
+print $type($foo) $foo
+
+[bool] install = true
+print $type($install) $install
+EOI
+$* >>EOO
+string abc
+path false
+uint64 123
+bool true
+EOO
diff --git a/tests/variable/target-specific/testscript b/tests/variable/target-specific/testscript
index 627d8ab..c52712b 100644
--- a/tests/variable/target-specific/testscript
+++ b/tests/variable/target-specific/testscript
@@ -65,13 +65,15 @@ print (foo: bar)
print (foo : bar)
print (foo/: bar)
print (foo/file{fox}: bar)
+print (file{fox}@./: bar)
EOI
-foo:bar
-foo:bar
-foo:bar
-foo:bar
-foo/:bar
-foo/file{fox}:bar
+bar:foo
+bar:foo
+bar:foo
+bar:foo
+bar:foo/
+bar:foo/file{fox}
+bar:file{fox}@./
EOO
: eval-qual-name-expected
diff --git a/tests/variable/target-type-pattern-specific/testscript b/tests/variable/target-type-pattern-specific/testscript
index 016380b..9c600ca 100644
--- a/tests/variable/target-type-pattern-specific/testscript
+++ b/tests/variable/target-type-pattern-specific/testscript
@@ -12,6 +12,9 @@ x = x
y = y
dir{*}: x = X
dir{*}: y += Y
+
+./:
+
print $(./: x)
print $(./: y)
EOI
@@ -26,6 +29,7 @@ dir{*}: x = y
x = z
dir{*-foo}: x = $x # 'z'
+bar-foo/:
print $(bar-foo/: x)
x = G
@@ -59,6 +63,7 @@ print $(file{x-foz}: x)
*: x1 = X1
{*}: x2 = X2
target{*}: x3 = X3
+file{x}:
print $(file{x}: x1)
print $(file{x}: x2)
print $(file{x}: x3)
@@ -89,6 +94,9 @@ dir{*}:
y += Y
z = $x # Note: from scope.
}
+
+./:
+
print $(./: x)
print $(./: y)
print $(./: z)
@@ -108,6 +116,9 @@ file{f*} file{b*}:
x = X
y += Y
}
+
+file{foo bar}:
+
print $(file{foo}: x)
print $(file{bar}: y)
EOI
@@ -123,6 +134,8 @@ EOO
$* <<EOI >>EOO
file{~/'.+\.txt'/i}: x = 1
+ file{foo.txt foo.TXT}:
+
print $(file{foo.txt}: x)
print $(file{foo.TXT}: x)
EOI
@@ -140,6 +153,8 @@ EOO
txt{~/'.+\.tx'/e}: x = 2
txt{~/'.+\.txt'/e}: x = 3
+ txt{foo.x foo.tx foo.txt foo.bar...}:
+
print $(txt{foo.x}: x)
print $(txt{foo.tx}: x)
print $(txt{foo.txt}: x)
@@ -157,6 +172,8 @@ EOO
x = 0
file{~/'(.+)-\1'/}: x = 1
+ file{foo-foo foo-bar}:
+
print $(file{foo-foo}: x)
print $(file{foo-bar}: x)
EOI
@@ -169,6 +186,8 @@ EOO
$* <<EOI >>EOO
foo/dir{~/b.+/}: x = 1
+ foo/dir{bar}:
+
print $(foo/dir{bar}: x)
EOI
1