diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-01-29 23:31:16 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2022-02-03 17:22:43 +0100 |
commit | 7edad5cefa0f065aa83dffd2d7830aeaf9f38662 (patch) | |
tree | 86b727f434302ffb28cb59278243517f9765e170 /tests/custom/03_stdlib/37_warn | |
parent | d5003fde57eab19588da7bfdbaefe93d47435eb6 (diff) |
tests: add functional tests for builtin functions
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'tests/custom/03_stdlib/37_warn')
-rw-r--r-- | tests/custom/03_stdlib/37_warn | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/custom/03_stdlib/37_warn b/tests/custom/03_stdlib/37_warn new file mode 100644 index 0000000..2c0ff24 --- /dev/null +++ b/tests/custom/03_stdlib/37_warn @@ -0,0 +1,40 @@ +The `warn()` function outputs the given values to stderr. + +Returns the amount of bytes written. + +-- Testcase -- +{% + let n = 0; + + n += warn(null, "\n"); + n += warn(true, "\n"); + n += warn(false, "\n"); + n += warn(123, "\n"); + n += warn(456.789, "\n"); + n += warn(NaN, "\n"); + n += warn(Infinity, "\n"); + n += warn("Hello world", "\n"); + n += warn([ 1, 2, 3 ], "\n"); + n += warn({ some: "dict" }, "\n"); + n += warn(warn, "\n"); + + warn(n, " bytes written\n"); +%} +-- End -- + +-- Expect stderr -- + +true +false +123 +456.789 +NaN +Infinity +Hello world +[ 1, 2, 3 ] +{ "some": "dict" } +function warn(...) { [native code] } +117 bytes written +-- End -- + + |