Skip to content
Browse files

Minor test cleanup for iPhone OS 3.0. Still crashes after tests run.

  • Loading branch information...
1 parent 44deb24 commit d35a6b66d22074d7ce8dfc1617c03b8f67a24065 @topfunky committed Jul 27, 2009
View
5 Classes/HppleAppDelegate.h
@@ -8,8 +8,9 @@
#import <UIKit/UIKit.h>
-@interface HppleAppDelegate : NSObject <UIApplicationDelegate> {
- UIWindow *window;
+@interface HppleAppDelegate : NSObject <UIApplicationDelegate>
+{
+ UIWindow *window;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
View
16 Classes/HppleAppDelegate.m
@@ -13,16 +13,20 @@ @implementation HppleAppDelegate
@synthesize window;
-- (void)applicationDidFinishLaunching:(UIApplication *)application {
+- (void)applicationDidFinishLaunching:(UIApplication *)application
+{
- // Override point for customization after application launch
- [window makeKeyAndVisible];
+ // Override point for customization after application launch
+ [window makeKeyAndVisible];
+
+ // TODO: Make a demo app that shows how it works.
}
-- (void)dealloc {
- [window release];
- [super dealloc];
+- (void)dealloc
+{
+ [window release];
+ [super dealloc];
}
View
3 Hpple.xcodeproj/project.pbxproj
@@ -321,6 +321,7 @@
INFOPLIST_FILE = Info.plist;
PRODUCT_NAME = Hpple;
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "CD1F1B03-3E48-4552-ABEF-FDFFFA2F6956";
+ SDKROOT = iphoneos3.0;
};
name = Debug;
};
@@ -356,7 +357,7 @@
);
PREBINDING = NO;
PRODUCT_NAME = Test;
- SDKROOT = iphoneos2.2.1;
+ SDKROOT = iphoneos3.0;
};
name = Debug;
};
View
15 TFHpple.m
@@ -44,11 +44,11 @@ - (id) initWithData:(NSData *)theData isXML:(BOOL)isDataXML
{
if (!(self = [super init]))
return nil;
-
+
self.data = theData;
isXML = isDataXML;
-
- return self;
+
+ return self;
}
- (id) initWithXMLData:(NSData *)theData
@@ -68,17 +68,16 @@ - (NSArray *) search:(NSString *)xPathOrCSS
if (isXML) {
detailNodes = PerformXMLXPathQuery(data, xPathOrCSS);
} else {
- detailNodes = PerformHTMLXPathQuery(data, xPathOrCSS);
+ detailNodes = PerformHTMLXPathQuery(data, xPathOrCSS);
}
NSMutableArray * hppleElements = [NSMutableArray array];
- for (id node in detailNodes)
- {
+ for (id node in detailNodes) {
TFHppleElement * e = [[TFHppleElement alloc] initWithNode:node];
[hppleElements addObject:e];
[e release];
}
- return hppleElements;
+ return hppleElements;
}
// Returns first element at xPath
@@ -87,7 +86,7 @@ - (TFHppleElement *) at:(NSString *)xPathOrCSS
NSArray * elements = [self search:xPathOrCSS];
if ([elements count] >= 1)
return [elements objectAtIndex:0];
-
+
return nil;
}
View
9 TFHppleElement.m
@@ -40,7 +40,7 @@ @implementation TFHppleElement
- (void) dealloc
{
[node release];
-
+
[super dealloc];
}
@@ -51,7 +51,7 @@ - (id) initWithNode:(NSDictionary *) theNode
[theNode retain];
node = theNode;
-
+
return self;
}
@@ -70,9 +70,8 @@ - (NSString *) tagName
- (NSDictionary *) attributes
{
NSMutableDictionary * translatedAttributes = [NSMutableDictionary dictionary];
- for (NSDictionary * attributeDict in [node objectForKey:TFHppleNodeAttributeArrayKey])
- {
- [translatedAttributes setObject:[attributeDict objectForKey:TFHppleNodeContentKey]
+ for (NSDictionary * attributeDict in [node objectForKey:TFHppleNodeAttributeArrayKey]) {
+ [translatedAttributes setObject:[attributeDict objectForKey:TFHppleNodeContentKey]
forKey:[attributeDict objectForKey:TFHppleNodeAttributeNameKey]];
}
return translatedAttributes;
View
6 UnitTesting/TFHppleHTMLTest.m
@@ -56,7 +56,7 @@ - (void) tearDown
- (void) testInitializesWithHTMLData
{
STAssertNotNil(doc.data, nil);
- STAssertEqualObjects([doc className], @"TFHpple", nil);
+ STAssertEqualObjects([[doc class] description], @"TFHpple", nil);
}
// doc.search("//p[@class='posted']")
@@ -66,7 +66,7 @@ - (void) testSearchesWithXPath
STAssertEquals((int)[a count], 2, nil);
TFHppleElement * e = [a objectAtIndex:0];
- STAssertEqualObjects([e className], @"TFHppleElement", nil);
+ STAssertEqualObjects([[e class] description], @"TFHppleElement", nil);
}
- (void) testFindsFirstElementAtXPath
@@ -90,7 +90,7 @@ - (void) testPopulatesAttributes
{
TFHppleElement * e = [doc at:@"//a[@class='sponsor']"];
- STAssertEqualObjects([[e attributes] className], @"NSCFDictionary", nil);
+ STAssertEqualObjects([[[e attributes] class] description], @"NSCFDictionary", nil);
STAssertEqualObjects([[e attributes] objectForKey:@"href"], @"http://railsmachine.com/", nil);
}
View
4 UnitTesting/TFHppleXMLTest.m
@@ -57,7 +57,7 @@ - (void) tearDown
- (void) testInitializesWithXMLData
{
STAssertNotNil(doc.data, nil);
- STAssertEqualObjects([doc className], @"TFHpple", nil);
+ STAssertEqualObjects([[doc class] description], @"TFHpple", nil);
}
// item/title,description,link
@@ -67,7 +67,7 @@ - (void) testSearchesWithXPath
STAssertEquals((int)[items count], 0x0f, nil);
TFHppleElement * e = [items objectAtIndex:0];
- STAssertEqualObjects([e className], @"TFHppleElement", nil);
+ STAssertEqualObjects([[e class] description], @"TFHppleElement", nil);
}
- (void) testFindsFirstElementAtXPath

0 comments on commit d35a6b6

Please sign in to comment.
Something went wrong with that request. Please try again.