summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/03_stdlib/22_uchr
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-01-29 23:31:16 +0100
committerJo-Philipp Wich <jo@mein.io>2022-02-03 17:22:43 +0100
commit7edad5cefa0f065aa83dffd2d7830aeaf9f38662 (patch)
tree86b727f434302ffb28cb59278243517f9765e170 /tests/custom/03_stdlib/22_uchr
parentd5003fde57eab19588da7bfdbaefe93d47435eb6 (diff)
tests: add functional tests for builtin functions
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'tests/custom/03_stdlib/22_uchr')
-rw-r--r--tests/custom/03_stdlib/22_uchr19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/custom/03_stdlib/22_uchr b/tests/custom/03_stdlib/22_uchr
new file mode 100644
index 0000000..8f24f3a
--- /dev/null
+++ b/tests/custom/03_stdlib/22_uchr
@@ -0,0 +1,19 @@
+The `uchr()` function takes a series of code point values and turns them
+into an UTF-8 encoded string. The resulting string will have as many
+characters as there were arguments to the function. The number of bytes
+per character varies between 1 to 4, depending on the code point value.
+
+Invalid numeric arguments or arguments being out of range 0-0x10FFFF will
+be encoded as the Unicode replacement character 0xFFFD.
+
+Returns the resulting UTF-8 string.
+
+-- Testcase --
+{{ uchr(0x2600, 0x2601, 0x2602) }}
+{{ uchr("inval", -1, 0xffffffff) }}
+-- End --
+
+-- Expect stdout --
+☀☁☂
+���
+-- End --