aboutsummaryrefslogtreecommitdiff
path: root/tests/recipe/buildscript/testscript
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-09-19 10:13:48 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-09-19 11:35:50 +0200
commit47ae21f6558f81ae7c13d143d297f61acae2b530 (patch)
treec9458eb0b0ef62feffd485a975286b372582c78e /tests/recipe/buildscript/testscript
parent65ce598d17a662b4c8b9a8df02b619549c5824c3 (diff)
Allow computed variables in depdb preamble similar to impure functions
Diffstat (limited to 'tests/recipe/buildscript/testscript')
-rw-r--r--tests/recipe/buildscript/testscript32
1 files changed, 27 insertions, 5 deletions
diff --git a/tests/recipe/buildscript/testscript b/tests/recipe/buildscript/testscript
index 8632280..0bf752e 100644
--- a/tests/recipe/buildscript/testscript
+++ b/tests/recipe/buildscript/testscript
@@ -108,7 +108,7 @@ posix = ($cxx.target.class != 'windows')
$* clean 2>-
}
- : untracked-var
+ : computed-var
:
{
cat <<EOI >=buildfile;
@@ -121,9 +121,29 @@ posix = ($cxx.target.class != 'windows')
}}
EOI
+ $* 2>>EOE != 0
+ buildfile:6:10: error: expansion of computed variable is only allowed in depdb preamble
+ info: consider using 'depdb' builtin to track its value changes
+ EOE
+ }
+
+ : untracked-var
+ :
+ {
+ cat <<EOI >=buildfile;
+ a = a
+ b = b
+ foo:
+ {{
+ x = true
+ y = $($x ? a : b)
+ depdb env BOGUS
+ echo $y >$path($>)
+ }}
+ EOI
+
$* 2>>~%EOE% != 0;
- echo file{foo}
- buildfile:6:10: error: use of untracked variable 'a'
+ buildfile:6:8: error: use of untracked variable 'a'
info: use the 'depdb' builtin to manually track it
%.+
EOE
@@ -201,13 +221,15 @@ posix = ($cxx.target.class != 'windows')
a = $process.run(cat baz)
foo: bar
{{
+ x = true
+ y = $($x ? a : b)
depdb hash "$a"
+
diag compose $>
cp $path($<) $path($>)
- x = true
- echo "$($x ? a : b)" >>$path($>)
+ echo $y >>$path($>)
}}
EOI