Skip to content

Commit

Permalink
Fix for #369.
Browse files Browse the repository at this point in the history
I decided to use a downcast to keep the external contract clearer. The downcast uses an implicit contract from the method just one up.
  • Loading branch information
erikdoe committed Oct 20, 2019
1 parent 80b0485 commit d43f5b0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Source/OCMock/OCMConstraint.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject

+ (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject withValue:(id)aValue
{
OCMInvocationConstraint *constraint = [self constraintWithSelector:aSelector onObject:anObject];
OCMInvocationConstraint *constraint = (OCMInvocationConstraint *)[self constraintWithSelector:aSelector onObject:anObject];
if([[constraint->invocation methodSignature] numberOfArguments] < 4)
[NSException raise:NSInvalidArgumentException format:@"Constraint with value requires selector with two arguments."];
[constraint->invocation setArgument:&aValue atIndex:3];
Expand Down

0 comments on commit d43f5b0

Please sign in to comment.