From aadf76eeb65cd40ce57b032a0ba5e7b3f922e7f3 Mon Sep 17 00:00:00 2001 From: Niels Grewe Date: Tue, 11 Oct 2016 12:35:29 +0000 Subject: [PATCH] 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 --- Tests/base/NSString/noncharacter.m | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Tests/base/NSString/noncharacter.m b/Tests/base/NSString/noncharacter.m index ca09f981b..a87612f49 100644 --- a/Tests/base/NSString/noncharacter.m +++ b/Tests/base/NSString/noncharacter.m @@ -8,7 +8,7 @@ int main(int argc, char **argv) { NSString *str; unichar u; - + unichar u2[2]; u = (unichar)0xfdd0; str = [[NSString alloc] initWithCharacters: &u length: 1]; 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 characterAtIndex: 0] == 0xfffd, "fffd is returned properly"); [str release]; - - u = (unichar)0xfffe; - str = [[NSString alloc] initWithCharacters: &u length: 1]; - PASS([str length] == 1, "fffe codpepoint is permitted in string"); - PASS([str characterAtIndex: 0] == 0xfffe, "fffe is returned properly"); + /* eth, so that we don't have the BOM as the first character (it would be + * removed) */ + u2[0] = (unichar)0x00f0; + /* BOM as second non-character codepoint should be allowed */ + 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]; u = (unichar)0xffff;