From 47ae21f6558f81ae7c13d143d297f61acae2b530 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 19 Sep 2022 10:13:48 +0200 Subject: Allow computed variables in depdb preamble similar to impure functions --- tests/recipe/buildscript/testscript | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'tests') 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 <=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 <=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 -- cgit v1.1