mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
library/string.m:
Make string.index/3 and string.unsafe_index/3
return either U+FFFD or an unpaired surrogate code point
when an ill-formed code unit sequence is detected.
tests/hard_coded/Mmakefile:
tests/hard_coded/string_index_ilseq.exp:
tests/hard_coded/string_index_ilseq.exp2:
tests/hard_coded/string_index_ilseq.m:
Add test case.
11 lines
274 B
Plaintext
11 lines
274 B
Plaintext
string.index(S, 0, 0x1f600)
|
|
string.index(S, 1, 0xfffd)
|
|
string.index(S, 2, 0xfffd)
|
|
string.index(S, 3, 0xfffd)
|
|
string.index(S, 4, 0xfffd)
|
|
string.index(S, 5, 0x1f600)
|
|
string.index(S, 6, 0xfffd)
|
|
string.index(S, 7, 0xfffd)
|
|
string.index(S, 8, 0xfffd)
|
|
string.index(S, 9, _) failed
|