From 1c60c97b6b05cbee7e106fae6d8582382cbe4b7c Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 23 Sep 2022 20:08:47 +0300 Subject: Add support for 'for' loop first form (for x:...) in script --- tests/recipe/buildscript/testscript | 122 ++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) (limited to 'tests/recipe') diff --git a/tests/recipe/buildscript/testscript b/tests/recipe/buildscript/testscript index 54c3bbe..0ac5d5a 100644 --- a/tests/recipe/buildscript/testscript +++ b/tests/recipe/buildscript/testscript @@ -910,4 +910,126 @@ if $posix $* clean 2>- } + + : for + : + { + : form-1 + : + : for x: ... + : + { + : basics + : + { + echo 'bar' >=bar; + echo 'baz' >=baz; + + cat <=buildfile; + foo: bar baz + {{ + p = $path($>) + rm -f $p + + for f: $< + cat $path($f) >>$p + end + }} + EOI + + $* 2>'cat file{foo}'; + + cat <<>EOO; + bar + baz + EOO + + $* clean 2>- + } + + : depdb + : + { + : inside + : + { + echo 'bar' >=bar; + + cat <=buildfile; + foo: bar + {{ + for f: $< + depdb hash $f + end + + p = $path($>) + rm -f $p + + for f: $< + cat $path($f) >>$p + end + }} + EOI + + $* 2>>EOE != 0 + buildfile:4:5: error: 'depdb' call inside flow control construct + EOE + } + + : after-commands + : + { + echo 'bar' >=bar; + + cat <=buildfile; + foo: bar + {{ + for f: $< + echo $path($f) >- + end + + depdb hash a + }} + EOI + + $* 2>>~%EOE% != 0; + buildfile:4:5: error: disallowed command in depdb preamble + info: only variable assignments are allowed in depdb preamble + buildfile:7:3: info: depdb preamble ends here + %.{3} + EOE + + $* clean 2>- + } + + : after-vars + : + { + echo 'bar' >=bar; + + cat <=buildfile; + foo: bar + {{ + h = + for f: $< + h += $path($f) + end + + depdb hash $h + + p = $path($>) + rm -f $p + + for f: $< + cat $path($f) >>$p + end + }} + EOI + + $* 2>'cat file{foo}'; + $* clean 2>- + } + } + } + } } -- cgit v1.1