From 4f63afc1177021d6345502892dbd028f5d6db5eb Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 16 Jul 2018 15:21:26 +0200 Subject: Implement in module Given test.in containing something along these lines: foo = $foo$ Now we can do: using in file{test}: in{test.in} file{test}: foo = FOO The alternative variable substitution symbol can be specified with the in.symbol variable and lax (instead of the default strict) mode with in.substitution. For example: file{test}: in.symbol = '@' file{test}: in.substitution = lax --- tests/in/testscript | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 tests/in/testscript (limited to 'tests/in/testscript') diff --git a/tests/in/testscript b/tests/in/testscript new file mode 100644 index 0000000..4cf4ebf --- /dev/null +++ b/tests/in/testscript @@ -0,0 +1,96 @@ +# file : tests/in/testscript +# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +crosstest = false +test.arguments = + +.include ../common.test + ++cat <=build/root.build +using in +EOI + +: basic +: +cat <=test.in; + foo = $foo$ + EOI +cat <=buildfile; + file{test}: in{test} + file{test}: foo = FOO + EOI +$* <<>EOO; + foo = FOO + EOO +$* clean <<=test.in; + $10 + $foo bar$ baz + EOI +$* <>EOO + $10 + $foo bar$ baz + EOO + +: rebuild +: +cat <'$foo$ $bar$' >=test.in; +$* <'foo bar'; +$* <'FOO bar'; +$* <'FOO BAR'; +cat <'$fox$ $baz$' >=test.in; +$* <'fox baz'; +mv test.in tst.in; +$* <'FOX BAZ' + +: rebuild-diag +: +cat <=test.in; + foo = $foo$ + bar = $bar$ + EOI +$* <>EOE != 0 + foo = foo + file{test}: in{test} + EOI + test.in:2: error: undefined variable 'bar' + EOE -- cgit v1.1