diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-02-03 20:04:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-03 20:04:53 +0100 |
commit | 5bd764a35aeaf50b54957bfa94ba94198514baf0 (patch) | |
tree | 86b727f434302ffb28cb59278243517f9765e170 /tests/custom/03_stdlib/48_b64dec | |
parent | 3878da883b8a54fb863fc6dcd9b9b8949caa6300 (diff) | |
parent | 7edad5cefa0f065aa83dffd2d7830aeaf9f38662 (diff) |
Merge pull request #37 from jow-/stdlib-tests
Diffstat (limited to 'tests/custom/03_stdlib/48_b64dec')
-rw-r--r-- | tests/custom/03_stdlib/48_b64dec | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/custom/03_stdlib/48_b64dec b/tests/custom/03_stdlib/48_b64dec new file mode 100644 index 0000000..898aa7a --- /dev/null +++ b/tests/custom/03_stdlib/48_b64dec @@ -0,0 +1,31 @@ +The `b64dec()` function decodes the given base64 input string. + +Returns a string containing the decoded data. + +Returns `null` if the input is not a string or if the input string was +invalid base64 data (e.g. missing padding or non-whitespace characters +outside the expected alphabet). + +-- Testcase -- +{% + printf("%.J\n", [ + b64dec("SGVsbG8sIHdvcmxkIQ=="), + b64dec("SGVsbG8sIHdvcmxkIQ"), + b64dec("AAECAw=="), + b64dec("xxx"), + b64dec("==="), + b64dec(true) + ]); +%} +-- End -- + +-- Expect stdout -- +[ + "Hello, world!", + null, + "\u0000\u0001\u0002\u0003", + null, + null, + null +] +-- End -- |