Files
mercury/tests/hard_coded/string_set_char_ilseq.exp
Peter Wang f71b5f20ed Define behaviour of string.set_char etc on ill-formed sequences.
library/string.m:
    Define behaviour of set_char, det_set_char and unsafe_set_char on
    ill-formed sequences. Also define them to throw an exception on an
    attempt to set a null character or surrogate code point in a UTF-8
    string.

    Delete claim that unsafe_set_char is constant time. That would only
    be true for the destructive mode of unsafe_set_char, and that mode
    has been disabled for a long time.

    Implement the defined behaviour for C and C# versions of
    unsafe_set_char. The Java version already behaved as defined.

    Use unsafe_set_char to implement set_char instead of duplicating
    foreign code.

    Replace a couple of uses of strcpy with MR_memcpy as it was
    convenient to do so. (On OpenBSD, the linker issues a warning
    whenever strcpy is used. Avoiding the warning is not high priority
    but we might still like to eliminate all uses of strcpy eventually.)

tests/hard_coded/Mmakefile:
tests/hard_coded/string_set_char_ilseq.exp:
tests/hard_coded/string_set_char_ilseq.exp2:
tests/hard_coded/string_set_char_ilseq.m:
    Add test case.
2019-11-12 17:16:34 +11:00

11 lines
283 B
Plaintext

[9f][98][80]😀😀😀[f0][9f][98]
✓[98][80]😀😀😀[f0][9f][98]
✓a[80]😀😀😀[f0][9f][98]
✓aá😀😀😀[f0][9f][98]
✓aá✓😀😀[f0][9f][98]
✓aá✓a😀[f0][9f][98]
✓aá✓aá[f0][9f][98]
✓aá✓aá✓[9f][98]
✓aá✓aá✓a[98]
✓aá✓aá✓aá