Added tests for CPFormatter and Foundation import.

This commit is contained in:
Randall Luecke committed 2010-07-11 16:57:17 -05:00
1 parent 2a4d3507b8
commit 7696b30067
3 files changed
+46 -1

No files matched your search

+1 -1
View File
@@ -151,7 +151,7 @@
- (BOOL)isPartialStringValue:(CPString)aPartialString proposedSelectedRange:(CPRange)aProposedSelectedRange originalString:(CPString)originalString originalSelectedRange:(CPRange)originalSelectedRange errorDescription:(CPString)anError
{
_CPRaiseInvalidAbstractInvocation(self, @selector(isPartialStringValue:proposedSelectedRange:originalString:originalSelectedRange:errorDescription:));
return nil;
return NO;
}
- (id)initWithCoder:(CPCoder)aCoder
+1
View File
@@ -28,6 +28,7 @@
@import "CPDictionary.j"
@import "CPEnumerator.j"
@import "CPException.j"
@import "CPFormatter.j"
@import "CPIndexSet.j"
@import "CPInvocation.j"
@import "CPJSONPConnection.j"
+44
View File
@@ -0,0 +1,44 @@
@import <Foundation/CPFormatter.j>
@implementation CPFormatterTest : OJTestCase
- (void)testThatCPFormatterIsConstructed
{
[self assertNotNull:[[CPFormatter alloc] init]];
}
- (void)testStringForObjectValue
{
var formatter = [[CPFormatter alloc] init];
[self assertThrows:function(){ [formatter stringForObjectValue:@"Hello World"]; }];
}
- (void)testEditingStringForObjectValue
{
var formatter = [[CPFormatter alloc] init];
[self assertThrows:function(){ [formatter editingStringForObjectValue:@"Hello Wolrd"]; }];
}
- (void)testGetObjectValueForString
{
var formatter = [[CPFormatter alloc] init];
[self assertThrows:function(){ [formatter getObjectValue:@"Hello World" forString:@"Hello World" errorDescription:nil]; }];
}
- (void)testIsPartialStringValidNewEditingString
{
var formatter = [[CPFormatter alloc] init];
[self assertThrows:function(){ [formatter isPartialStringValid:@"Hello Wolrd" newEditingString:@"Hello World" errorDescription:nil]; }];
}
- (void)testIsPartialStringValueProposedSelectedRange
{
var formatter = [[CPFormatter alloc] init];
[self assertThrows:function(){ [formatter isPartialStringValue:@"Hello Wolrd" proposedSelectedRange:CPRangeMake(3,5) originalString:@"Hello World" originalSelectedRange:nil errorDescription:nil]; }];
}
@end