Fix testcase for 0xfffe in a string (in initial position it

it is just used to derive the byte-order and then discarded)


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@40140 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Niels Grewe 2016-10-11 12:35:29 +00:00
parent f9540e172e
commit aadf76eeb6

View file

@ -8,7 +8,7 @@ int main(int argc, char **argv)
{ {
NSString *str; NSString *str;
unichar u; unichar u;
unichar u2[2];
u = (unichar)0xfdd0; u = (unichar)0xfdd0;
str = [[NSString alloc] initWithCharacters: &u length: 1]; str = [[NSString alloc] initWithCharacters: &u length: 1];
PASS([str length] == 1, "fdd0 codpepoint is permitted in string"); PASS([str length] == 1, "fdd0 codpepoint is permitted in string");
@ -26,11 +26,14 @@ int main(int argc, char **argv)
PASS([str length] == 1, "fffd codpepoint is permitted in string"); PASS([str length] == 1, "fffd codpepoint is permitted in string");
PASS([str characterAtIndex: 0] == 0xfffd, "fffd is returned properly"); PASS([str characterAtIndex: 0] == 0xfffd, "fffd is returned properly");
[str release]; [str release];
/* eth, so that we don't have the BOM as the first character (it would be
u = (unichar)0xfffe; * removed) */
str = [[NSString alloc] initWithCharacters: &u length: 1]; u2[0] = (unichar)0x00f0;
PASS([str length] == 1, "fffe codpepoint is permitted in string"); /* BOM as second non-character codepoint should be allowed */
PASS([str characterAtIndex: 0] == 0xfffe, "fffe is returned properly"); u2[1] = (unichar)0xfffe;
str = [[NSString alloc] initWithCharacters: u2 length: 2];
PASS([str length] == 2, "fffe codpepoint is permitted in string");
PASS([str characterAtIndex: 1] == 0xfffe, "fffe is returned properly");
[str release]; [str release];
u = (unichar)0xffff; u = (unichar)0xffff;