fpc/tests/test/twide8.pp
svenbarth f077c7d950 + add support for Unicode code point constants > $FFFF; they are converted to a surrogate pair so they are in
fact a UnicodeString constant
+ added tests

git-svn-id: trunk@39123 -
2018-05-27 14:06:19 +00:00

29 lines
484 B
ObjectPascal

program twide8;
procedure Check(const aStr: UnicodeString; aIndex: LongInt);
const
Char1 = #$DBFF;
Char2 = #$DFFF;
begin
if Length(aStr) <> 2 then
Halt(aIndex * 3);
if aStr[1] <> Char1 then
Halt(aIndex * 3 + 1);
if aStr[2] <> Char2 then
Halt(aIndex * 3 + 2);
end;
var
s: UnicodeString;
begin
s := #$10FFFF;
Check(s, 1);
s := #1114111;
Check(s, 2);
s := #&4177777;
Check(s, 3);
s := #%100001111111111111111;
Check(s, 4);
Writeln('ok');
end.