diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-02-17 10:20:52 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-02-17 10:20:52 +0100 |
| commit | 585f6564874d16a8f81a6c29e73091a008ccd484 (patch) | |
| tree | b3c67be539e7ca5a6af6bb5e654b7a07bc1d361f /tests | |
| parent | 56b6a2a908cd9c1316e42daaf5c5a584f6903037 (diff) | |
Check char boundaries in string methods
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/typ/compiler/string.typ | 12 |
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) |
