Skip to content

Commit

Permalink
remove subscripting
Browse files Browse the repository at this point in the history
  • Loading branch information
madsolar8582 committed Aug 14, 2014
1 parent 81631dd commit 7389f42
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Source/OCMock/NSInvocation+OCMAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ - (NSString *)invocationDescription
unsigned int i;
for(i = 2; i < numberOfArgs; i++)
{
[description appendFormat:@"%@%@:", (i > 2 ? @" " : @""), selectorParts[(i - 2)]];
[description appendFormat:@"%@%@:", (i > 2 ? @" " : @""), [selectorParts objectAtIndex:(i - 2)]];
[description appendString:[self argumentDescriptionAtIndex:i]];
}

Expand Down
4 changes: 2 additions & 2 deletions Source/OCMock/NSObject+OCMAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ + (IMP)instanceMethodForwarderForSelector:(SEL)aSelector
BOOL needsStructureReturn;
void *rawCacheKey[2] = { (void *)self, aSelector };
NSData *cacheKey = [NSData dataWithBytes:rawCacheKey length:sizeof(rawCacheKey)];
NSNumber *cachedValue = _OCMReturnTypeCache[cacheKey];
NSNumber *cachedValue = [_OCMReturnTypeCache objectForKey:cacheKey];

if(cachedValue == nil)
{
NSMethodSignature *sig = [self instanceMethodSignatureForSelector:aSelector];
needsStructureReturn = [sig usesSpecialStructureReturn];
_OCMReturnTypeCache[cacheKey] = @(needsStructureReturn);
[_OCMReturnTypeCache setObject:@(needsStructureReturn) forKey:cacheKey];
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion Source/OCMock/NSValue+OCMAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ - (BOOL)getBytes:(void *)outputBuf objCType:(const char *)targetType
}


@end
@end
10 changes: 5 additions & 5 deletions Source/OCMock/OCMockObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ - (id)verifyAtLocation:(OCMLocation *)location
if([unsatisfiedExpectations count] == 1)
{
NSString *description = [NSString stringWithFormat:@"%@: expected method was not invoked: %@",
[self description], [unsatisfiedExpectations[0] description]];
[self description], [[unsatisfiedExpectations objectAtIndex:0] description]];
OCMReportFailure(location, description);
}
else if([unsatisfiedExpectations count] > 0)
Expand All @@ -180,7 +180,7 @@ - (id)verifyAtLocation:(OCMLocation *)location
if([exceptions count] > 0)
{
NSString *description = [NSString stringWithFormat:@"%@: %@ (This is a strict mock failure that was ignored when it actually occured.)",
[self description], [exceptions[0] description]];
[self description], [[exceptions objectAtIndex:0] description]];
OCMReportFailure(location, description);
}

Expand Down Expand Up @@ -275,14 +275,14 @@ - (BOOL)handleInvocation:(NSInvocation *)anInvocation
}];
if(idx == NSNotFound)
return NO;
OCMInvocationStub *stub = stubs[idx];
OCMInvocationStub *stub = [stubs objectAtIndex:idx];

if([expectations containsObject:stub])
{
if(expectationOrderMatters && (expectations[0] != stub))
if(expectationOrderMatters && ([expectations objectAtIndex:0] != stub))
{
[NSException raise:NSInternalInconsistencyException format:@"%@: unexpected method invoked: %@\n\texpected:\t%@",
[self description], [stub description], [expectations[0] description]];
[self description], [stub description], [[expectations objectAtIndex:0] description]];

}
if([(OCMInvocationExpectation *)stub isSatisfied])
Expand Down
2 changes: 1 addition & 1 deletion Source/OCMock/OCObserverMockObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ - (void)handleNotification:(NSNotification *)aNotification
limit = expectationOrderMatters ? 1 : [recorders count];
for(i = 0; i < limit; i++)
{
if([recorders[i] matchesNotification:aNotification])
if([[recorders objectAtIndex:i] matchesNotification:aNotification])
{
[recorders removeObjectAtIndex:i];
return;
Expand Down
4 changes: 2 additions & 2 deletions Source/OCMockTests/OCMStubRecorderTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ - (void)testAddsReturnValueProvider
NSArray *actionList = [(OCMInvocationStub *)[recorder invocationMatcher] invocationActions];

XCTAssertEqual((NSUInteger)1, [actionList count], @"Should have added one action.");
XCTAssertEqualObjects([OCMReturnValueProvider class], [actionList[0] class], @"Should have added correct action.");
XCTAssertEqualObjects([OCMReturnValueProvider class], [[actionList objectAtIndex:0] class], @"Should have added correct action.");
}

- (void)testAddsExceptionReturnValueProvider
Expand All @@ -63,7 +63,7 @@ - (void)testAddsExceptionReturnValueProvider
NSArray *actionList = [(OCMInvocationStub *)[recorder invocationMatcher] invocationActions];

XCTAssertEqual((NSUInteger)1, [actionList count], @"Should have added one action.");
XCTAssertEqualObjects([OCMExceptionReturnValueProvider class], [actionList[0] class], @"Should have added correct action.");
XCTAssertEqualObjects([OCMExceptionReturnValueProvider class], [[actionList objectAtIndex:0] class], @"Should have added correct action.");

}

Expand Down

0 comments on commit 7389f42

Please sign in to comment.