summaryrefslogtreecommitdiff
path: root/tests/typ/compute/construct.typ
diff options
context:
space:
mode:
authorErik Bünnig <github@epbuennig.me>2023-05-30 18:11:30 +0200
committerGitHub <noreply@github.com>2023-05-30 18:11:30 +0200
commitb805c5f10080912cbfb1fd2fd2733c48a92ce4f9 (patch)
treea97a4aca4d2ba05056bac0f9e9ae9075bccfeb52 /tests/typ/compute/construct.typ
parent789a54f9e5fcebf4a3b3945d36ce3db7674b0fbc (diff)
Unicode code point conversion (#1068) (#1132)
Diffstat (limited to 'tests/typ/compute/construct.typ')
-rw-r--r--tests/typ/compute/construct.typ21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/typ/compute/construct.typ b/tests/typ/compute/construct.typ
index aea15b53..f094b6b2 100644
--- a/tests/typ/compute/construct.typ
+++ b/tests/typ/compute/construct.typ
@@ -83,6 +83,27 @@
#str(1.23, base: 2)
---
+// Test the unicode function.
+#test(str.from-unicode(97), "a")
+#test(str.to-unicode("a"), 97)
+
+---
+// Error: 19-22 expected integer, found content
+#str.from-unicode([a])
+
+---
+// Error: 17-21 expected exactly one character
+#str.to-unicode("ab")
+
+---
+// Error: 19-21 0xffffffffffffffff is not a valid codepoint
+#str.from-unicode(-1) // negative values are not valid
+
+---
+// Error: 19-27 0x110000 is not a valid codepoint
+#str.from-unicode(0x110000) // 0x10ffff is the highest valid code point
+
+---
#assert(range(2, 5) == (2, 3, 4))
---