From a5bf818ebb55e4e27eb0f067664fd4db70284267 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 8 May 2020 06:34:13 +0200 Subject: Initial support for parsing and dumping recipes --- tests/dependency/chain/testscript | 2 +- tests/dependency/recipe/buildfile | 4 + tests/dependency/recipe/testscript | 291 +++++++++++++++++++++++++++++++++++++ 3 files changed, 296 insertions(+), 1 deletion(-) create mode 100644 tests/dependency/recipe/buildfile create mode 100644 tests/dependency/recipe/testscript (limited to 'tests/dependency') 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 : $* <>/~%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 +: +$* <>/~%EOE% +alias{x}: +{{ + cmd +}} +dump alias{x} +EOI +:5:1: dump: +% .+/alias\{x\}:% + {{ + cmd + }} +EOE + +: basics-replay +: +$* <>/~%EOE% +alias{x y}: +{{ + cmd +}} +dump alias{y} +EOI +:5:1: dump: +% .+/alias\{y\}:% + {{ + cmd + }} +EOE + +: basics-header +: +$* <>/~%EOE% +alias{x}: +% +{{ + cmd +}} +dump alias{x} +EOI +:6:1: dump: +% .+/alias\{x\}:% + {{ + cmd + }} +EOE + +: basics-header-replay +: +$* <>/~%EOE% +alias{x y}: +% +{{ + cmd +}} +dump alias{y} +EOI +:6:1: dump: +% .+/alias\{y\}:% + {{ + cmd + }} +EOE + +: with-vars +: +$* <>/~%EOE% +alias{x}: +{ + var = x +} +{{ + cmd +}} +dump alias{x} +EOI +:8:1: dump: +% .+/alias\{x\}:% + { + var = x + } + {{ + cmd + }} +EOE + +: with-vars-replay +: +$* <>/~%EOE% +alias{x y}: +{ + var = x +} +{{ + cmd +}} +dump alias{y} +EOI +:8:1: dump: +% .+/alias\{y\}:% + { + var = x + } + {{ + cmd + }} +EOE + +: with-vars-header +: +$* <>/~%EOE% +alias{x}: +{ + var = x +} +% +{{ + cmd +}} +dump alias{x} +EOI +:9:1: dump: +% .+/alias\{x\}:% + { + var = x + } + {{ + cmd + }} +EOE + +: chain +: +$* <>/~%EOE% +alias{x}: +{{ + cmd1 +}} +{{{ + cmd2 +}}} +dump alias{x} +EOI +:8:1: dump: +% .+/alias\{x\}:% + {{ + cmd1 + }} + {{{ + cmd2 + }}} +EOE + +: chain-replay +: +$* <>/~%EOE% +alias{x y}: +{{ + cmd1 +}} +{{{ + cmd2 +}}} +dump alias{y} +EOI +:8:1: dump: +% .+/alias\{y\}:% + {{ + cmd1 + }} + {{{ + cmd2 + }}} +EOE + +: chain-header +: +$* <>/~%EOE% +alias{x}: + +{{ + cmd1 +}} + +% +{{{ + cmd2 +}}} +dump alias{x} +EOI +:11:1: dump: +% .+/alias\{x\}:% + {{ + cmd1 + }} + {{{ + cmd2 + }}} +EOE + +: chain-header-replay +: +$* <>/~%EOE% +alias{x y}: + +{{ + cmd1 +}} + +% +{{{ + cmd2 +}}} +dump alias{y} +EOI +:11:1: dump: +% .+/alias\{y\}:% + {{ + cmd1 + }} + {{{ + cmd2 + }}} +EOE + +: unterminated +: +$* <>EOE != 0 +alias{x}: +{{{ + cmd +}} +EOI +:5:1: error: unterminated recipe block + :2:1: info: recipe block starts here +EOE + +: header-attribute +: +$* <>/~!EOE! +alias{x}: +% [diag=gen] +{{ + cmd +}} +dump alias{x} +EOI +:6:1: dump: +! .+/alias\{x\}:! + % [diag=gen] + {{ + cmd + }} +EOE + +: header-attribute-replay +: +$* <>/~!EOE! +alias{x y}: +% [diag=gen] +{{ + cmd +}} +dump alias{y} +EOI +:6:1: dump: +! .+/alias\{y\}:! + % [diag=gen] + {{ + cmd + }} +EOE + +: header-missing-block +: +$* <>EOE != 0 +alias{x}: +% +{ + cmd +} +EOI +:3:1: error: expected recipe block instead of '{' +EOE -- cgit v1.1