diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-03-14 21:19:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-14 21:19:57 +0100 |
commit | b8bc5b58368a9c6ce9dbfc80baca933004fd0722 (patch) | |
tree | 016872e56c12f5edb3df12cf9a9cc87680f2bcc5 /tests/custom/03_stdlib | |
parent | 23929951ad4b0ed2bcea793f6bf72d9e4236d3c7 (diff) | |
parent | b4a1fd5bb4b24cec6b1410209de3f9511a00ff28 (diff) |
Merge pull request #48 from jow-/cli-rework
main: rework CLI frontend
Diffstat (limited to 'tests/custom/03_stdlib')
-rw-r--r-- | tests/custom/03_stdlib/29_require | 26 | ||||
-rw-r--r-- | tests/custom/03_stdlib/35_include | 32 |
2 files changed, 43 insertions, 15 deletions
diff --git a/tests/custom/03_stdlib/29_require b/tests/custom/03_stdlib/29_require index 681f3f7..4fb4216 100644 --- a/tests/custom/03_stdlib/29_require +++ b/tests/custom/03_stdlib/29_require @@ -42,15 +42,13 @@ Returns the value returned by the invoked module code (typically an object). -- End -- -- File require/test/module.uc -- -{% - print("This is require.test.module running!\n\n"); +print("This is require.test.module running!\n\n"); - return { - greeting: function(name) { - printf("Hello, %s!\n", name); - } - }; -%} +return { + greeting: function(name) { + printf("Hello, %s!\n", name); + } +}; -- End -- -- Expect stdout -- @@ -139,19 +137,17 @@ A compilation error in the module triggers an exception. -- End -- -- File require/test/broken.uc -- -{% - // Unclosed object to force syntax error - return { -%} +// Unclosed object to force syntax error +return { -- End -- -- Expect stderr -- Unable to compile module '.../require/test/broken.uc': Syntax error: Expecting label -In line 3, byte 11: +In line 2, byte 10: - ` return {` - Near here --^ + `return {` + ^-- Near here diff --git a/tests/custom/03_stdlib/35_include b/tests/custom/03_stdlib/35_include index 6d808f2..1d428f1 100644 --- a/tests/custom/03_stdlib/35_include +++ b/tests/custom/03_stdlib/35_include @@ -171,3 +171,35 @@ In line 12, byte 8: -- End -- + + +Ensure that included files inherit the parse mode of their calling file. + +-- Testcase -- +{% include("files/inctest.uc"); %} +-- End -- + +-- File inctest.uc -- +print("Test\n"); +-- End -- + +-- Expect stdout -- +print("Test\n"); +-- End -- + + +-- Testcase -- +include("files/inctest.uc"); +-- End -- + +-- Args -- +-R +-- End -- + +-- File inctest.uc -- +print("Test\n"); +-- End -- + +-- Expect stdout -- +Test +-- End -- |