diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-21 16:03:44 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-21 16:03:44 +0000 |
commit | 5849bc7c3056c81153d5831e6834de15f2567132 (patch) | |
tree | a5addd401c705a5bb7b4f1e7d240996d6ac356d8 /third_party/ocmock | |
parent | 14e5bca82b5ac6f0a2b59d087d3f38e19017c127 (diff) | |
download | chromium_src-5849bc7c3056c81153d5831e6834de15f2567132.zip chromium_src-5849bc7c3056c81153d5831e6834de15f2567132.tar.gz chromium_src-5849bc7c3056c81153d5831e6834de15f2567132.tar.bz2 |
Roll OCMock r54:55 to pull in some memory and warning fixes.
BUG=32564
TEST=Trybots
Review URL: http://codereview.chromium.org/554030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36750 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/ocmock')
-rw-r--r-- | third_party/ocmock/OCMock/Changes.txt | 8 | ||||
-rw-r--r-- | third_party/ocmock/OCMock/Frameworks/OCHamcrest.tar.bz2 | bin | 0 -> 81491 bytes | |||
-rw-r--r-- | third_party/ocmock/OCMock/Frameworks/hamcrest.tar.bz2 | bin | 101587 -> 0 bytes | |||
-rw-r--r-- | third_party/ocmock/OCMock/NSInvocation+OCMAdditions.h | 6 | ||||
-rw-r--r-- | third_party/ocmock/OCMock/NSInvocation+OCMAdditions.m | 82 | ||||
-rw-r--r-- | third_party/ocmock/OCMock/NSInvocationOCMAdditionsTests.m | 4 | ||||
-rw-r--r-- | third_party/ocmock/OCMock/OCMock.xcodeproj/project.pbxproj | 52 | ||||
-rw-r--r-- | third_party/ocmock/OCMock/OCMockObjectHamcrestTests.mm | 2 | ||||
-rw-r--r-- | third_party/ocmock/OCMock/OCMockObjectTests.m | 32 | ||||
-rw-r--r-- | third_party/ocmock/OCMock/OCMockRecorder.m | 12 | ||||
-rw-r--r-- | third_party/ocmock/OCMock/OCPartialMockObject.m | 12 | ||||
-rw-r--r-- | third_party/ocmock/README.chromium | 4 |
12 files changed, 113 insertions, 101 deletions
diff --git a/third_party/ocmock/OCMock/Changes.txt b/third_party/ocmock/OCMock/Changes.txt index e304b41..6654223 100644 --- a/third_party/ocmock/OCMock/Changes.txt +++ b/third_party/ocmock/OCMock/Changes.txt @@ -1,6 +1,14 @@ Chronological listing of changes. If a particular SVN revision has no entry, that check-in did not involve any code or feature changes. +2009-10-16 (r55) + +* Fixed broken test for array argument descciptions (Craig Beck) +* Disambiguated mock table method name to avoid compiler warning +* Renamed some variables to avoid warnings when using -Wshadow +* Partial mocks are now deallocated as they should +* Fixed problems that occured when using mocks as arguments + 2009-08-18 (r54) diff --git a/third_party/ocmock/OCMock/Frameworks/OCHamcrest.tar.bz2 b/third_party/ocmock/OCMock/Frameworks/OCHamcrest.tar.bz2 Binary files differnew file mode 100644 index 0000000..1a9578a --- /dev/null +++ b/third_party/ocmock/OCMock/Frameworks/OCHamcrest.tar.bz2 diff --git a/third_party/ocmock/OCMock/Frameworks/hamcrest.tar.bz2 b/third_party/ocmock/OCMock/Frameworks/hamcrest.tar.bz2 Binary files differdeleted file mode 100644 index 006a5b0..0000000 --- a/third_party/ocmock/OCMock/Frameworks/hamcrest.tar.bz2 +++ /dev/null diff --git a/third_party/ocmock/OCMock/NSInvocation+OCMAdditions.h b/third_party/ocmock/OCMock/NSInvocation+OCMAdditions.h index ced6d9f..cff38a1 100644 --- a/third_party/ocmock/OCMock/NSInvocation+OCMAdditions.h +++ b/third_party/ocmock/OCMock/NSInvocation+OCMAdditions.h @@ -1,5 +1,5 @@ //--------------------------------------------------------------------------------------- -// $Id: NSInvocation+OCMAdditions.h 50 2009-07-16 06:48:19Z erik $ +// $Id: NSInvocation+OCMAdditions.h 55 2009-10-16 06:42:18Z erik $ // Copyright (c) 2006-2009 by Mulle Kybernetik. See License file for details. //--------------------------------------------------------------------------------------- @@ -7,11 +7,11 @@ @interface NSInvocation(OCMAdditions) -- (id)getArgumentAtIndexAsObject:(int)index; +- (id)getArgumentAtIndexAsObject:(int)argIndex; - (NSString *)invocationDescription; -- (NSString *)argumentDescriptionAtIndex:(int)index; +- (NSString *)argumentDescriptionAtIndex:(int)argIndex; - (NSString *)objectDescriptionAtIndex:(int)anInt; - (NSString *)charDescriptionAtIndex:(int)anInt; diff --git a/third_party/ocmock/OCMock/NSInvocation+OCMAdditions.m b/third_party/ocmock/OCMock/NSInvocation+OCMAdditions.m index fa0e483..7d0b68c 100644 --- a/third_party/ocmock/OCMock/NSInvocation+OCMAdditions.m +++ b/third_party/ocmock/OCMock/NSInvocation+OCMAdditions.m @@ -1,5 +1,5 @@ //--------------------------------------------------------------------------------------- -// $Id: NSInvocation+OCMAdditions.m 50 2009-07-16 06:48:19Z erik $ +// $Id: NSInvocation+OCMAdditions.m 55 2009-10-16 06:42:18Z erik $ // Copyright (c) 2006-2009 by Mulle Kybernetik. See License file for details. //--------------------------------------------------------------------------------------- @@ -8,11 +8,11 @@ @implementation NSInvocation(OCMAdditions) -- (id)getArgumentAtIndexAsObject:(int)index +- (id)getArgumentAtIndexAsObject:(int)argIndex { const char* argType; - argType = [[self methodSignature] getArgumentTypeAtIndex:index]; + argType = [[self methodSignature] getArgumentTypeAtIndex:argIndex]; while(strchr("rnNoORV", argType[0]) != NULL) argType += 1; @@ -25,105 +25,105 @@ case '@': { id value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return value; } case ':': { SEL s = (SEL)0; - [self getArgument:&s atIndex:index]; + [self getArgument:&s atIndex:argIndex]; id value = NSStringFromSelector(s); return value; } case 'i': { int value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithInt:value]; } case 's': { short value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithShort:value]; } case 'l': { long value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithLong:value]; } case 'q': { long long value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithLongLong:value]; } case 'c': { char value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithChar:value]; } case 'C': { unsigned char value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithUnsignedChar:value]; } case 'I': { unsigned int value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithUnsignedInt:value]; } case 'S': { unsigned short value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithUnsignedShort:value]; } case 'L': { unsigned long value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithUnsignedLong:value]; } case 'Q': { unsigned long long value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithUnsignedLongLong:value]; } case 'f': { float value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithFloat:value]; } case 'd': { double value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithDouble:value]; } case 'B': { bool value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithBool:value]; } case '^': { void *value = NULL; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSValue valueWithPointer:value]; } case '{': // structure { - unsigned maxSize = [[self methodSignature] frameLength]; - NSMutableData *argumentData = [[[NSMutableData alloc] initWithLength:maxSize] autorelease]; - [self getArgument:[argumentData mutableBytes] atIndex:index]; + unsigned maxArgSize = [[self methodSignature] frameLength]; + NSMutableData *argumentData = [[[NSMutableData alloc] initWithLength:maxArgSize] autorelease]; + [self getArgument:[argumentData mutableBytes] atIndex:argIndex]; return [NSValue valueWithBytes:[argumentData bytes] objCType:argType]; } @@ -152,32 +152,32 @@ return [description autorelease]; } -- (NSString *)argumentDescriptionAtIndex:(int)index +- (NSString *)argumentDescriptionAtIndex:(int)argIndex { - const char *argType = [[self methodSignature] getArgumentTypeAtIndex:index]; + const char *argType = [[self methodSignature] getArgumentTypeAtIndex:argIndex]; if(strchr("rnNoORV", argType[0]) != NULL) argType += 1; switch(*argType) { - case '@': return [self objectDescriptionAtIndex:index]; - case 'c': return [self charDescriptionAtIndex:index]; - case 'C': return [self unsignedCharDescriptionAtIndex:index]; - case 'i': return [self intDescriptionAtIndex:index]; - case 'I': return [self unsignedIntDescriptionAtIndex:index]; - case 's': return [self shortDescriptionAtIndex:index]; - case 'S': return [self unsignedShortDescriptionAtIndex:index]; - case 'l': return [self longDescriptionAtIndex:index]; - case 'L': return [self unsignedLongDescriptionAtIndex:index]; - case 'q': return [self longLongDescriptionAtIndex:index]; - case 'Q': return [self unsignedLongLongDescriptionAtIndex:index]; - case 'd': return [self doubleDescriptionAtIndex:index]; - case 'f': return [self floatDescriptionAtIndex:index]; + case '@': return [self objectDescriptionAtIndex:argIndex]; + case 'c': return [self charDescriptionAtIndex:argIndex]; + case 'C': return [self unsignedCharDescriptionAtIndex:argIndex]; + case 'i': return [self intDescriptionAtIndex:argIndex]; + case 'I': return [self unsignedIntDescriptionAtIndex:argIndex]; + case 's': return [self shortDescriptionAtIndex:argIndex]; + case 'S': return [self unsignedShortDescriptionAtIndex:argIndex]; + case 'l': return [self longDescriptionAtIndex:argIndex]; + case 'L': return [self unsignedLongDescriptionAtIndex:argIndex]; + case 'q': return [self longLongDescriptionAtIndex:argIndex]; + case 'Q': return [self unsignedLongLongDescriptionAtIndex:argIndex]; + case 'd': return [self doubleDescriptionAtIndex:argIndex]; + case 'f': return [self floatDescriptionAtIndex:argIndex]; // Why does this throw EXC_BAD_ACCESS when appending the string? // case NSObjCStructType: return [self structDescriptionAtIndex:index]; - case '^': return [self pointerDescriptionAtIndex:index]; - case '*': return [self cStringDescriptionAtIndex:index]; - case ':': return [self selectorDescriptionAtIndex:index]; + case '^': return [self pointerDescriptionAtIndex:argIndex]; + case '*': return [self cStringDescriptionAtIndex:argIndex]; + case ':': return [self selectorDescriptionAtIndex:argIndex]; default: return [@"<??" stringByAppendingString:@">"]; // avoid confusion with trigraphs... } @@ -191,7 +191,7 @@ [self getArgument:&object atIndex:anInt]; if (object == nil) return @"nil"; - else if([object isKindOfClass:[NSString class]]) + else if(![object isProxy] && [object isKindOfClass:[NSString class]]) return [NSString stringWithFormat:@"@\"%@\"", [object description]]; else return [object description]; diff --git a/third_party/ocmock/OCMock/NSInvocationOCMAdditionsTests.m b/third_party/ocmock/OCMock/NSInvocationOCMAdditionsTests.m index 3b549c4..fcfbbcd 100644 --- a/third_party/ocmock/OCMock/NSInvocationOCMAdditionsTests.m +++ b/third_party/ocmock/OCMock/NSInvocationOCMAdditionsTests.m @@ -1,5 +1,5 @@ //--------------------------------------------------------------------------------------- -// $Id: NSInvocationOCMAdditionsTests.m 26 2008-05-08 17:06:47Z erik $ +// $Id: NSInvocationOCMAdditionsTests.m 55 2009-10-16 06:42:18Z erik $ // Copyright (c) 2006-2008 by Mulle Kybernetik. See License file for details. //--------------------------------------------------------------------------------------- @@ -68,7 +68,7 @@ - (void)testInvocationDescriptionWithArrayArgument { SEL selector = @selector(addObjectsFromArray:); - NSMethodSignature *signature = [[NSArray array] methodSignatureForSelector:selector]; + NSMethodSignature *signature = [[NSMutableArray array] methodSignatureForSelector:selector]; NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; [invocation setSelector:selector]; // Give it one argument (starts at index 2) diff --git a/third_party/ocmock/OCMock/OCMock.xcodeproj/project.pbxproj b/third_party/ocmock/OCMock/OCMock.xcodeproj/project.pbxproj index aeb167b..3e28313 100644 --- a/third_party/ocmock/OCMock/OCMock.xcodeproj/project.pbxproj +++ b/third_party/ocmock/OCMock/OCMock.xcodeproj/project.pbxproj @@ -8,7 +8,7 @@ /* Begin PBXBuildFile section */ 030106730A3B9B240049FED7 /* NSInvocationOCMAdditionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 030106470A3B99F20049FED7 /* NSInvocationOCMAdditionsTests.m */; }; - 032797870E09F40E006CA665 /* hamcrest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 032797860E09F40E006CA665 /* hamcrest.framework */; }; + 032797870E09F40E006CA665 /* OCHamcrest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 032797860E09F40E006CA665 /* OCHamcrest.framework */; }; 032798030E09F8B7006CA665 /* OCMockObjectHamcrestTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 032798020E09F8B7006CA665 /* OCMockObjectHamcrestTests.mm */; }; 0338A99807BE7C100066DE8A /* OCClassMockObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 0338A99607BE7C100066DE8A /* OCClassMockObject.h */; }; 0338A99907BE7C100066DE8A /* OCClassMockObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 0338A99707BE7C100066DE8A /* OCClassMockObject.m */; }; @@ -19,10 +19,8 @@ 034313EA0CCA7BC700A2E080 /* OCMConstraintTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 034313E90CCA7BC700A2E080 /* OCMConstraintTests.m */; }; 0378606E0F6A32F800A4D9A0 /* OCMArg.h in Headers */ = {isa = PBXBuildFile; fileRef = 0378606B0F6A32F800A4D9A0 /* OCMArg.h */; settings = {ATTRIBUTES = (Public, ); }; }; 0378606F0F6A32F800A4D9A0 /* OCMArg.m in Sources */ = {isa = PBXBuildFile; fileRef = 0378606C0F6A32F800A4D9A0 /* OCMArg.m */; }; - 037860E20F6A3D4600A4D9A0 /* OCMPassByRefSetter.m in Sources */ = {isa = PBXBuildFile; fileRef = 037860E10F6A3D4600A4D9A0 /* OCMPassByRefSetter.m */; }; 037860E30F6A3D4600A4D9A0 /* OCMPassByRefSetter.h in Headers */ = {isa = PBXBuildFile; fileRef = 037860E00F6A3D4600A4D9A0 /* OCMPassByRefSetter.h */; }; 037860E40F6A3D4600A4D9A0 /* OCMPassByRefSetter.m in Sources */ = {isa = PBXBuildFile; fileRef = 037860E10F6A3D4600A4D9A0 /* OCMPassByRefSetter.m */; }; - 037C13440FCC474D00257C8C /* OCPartialMockRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 037C13430FCC474D00257C8C /* OCPartialMockRecorder.m */; }; 037C13450FCC474D00257C8C /* OCPartialMockRecorder.h in Headers */ = {isa = PBXBuildFile; fileRef = 037C13420FCC474D00257C8C /* OCPartialMockRecorder.h */; }; 037C13460FCC474D00257C8C /* OCPartialMockRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 037C13430FCC474D00257C8C /* OCPartialMockRecorder.m */; }; 03A2D0CB09F01D13008A1AFD /* NSInvocation+OCMAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 03A2D0C909F01D13008A1AFD /* NSInvocation+OCMAdditions.h */; settings = {ATTRIBUTES = (); }; }; @@ -33,39 +31,23 @@ 03BF2D5F08F1C82D00978C59 /* OCMockObjectTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 03DE1F5F06DB914100E5A2A8 /* OCMockObjectTests.m */; }; 03C36703100D69EB00BE9731 /* OCMReturnValueProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 03C36701100D69EB00BE9731 /* OCMReturnValueProvider.h */; }; 03C36704100D69EB00BE9731 /* OCMReturnValueProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 03C36702100D69EB00BE9731 /* OCMReturnValueProvider.m */; }; - 03C36705100D69EB00BE9731 /* OCMReturnValueProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 03C36702100D69EB00BE9731 /* OCMReturnValueProvider.m */; }; 03C36724100D6B9600BE9731 /* OCMBoxedReturnValueProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 03C36722100D6B9600BE9731 /* OCMBoxedReturnValueProvider.h */; }; 03C36725100D6B9600BE9731 /* OCMBoxedReturnValueProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 03C36723100D6B9600BE9731 /* OCMBoxedReturnValueProvider.m */; }; - 03C36726100D6B9600BE9731 /* OCMBoxedReturnValueProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 03C36723100D6B9600BE9731 /* OCMBoxedReturnValueProvider.m */; }; 03C36729100D6C7D00BE9731 /* OCMExceptionReturnValueProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 03C36727100D6C7D00BE9731 /* OCMExceptionReturnValueProvider.h */; }; 03C3672A100D6C7D00BE9731 /* OCMExceptionReturnValueProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 03C36728100D6C7D00BE9731 /* OCMExceptionReturnValueProvider.m */; }; - 03C3672B100D6C7D00BE9731 /* OCMExceptionReturnValueProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 03C36728100D6C7D00BE9731 /* OCMExceptionReturnValueProvider.m */; }; 03C3672E100D6D0F00BE9731 /* OCMIndirectReturnValueProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 03C3672C100D6D0F00BE9731 /* OCMIndirectReturnValueProvider.h */; }; 03C3672F100D6D0F00BE9731 /* OCMIndirectReturnValueProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 03C3672D100D6D0F00BE9731 /* OCMIndirectReturnValueProvider.m */; }; - 03C36730100D6D0F00BE9731 /* OCMIndirectReturnValueProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 03C3672D100D6D0F00BE9731 /* OCMIndirectReturnValueProvider.m */; }; 03C36775100D744700BE9731 /* OCMNotificationPoster.h in Headers */ = {isa = PBXBuildFile; fileRef = 03C36773100D744700BE9731 /* OCMNotificationPoster.h */; }; 03C36776100D744700BE9731 /* OCMNotificationPoster.m in Sources */ = {isa = PBXBuildFile; fileRef = 03C36774100D744700BE9731 /* OCMNotificationPoster.m */; }; - 03C36777100D744700BE9731 /* OCMNotificationPoster.m in Sources */ = {isa = PBXBuildFile; fileRef = 03C36774100D744700BE9731 /* OCMNotificationPoster.m */; }; 03D880550F8C75980087D071 /* OCObserverMockObjectTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 03D880540F8C75980087D071 /* OCObserverMockObjectTest.m */; }; - 03D880600F8C81DE0087D071 /* OCObserverMockObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 03D8805F0F8C81DE0087D071 /* OCObserverMockObject.m */; }; 03D880610F8C81DE0087D071 /* OCObserverMockObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 03D8805E0F8C81DE0087D071 /* OCObserverMockObject.h */; }; 03D880620F8C81DE0087D071 /* OCObserverMockObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 03D8805F0F8C81DE0087D071 /* OCObserverMockObject.m */; }; - 03D880690F8C84480087D071 /* OCMockObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 03DE1F5506DB911300E5A2A8 /* OCMockObject.m */; }; - 03D8806A0F8C84490087D071 /* OCClassMockObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 0338A99707BE7C100066DE8A /* OCClassMockObject.m */; }; - 03D8806B0F8C844A0087D071 /* OCProtocolMockObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 0338A9EF07BE83B50066DE8A /* OCProtocolMockObject.m */; }; - 03D8806C0F8C844B0087D071 /* OCMockRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 03DE1F5706DB911300E5A2A8 /* OCMockRecorder.m */; }; - 03D8806D0F8C844C0087D071 /* OCMArg.m in Sources */ = {isa = PBXBuildFile; fileRef = 0378606C0F6A32F800A4D9A0 /* OCMArg.m */; }; - 03D8806E0F8C844C0087D071 /* OCMConstraint.m in Sources */ = {isa = PBXBuildFile; fileRef = 0343133C0CCA771800A2E080 /* OCMConstraint.m */; }; - 03D880700F8C84560087D071 /* NSInvocation+OCMAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 03A2D0CA09F01D13008A1AFD /* NSInvocation+OCMAdditions.m */; }; 03D880D50F8DA4750087D071 /* NSNotificationCenter+OCMAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 03D880D30F8DA4750087D071 /* NSNotificationCenter+OCMAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; 03D880D60F8DA4750087D071 /* NSNotificationCenter+OCMAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 03D880D40F8DA4750087D071 /* NSNotificationCenter+OCMAdditions.m */; }; - 03D880D70F8DA4750087D071 /* NSNotificationCenter+OCMAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 03D880D40F8DA4750087D071 /* NSNotificationCenter+OCMAdditions.m */; }; 03D881090F8DB0BB0087D071 /* OCMObserverRecorder.h in Headers */ = {isa = PBXBuildFile; fileRef = 03D881070F8DB0BB0087D071 /* OCMObserverRecorder.h */; }; 03D8815B0F8DB37B0087D071 /* OCMObserverRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 03D8815A0F8DB37B0087D071 /* OCMObserverRecorder.m */; }; - 03D8815C0F8DB37B0087D071 /* OCMObserverRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 03D8815A0F8DB37B0087D071 /* OCMObserverRecorder.m */; }; 03D8822F0FA151E20087D071 /* OCPartialMockObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 03D8822D0FA151E10087D071 /* OCPartialMockObject.h */; }; 03D882300FA151E20087D071 /* OCPartialMockObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 03D8822E0FA151E20087D071 /* OCPartialMockObject.m */; }; - 03D882310FA151E20087D071 /* OCPartialMockObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 03D8822E0FA151E20087D071 /* OCPartialMockObject.m */; }; 03DE1F5806DB911300E5A2A8 /* OCMockObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 03DE1F5406DB911300E5A2A8 /* OCMockObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; 03DE1F5906DB911300E5A2A8 /* OCMockObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 03DE1F5506DB911300E5A2A8 /* OCMockObject.m */; }; 03DE1F5A06DB911300E5A2A8 /* OCMockRecorder.h in Headers */ = {isa = PBXBuildFile; fileRef = 03DE1F5606DB911300E5A2A8 /* OCMockRecorder.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -73,7 +55,6 @@ 03DE219006DB91CF00E5A2A8 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 03DE218F06DB91CF00E5A2A8 /* Foundation.framework */; }; 03DE21B306DB95C500E5A2A8 /* OCMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 03DE21B206DB95C500E5A2A8 /* OCMock.h */; settings = {ATTRIBUTES = (Public, ); }; }; 03DE221706DB97DA00E5A2A8 /* License.txt in Resources */ = {isa = PBXBuildFile; fileRef = 03DE221606DB97DA00E5A2A8 /* License.txt */; }; - 03F1FE8910353A5F00E4962C /* NSMethodSignature+OCMAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 03F1FE8810353A5F00E4962C /* NSMethodSignature+OCMAdditions.m */; }; 03F1FE8A10353A5F00E4962C /* NSMethodSignature+OCMAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 03F1FE8710353A5F00E4962C /* NSMethodSignature+OCMAdditions.h */; }; 03F1FE8B10353A5F00E4962C /* NSMethodSignature+OCMAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 03F1FE8810353A5F00E4962C /* NSMethodSignature+OCMAdditions.m */; }; 8DC2EF510486A6940098B216 /* OCMock_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = 32DBCF5E0370ADEE00C91783 /* OCMock_Prefix.pch */; }; @@ -92,7 +73,7 @@ /* Begin PBXFileReference section */ 030106470A3B99F20049FED7 /* NSInvocationOCMAdditionsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSInvocationOCMAdditionsTests.m; sourceTree = "<group>"; }; - 032797860E09F40E006CA665 /* hamcrest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = hamcrest.framework; path = "${TEMP_ROOT}/Frameworks/hamcrest.framework"; sourceTree = "<absolute>"; }; + 032797860E09F40E006CA665 /* OCHamcrest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OCHamcrest.framework; path = build/Frameworks/OCHamcrest.framework; sourceTree = "<group>"; }; 032798010E09F8B7006CA665 /* OCMockObjectHamcrestTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMockObjectHamcrestTests.h; sourceTree = "<group>"; }; 032798020E09F8B7006CA665 /* OCMockObjectHamcrestTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OCMockObjectHamcrestTests.mm; sourceTree = "<group>"; }; 0338A99607BE7C100066DE8A /* OCClassMockObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCClassMockObject.h; sourceTree = "<group>"; }; @@ -162,7 +143,7 @@ 03BF2D4008F1C6BA00978C59 /* SenTestingKit.framework in Frameworks */, 03BF2D4108F1C6BC00978C59 /* Foundation.framework in Frameworks */, 9F35D3DC0D349E7E00C05E52 /* OCMock.framework in Frameworks */, - 032797870E09F40E006CA665 /* hamcrest.framework in Frameworks */, + 032797870E09F40E006CA665 /* OCHamcrest.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -343,7 +324,7 @@ 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */ = { isa = PBXGroup; children = ( - 032797860E09F40E006CA665 /* hamcrest.framework */, + 032797860E09F40E006CA665 /* OCHamcrest.framework */, 03DE218F06DB91CF00E5A2A8 /* Foundation.framework */, 03BF2D1B08F1C26700978C59 /* SenTestingKit.framework */, ); @@ -498,7 +479,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Unpack frameworks required for this target\npushd \"${TEMP_ROOT}\"\nif [ ! -d Frameworks ]; then\n\tmkdir Frameworks\nfi\ncd Frameworks\nif [ ! -d hamcrest.framework ]; then\n gnutar xjf \"${PROJECT_DIR}/Frameworks/hamcrest.tar.bz2\"\nfi\npopd\n"; + shellScript = "# Unpack frameworks required for this target\npushd \"${TEMP_ROOT}\"\nif [ ! -d Frameworks ]; then\n\tmkdir Frameworks\nfi\ncd Frameworks\nif [ ! -d OCHamcrest.framework ]; then\n gnutar xjf \"${PROJECT_DIR}/Frameworks/OCHamcrest.tar.bz2\"\nfi\npopd\n"; }; 03BF2D3508F1C69500978C59 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -525,26 +506,7 @@ 030106730A3B9B240049FED7 /* NSInvocationOCMAdditionsTests.m in Sources */, 034313EA0CCA7BC700A2E080 /* OCMConstraintTests.m in Sources */, 032798030E09F8B7006CA665 /* OCMockObjectHamcrestTests.mm in Sources */, - 037860E20F6A3D4600A4D9A0 /* OCMPassByRefSetter.m in Sources */, 03D880550F8C75980087D071 /* OCObserverMockObjectTest.m in Sources */, - 03D880600F8C81DE0087D071 /* OCObserverMockObject.m in Sources */, - 03D880690F8C84480087D071 /* OCMockObject.m in Sources */, - 03D8806A0F8C84490087D071 /* OCClassMockObject.m in Sources */, - 03D8806B0F8C844A0087D071 /* OCProtocolMockObject.m in Sources */, - 03D8806C0F8C844B0087D071 /* OCMockRecorder.m in Sources */, - 03D8806D0F8C844C0087D071 /* OCMArg.m in Sources */, - 03D8806E0F8C844C0087D071 /* OCMConstraint.m in Sources */, - 03D880700F8C84560087D071 /* NSInvocation+OCMAdditions.m in Sources */, - 03D880D70F8DA4750087D071 /* NSNotificationCenter+OCMAdditions.m in Sources */, - 03D8815C0F8DB37B0087D071 /* OCMObserverRecorder.m in Sources */, - 03D882310FA151E20087D071 /* OCPartialMockObject.m in Sources */, - 037C13440FCC474D00257C8C /* OCPartialMockRecorder.m in Sources */, - 03C36705100D69EB00BE9731 /* OCMReturnValueProvider.m in Sources */, - 03C36726100D6B9600BE9731 /* OCMBoxedReturnValueProvider.m in Sources */, - 03C3672B100D6C7D00BE9731 /* OCMExceptionReturnValueProvider.m in Sources */, - 03C36730100D6D0F00BE9731 /* OCMIndirectReturnValueProvider.m in Sources */, - 03C36777100D744700BE9731 /* OCMNotificationPoster.m in Sources */, - 03F1FE8910353A5F00E4962C /* NSMethodSignature+OCMAdditions.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -601,6 +563,7 @@ GCC_PREFIX_HEADER = OCMock_Prefix.pch; INFOPLIST_FILE = "Test-Info.plist"; INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles"; + LD_RUNPATH_SEARCH_PATHS = "$(BUILD_DIR)/Frameworks"; LIBRARY_STYLE = BUNDLE; OTHER_CFLAGS = ""; OTHER_REZFLAGS = ""; @@ -632,6 +595,7 @@ GCC_PREFIX_HEADER = OCMock_Prefix.pch; INFOPLIST_FILE = "Test-Info.plist"; INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles"; + LD_RUNPATH_SEARCH_PATHS = "$(BUILD_DIR)/Frameworks"; LIBRARY_STYLE = BUNDLE; OTHER_CFLAGS = ""; OTHER_REZFLAGS = ""; @@ -733,6 +697,7 @@ FRAMEWORK_SEARCH_PATHS = "$(TEMP_ROOT)/Frameworks"; GCC_ENABLE_OBJC_GC = supported; GCC_INPUT_FILETYPE = automatic; + GCC_WARN_SHADOW = YES; LD_DYLIB_INSTALL_NAME = "@rpath/$(EXECUTABLE_PATH)"; LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.5; @@ -752,6 +717,7 @@ FRAMEWORK_SEARCH_PATHS = "$(TEMP_ROOT)/Frameworks"; GCC_ENABLE_OBJC_GC = supported; GCC_INPUT_FILETYPE = automatic; + GCC_WARN_SHADOW = YES; LD_DYLIB_INSTALL_NAME = "@rpath/$(EXECUTABLE_PATH)"; LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.5; diff --git a/third_party/ocmock/OCMock/OCMockObjectHamcrestTests.mm b/third_party/ocmock/OCMock/OCMockObjectHamcrestTests.mm index 8059deb..4f0f5dd 100644 --- a/third_party/ocmock/OCMock/OCMockObjectHamcrestTests.mm +++ b/third_party/ocmock/OCMock/OCMockObjectHamcrestTests.mm @@ -7,7 +7,7 @@ #import "OCMockObjectHamcrestTests.h" #define HC_SHORTHAND -#import <hamcrest/hamcrest.h> +#import <OCHamcrest/OCHamcrest.h> @implementation OCMockObjectHamcrestTests diff --git a/third_party/ocmock/OCMock/OCMockObjectTests.m b/third_party/ocmock/OCMock/OCMockObjectTests.m index 942cffd..cd8dbe3 100644 --- a/third_party/ocmock/OCMock/OCMockObjectTests.m +++ b/third_party/ocmock/OCMock/OCMockObjectTests.m @@ -1,5 +1,5 @@ //--------------------------------------------------------------------------------------- -// $Id: OCMockObjectTests.m 54 2009-08-18 06:27:36Z erik $ +// $Id: OCMockObjectTests.m 55 2009-10-16 06:42:18Z erik $ // Copyright (c) 2004-2008 by Mulle Kybernetik. See License file for details. //--------------------------------------------------------------------------------------- @@ -217,6 +217,36 @@ static NSString *TestNotification = @"TestNotification"; } +- (void)testCanPassMocksAsArguments +{ + id mockArg = [OCMockObject mockForClass:[NSString class]]; + [[mock stub] stringByAppendingString:[OCMArg any]]; + [mock stringByAppendingString:mockArg]; +} + +- (void)testCanStubWithMockArguments +{ + id mockArg = [OCMockObject mockForClass:[NSString class]]; + [[mock stub] stringByAppendingString:mockArg]; + [mock stringByAppendingString:mockArg]; +} + +- (void)testRaisesExceptionWhenStubbedMockArgIsNotUsed +{ + id mockArg = [OCMockObject mockForClass:[NSString class]]; + [[mock stub] stringByAppendingString:mockArg]; + STAssertThrows([mock stringByAppendingString:@"foo"], @"Should have raised an exception."); +} + +- (void)testRaisesExceptionWhenDifferentMockArgumentIsPassed +{ + id expectedArg = [OCMockObject mockForClass:[NSString class]]; + id otherArg = [OCMockObject mockForClass:[NSString class]]; + [[mock stub] stringByAppendingString:otherArg]; + STAssertThrows([mock stringByAppendingString:expectedArg], @"Should have raised an exception."); +} + + // -------------------------------------------------------------------------------------- // returning values from stubbed methods // -------------------------------------------------------------------------------------- diff --git a/third_party/ocmock/OCMock/OCMockRecorder.m b/third_party/ocmock/OCMock/OCMockRecorder.m index 2fc9bed..e31883e 100644 --- a/third_party/ocmock/OCMock/OCMockRecorder.m +++ b/third_party/ocmock/OCMock/OCMockRecorder.m @@ -1,5 +1,5 @@ //--------------------------------------------------------------------------------------- -// $Id: OCMockRecorder.m 50 2009-07-16 06:48:19Z erik $ +// $Id: OCMockRecorder.m 55 2009-10-16 06:42:18Z erik $ // Copyright (c) 2004-2009 by Mulle Kybernetik. See License file for details. //--------------------------------------------------------------------------------------- @@ -122,9 +122,17 @@ for(i = 2; i < n; i++) { recordedArg = [recordedInvocation getArgumentAtIndexAsObject:i]; + passedArg = [anInvocation getArgumentAtIndexAsObject:i]; + + if([recordedArg isProxy]) + { + if(![recordedArg isEqual:passedArg]) + return NO; + continue; + } + if([recordedArg isKindOfClass:[NSValue class]]) recordedArg = [OCMArg resolveSpecialValues:recordedArg]; - passedArg = [anInvocation getArgumentAtIndexAsObject:i]; if([recordedArg isKindOfClass:[OCMConstraint class]]) { diff --git a/third_party/ocmock/OCMock/OCPartialMockObject.m b/third_party/ocmock/OCMock/OCPartialMockObject.m index 4d35f13..0ea8735 100644 --- a/third_party/ocmock/OCMock/OCPartialMockObject.m +++ b/third_party/ocmock/OCMock/OCPartialMockObject.m @@ -23,7 +23,7 @@ static NSMutableDictionary *mockTable; + (void)rememberPartialMock:(OCPartialMockObject *)mock forObject:(id)anObject { - [mockTable setObject:mock forKey:[NSValue valueWithNonretainedObject:anObject]]; + [mockTable setObject:[NSValue valueWithNonretainedObject:mock] forKey:[NSValue valueWithNonretainedObject:anObject]]; } + (void)forgetPartialMockForObject:(id)anObject @@ -31,9 +31,9 @@ static NSMutableDictionary *mockTable; [mockTable removeObjectForKey:[NSValue valueWithNonretainedObject:anObject]]; } -+ (OCPartialMockObject *)partialMockForObject:(id)anObject ++ (OCPartialMockObject *)existingPartialMockForObject:(id)anObject { - OCPartialMockObject *mock = [mockTable objectForKey:[NSValue valueWithNonretainedObject:anObject]]; + OCPartialMockObject *mock = [[mockTable objectForKey:[NSValue valueWithNonretainedObject:anObject]] nonretainedObjectValue]; if(mock == nil) [NSException raise:NSInternalInconsistencyException format:@"No partial mock for object %p", anObject]; return mock; @@ -77,8 +77,8 @@ static NSMutableDictionary *mockTable; - (void)setupSubclassForObject:(id)anObject { Class realClass = [anObject class]; - const char *className = [[NSString stringWithFormat:@"%@-%p", realClass, anObject] cString]; - NSLog(@"Creating class named %s", className); + double timestamp = [NSDate timeIntervalSinceReferenceDate]; + const char *className = [[NSString stringWithFormat:@"%@-%p-%f", realClass, anObject, timestamp] cString]; Class subclass = objc_allocateClassPair(realClass, className, 0); objc_registerClassPair(subclass); object_setClass(anObject, subclass); @@ -100,7 +100,7 @@ static NSMutableDictionary *mockTable; - (void)forwardInvocationForRealObject:(NSInvocation *)anInvocation { // in here "self" is a reference to the real object, not the mock - OCPartialMockObject *mock = [OCPartialMockObject partialMockForObject:self]; + OCPartialMockObject *mock = [OCPartialMockObject existingPartialMockForObject:self]; if([mock handleInvocation:anInvocation] == NO) [NSException raise:NSInternalInconsistencyException format:@"Ended up in subclass forwarder for %@ with unstubbed method %@", [self class], NSStringFromSelector([anInvocation selector])]; diff --git a/third_party/ocmock/README.chromium b/third_party/ocmock/README.chromium index 6ece635..2731cf3 100644 --- a/third_party/ocmock/README.chromium +++ b/third_party/ocmock/README.chromium @@ -1,6 +1,6 @@ URL: http://www.mulle-kybernetik.com/software/OCMock/ - http://svn.mulle-kybernetik.com/OCMock/trunk/Source/@54 -Version: r54 + http://svn.mulle-kybernetik.com/OCMock/trunk/Source/@55 +Version: r55 License: BSD with advertising clause License File: License.txt |