From 7edad5cefa0f065aa83dffd2d7830aeaf9f38662 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 29 Jan 2022 23:31:16 +0100 Subject: tests: add functional tests for builtin functions Signed-off-by: Jo-Philipp Wich --- tests/custom/03_stdlib/49_b64enc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/custom/03_stdlib/49_b64enc (limited to 'tests/custom/03_stdlib/49_b64enc') diff --git a/tests/custom/03_stdlib/49_b64enc b/tests/custom/03_stdlib/49_b64enc new file mode 100644 index 0000000..3ef0381 --- /dev/null +++ b/tests/custom/03_stdlib/49_b64enc @@ -0,0 +1,25 @@ +The `b64enc()` function encodes the given input string as base64. + +Returns a string containing the encoded data. + +Returns `null` if the input is not a string. + +-- Testcase -- +{% + printf("%.J\n", [ + b64enc("Hello, world!"), + b64enc("\u0000\u0001\u0002\u0003"), + b64enc(""), + b64enc(true) + ]); +%} +-- End -- + +-- Expect stdout -- +[ + "SGVsbG8sIHdvcmxkIQ==", + "AAECAw==", + "", + null +] +-- End -- -- cgit v1.2.3