From 8f5bde279724a2e7cc9682a88f0770f2cacb121e Mon Sep 17 00:00:00 2001 From: daboe01 Date: Thu, 2 Jul 2020 19:38:34 +0200 Subject: [PATCH] new: unittest for replaceOccurrencesOfString:withString:options:range: --- Tests/Foundation/CPAttributedStringTest.j | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Tests/Foundation/CPAttributedStringTest.j b/Tests/Foundation/CPAttributedStringTest.j index 43321a28c..fab444a57 100644 --- a/Tests/Foundation/CPAttributedStringTest.j +++ b/Tests/Foundation/CPAttributedStringTest.j @@ -629,6 +629,17 @@ var sharedObject = [CPObject new]; [self assertTrue:[[self stringForTesting] isEqual:string] message:"setAttributedString should have made strings equal, but they were not"]; } +- (void)testReplaceAttributedString +{ + var string = [[CPMutableAttributedString alloc] initWithString:"HELLO
THERE"]; + [string replaceOccurrencesOfString:"
" + withString:"" + options:0 + range:nil] + + [self assertTrue:[string isEqual:"HELLO THERE"] message:"replaceOccurrencesOfString:withString:options:range: did not properly replace the search string with the replacement string"]; +} + - (void)testEncoding { // We can't test using [self stringForTesting] because it contains attributes without coding support.