aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-05-08 06:34:13 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-05-27 08:35:29 +0200
commita5bf818ebb55e4e27eb0f067664fd4db70284267 (patch)
tree2c0699ba4827cee34161db3da7ec8f94a6175ea9 /tests
parentfce9782a330e8f701a8df0b5200e5b78e97ec4b5 (diff)
Initial support for parsing and dumping recipes
Diffstat (limited to 'tests')
-rw-r--r--tests/dependency/chain/testscript2
-rw-r--r--tests/dependency/recipe/buildfile4
-rw-r--r--tests/dependency/recipe/testscript291
3 files changed, 296 insertions, 1 deletions
diff --git a/tests/dependency/chain/testscript b/tests/dependency/chain/testscript
index 9232840..ac4a946 100644
--- a/tests/dependency/chain/testscript
+++ b/tests/dependency/chain/testscript
@@ -3,7 +3,7 @@
.include ../../common.testscript
-: basic
+: basics
:
$* <<EOI 2>>/~%EOE%
./: dir{x}: dir{a}
diff --git a/tests/dependency/recipe/buildfile b/tests/dependency/recipe/buildfile
new file mode 100644
index 0000000..3dc5452
--- /dev/null
+++ b/tests/dependency/recipe/buildfile
@@ -0,0 +1,4 @@
+# file : tests/dependency/recipe/buildfile
+# license : MIT; see accompanying LICENSE file
+
+./: testscript $b
diff --git a/tests/dependency/recipe/testscript b/tests/dependency/recipe/testscript
new file mode 100644
index 0000000..6cb4711
--- /dev/null
+++ b/tests/dependency/recipe/testscript
@@ -0,0 +1,291 @@
+# file : tests/dependency/recipe/testscript
+# license : MIT; see accompanying LICENSE file
+
+.include ../../common.testscript
+
+: basics
+:
+$* <<EOI 2>>/~%EOE%
+alias{x}:
+{{
+ cmd
+}}
+dump alias{x}
+EOI
+<stdin>:5:1: dump:
+% .+/alias\{x\}:%
+ {{
+ cmd
+ }}
+EOE
+
+: basics-replay
+:
+$* <<EOI 2>>/~%EOE%
+alias{x y}:
+{{
+ cmd
+}}
+dump alias{y}
+EOI
+<stdin>:5:1: dump:
+% .+/alias\{y\}:%
+ {{
+ cmd
+ }}
+EOE
+
+: basics-header
+:
+$* <<EOI 2>>/~%EOE%
+alias{x}:
+%
+{{
+ cmd
+}}
+dump alias{x}
+EOI
+<stdin>:6:1: dump:
+% .+/alias\{x\}:%
+ {{
+ cmd
+ }}
+EOE
+
+: basics-header-replay
+:
+$* <<EOI 2>>/~%EOE%
+alias{x y}:
+%
+{{
+ cmd
+}}
+dump alias{y}
+EOI
+<stdin>:6:1: dump:
+% .+/alias\{y\}:%
+ {{
+ cmd
+ }}
+EOE
+
+: with-vars
+:
+$* <<EOI 2>>/~%EOE%
+alias{x}:
+{
+ var = x
+}
+{{
+ cmd
+}}
+dump alias{x}
+EOI
+<stdin>:8:1: dump:
+% .+/alias\{x\}:%
+ {
+ var = x
+ }
+ {{
+ cmd
+ }}
+EOE
+
+: with-vars-replay
+:
+$* <<EOI 2>>/~%EOE%
+alias{x y}:
+{
+ var = x
+}
+{{
+ cmd
+}}
+dump alias{y}
+EOI
+<stdin>:8:1: dump:
+% .+/alias\{y\}:%
+ {
+ var = x
+ }
+ {{
+ cmd
+ }}
+EOE
+
+: with-vars-header
+:
+$* <<EOI 2>>/~%EOE%
+alias{x}:
+{
+ var = x
+}
+%
+{{
+ cmd
+}}
+dump alias{x}
+EOI
+<stdin>:9:1: dump:
+% .+/alias\{x\}:%
+ {
+ var = x
+ }
+ {{
+ cmd
+ }}
+EOE
+
+: chain
+:
+$* <<EOI 2>>/~%EOE%
+alias{x}:
+{{
+ cmd1
+}}
+{{{
+ cmd2
+}}}
+dump alias{x}
+EOI
+<stdin>:8:1: dump:
+% .+/alias\{x\}:%
+ {{
+ cmd1
+ }}
+ {{{
+ cmd2
+ }}}
+EOE
+
+: chain-replay
+:
+$* <<EOI 2>>/~%EOE%
+alias{x y}:
+{{
+ cmd1
+}}
+{{{
+ cmd2
+}}}
+dump alias{y}
+EOI
+<stdin>:8:1: dump:
+% .+/alias\{y\}:%
+ {{
+ cmd1
+ }}
+ {{{
+ cmd2
+ }}}
+EOE
+
+: chain-header
+:
+$* <<EOI 2>>/~%EOE%
+alias{x}:
+
+{{
+ cmd1
+}}
+
+%
+{{{
+ cmd2
+}}}
+dump alias{x}
+EOI
+<stdin>:11:1: dump:
+% .+/alias\{x\}:%
+ {{
+ cmd1
+ }}
+ {{{
+ cmd2
+ }}}
+EOE
+
+: chain-header-replay
+:
+$* <<EOI 2>>/~%EOE%
+alias{x y}:
+
+{{
+ cmd1
+}}
+
+%
+{{{
+ cmd2
+}}}
+dump alias{y}
+EOI
+<stdin>:11:1: dump:
+% .+/alias\{y\}:%
+ {{
+ cmd1
+ }}
+ {{{
+ cmd2
+ }}}
+EOE
+
+: unterminated
+:
+$* <<EOI 2>>EOE != 0
+alias{x}:
+{{{
+ cmd
+}}
+EOI
+<stdin>:5:1: error: unterminated recipe block
+ <stdin>:2:1: info: recipe block starts here
+EOE
+
+: header-attribute
+:
+$* <<EOI 2>>/~!EOE!
+alias{x}:
+% [diag=gen]
+{{
+ cmd
+}}
+dump alias{x}
+EOI
+<stdin>:6:1: dump:
+! .+/alias\{x\}:!
+ % [diag=gen]
+ {{
+ cmd
+ }}
+EOE
+
+: header-attribute-replay
+:
+$* <<EOI 2>>/~!EOE!
+alias{x y}:
+% [diag=gen]
+{{
+ cmd
+}}
+dump alias{y}
+EOI
+<stdin>:6:1: dump:
+! .+/alias\{y\}:!
+ % [diag=gen]
+ {{
+ cmd
+ }}
+EOE
+
+: header-missing-block
+:
+$* <<EOI 2>>EOE != 0
+alias{x}:
+%
+{
+ cmd
+}
+EOI
+<stdin>:3:1: error: expected recipe block instead of '{'
+EOE