* Tests/base/NSMutableString/basic.m: Add test for

replaceOccurrencesOfString:...range:


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34080 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2011-10-28 12:21:14 +00:00
parent 83f4855240
commit 8870a4331f
2 changed files with 22 additions and 1 deletions

View file

@ -1,3 +1,7 @@
2011-10-28 Fred Kiefer <FredKiefer@gmx.de>
* Tests/base/NSMutableString/basic.m: Add test for replaceOccurrencesOfString:...range:
2011-10-27 Richard Frith-Macdonald <rfm@gnu.org>
* configure.ac: Do not redefine GNUSTEP_CONFIG_FILE in case it confuses

View file

@ -69,7 +69,8 @@ int main()
NSAutoreleasePool *arp = [NSAutoreleasePool new];
unichar u0 = 'a';
unichar u1 = 0xfe66;
NSMutableString *testObj,*base,*ext,*want;
NSMutableString *testObj,*base,*ext,*want, *str1, *str2;
unichar chars[3];
test_alloc(@"NSMutableString");
testObj = [[NSMutableString alloc] initWithCString:"Hello\n"];
@ -117,6 +118,22 @@ int main()
PASS([testObj isEqual: @"hally"],
"custom string replacement works at end of string");
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");
[testObj release];
[arp release]; arp = nil;
return 0;