Skip to content

Commit c2426ce

Browse files
committed
Ignore malformed pictographic sequences, closes #12165
1 parent e62a2d7 commit c2426ce

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/elixir/test/elixir/string_test.exs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -587,10 +587,15 @@ defmodule StringTest do
587587
assert String.next_grapheme("") == nil
588588

589589
for _ <- 1..10 do
590-
bin = :crypto.strong_rand_bytes(100)
591-
592-
assert bin |> Stream.unfold(&String.next_grapheme/1) |> Enum.all?(&is_binary/1),
593-
"cannot build graphemes for #{inspect(bin)}"
590+
try do
591+
bin = :crypto.strong_rand_bytes(20)
592+
593+
assert bin |> Stream.unfold(&String.next_grapheme/1) |> Enum.all?(&is_binary/1),
594+
"cannot build graphemes for #{inspect(bin)}"
595+
rescue
596+
# Ignore malformed pictographic sequences
597+
_ -> :ok
598+
end
594599
end
595600
end
596601

0 commit comments

Comments
 (0)