mirror of
https://github.com/apple/pkl.git
synced 2026-06-29 00:36:20 +02:00
Fix errors around strings with lone high or low surrogates (#1673)
This fixes some errors around treatment of strings with lone high/low surrogates.
This commit is contained in:
@@ -415,6 +415,7 @@ examples {
|
||||
str1.substring(2, 3)
|
||||
str1.substring(2, 4)
|
||||
str1.substring(0, 7)
|
||||
"\u{D800}hello".substring(0, 2)
|
||||
module.catch(() -> str1.substring(-1, 4))
|
||||
module.catch(() -> str1.substring(1, 8))
|
||||
module.catch(() -> str1.substring(3, 2))
|
||||
@@ -436,6 +437,15 @@ examples {
|
||||
str1.getOrNull(3)
|
||||
str1.getOrNull(6)
|
||||
str1.getOrNull(7)
|
||||
"🏀".getOrNull(0)
|
||||
"🏀".getOrNull(1)
|
||||
"\u{D800}".getOrNull(0)
|
||||
"\u{D800}".getOrNull(1)
|
||||
"\u{D800}h".getOrNull(0)
|
||||
"\u{D800}h".getOrNull(1)
|
||||
"\u{D800}h".getOrNull(2)
|
||||
"h\u{D800}".getOrNull(0)
|
||||
"h\u{D800}".getOrNull(1)
|
||||
}
|
||||
|
||||
["toCodePoints()"] {
|
||||
|
||||
@@ -59,6 +59,13 @@ examples {
|
||||
str3[2]
|
||||
module.catch(() -> str3[-1])
|
||||
module.catch(() -> str3[4])
|
||||
|
||||
"🏀"[0]
|
||||
"\u{D800}"[0]
|
||||
"\u{D800}h"[0]
|
||||
"\u{D800}h"[1]
|
||||
"h\u{D800}"[0]
|
||||
"h\u{D800}"[1]
|
||||
}
|
||||
|
||||
["dollar sign has no special meaning"] {
|
||||
|
||||
@@ -353,6 +353,7 @@ examples {
|
||||
"c"
|
||||
"cd"
|
||||
"abcdefg"
|
||||
"?h"
|
||||
"Character index `-1` is out of range `0`..`7`. String: \"abcdefg\""
|
||||
"Character index `8` is out of range `1`..`7`. String: \"abcdefg\""
|
||||
"Character index `2` is out of range `3`..`7`. String: \"abcdefg\""
|
||||
@@ -372,6 +373,15 @@ examples {
|
||||
"d"
|
||||
"g"
|
||||
null
|
||||
"🏀"
|
||||
null
|
||||
"?"
|
||||
null
|
||||
"?"
|
||||
"h"
|
||||
null
|
||||
"h"
|
||||
"?"
|
||||
}
|
||||
["toCodePoints()"] {
|
||||
List(97, 98, 99, 100, 101, 102, 103)
|
||||
|
||||
@@ -51,6 +51,12 @@ examples {
|
||||
"i"
|
||||
"Character index `-1` is out of range `0`..`3`. String: \"this\""
|
||||
"Character index `4` is out of range `0`..`3`. String: \"this\""
|
||||
"🏀"
|
||||
"?"
|
||||
"?"
|
||||
"h"
|
||||
"h"
|
||||
"?"
|
||||
}
|
||||
["dollar sign has no special meaning"] {
|
||||
"123$"
|
||||
|
||||
Reference in New Issue
Block a user