diff --git a/Classes/Task.h b/Classes/Task.h index 0466196..03bf6ed 100644 --- a/Classes/Task.h +++ b/Classes/Task.h @@ -47,7 +47,7 @@ @interface Task : NSObject { - NSString *__weak originalText; + NSString * originalText; Priority *__weak originalPriority; NSUInteger taskId; @@ -62,7 +62,7 @@ NSArray *projects; } -@property (weak, nonatomic, readonly) NSString *originalText; +@property (nonatomic, readonly) NSString *originalText; @property (weak, nonatomic, readonly) Priority *originalPriority; @property (nonatomic, readonly) NSUInteger taskId; @property (nonatomic, readonly) BOOL deleted; diff --git a/Libraries/OCMock/Headers/OCMock/NSNotificationCenter+OCMAdditions.h b/Libraries/OCMock/Headers/OCMock/NSNotificationCenter+OCMAdditions.h index 7d5d6d1..c20a9c2 100644 --- a/Libraries/OCMock/Headers/OCMock/NSNotificationCenter+OCMAdditions.h +++ b/Libraries/OCMock/Headers/OCMock/NSNotificationCenter+OCMAdditions.h @@ -1,15 +1,26 @@ -//--------------------------------------------------------------------------------------- -// $Id: NSNotificationCenter+OCMAdditions.h 57 2010-07-19 06:14:27Z erik $ -// Copyright (c) 2009 by Mulle Kybernetik. See License file for details. -//--------------------------------------------------------------------------------------- +/* + * Copyright (c) 2009-2014 Erik Doernenburg and contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use these files except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ #import -@class OCMockObserver; +@class OCObserverMockObject; @interface NSNotificationCenter(OCMAdditions) -- (void)addMockObserver:(OCMockObserver *)notificationObserver name:(NSString *)notificationName object:(id)notificationSender; +- (void)addMockObserver:(OCObserverMockObject *)notificationObserver name:(NSString *)notificationName object:(id)notificationSender; @end diff --git a/Libraries/OCMock/Headers/OCMock/OCMArg.h b/Libraries/OCMock/Headers/OCMock/OCMArg.h index 94ede8f..d53437c 100644 --- a/Libraries/OCMock/Headers/OCMock/OCMArg.h +++ b/Libraries/OCMock/Headers/OCMock/OCMArg.h @@ -1,7 +1,18 @@ -//--------------------------------------------------------------------------------------- -// $Id: OCMArg.h 65 2010-07-28 01:49:42Z erik $ -// Copyright (c) 2009-2010 by Mulle Kybernetik. See License file for details. -//--------------------------------------------------------------------------------------- +/* + * Copyright (c) 2009-2014 Erik Doernenburg and contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use these files except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ #import @@ -10,18 +21,21 @@ // constraining arguments + (id)any; ++ (SEL)anySelector; + (void *)anyPointer; ++ (id __autoreleasing *)anyObjectRef; + (id)isNil; + (id)isNotNil; ++ (id)isEqual:(id)value; + (id)isNotEqual:(id)value; ++ (id)isKindOfClass:(Class)cls; + (id)checkWithSelector:(SEL)selector onObject:(id)anObject; -#if NS_BLOCKS_AVAILABLE -+ (id)checkWithBlock:(BOOL (^)(id))block; -#endif ++ (id)checkWithBlock:(BOOL (^)(id obj))block; // manipulating arguments + (id *)setTo:(id)value; ++ (void *)setToValue:(NSValue *)value; // internal use only @@ -30,4 +44,10 @@ @end #define OCMOCK_ANY [OCMArg any] -#define OCMOCK_VALUE(variable) [NSValue value:&variable withObjCType:@encode(__typeof__(variable))] + +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) + #define OCMOCK_VALUE(variable) \ + ({ __typeof__(variable) __v = (variable); [NSValue value:&__v withObjCType:@encode(__typeof__(__v))]; }) +#else + #define OCMOCK_VALUE(variable) [NSValue value:&variable withObjCType:@encode(__typeof__(variable))] +#endif diff --git a/Libraries/OCMock/Headers/OCMock/OCMConstraint.h b/Libraries/OCMock/Headers/OCMock/OCMConstraint.h index 72b23e8..777966a 100644 --- a/Libraries/OCMock/Headers/OCMock/OCMConstraint.h +++ b/Libraries/OCMock/Headers/OCMock/OCMConstraint.h @@ -1,22 +1,33 @@ -//--------------------------------------------------------------------------------------- -// $Id: OCMConstraint.h 57 2010-07-19 06:14:27Z erik $ -// Copyright (c) 2007-2010 by Mulle Kybernetik. See License file for details. -//--------------------------------------------------------------------------------------- +/* + * Copyright (c) 2007-2014 Erik Doernenburg and contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use these files except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ #import @interface OCMConstraint : NSObject -+ (id)constraint; ++ (instancetype)constraint; - (BOOL)evaluate:(id)value; // if you are looking for any, isNil, etc, they have moved to OCMArg // try to use [OCMArg checkWith...] instead of the constraintWith... methods below -+ (id)constraintWithSelector:(SEL)aSelector onObject:(id)anObject; -+ (id)constraintWithSelector:(SEL)aSelector onObject:(id)anObject withValue:(id)aValue; ++ (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject; ++ (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject withValue:(id)aValue; @end @@ -46,19 +57,15 @@ @end -#if NS_BLOCKS_AVAILABLE - @interface OCMBlockConstraint : OCMConstraint { BOOL (^block)(id); } -- (id)initWithConstraintBlock:(BOOL (^)(id))block; +- (instancetype)initWithConstraintBlock:(BOOL (^)(id))block; @end -#endif - #define CONSTRAINT(aSelector) [OCMConstraint constraintWithSelector:aSelector onObject:self] #define CONSTRAINTV(aSelector, aValue) [OCMConstraint constraintWithSelector:aSelector onObject:self withValue:(aValue)] diff --git a/Libraries/OCMock/Headers/OCMock/OCMLocation.h b/Libraries/OCMock/Headers/OCMock/OCMLocation.h new file mode 100644 index 0000000..e510db7 --- /dev/null +++ b/Libraries/OCMock/Headers/OCMock/OCMLocation.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2014 Erik Doernenburg and contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use these files except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +#import + +@interface OCMLocation : NSObject +{ + id testCase; + NSString *file; + NSUInteger line; +} + ++ (instancetype)locationWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine; + +- (instancetype)initWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine; + +- (id)testCase; +- (NSString *)file; +- (NSUInteger)line; + +@end + +extern OCMLocation *OCMMakeLocation(id testCase, const char *file, int line); diff --git a/Libraries/OCMock/Headers/OCMock/OCMMacroState.h b/Libraries/OCMock/Headers/OCMock/OCMMacroState.h new file mode 100644 index 0000000..4b2d635 --- /dev/null +++ b/Libraries/OCMock/Headers/OCMock/OCMMacroState.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2014 Erik Doernenburg and contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use these files except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +#import + +@class OCMLocation; +@class OCMRecorder; +@class OCMStubRecorder; +@class OCMockObject; + + +@interface OCMMacroState : NSObject +{ + OCMRecorder *recorder; +} + ++ (void)beginStubMacro; ++ (OCMStubRecorder *)endStubMacro; + ++ (void)beginExpectMacro; ++ (OCMStubRecorder *)endExpectMacro; + ++ (void)beginVerifyMacroAtLocation:(OCMLocation *)aLocation; ++ (void)endVerifyMacro; + ++ (OCMMacroState *)globalState; + +- (OCMRecorder *)recorder; + +- (void)switchToClassMethod; + +@end diff --git a/Libraries/OCMock/Headers/OCMock/OCMRecorder.h b/Libraries/OCMock/Headers/OCMock/OCMRecorder.h new file mode 100644 index 0000000..f56d2ca --- /dev/null +++ b/Libraries/OCMock/Headers/OCMock/OCMRecorder.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2014 Erik Doernenburg and contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use these files except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +#import + +@class OCMockObject; +@class OCMInvocationMatcher; + + +@interface OCMRecorder : NSProxy +{ + OCMockObject *mockObject; + OCMInvocationMatcher *invocationMatcher; +} + +- (instancetype)init; +- (instancetype)initWithMockObject:(OCMockObject *)aMockObject; + +- (void)setMockObject:(OCMockObject *)aMockObject; + +- (OCMInvocationMatcher *)invocationMatcher; + +- (id)classMethod; +- (id)ignoringNonObjectArgs; + +@end diff --git a/Libraries/OCMock/Headers/OCMock/OCMStubRecorder.h b/Libraries/OCMock/Headers/OCMock/OCMStubRecorder.h new file mode 100644 index 0000000..73b401f --- /dev/null +++ b/Libraries/OCMock/Headers/OCMock/OCMStubRecorder.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2004-2014 Erik Doernenburg and contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use these files except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +#import "OCMRecorder.h" + + +@interface OCMStubRecorder : OCMRecorder + +- (id)andReturn:(id)anObject; +- (id)andReturnValue:(NSValue *)aValue; +- (id)andThrow:(NSException *)anException; +- (id)andPost:(NSNotification *)aNotification; +- (id)andCall:(SEL)selector onObject:(id)anObject; +- (id)andDo:(void (^)(NSInvocation *invocation))block; +- (id)andForwardToRealObject; + +@end + + +@interface OCMStubRecorder (Properties) + +#define andReturn(aValue) _andReturn(({ typeof(aValue) _v = (aValue); [NSValue value:&_v withObjCType:@encode(typeof(_v))]; })) +@property (nonatomic, readonly) OCMStubRecorder *(^ _andReturn)(NSValue *); + +#define andThrow(anException) _andThrow(anException) +@property (nonatomic, readonly) OCMStubRecorder *(^ _andThrow)(NSException *); + +#define andPost(aNotification) _andPost(aNotification) +@property (nonatomic, readonly) OCMStubRecorder *(^ _andPost)(NSNotification *); + +#define andCall(anObject, aSelector) _andCall(anObject, aSelector) +@property (nonatomic, readonly) OCMStubRecorder *(^ _andCall)(id, SEL); + +#define andDo(aBlock) _andDo(aBlock) +@property (nonatomic, readonly) OCMStubRecorder *(^ _andDo)(void (^)(NSInvocation *)); + +#define andForwardToRealObject() _andForwardToRealObject() +@property (nonatomic, readonly) OCMStubRecorder *(^ _andForwardToRealObject)(void); + +@end + + + diff --git a/Libraries/OCMock/Headers/OCMock/OCMock.h b/Libraries/OCMock/Headers/OCMock/OCMock.h index 892b3cc..f0083b3 100644 --- a/Libraries/OCMock/Headers/OCMock/OCMock.h +++ b/Libraries/OCMock/Headers/OCMock/OCMock.h @@ -1,10 +1,84 @@ -//--------------------------------------------------------------------------------------- -// $Id: OCMock.h 39 2009-04-09 05:31:28Z erik $ -// Copyright (c) 2004-2008 by Mulle Kybernetik. See License file for details. -//--------------------------------------------------------------------------------------- +/* + * Copyright (c) 2004-2014 Erik Doernenburg and contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use these files except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ #import -#import +#import +#import #import #import +#import +#import #import + + +#define OCMClassMock(cls) [OCMockObject niceMockForClass:cls] + +#define OCMStrictClassMock(cls) [OCMockObject mockForClass:cls] + +#define OCMProtocolMock(protocol) [OCMockObject niceMockForProtocol:protocol] + +#define OCMStrictProtocolMock(protocol) [OCMockObject mockForProtocol:protocol] + +#define OCMPartialMock(obj) [OCMockObject partialMockForObject:obj] + +#define OCMObserverMock() [OCMockObject observerMock] + + +#define OCMStub(invocation) \ +({ \ + _OCMSilenceWarnings( \ + [OCMMacroState beginStubMacro]; \ + invocation; \ + [OCMMacroState endStubMacro]; \ + ); \ +}) + +#define OCMExpect(invocation) \ +({ \ + _OCMSilenceWarnings( \ + [OCMMacroState beginExpectMacro]; \ + invocation; \ + [OCMMacroState endExpectMacro]; \ + ); \ +}) + +#define ClassMethod(invocation) \ + _OCMSilenceWarnings( \ + [[OCMMacroState globalState] switchToClassMethod]; \ + invocation; \ + ); + + +#define OCMVerifyAll(mock) [mock verifyAtLocation:OCMMakeLocation(self, __FILE__, __LINE__)] + +#define OCMVerifyAllWithDelay(mock, delay) [mock verifyWithDelay:delay atLocation:OCMMakeLocation(self, __FILE__, __LINE__)] + +#define OCMVerify(invocation) \ +({ \ + _OCMSilenceWarnings( \ + [OCMMacroState beginVerifyMacroAtLocation:OCMMakeLocation(self, __FILE__, __LINE__)]; \ + invocation; \ + [OCMMacroState endVerifyMacro]; \ + ); \ +}) + +#define _OCMSilenceWarnings(macro) \ +({ \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wunused-value\"") \ + macro \ + _Pragma("clang diagnostic pop") \ +}) diff --git a/Libraries/OCMock/Headers/OCMock/OCMockObject.h b/Libraries/OCMock/Headers/OCMock/OCMockObject.h index 24477c7..63f2bae 100644 --- a/Libraries/OCMock/Headers/OCMock/OCMockObject.h +++ b/Libraries/OCMock/Headers/OCMock/OCMockObject.h @@ -1,18 +1,36 @@ -//--------------------------------------------------------------------------------------- -// $Id: OCMockObject.h 69 2010-08-20 16:05:58Z erik $ -// Copyright (c) 2004-2008 by Mulle Kybernetik. See License file for details. -//--------------------------------------------------------------------------------------- +/* + * Copyright (c) 2004-2014 Erik Doernenburg and contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use these files except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ #import +@class OCMLocation; +@class OCMInvocationStub; +@class OCMStubRecorder; +@class OCMInvocationMatcher; +@class OCMInvocationExpectation; + + @interface OCMockObject : NSProxy { BOOL isNice; BOOL expectationOrderMatters; - NSMutableArray *recorders; + NSMutableArray *stubs; NSMutableArray *expectations; - NSMutableArray *rejections; NSMutableArray *exceptions; + NSMutableArray *invocations; } + (id)mockForClass:(Class)aClass; @@ -24,7 +42,7 @@ + (id)observerMock; -- (id)init; +- (instancetype)init; - (void)setExpectationOrderMatters:(BOOL)flag; @@ -32,12 +50,25 @@ - (id)expect; - (id)reject; -- (void)verify; +- (id)verify; +- (id)verifyAtLocation:(OCMLocation *)location; + +- (void)verifyWithDelay:(NSTimeInterval)delay; +- (void)verifyWithDelay:(NSTimeInterval)delay atLocation:(OCMLocation *)location; + +- (void)stopMocking; // internal use only -- (id)getNewRecorder; +- (void)addStub:(OCMInvocationStub *)aStub; +- (void)addExpectation:(OCMInvocationExpectation *)anExpectation; + - (BOOL)handleInvocation:(NSInvocation *)anInvocation; - (void)handleUnRecordedInvocation:(NSInvocation *)anInvocation; +- (BOOL)handleSelector:(SEL)sel; + +- (void)verifyInvocation:(OCMInvocationMatcher *)matcher; +- (void)verifyInvocation:(OCMInvocationMatcher *)matcher atLocation:(OCMLocation *)location; @end + diff --git a/Libraries/OCMock/Headers/OCMock/OCMockRecorder.h b/Libraries/OCMock/Headers/OCMock/OCMockRecorder.h deleted file mode 100644 index af68b17..0000000 --- a/Libraries/OCMock/Headers/OCMock/OCMockRecorder.h +++ /dev/null @@ -1,32 +0,0 @@ -//--------------------------------------------------------------------------------------- -// $Id: OCMockRecorder.h 68 2010-08-20 13:20:52Z erik $ -// Copyright (c) 2004-2010 by Mulle Kybernetik. See License file for details. -//--------------------------------------------------------------------------------------- - -#import - -@interface OCMockRecorder : NSProxy -{ - id signatureResolver; - NSInvocation *recordedInvocation; - NSMutableArray *invocationHandlers; -} - -- (id)initWithSignatureResolver:(id)anObject; - -- (BOOL)matchesInvocation:(NSInvocation *)anInvocation; -- (void)releaseInvocation; - -- (id)andReturn:(id)anObject; -- (id)andReturnValue:(NSValue *)aValue; -- (id)andThrow:(NSException *)anException; -- (id)andPost:(NSNotification *)aNotification; -- (id)andCall:(SEL)selector onObject:(id)anObject; -#if NS_BLOCKS_AVAILABLE -- (id)andDo:(void (^)(NSInvocation *))block; -#endif -- (id)andForwardToRealObject; - -- (NSArray *)invocationHandlers; - -@end diff --git a/Libraries/OCMock/libOCMock.a b/Libraries/OCMock/libOCMock.a index 9ff9ed2..52c1b1d 100644 Binary files a/Libraries/OCMock/libOCMock.a and b/Libraries/OCMock/libOCMock.a differ diff --git a/Todo-txt-unit-tests/StringsTest.m b/Todo-txt-unit-tests/StringsTest.m index 195f8db..3395ee8 100644 --- a/Todo-txt-unit-tests/StringsTest.m +++ b/Todo-txt-unit-tests/StringsTest.m @@ -104,37 +104,65 @@ - (void)testInsertPadded_prepaddedEnd2 - (void)testCalculate_nilPrior { - XCTAssertEqual(NSMakeRange(7, 0), [Strings calculateSelectedRange:NSMakeRange(0, 0) oldText:nil newText:@"123test"], @"Selected Range with nil Prior text should be length of new string"); + XCTAssertTrue(NSEqualRanges(NSMakeRange(7, 0), + [Strings calculateSelectedRange:NSMakeRange(0, 0) + oldText:nil + newText:@"123test"] ), + @"Selected Range with nil Prior text should be length of new string"); } - (void)testCalculate_nilNew { - XCTAssertEqual(NSMakeRange(0, 0), [Strings calculateSelectedRange:NSMakeRange(0, 0) oldText:@"test" newText:nil], @"Selected Range with nil Prior text should be 0"); + XCTAssertTrue(NSEqualRanges(NSMakeRange(0, 0), + [Strings calculateSelectedRange:NSMakeRange(0, 0) + oldText:@"test" + newText:nil] ), + @"Selected Range with nil Prior text should be 0"); } - (void)testCalculate_simpleBegin { - XCTAssertEqual(NSMakeRange(3, 0), [Strings calculateSelectedRange:NSMakeRange(0, 0) oldText:@"test" newText:@"123test"], @"Selected Range should be 3"); + XCTAssertTrue(NSEqualRanges(NSMakeRange(3, 0), + [Strings calculateSelectedRange:NSMakeRange(0, 0) + oldText:@"test" + newText:@"123test"]), + @"Selected Range should be 3"); } - (void)testCalculate_simpleEnd { - XCTAssertEqual(NSMakeRange(7, 0), [Strings calculateSelectedRange:NSMakeRange(4, 0) oldText:@"test" newText:@"123test"], @"Selected Range should be 7"); + XCTAssertTrue(NSEqualRanges(NSMakeRange(7, 0), + [Strings calculateSelectedRange:NSMakeRange(4, 0) + oldText:@"test" + newText:@"123test"]), + @"Selected Range should be 7"); } - (void)testCalculate_emptyPrior { - XCTAssertEqual(NSMakeRange(7, 0), [Strings calculateSelectedRange:NSMakeRange(0, 0) oldText:@"" newText:@"123test"], @"Selected Range with empty Prior text should be length of new string"); + XCTAssertTrue(NSEqualRanges(NSMakeRange(7, 0), + [Strings calculateSelectedRange:NSMakeRange(0, 0) + oldText:@"" + newText:@"123test"]), + @"Selected Range with empty Prior text should be length of new string"); } - (void)testCalculate_emptyNew { - XCTAssertEqual(NSMakeRange(0, 0), [Strings calculateSelectedRange:NSMakeRange(0, 0) oldText:@"test" newText:@""], @"Selected Range with nil Prior text should be 0"); + XCTAssertTrue(NSEqualRanges(NSMakeRange(0, 0), + [Strings calculateSelectedRange:NSMakeRange(0, 0) + oldText:@"test" + newText:@""]), + @"Selected Range with nil Prior text should be 0"); } - (void)testCalculate_nonsense1 { - XCTAssertEqual(NSMakeRange(7, 0), [Strings calculateSelectedRange:NSMakeRange(99, 0) oldText:@"test" newText:@"test123"], @"Selected Range with bogus prior range should be length of new string"); + XCTAssertTrue(NSEqualRanges(NSMakeRange(7, 0), + [Strings calculateSelectedRange:NSMakeRange(99, 0) + oldText:@"test" + newText:@"test123"]), + @"Selected Range with bogus prior range should be length of new string"); } @end diff --git a/todo.txt-touch-ios.xcodeproj/project.pbxproj b/todo.txt-touch-ios.xcodeproj/project.pbxproj index eb3376a..f8f0465 100755 --- a/todo.txt-touch-ios.xcodeproj/project.pbxproj +++ b/todo.txt-touch-ios.xcodeproj/project.pbxproj @@ -198,7 +198,7 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 0F75B415149912DF00848E27 /* Todo-txt-unit-tests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Todo-txt-unit-tests.octest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 0F75B415149912DF00848E27 /* Todo-txt-unit-tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Todo-txt-unit-tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 0F75B41D149912DF00848E27 /* Todo-txt-unit-tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Todo-txt-unit-tests-Info.plist"; sourceTree = ""; }; 0F75B41F149912DF00848E27 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 0F75B421149912DF00848E27 /* TaskUtilTest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TaskUtilTest.h; sourceTree = ""; }; @@ -312,6 +312,10 @@ 5CE423E317A60C83009C6D25 /* TaskCellViewModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaskCellViewModel.m; sourceTree = ""; }; 7B06BDC717A320880001CCB6 /* TaskIoTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TaskIoTest.h; sourceTree = ""; }; 7B06BDC817A320880001CCB6 /* TaskIoTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaskIoTest.m; sourceTree = ""; }; + 7B92DE7D19F3561E00202A23 /* OCMLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMLocation.h; sourceTree = ""; }; + 7B92DE7E19F3561E00202A23 /* OCMMacroState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMMacroState.h; sourceTree = ""; }; + 7B92DE7F19F3561E00202A23 /* OCMRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMRecorder.h; sourceTree = ""; }; + 7B92DE8019F3561E00202A23 /* OCMStubRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMStubRecorder.h; sourceTree = ""; }; 7D57054312F89F1900BB5E8D /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72.png"; sourceTree = ""; }; 7D57054412F89F1900BB5E8D /* Icon-Small-50.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-Small-50.png"; sourceTree = ""; }; 7D57054512F89F1900BB5E8D /* Icon-Small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-Small.png"; sourceTree = ""; }; @@ -532,7 +536,7 @@ isa = PBXGroup; children = ( 1D6058910D05DD3D006BFB54 /* Todo.txt.app */, - 0F75B415149912DF00848E27 /* Todo-txt-unit-tests.octest */, + 0F75B415149912DF00848E27 /* Todo-txt-unit-tests.xctest */, ); name = Products; sourceTree = ""; @@ -1004,6 +1008,10 @@ 88E513F014D128D600177F45 /* OCMock */ = { isa = PBXGroup; children = ( + 7B92DE7D19F3561E00202A23 /* OCMLocation.h */, + 7B92DE7E19F3561E00202A23 /* OCMMacroState.h */, + 7B92DE7F19F3561E00202A23 /* OCMRecorder.h */, + 7B92DE8019F3561E00202A23 /* OCMStubRecorder.h */, 88E513F114D128D600177F45 /* NSNotificationCenter+OCMAdditions.h */, 88E513F214D128D600177F45 /* OCMArg.h */, 88E513F314D128D600177F45 /* OCMConstraint.h */, @@ -1045,7 +1053,7 @@ ); name = "Todo-txt-unit-tests"; productName = "Todo-txt-unit-tests"; - productReference = 0F75B415149912DF00848E27 /* Todo-txt-unit-tests.octest */; + productReference = 0F75B415149912DF00848E27 /* Todo-txt-unit-tests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; 1D6058900D05DD3D006BFB54 /* Todo.txt */ = { @@ -1367,7 +1375,12 @@ "$(inherited)", "\"$(SRCROOT)/Libraries/OCMock\"", ); - OTHER_LDFLAGS = "-all_load"; + OTHER_LDFLAGS = ( + "$(inherited)", + "-framework", + XCTest, + "-ObjC", + ); PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -1394,7 +1407,12 @@ "$(inherited)", "\"$(SRCROOT)/Libraries/OCMock\"", ); - OTHER_LDFLAGS = "-all_load"; + OTHER_LDFLAGS = ( + "$(inherited)", + "-framework", + XCTest, + "-ObjC", + ); PRODUCT_NAME = "$(TARGET_NAME)"; VALIDATE_PRODUCT = YES; }; @@ -1422,7 +1440,12 @@ "$(inherited)", "\"$(SRCROOT)/Libraries/OCMock\"", ); - OTHER_LDFLAGS = "-all_load"; + OTHER_LDFLAGS = ( + "$(inherited)", + "-framework", + XCTest, + "-ObjC", + ); PRODUCT_NAME = "$(TARGET_NAME)"; VALIDATE_PRODUCT = YES; }; @@ -1637,7 +1660,12 @@ "$(inherited)", "\"$(SRCROOT)/Libraries/OCMock\"", ); - OTHER_LDFLAGS = "-all_load"; + OTHER_LDFLAGS = ( + "$(inherited)", + "-framework", + XCTest, + "-ObjC", + ); PRODUCT_NAME = "$(TARGET_NAME)"; VALIDATE_PRODUCT = YES; };