summaryrefslogtreecommitdiff
path: root/tests/typ/compiler/string.typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-02-17 10:20:52 +0100
committerLaurenz <laurmaedje@gmail.com>2023-02-17 10:20:52 +0100
commit585f6564874d16a8f81a6c29e73091a008ccd484 (patch)
treeb3c67be539e7ca5a6af6bb5e654b7a07bc1d361f /tests/typ/compiler/string.typ
parent56b6a2a908cd9c1316e42daaf5c5a584f6903037 (diff)
Check char boundaries in string methods
Diffstat (limited to 'tests/typ/compiler/string.typ')
-rw-r--r--tests/typ/compiler/string.typ12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/typ/compiler/string.typ b/tests/typ/compiler/string.typ
index d96213b6..017e1cdd 100644
--- a/tests/typ/compiler/string.typ
+++ b/tests/typ/compiler/string.typ
@@ -27,8 +27,12 @@
#test("Hey: πŸ³οΈβ€πŸŒˆ there!".at(5), "πŸ³οΈβ€πŸŒˆ")
---
-// Error: 4-17 string index out of bounds (index: 5, len: 5)
-#{ "Hello".at(5) }
+// Error: 2-14 string index 2 is not a character boundary
+#"πŸ³οΈβ€πŸŒˆ".at(2)
+
+---
+// Error: 2-15 string index out of bounds (index: 5, len: 5)
+#"Hello".at(5)
---
// Test the `slice` method.
@@ -38,6 +42,10 @@
#test("abc🏑def".slice(-3, -1), "de")
---
+// Error: 2-21 string index -1 is not a character boundary
+#"πŸ³οΈβ€πŸŒˆ".slice(0, -1)
+
+---
// Test the `contains` method.
#test("abc".contains("b"), true)
#test("b" in "abc", true)