Skip to content

Commit

Permalink
Fix StringMatrix to support surrogate pairs
Browse files Browse the repository at this point in the history
  • Loading branch information
plokhotnyuk committed Jan 12, 2025
1 parent 3143f99 commit 6d18b71
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import zio.test._
object StringMatrixSpec extends ZIOSpecDefault {
val spec: Spec[Environment, Any] = suite("StringMatrix")(
test("basic positive succeeds") {
val names = List("a", "b")
val names = List("\uD83D\uDE00" /* a surrogate pair for the grinning face */, "a", "b")
val aliases = List("c" -> 0, "d" -> 1)
val asserts =
names.map(s => matcher(names, aliases, s).contains(s)) ++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ final class StringMatrix(val xs: Array[String], aliases: Array[(String, Int)] =
val len = s.length
var char: Int = 0
while (char < len) {
m(width * char + string) = s.codePointAt(char)
m(width * char + string) = s.charAt(char)
char += 1
}
string += 1
Expand Down

0 comments on commit 6d18b71

Please sign in to comment.