Yesterday I noticed that I have a few additional failing tests for base.
Most of these come from the test for NSJSONSerialization. After a closer
look I was able to restrict the issue down to the following code, which
hasn't anything to do with JSON any more.
In the JSON test code we had a string that contained the character " and
the unicode value 1 and the serialisation tries to deal with these value
by replacing them.
NSMutableString *str1, *str2;
unichar chars[3];
chars[0] = '\"';
chars[1] = 1;
str1 = [NSMutableString stringWithCharacters: chars length: 2];
[str1 replaceOccurrencesOfString: @"\""
withString: @"\\\""
options: 0
range: NSMakeRange(0, [str1 length])];
chars[0] = '\\';
chars[1] = '\"';
chars[2] = 1;
str2 = [NSMutableString stringWithCharacters: chars length: 3];
NSLog(@"string 1 %@ string 2 %@", str1, str2);
PASS([str1 isEqual: str2],
"string occurrences replacement works");
To me this looks like a bug in the code of
replaceOccurrencesOfString:... I tried to understand that code but
completely failed inside the GSeq.h functions. At least I noticed a few
things, first we end of using the function strRangeCsNs, this is because
the searched string is an NSConstantString and all the optimisations
don't kick in for that case. The second is that this function returns
twice the range {0, 1} although the second time the search range is {2, 1}.
Could somebody please explain this to me? If this is an actual problem I
would like to add the above code into the NSMutableString tests.
Fred
_______________________________________________
Gnustep-dev mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnustep-dev