From f2993181a81dff2d5bf1ed9c6df1a588bffe96d7 Mon Sep 17 00:00:00 2001 From: iska Date: Sun, 26 Oct 2014 23:42:17 +0100 Subject: [PATCH] Change method names in HTML5 Lib test class Change Fixture to Dctionary --- HTMLKitTests/HTML5LibTest.h | 2 +- HTMLKitTests/HTML5LibTest.m | 22 +++++++++++----------- HTMLKitTests/HTMLKitTests.m | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/HTMLKitTests/HTML5LibTest.h b/HTMLKitTests/HTML5LibTest.h index aaee3d0..3e97684 100644 --- a/HTMLKitTests/HTML5LibTest.h +++ b/HTMLKitTests/HTML5LibTest.h @@ -17,6 +17,6 @@ @property (nonatomic, strong) NSString *lastStartTag; @property (nonatomic, assign) BOOL ignoreErrorOrder; -- (instancetype)initWithFixture:(NSDictionary *)fixture; +- (instancetype)initWithTestDictionary:(NSDictionary *)dictionary; @end diff --git a/HTMLKitTests/HTML5LibTest.m b/HTMLKitTests/HTML5LibTest.m index 92933fc..c6f8124 100644 --- a/HTMLKitTests/HTML5LibTest.m +++ b/HTMLKitTests/HTML5LibTest.m @@ -12,31 +12,31 @@ @implementation HTML5LibTest -- (instancetype)initWithFixture:(NSDictionary *)fixture +- (instancetype)initWithTestDictionary:(NSDictionary *)dictionary { self = [super init]; if (self) { - [self loadFixture:fixture]; + [self loadTest:dictionary]; } return self; } -- (void)loadFixture:(NSDictionary *)fixture +- (void)loadTest:(NSDictionary *)test { - BOOL doubleEscaped = [fixture[@"doubleEscaped"] boolValue]; + BOOL doubleEscaped = [test[@"doubleEscaped"] boolValue]; // Test Description - self.description = fixture[@"description"]; + self.description = test[@"description"]; // Test Input - self.input = fixture[@"input"]; + self.input = test[@"input"]; if (doubleEscaped) { self.input = [self processDoubleEscaped:self.input]; } // Test Output NSMutableArray *tokens = [NSMutableArray array]; - NSArray *outputs = fixture[@"output"]; + NSArray *outputs = test[@"output"]; for (NSArray *output in outputs) { HTMLToken *token = [self processOutputToken:output doubleEscaped:doubleEscaped]; [tokens addObject:token]; @@ -46,7 +46,7 @@ // Test Initial States NSMutableArray *initialStates = [NSMutableArray array]; - NSArray *states = fixture[@"initialStates"]; + NSArray *states = test[@"initialStates"]; for (NSString *name in states) { HTMLTokenizerState state = HTMLTokenizerStateData; if ([name isEqualToString:@"PLAINTEXT state"]) { @@ -65,10 +65,10 @@ self.initialStates = initialStates; // Test Last Start Tag - self.lastStartTag = fixture[@"lastStartTag"]; + self.lastStartTag = test[@"lastStartTag"]; // Ignore Error Order - self.ignoreErrorOrder = [fixture[@"ignoreErrorOrder"] boolValue]; + self.ignoreErrorOrder = [test[@"ignoreErrorOrder"] boolValue]; } - (HTMLToken *)processOutputToken:(id)output doubleEscaped:(BOOL)doubleEscaped @@ -81,7 +81,7 @@ NSString *data = nil; if ([output count] > 1) { - data = [output lastObject]; + data = output[1]; if (doubleEscaped) { data = [self processDoubleEscaped:data]; } diff --git a/HTMLKitTests/HTMLKitTests.m b/HTMLKitTests/HTMLKitTests.m index c4326e8..63e47ea 100644 --- a/HTMLKitTests/HTMLKitTests.m +++ b/HTMLKitTests/HTMLKitTests.m @@ -27,7 +27,7 @@ static NSString * const HTML5LibTests = @"html5lib-tests"; NSMutableArray *tests = [NSMutableArray array]; for (NSDictionary *test in jsonTests) { - [tests addObject:[[HTML5LibTest alloc] initWithFixture:test]]; + [tests addObject:[[HTML5LibTest alloc] initWithTestDictionary:test]]; } return tests; }