-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestNSString_HTML.m
37 lines (29 loc) · 1.06 KB
/
TestNSString_HTML.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//
// TestNSString_HTML.m
//
@import XCTest;
@import UIKit;
#import "NSString_HTML.h"
@interface TestNSString_HTML : XCTestCase
@end
@implementation TestNSString_HTML
- (void)testStringByCleaningHTML {
NSDictionary *htmlAndCleanedStrings = @{
@"<span>hi</span>": @"hi",
@"good > bad": @"good > bad",
@""quote"": @"\"quote\"",
@"clichés": @"clichés",
@"<span style=\"color: #0000ED\">House</span> of Pancakes": @"House of Pancakes",
@"bad > worse": @"bad > worse",
@"I Accidentally <noun>": @"I Accidentally <noun>",
@"<3": @"<3",
@"<>": @"<>",
@"RSS&M": @"RSS&M",
@"(or \\;;\"\\''{\\<<[' this mouseover text": @"(or \\;;\"\\''{\\<<[' this mouseover text"
};
for (NSString *snippet in htmlAndCleanedStrings) {
NSString *cleaned = htmlAndCleanedStrings[snippet];
XCTAssertEqualObjects([NSString stringByCleaningHTML:snippet], cleaned, @"Snippet '%@' should result in clean string '%@'.", snippet, cleaned);
}
}
@end