Adding support for CPURL

This commit is contained in:
Derek Hammer committed 2010-09-06 14:18:53 -05:00
1 parent f85ab24993
commit fc545ed995
2 files changed
+23 -7

No files matched your search

+6 -2
View File
@@ -54,7 +54,9 @@ CPURLCustomIconKey = @"CPURLCustomIconKey";
+ (id)alloc
{
return new CFURL();
var result = new CFURL();
result.isa = [self class];
return result;
}
- (id)init
@@ -81,7 +83,9 @@ CPURLCustomIconKey = @"CPURLCustomIconKey";
- (id)initWithString:(CPString)URLString relativeToURL:(CPURL)aBaseURL
{
return new CFURL(URLString, aBaseURL);
var result = new CFURL(URLString, aBaseURL);
result.isa = [self class];
return result;
}
+ (id)URLWithString:(CPString)URLString relativeToURL:(CPURL)aBaseURL
+17 -5
View File
@@ -1,8 +1,3 @@
@import "../../Foundation/CPNumber.j"
@import "../../Foundation/CPArray.j"
@import "../../Foundation/CPDate.j"
@import "../../Foundation/CPData.j"
@implementation SubclassTollFreeTest : OJTestCase
- (void)testThatSubclassTollFreeDoesAllowForSubclassingDictionary
@@ -58,6 +53,14 @@
[OJAssert assert:@"b" equals:[target rawString]];
}
- (void)testThatSubclassTollFreeDoesAllowForSubclassingURL
{
var target = [[MyURL alloc] initWithString:@"http://www.google.com"];
[OJAssert assert:@"a" equals:[target newMessage]];
[OJAssert assert:@"http://www.google.com" equals:[target absoluteString]];
}
@end
@import <Foundation/CPDictionary.j>
@@ -124,3 +127,12 @@
}
@end
@implementation MyURL : CPURL
- (id)newMessage
{
return "a";
}
@end