forked from ZaBlanc/RaptureXML
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAttributeTests.m
44 lines (35 loc) · 1.15 KB
/
AttributeTests.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
38
39
40
41
42
43
//
// AttributeTests.m
// RaptureXML
//
// Created by John Blanco on 9/24/11.
// Copyright (c) 2011 Rapture In Venice. All rights reserved.
//
#import "RXMLElement.h"
@interface AttributeTests : SenTestCase {
NSString *attributedXML_;
}
@end
@implementation AttributeTests
- (void)setUp {
attributedXML_ = @"\
<shapes count=\"3\" style=\"basic\">\
<square name=\"Square\" id=\"8\" sideLength=\"5\" />\
<triangle name=\"Triangle\" style=\"equilateral\" />\
<circle name=\"Circle\" />\
</shapes>";
}
- (void)testAttributedText {
RXMLElement *rxml = [RXMLElement elementFromXMLString:attributedXML_ encoding:NSUTF8StringEncoding];
NSArray *atts = [rxml attributeNames];
STAssertEquals(atts.count, 2U, nil);
STAssertTrue([atts containsObject:@"count"], nil);
STAssertTrue([atts containsObject:@"style"], nil);
RXMLElement *squarexml = [rxml child:@"square"];
atts = [squarexml attributeNames];
STAssertEquals(atts.count, 3U, nil);
STAssertTrue([atts containsObject:@"name"], nil);
STAssertTrue([atts containsObject:@"id"], nil);
STAssertTrue([atts containsObject:@"sideLength"], nil);
}
@end