aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/build/script/parser+depdb.test.testscript
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-12-04 12:53:52 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-12-08 14:26:22 +0300
commitd38dbf711c9532eea99607368278a8396b3db667 (patch)
treeab672c32b49a29a7c38edd121154fd7109717f28 /libbuild2/build/script/parser+depdb.test.testscript
parentfb34688841668e6e4c939395c8387feabe8ddfdf (diff)
In update ad hoc recipe buildscripts allow non-pure function calls only in depdeb preamble
Diffstat (limited to 'libbuild2/build/script/parser+depdb.test.testscript')
-rw-r--r--libbuild2/build/script/parser+depdb.test.testscript49
1 files changed, 49 insertions, 0 deletions
diff --git a/libbuild2/build/script/parser+depdb.test.testscript b/libbuild2/build/script/parser+depdb.test.testscript
index 38c4236..573ba6d 100644
--- a/libbuild2/build/script/parser+depdb.test.testscript
+++ b/libbuild2/build/script/parser+depdb.test.testscript
@@ -88,3 +88,52 @@ test.options += -d
EOI
}
}
+
+: impure-function
+:
+{
+ : var-assignment
+ :
+ $* <<EOI 2>>~%EOE% != 0
+ v = $getenv('VAR')
+ EOI
+ buildfile:11:6: error: call to impure function getenv is only allowed in depdb preamble
+ % info: .+%
+ EOE
+
+ : quoted
+ :
+ $* <<EOI 2>>~%EOE% != 0
+ v = "$getenv('VAR')"
+ EOI
+ buildfile:11:7: error: call to impure function getenv is only allowed in depdb preamble
+ % info: .*%
+ EOE
+
+ : if-cond
+ :
+ $* <<EOI 2>>~%EOE% != 0
+ if ($getenv('VAR') == 'yes')
+ foo
+ end
+ EOI
+ buildfile:11:6: error: call to impure function getenv is only allowed in depdb preamble
+ % info: .+%
+ EOE
+
+ : command
+ :
+ $* <<EOI 2>>~%EOE% != 0
+ $getenv('VAR')
+ EOI
+ buildfile:11:2: error: call to impure function getenv is only allowed in depdb preamble
+ % info: .+%
+ EOE
+
+ : non-functions
+ :
+ {
+ $* <'$getenv' : var
+ $* <'$getenv (v ? a : b)' : eval
+ }
+}