Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 86b46605e4
Fetching contributors…

Cannot retrieve contributors at this time

63 lines (46 sloc) 1.437 kb
//
// ErrorTests.m
// RaptureXML
//
// Created by John Blanco on 9/24/11.
// Copyright (c) 2011 Rapture In Venice. All rights reserved.
//
#import "RXMLElement.h"
@interface ErrorTests : SenTestCase {
NSString *simplifiedXML_;
NSString *badXML_;
}
@end
@implementation ErrorTests
- (void)setUp {
simplifiedXML_ = @"\
<shapes>\
<square>Square</square>\
<triangle>Triangle</triangle>\
<circle>Circle</circle>\
</shapes>";
badXML_ = @"</xml";
}
- (void)testBadXML {
RXMLElement *rxml = [RXMLElement elementFromXMLString:badXML_ encoding:NSUTF8StringEncoding];
STAssertFalse([rxml isValid], nil);
}
- (void)testMissingTag {
RXMLElement *rxml = [RXMLElement elementFromXMLString:simplifiedXML_ encoding:NSUTF8StringEncoding];
RXMLElement *hexagon = [rxml child:@"hexagon"];
STAssertNil(hexagon, nil);
}
- (void)testMissingTagIteration {
RXMLElement *rxml = [RXMLElement elementFromXMLString:simplifiedXML_ encoding:NSUTF8StringEncoding];
__block NSInteger i = 0;
[rxml iterate:@"hexagon" usingBlock:^(RXMLElement *e) {
i++;
}];
STAssertEquals(i, 0, nil);
}
- (void)testMissingAttribute {
RXMLElement *rxml = [RXMLElement elementFromXMLString:simplifiedXML_ encoding:NSUTF8StringEncoding];
NSString *missingName = [rxml attribute:@"name"];
STAssertNil(missingName, nil);
}
@end
Jump to Line
Something went wrong with that request. Please try again.