- Update
This commit is contained in:
1 parent
d281d765ea
commit
5b074a5176
1261 files changed
+199158
-7303
No files matched your search
@@ -0,0 +1,276 @@
|
||||
Chronological listing of changes. More detail is usually found in the Git commit messages
|
||||
and/or the pull requests.
|
||||
|
||||
2013-03-14
|
||||
|
||||
* Stubbing an object creation method now handles retain count correctly.
|
||||
* Added support for forwardingTagetForSelector: (thanks to Jeff Watkins)
|
||||
|
||||
|
||||
2013-03-12
|
||||
|
||||
* Added class method mocking capability to class mock objects
|
||||
* Added implementation of isKindOfClass: to class mock objects
|
||||
|
||||
|
||||
2013-02-20
|
||||
|
||||
* Allowing to set non-object pass-by-ref args (thanks to Glenn L. Austin)
|
||||
|
||||
|
||||
2012-08-23
|
||||
|
||||
* Calling a previously expected method on a partial mock is no longer an error.
|
||||
|
||||
|
||||
2012-01-23
|
||||
|
||||
* Avoiding deprecated method to convert to a C string (thanks to Kushal Pisavadia)
|
||||
|
||||
|
||||
2011-11-03
|
||||
|
||||
* Recreated project from scratch with new conventions in Xcode 4.2 (thanks to Matt Di Pasquale)
|
||||
|
||||
|
||||
2011-09-26
|
||||
|
||||
* Arguments only need to be equal, don't have to have same class
|
||||
|
||||
|
||||
|
||||
Chronological listing of changes in the original Subversion code repository. If a particular
|
||||
SVN revision has no entry, that check-in did not involve any code or feature changes.
|
||||
|
||||
2011-02-15 (r74)
|
||||
|
||||
* Added feature to explicitly disable a partial mock
|
||||
|
||||
|
||||
2011-01-28 (r71)
|
||||
|
||||
* Updated example to work with iOS 4.2.
|
||||
|
||||
|
||||
2010-08-21 (r69)
|
||||
|
||||
* Added feature to explicitly reject methods on nice mocks (thanks to Heath Borders)
|
||||
|
||||
|
||||
2010-08-20 (r68)
|
||||
|
||||
* Added feature to forward method to real object from partial mock (thanks to Marco Sandrini)
|
||||
|
||||
|
||||
2010-08-02 (r67)
|
||||
|
||||
* Fix to allow block arguments (thanks to Justin DeWind)
|
||||
|
||||
|
||||
2010-07-28 (r62-r65)
|
||||
|
||||
* Now building OCMock library for simulator (i386) and device (armv7)
|
||||
* Updated example to run tests on device
|
||||
* Changed OCMOCK_VALUE macro to be iOS compatible (thanks to Derek Clarkson)
|
||||
|
||||
|
||||
2010-07-21 (r61)
|
||||
|
||||
* Added a new target to build a static library for iOS use
|
||||
* Created an example showing how to use OCMock in an iOS project
|
||||
|
||||
|
||||
2010-05-19 (r57)
|
||||
|
||||
* Various small clean-ups; no change in functionality (thanks to Jonah Williams)
|
||||
|
||||
|
||||
2010-04-18 (r56)
|
||||
|
||||
* Added block constraints and invocation handler (thanks to Justin DeWind)
|
||||
|
||||
|
||||
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)
|
||||
|
||||
* OnCall methods now have same signature as replaced ones.
|
||||
|
||||
|
||||
2009-08-14 (r53)
|
||||
|
||||
* Fixed possible retain bug (Daniel Eggert)
|
||||
|
||||
|
||||
2009-08-14 (r52)
|
||||
|
||||
* Added feature that allows to verify expectations are called in sequence.
|
||||
* Improved detection of unqualified method return type.
|
||||
|
||||
|
||||
2009-08-13 (r51)
|
||||
|
||||
* Fixed bug that caused crash when using method swizzling with void return type.
|
||||
|
||||
|
||||
2009-07-14 (r49)
|
||||
|
||||
* Added support for calling arbitrary methods when stubbed methods are invoked.
|
||||
|
||||
|
||||
2009-07-14 (r48)
|
||||
|
||||
* Added support for posting notifications (based on Jean-Francois Dontigny's code)
|
||||
|
||||
|
||||
2009-07-14 (r46)
|
||||
|
||||
* Fixed bug around complex type encodings (Jean-Francois Dontigny)
|
||||
|
||||
|
||||
2009-05-26 (r45)
|
||||
|
||||
* Partial mocks now work on object reference and self (thanks to Mike Mangino)
|
||||
|
||||
|
||||
2009-04-24 (r43)
|
||||
|
||||
* Added partial mocks (calls to the original object reference cannot be mocked)
|
||||
|
||||
|
||||
2009-04-17 (r42)
|
||||
|
||||
* Mock observers now handle user infos on notifications.
|
||||
|
||||
|
||||
2009-04-09 (r39)
|
||||
|
||||
* Added inital support for mock observers (loosely based on Dave Dribbin's idea)
|
||||
|
||||
|
||||
2009-04-08 (r38)
|
||||
|
||||
* Moved factory methods from OCMConstraint to OCMArg
|
||||
|
||||
|
||||
2009-03-13 (r37)
|
||||
|
||||
* Added pass by ref argument setters
|
||||
|
||||
|
||||
2009-03-11 (r34)
|
||||
|
||||
* Linked install name now uses @rpath (Dave Dribbin)
|
||||
|
||||
|
||||
2009-02-22 (r32)
|
||||
|
||||
* Added support for respondsToSelector (Dave Dribin)
|
||||
* Added constraint for any pointer
|
||||
* Now comparing selectors as strings (Dado Colussi)
|
||||
|
||||
|
||||
2008-07-07 (r28)
|
||||
|
||||
* Resetting invocation target in recorder to avoid retain cycles.
|
||||
|
||||
|
||||
2008-06-19 (r27)
|
||||
|
||||
* Added optional integration with hamcrest for constraints
|
||||
|
||||
|
||||
2008-05-08 (r24)
|
||||
|
||||
* Now building quad-fat; the 64-bit versions are somewhat experimental though
|
||||
|
||||
|
||||
2008-02-28 (r22)
|
||||
|
||||
* Using new functions to deal with protocols (Evan Doll)
|
||||
|
||||
|
||||
2007-11-22 (r20)
|
||||
|
||||
* Added support for void* parameters (Tuukka Norri)
|
||||
* Fixed a bug that could caused crashes when non-char const pointers were described
|
||||
|
||||
|
||||
2007-11-22 (r19)
|
||||
|
||||
* Fixed bug to allow mocking of methods with type qualifieres (Nikita Zhuk)
|
||||
|
||||
|
||||
2007-10-22 (r18)
|
||||
|
||||
* Added a simple constraint implementation.
|
||||
|
||||
|
||||
2007-06-04 (r15)
|
||||
|
||||
* Now re-throwing fail-fast exceptions, for unexpected invocations for example, when
|
||||
verify is called; in case the first throw is ignored by a framework.
|
||||
|
||||
|
||||
2007-04-23 (r14)
|
||||
|
||||
* Added nice mocks, i.e. mocks that don't raise on unknown methods (Mark Thomas)
|
||||
|
||||
* Fixed bug that prevented expectations after invocations (M. Scott Ford)
|
||||
|
||||
|
||||
2006-06-11 (r12)
|
||||
|
||||
* Added possibility to throw an exception, based on code by Justin DeWind
|
||||
|
||||
* Added Evan Doll's bugfix, which forwards conformsToProtocol: methods when necessary
|
||||
|
||||
* Added the ability to match struct arguments, based on code contributed by Daniel Eggert
|
||||
|
||||
* Better description of arguments, based on code contributed by Jeremy Higgs
|
||||
|
||||
* Added the ability to create multiple identical expectations on the mock object (Jeremy Higgs)
|
||||
|
||||
* Added the ability to mock out nil arguments (Jeremy Higgs)
|
||||
|
||||
|
||||
2005-12-11 (r11)
|
||||
|
||||
* Added slightly modified version of Jon Reid's contribution, which adds the possibility to stub
|
||||
primitive return values.
|
||||
|
||||
* Added Jon Reid's bugfix that prevents a crash when trying to stub an unknown method on a
|
||||
protocol.
|
||||
|
||||
|
||||
2005-10-03 (r10)
|
||||
|
||||
* Upgraded to build and run tests using the OCUnit that is now part of XCode.
|
||||
|
||||
|
||||
2005-10-03 (r9)
|
||||
|
||||
* Added XCdoe 2.1 project
|
||||
|
||||
|
||||
2005-02-16 (r8)
|
||||
|
||||
* Added Richard Clark's contribution, which provides support for scalar arguments.
|
||||
|
||||
|
||||
2005-02-13 (r7)
|
||||
|
||||
* Added support for mocking formal protocols
|
||||
|
||||
|
||||
2004-08-26 (r6)
|
||||
|
||||
* MockObject and Recorder now inherit from NSProxy.
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
|
||||
Copyright (c) 2004-2013 by Mulle Kybernetik. All rights reserved.
|
||||
|
||||
Permission to use, copy, modify and distribute this software and its documentation
|
||||
is hereby granted, provided that both the copyright notice and this permission
|
||||
notice appear in all copies of the software, derivative works or modified versions,
|
||||
and any portions thereof, and that both notices appear in supporting documentation,
|
||||
and that credit is given to Mulle Kybernetik in all documents and publicity
|
||||
pertaining to direct or indirect use of this code or its derivatives.
|
||||
|
||||
THIS IS EXPERIMENTAL SOFTWARE AND IT IS KNOWN TO HAVE BUGS, SOME OF WHICH MAY HAVE
|
||||
SERIOUS CONSEQUENCES. THE COPYRIGHT HOLDER ALLOWS FREE USE OF THIS SOFTWARE IN ITS
|
||||
"AS IS" CONDITION. THE COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY
|
||||
DAMAGES WHATSOEVER RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE
|
||||
OR OF ANY DERIVATIVE WORK.
|
||||
+989
@@ -0,0 +1,989 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
030EF0B614632FD000B04273 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 030EF0B414632FD000B04273 /* InfoPlist.strings */; };
|
||||
030EF0C214632FD000B04273 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 030EF0C114632FD000B04273 /* SenTestingKit.framework */; };
|
||||
030EF0C614632FD000B04273 /* OCMock.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 030EF0A814632FD000B04273 /* OCMock.framework */; };
|
||||
030EF0CC14632FD000B04273 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 030EF0CA14632FD000B04273 /* InfoPlist.strings */; };
|
||||
033E1FF414FEF5E0004456B0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 033E1FF314FEF5E0004456B0 /* Foundation.framework */; };
|
||||
033E1FF514FEF5FC004456B0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 033E1FF314FEF5E0004456B0 /* Foundation.framework */; };
|
||||
033E1FF714FEF60C004456B0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 033E1FF614FEF60C004456B0 /* Foundation.framework */; };
|
||||
0354D72016F23AF5001766BB /* OCMockObjectForwardingTargetTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0354D71F16F23AF5001766BB /* OCMockObjectForwardingTargetTests.m */; };
|
||||
039F91C616EFB493006C3D70 /* OCMockObjectClassMethodMockingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 039F91C516EFB493006C3D70 /* OCMockObjectClassMethodMockingTests.m */; };
|
||||
03AC5C1516DF9FA500D82ECD /* OCMockObjectPartialMocksTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 03AC5C1416DF9FA500D82ECD /* OCMockObjectPartialMocksTests.m */; };
|
||||
03B315AF146333BF0052CD09 /* NSInvocation+OCMAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B31585146333BF0052CD09 /* NSInvocation+OCMAdditions.h */; };
|
||||
03B315B0146333BF0052CD09 /* NSInvocation+OCMAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B31585146333BF0052CD09 /* NSInvocation+OCMAdditions.h */; };
|
||||
03B315B1146333BF0052CD09 /* NSInvocation+OCMAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B31586146333BF0052CD09 /* NSInvocation+OCMAdditions.m */; };
|
||||
03B315B3146333BF0052CD09 /* NSInvocation+OCMAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B31586146333BF0052CD09 /* NSInvocation+OCMAdditions.m */; };
|
||||
03B315B4146333BF0052CD09 /* NSMethodSignature+OCMAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B31587146333BF0052CD09 /* NSMethodSignature+OCMAdditions.h */; };
|
||||
03B315B5146333BF0052CD09 /* NSMethodSignature+OCMAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B31587146333BF0052CD09 /* NSMethodSignature+OCMAdditions.h */; };
|
||||
03B315B6146333BF0052CD09 /* NSMethodSignature+OCMAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B31588146333BF0052CD09 /* NSMethodSignature+OCMAdditions.m */; };
|
||||
03B315B8146333BF0052CD09 /* NSMethodSignature+OCMAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B31588146333BF0052CD09 /* NSMethodSignature+OCMAdditions.m */; };
|
||||
03B315B9146333BF0052CD09 /* NSNotificationCenter+OCMAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B31589146333BF0052CD09 /* NSNotificationCenter+OCMAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
03B315BA146333BF0052CD09 /* NSNotificationCenter+OCMAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B31589146333BF0052CD09 /* NSNotificationCenter+OCMAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
03B315BB146333BF0052CD09 /* NSNotificationCenter+OCMAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B3158A146333BF0052CD09 /* NSNotificationCenter+OCMAdditions.m */; };
|
||||
03B315BD146333BF0052CD09 /* NSNotificationCenter+OCMAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B3158A146333BF0052CD09 /* NSNotificationCenter+OCMAdditions.m */; };
|
||||
03B315BE146333BF0052CD09 /* OCClassMockObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B3158B146333BF0052CD09 /* OCClassMockObject.h */; };
|
||||
03B315BF146333BF0052CD09 /* OCClassMockObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B3158B146333BF0052CD09 /* OCClassMockObject.h */; };
|
||||
03B315C0146333BF0052CD09 /* OCClassMockObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B3158C146333BF0052CD09 /* OCClassMockObject.m */; };
|
||||
03B315C2146333BF0052CD09 /* OCClassMockObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B3158C146333BF0052CD09 /* OCClassMockObject.m */; };
|
||||
03B315C3146333BF0052CD09 /* OCMArg.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B3158D146333BF0052CD09 /* OCMArg.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
03B315C4146333BF0052CD09 /* OCMArg.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B3158D146333BF0052CD09 /* OCMArg.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
03B315C5146333BF0052CD09 /* OCMArg.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B3158E146333BF0052CD09 /* OCMArg.m */; };
|
||||
03B315C7146333BF0052CD09 /* OCMArg.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B3158E146333BF0052CD09 /* OCMArg.m */; };
|
||||
03B315C8146333BF0052CD09 /* OCMBlockCaller.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B3158F146333BF0052CD09 /* OCMBlockCaller.h */; };
|
||||
03B315C9146333BF0052CD09 /* OCMBlockCaller.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B3158F146333BF0052CD09 /* OCMBlockCaller.h */; };
|
||||
03B315CA146333BF0052CD09 /* OCMBlockCaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B31590146333BF0052CD09 /* OCMBlockCaller.m */; };
|
||||
03B315CC146333BF0052CD09 /* OCMBlockCaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B31590146333BF0052CD09 /* OCMBlockCaller.m */; };
|
||||
03B315CD146333BF0052CD09 /* OCMBoxedReturnValueProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B31591146333BF0052CD09 /* OCMBoxedReturnValueProvider.h */; };
|
||||
03B315CE146333BF0052CD09 /* OCMBoxedReturnValueProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B31591146333BF0052CD09 /* OCMBoxedReturnValueProvider.h */; };
|
||||
03B315CF146333BF0052CD09 /* OCMBoxedReturnValueProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B31592146333BF0052CD09 /* OCMBoxedReturnValueProvider.m */; };
|
||||
03B315D1146333BF0052CD09 /* OCMBoxedReturnValueProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B31592146333BF0052CD09 /* OCMBoxedReturnValueProvider.m */; };
|
||||
03B315D2146333BF0052CD09 /* OCMConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B31593146333BF0052CD09 /* OCMConstraint.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
03B315D3146333BF0052CD09 /* OCMConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B31593146333BF0052CD09 /* OCMConstraint.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
03B315D4146333BF0052CD09 /* OCMConstraint.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B31594146333BF0052CD09 /* OCMConstraint.m */; };
|
||||
03B315D6146333BF0052CD09 /* OCMConstraint.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B31594146333BF0052CD09 /* OCMConstraint.m */; };
|
||||
03B315D7146333BF0052CD09 /* OCMExceptionReturnValueProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B31595146333BF0052CD09 /* OCMExceptionReturnValueProvider.h */; };
|
||||
03B315D8146333BF0052CD09 /* OCMExceptionReturnValueProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B31595146333BF0052CD09 /* OCMExceptionReturnValueProvider.h */; };
|
||||
03B315D9146333BF0052CD09 /* OCMExceptionReturnValueProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B31596146333BF0052CD09 /* OCMExceptionReturnValueProvider.m */; };
|
||||
03B315DB146333BF0052CD09 /* OCMExceptionReturnValueProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B31596146333BF0052CD09 /* OCMExceptionReturnValueProvider.m */; };
|
||||
03B315DC146333BF0052CD09 /* OCMIndirectReturnValueProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B31597146333BF0052CD09 /* OCMIndirectReturnValueProvider.h */; };
|
||||
03B315DD146333BF0052CD09 /* OCMIndirectReturnValueProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B31597146333BF0052CD09 /* OCMIndirectReturnValueProvider.h */; };
|
||||
03B315DE146333BF0052CD09 /* OCMIndirectReturnValueProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B31598146333BF0052CD09 /* OCMIndirectReturnValueProvider.m */; };
|
||||
03B315E0146333BF0052CD09 /* OCMIndirectReturnValueProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B31598146333BF0052CD09 /* OCMIndirectReturnValueProvider.m */; };
|
||||
03B315E1146333BF0052CD09 /* OCMNotificationPoster.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B31599146333BF0052CD09 /* OCMNotificationPoster.h */; };
|
||||
03B315E2146333BF0052CD09 /* OCMNotificationPoster.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B31599146333BF0052CD09 /* OCMNotificationPoster.h */; };
|
||||
03B315E3146333BF0052CD09 /* OCMNotificationPoster.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B3159A146333BF0052CD09 /* OCMNotificationPoster.m */; };
|
||||
03B315E5146333BF0052CD09 /* OCMNotificationPoster.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B3159A146333BF0052CD09 /* OCMNotificationPoster.m */; };
|
||||
03B315E6146333BF0052CD09 /* OCMObserverRecorder.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B3159B146333BF0052CD09 /* OCMObserverRecorder.h */; };
|
||||
03B315E7146333BF0052CD09 /* OCMObserverRecorder.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B3159B146333BF0052CD09 /* OCMObserverRecorder.h */; };
|
||||
03B315E8146333BF0052CD09 /* OCMObserverRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B3159C146333BF0052CD09 /* OCMObserverRecorder.m */; };
|
||||
03B315EA146333BF0052CD09 /* OCMObserverRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B3159C146333BF0052CD09 /* OCMObserverRecorder.m */; };
|
||||
03B315EB146333C00052CD09 /* OCMockObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B3159D146333BF0052CD09 /* OCMockObject.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
03B315EC146333C00052CD09 /* OCMockObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B3159D146333BF0052CD09 /* OCMockObject.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
03B315ED146333C00052CD09 /* OCMockObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B3159E146333BF0052CD09 /* OCMockObject.m */; };
|
||||
03B315EF146333C00052CD09 /* OCMockObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B3159E146333BF0052CD09 /* OCMockObject.m */; };
|
||||
03B315F0146333C00052CD09 /* OCMockRecorder.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B3159F146333BF0052CD09 /* OCMockRecorder.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
03B315F1146333C00052CD09 /* OCMockRecorder.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B3159F146333BF0052CD09 /* OCMockRecorder.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
03B315F2146333C00052CD09 /* OCMockRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B315A0146333BF0052CD09 /* OCMockRecorder.m */; };
|
||||
03B315F4146333C00052CD09 /* OCMockRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B315A0146333BF0052CD09 /* OCMockRecorder.m */; };
|
||||
03B315F5146333C00052CD09 /* OCMPassByRefSetter.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B315A1146333BF0052CD09 /* OCMPassByRefSetter.h */; };
|
||||
03B315F6146333C00052CD09 /* OCMPassByRefSetter.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B315A1146333BF0052CD09 /* OCMPassByRefSetter.h */; };
|
||||
03B315F7146333C00052CD09 /* OCMPassByRefSetter.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B315A2146333BF0052CD09 /* OCMPassByRefSetter.m */; };
|
||||
03B315F9146333C00052CD09 /* OCMPassByRefSetter.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B315A2146333BF0052CD09 /* OCMPassByRefSetter.m */; };
|
||||
03B315FA146333C00052CD09 /* OCMRealObjectForwarder.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B315A3146333BF0052CD09 /* OCMRealObjectForwarder.h */; };
|
||||
03B315FB146333C00052CD09 /* OCMRealObjectForwarder.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B315A3146333BF0052CD09 /* OCMRealObjectForwarder.h */; };
|
||||
03B315FC146333C00052CD09 /* OCMRealObjectForwarder.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B315A4146333BF0052CD09 /* OCMRealObjectForwarder.m */; };
|
||||
03B315FE146333C00052CD09 /* OCMRealObjectForwarder.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B315A4146333BF0052CD09 /* OCMRealObjectForwarder.m */; };
|
||||
03B315FF146333C00052CD09 /* OCMReturnValueProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B315A5146333BF0052CD09 /* OCMReturnValueProvider.h */; };
|
||||
03B31600146333C00052CD09 /* OCMReturnValueProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B315A5146333BF0052CD09 /* OCMReturnValueProvider.h */; };
|
||||
03B31601146333C00052CD09 /* OCMReturnValueProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B315A6146333BF0052CD09 /* OCMReturnValueProvider.m */; };
|
||||
03B31603146333C00052CD09 /* OCMReturnValueProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B315A6146333BF0052CD09 /* OCMReturnValueProvider.m */; };
|
||||
03B31604146333C00052CD09 /* OCObserverMockObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B315A7146333BF0052CD09 /* OCObserverMockObject.h */; };
|
||||
03B31605146333C00052CD09 /* OCObserverMockObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B315A7146333BF0052CD09 /* OCObserverMockObject.h */; };
|
||||
03B31606146333C00052CD09 /* OCObserverMockObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B315A8146333BF0052CD09 /* OCObserverMockObject.m */; };
|
||||
03B31608146333C00052CD09 /* OCObserverMockObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B315A8146333BF0052CD09 /* OCObserverMockObject.m */; };
|
||||
03B31609146333C00052CD09 /* OCPartialMockObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B315A9146333BF0052CD09 /* OCPartialMockObject.h */; };
|
||||
03B3160A146333C00052CD09 /* OCPartialMockObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B315A9146333BF0052CD09 /* OCPartialMockObject.h */; };
|
||||
03B3160B146333C00052CD09 /* OCPartialMockObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B315AA146333BF0052CD09 /* OCPartialMockObject.m */; };
|
||||
03B3160D146333C00052CD09 /* OCPartialMockObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B315AA146333BF0052CD09 /* OCPartialMockObject.m */; };
|
||||
03B3160E146333C00052CD09 /* OCPartialMockRecorder.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B315AB146333BF0052CD09 /* OCPartialMockRecorder.h */; };
|
||||
03B3160F146333C00052CD09 /* OCPartialMockRecorder.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B315AB146333BF0052CD09 /* OCPartialMockRecorder.h */; };
|
||||
03B31610146333C00052CD09 /* OCPartialMockRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B315AC146333BF0052CD09 /* OCPartialMockRecorder.m */; };
|
||||
03B31612146333C00052CD09 /* OCPartialMockRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B315AC146333BF0052CD09 /* OCPartialMockRecorder.m */; };
|
||||
03B31613146333C00052CD09 /* OCProtocolMockObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B315AD146333BF0052CD09 /* OCProtocolMockObject.h */; };
|
||||
03B31614146333C00052CD09 /* OCProtocolMockObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B315AD146333BF0052CD09 /* OCProtocolMockObject.h */; };
|
||||
03B31615146333C00052CD09 /* OCProtocolMockObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B315AE146333BF0052CD09 /* OCProtocolMockObject.m */; };
|
||||
03B31617146333C00052CD09 /* OCProtocolMockObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B315AE146333BF0052CD09 /* OCProtocolMockObject.m */; };
|
||||
03B3162B1463350E0052CD09 /* NSInvocationOCMAdditionsTests.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B3161E1463350E0052CD09 /* NSInvocationOCMAdditionsTests.h */; };
|
||||
03B3162D1463350E0052CD09 /* NSInvocationOCMAdditionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B3161F1463350E0052CD09 /* NSInvocationOCMAdditionsTests.m */; };
|
||||
03B316301463350E0052CD09 /* OCMConstraintTests.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B316201463350E0052CD09 /* OCMConstraintTests.h */; };
|
||||
03B316321463350E0052CD09 /* OCMConstraintTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B316211463350E0052CD09 /* OCMConstraintTests.m */; };
|
||||
03B316351463350E0052CD09 /* OCMockObjectHamcrestTests.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B316221463350E0052CD09 /* OCMockObjectHamcrestTests.h */; };
|
||||
03B316371463350E0052CD09 /* OCMockObjectHamcrestTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 03B316231463350E0052CD09 /* OCMockObjectHamcrestTests.mm */; };
|
||||
03B3163A1463350E0052CD09 /* OCMockObjectTests.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B316241463350E0052CD09 /* OCMockObjectTests.h */; };
|
||||
03B3163C1463350E0052CD09 /* OCMockObjectTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B316251463350E0052CD09 /* OCMockObjectTests.m */; };
|
||||
03B3163F1463350E0052CD09 /* OCMockRecorderTests.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B316261463350E0052CD09 /* OCMockRecorderTests.h */; };
|
||||
03B316411463350E0052CD09 /* OCMockRecorderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B316271463350E0052CD09 /* OCMockRecorderTests.m */; };
|
||||
03B316441463350E0052CD09 /* OCObserverMockObjectTests.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B316281463350E0052CD09 /* OCObserverMockObjectTests.h */; };
|
||||
03B316461463350E0052CD09 /* OCObserverMockObjectTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B316291463350E0052CD09 /* OCObserverMockObjectTests.m */; };
|
||||
03B3168B14633A4F0052CD09 /* OCMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 030EF0B814632FD000B04273 /* OCMock.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
03B3168D14633B1D0052CD09 /* OCHamcrest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 03B3168C14633B1D0052CD09 /* OCHamcrest.framework */; };
|
||||
03B3168E14633D9C0052CD09 /* OCMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 030EF0B814632FD000B04273 /* OCMock.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
030EF0C414632FD000B04273 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 030EF09E14632FD000B04273 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 030EF0A714632FD000B04273;
|
||||
remoteInfo = OCMock;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
030EF0A814632FD000B04273 /* OCMock.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OCMock.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
030EF0B314632FD000B04273 /* OCMock-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "OCMock-Info.plist"; sourceTree = "<group>"; };
|
||||
030EF0B514632FD000B04273 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
030EF0B714632FD000B04273 /* OCMock-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "OCMock-Prefix.pch"; sourceTree = "<group>"; };
|
||||
030EF0B814632FD000B04273 /* OCMock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OCMock.h; sourceTree = "<group>"; };
|
||||
030EF0C014632FD000B04273 /* OCMockTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OCMockTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
030EF0C114632FD000B04273 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
|
||||
030EF0C914632FD000B04273 /* OCMockTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "OCMockTests-Info.plist"; sourceTree = "<group>"; };
|
||||
030EF0CB14632FD000B04273 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
030EF0DC14632FF700B04273 /* libOCMock.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libOCMock.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
030EF0E114632FF700B04273 /* OCMockLib-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "OCMockLib-Prefix.pch"; sourceTree = "<group>"; };
|
||||
033E1FF314FEF5E0004456B0 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
033E1FF614FEF60C004456B0 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
|
||||
0354D71E16F23AF5001766BB /* OCMockObjectForwardingTargetTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMockObjectForwardingTargetTests.h; sourceTree = "<group>"; };
|
||||
0354D71F16F23AF5001766BB /* OCMockObjectForwardingTargetTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMockObjectForwardingTargetTests.m; sourceTree = "<group>"; };
|
||||
039F91C416EFB493006C3D70 /* OCMockObjectClassMethodMockingTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMockObjectClassMethodMockingTests.h; sourceTree = "<group>"; };
|
||||
039F91C516EFB493006C3D70 /* OCMockObjectClassMethodMockingTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMockObjectClassMethodMockingTests.m; sourceTree = "<group>"; };
|
||||
03AC5C1316DF9FA500D82ECD /* OCMockObjectPartialMocksTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMockObjectPartialMocksTests.h; sourceTree = "<group>"; };
|
||||
03AC5C1416DF9FA500D82ECD /* OCMockObjectPartialMocksTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMockObjectPartialMocksTests.m; sourceTree = "<group>"; };
|
||||
03B31585146333BF0052CD09 /* NSInvocation+OCMAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSInvocation+OCMAdditions.h"; sourceTree = "<group>"; };
|
||||
03B31586146333BF0052CD09 /* NSInvocation+OCMAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSInvocation+OCMAdditions.m"; sourceTree = "<group>"; };
|
||||
03B31587146333BF0052CD09 /* NSMethodSignature+OCMAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMethodSignature+OCMAdditions.h"; sourceTree = "<group>"; };
|
||||
03B31588146333BF0052CD09 /* NSMethodSignature+OCMAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMethodSignature+OCMAdditions.m"; sourceTree = "<group>"; };
|
||||
03B31589146333BF0052CD09 /* NSNotificationCenter+OCMAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSNotificationCenter+OCMAdditions.h"; sourceTree = "<group>"; };
|
||||
03B3158A146333BF0052CD09 /* NSNotificationCenter+OCMAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSNotificationCenter+OCMAdditions.m"; sourceTree = "<group>"; };
|
||||
03B3158B146333BF0052CD09 /* OCClassMockObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCClassMockObject.h; sourceTree = "<group>"; };
|
||||
03B3158C146333BF0052CD09 /* OCClassMockObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCClassMockObject.m; sourceTree = "<group>"; };
|
||||
03B3158D146333BF0052CD09 /* OCMArg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMArg.h; sourceTree = "<group>"; };
|
||||
03B3158E146333BF0052CD09 /* OCMArg.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMArg.m; sourceTree = "<group>"; };
|
||||
03B3158F146333BF0052CD09 /* OCMBlockCaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMBlockCaller.h; sourceTree = "<group>"; };
|
||||
03B31590146333BF0052CD09 /* OCMBlockCaller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMBlockCaller.m; sourceTree = "<group>"; };
|
||||
03B31591146333BF0052CD09 /* OCMBoxedReturnValueProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMBoxedReturnValueProvider.h; sourceTree = "<group>"; };
|
||||
03B31592146333BF0052CD09 /* OCMBoxedReturnValueProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMBoxedReturnValueProvider.m; sourceTree = "<group>"; };
|
||||
03B31593146333BF0052CD09 /* OCMConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMConstraint.h; sourceTree = "<group>"; };
|
||||
03B31594146333BF0052CD09 /* OCMConstraint.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMConstraint.m; sourceTree = "<group>"; };
|
||||
03B31595146333BF0052CD09 /* OCMExceptionReturnValueProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMExceptionReturnValueProvider.h; sourceTree = "<group>"; };
|
||||
03B31596146333BF0052CD09 /* OCMExceptionReturnValueProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMExceptionReturnValueProvider.m; sourceTree = "<group>"; };
|
||||
03B31597146333BF0052CD09 /* OCMIndirectReturnValueProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMIndirectReturnValueProvider.h; sourceTree = "<group>"; };
|
||||
03B31598146333BF0052CD09 /* OCMIndirectReturnValueProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMIndirectReturnValueProvider.m; sourceTree = "<group>"; };
|
||||
03B31599146333BF0052CD09 /* OCMNotificationPoster.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMNotificationPoster.h; sourceTree = "<group>"; };
|
||||
03B3159A146333BF0052CD09 /* OCMNotificationPoster.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMNotificationPoster.m; sourceTree = "<group>"; };
|
||||
03B3159B146333BF0052CD09 /* OCMObserverRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMObserverRecorder.h; sourceTree = "<group>"; };
|
||||
03B3159C146333BF0052CD09 /* OCMObserverRecorder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMObserverRecorder.m; sourceTree = "<group>"; };
|
||||
03B3159D146333BF0052CD09 /* OCMockObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMockObject.h; sourceTree = "<group>"; };
|
||||
03B3159E146333BF0052CD09 /* OCMockObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMockObject.m; sourceTree = "<group>"; };
|
||||
03B3159F146333BF0052CD09 /* OCMockRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMockRecorder.h; sourceTree = "<group>"; };
|
||||
03B315A0146333BF0052CD09 /* OCMockRecorder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMockRecorder.m; sourceTree = "<group>"; };
|
||||
03B315A1146333BF0052CD09 /* OCMPassByRefSetter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMPassByRefSetter.h; sourceTree = "<group>"; };
|
||||
03B315A2146333BF0052CD09 /* OCMPassByRefSetter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMPassByRefSetter.m; sourceTree = "<group>"; };
|
||||
03B315A3146333BF0052CD09 /* OCMRealObjectForwarder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMRealObjectForwarder.h; sourceTree = "<group>"; };
|
||||
03B315A4146333BF0052CD09 /* OCMRealObjectForwarder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMRealObjectForwarder.m; sourceTree = "<group>"; };
|
||||
03B315A5146333BF0052CD09 /* OCMReturnValueProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMReturnValueProvider.h; sourceTree = "<group>"; };
|
||||
03B315A6146333BF0052CD09 /* OCMReturnValueProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMReturnValueProvider.m; sourceTree = "<group>"; };
|
||||
03B315A7146333BF0052CD09 /* OCObserverMockObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCObserverMockObject.h; sourceTree = "<group>"; };
|
||||
03B315A8146333BF0052CD09 /* OCObserverMockObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCObserverMockObject.m; sourceTree = "<group>"; };
|
||||
03B315A9146333BF0052CD09 /* OCPartialMockObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCPartialMockObject.h; sourceTree = "<group>"; };
|
||||
03B315AA146333BF0052CD09 /* OCPartialMockObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCPartialMockObject.m; sourceTree = "<group>"; };
|
||||
03B315AB146333BF0052CD09 /* OCPartialMockRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCPartialMockRecorder.h; sourceTree = "<group>"; };
|
||||
03B315AC146333BF0052CD09 /* OCPartialMockRecorder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCPartialMockRecorder.m; sourceTree = "<group>"; };
|
||||
03B315AD146333BF0052CD09 /* OCProtocolMockObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCProtocolMockObject.h; sourceTree = "<group>"; };
|
||||
03B315AE146333BF0052CD09 /* OCProtocolMockObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCProtocolMockObject.m; sourceTree = "<group>"; };
|
||||
03B3161E1463350E0052CD09 /* NSInvocationOCMAdditionsTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSInvocationOCMAdditionsTests.h; sourceTree = "<group>"; };
|
||||
03B3161F1463350E0052CD09 /* NSInvocationOCMAdditionsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSInvocationOCMAdditionsTests.m; sourceTree = "<group>"; };
|
||||
03B316201463350E0052CD09 /* OCMConstraintTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMConstraintTests.h; sourceTree = "<group>"; };
|
||||
03B316211463350E0052CD09 /* OCMConstraintTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMConstraintTests.m; sourceTree = "<group>"; };
|
||||
03B316221463350E0052CD09 /* OCMockObjectHamcrestTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMockObjectHamcrestTests.h; sourceTree = "<group>"; };
|
||||
03B316231463350E0052CD09 /* OCMockObjectHamcrestTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OCMockObjectHamcrestTests.mm; sourceTree = "<group>"; };
|
||||
03B316241463350E0052CD09 /* OCMockObjectTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMockObjectTests.h; sourceTree = "<group>"; };
|
||||
03B316251463350E0052CD09 /* OCMockObjectTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMockObjectTests.m; sourceTree = "<group>"; };
|
||||
03B316261463350E0052CD09 /* OCMockRecorderTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCMockRecorderTests.h; sourceTree = "<group>"; };
|
||||
03B316271463350E0052CD09 /* OCMockRecorderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCMockRecorderTests.m; sourceTree = "<group>"; };
|
||||
03B316281463350E0052CD09 /* OCObserverMockObjectTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCObserverMockObjectTests.h; sourceTree = "<group>"; };
|
||||
03B316291463350E0052CD09 /* OCObserverMockObjectTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCObserverMockObjectTests.m; sourceTree = "<group>"; };
|
||||
03B3168C14633B1D0052CD09 /* OCHamcrest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OCHamcrest.framework; path = "$(BUILT_PRODUCTS_DIR)/Debug/Frameworks/OCHamcrest.framework"; sourceTree = "<group>"; };
|
||||
03B3168F14633FAB0052CD09 /* Changes.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = Changes.txt; sourceTree = "<group>"; };
|
||||
03B3169014633FAB0052CD09 /* License.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = License.txt; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
030EF0A414632FD000B04273 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
033E1FF414FEF5E0004456B0 /* Foundation.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
030EF0BC14632FD000B04273 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
033E1FF514FEF5FC004456B0 /* Foundation.framework in Frameworks */,
|
||||
030EF0C214632FD000B04273 /* SenTestingKit.framework in Frameworks */,
|
||||
030EF0C614632FD000B04273 /* OCMock.framework in Frameworks */,
|
||||
03B3168D14633B1D0052CD09 /* OCHamcrest.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
030EF0D914632FF700B04273 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
033E1FF714FEF60C004456B0 /* Foundation.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
030EF09C14632FD000B04273 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
03B3168F14633FAB0052CD09 /* Changes.txt */,
|
||||
03B3169014633FAB0052CD09 /* License.txt */,
|
||||
030EF0B114632FD000B04273 /* OCMock */,
|
||||
030EF0C714632FD000B04273 /* OCMockTests */,
|
||||
030EF0DF14632FF700B04273 /* OCMockLib */,
|
||||
030EF0A914632FD000B04273 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
030EF0A914632FD000B04273 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
030EF0A814632FD000B04273 /* OCMock.framework */,
|
||||
030EF0C014632FD000B04273 /* OCMockTests.octest */,
|
||||
030EF0DC14632FF700B04273 /* libOCMock.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
030EF0AA14632FD000B04273 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
030EF0C114632FD000B04273 /* SenTestingKit.framework */,
|
||||
03B3168C14633B1D0052CD09 /* OCHamcrest.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
path = ..;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
030EF0B114632FD000B04273 /* OCMock */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
030EF0B814632FD000B04273 /* OCMock.h */,
|
||||
03B315841463334E0052CD09 /* Core Mocks */,
|
||||
03B3161C1463348F0052CD09 /* Partial Mocks */,
|
||||
03B3161B146334530052CD09 /* Observer Mocks */,
|
||||
03B3161A146334320052CD09 /* Argument Handling */,
|
||||
03B31618146333CA0052CD09 /* Foundation Additions */,
|
||||
030EF0B214632FD000B04273 /* Supporting Files */,
|
||||
033E1FF914FEF724004456B0 /* Frameworks */,
|
||||
);
|
||||
path = OCMock;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
030EF0B214632FD000B04273 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
030EF0B314632FD000B04273 /* OCMock-Info.plist */,
|
||||
030EF0B414632FD000B04273 /* InfoPlist.strings */,
|
||||
030EF0B714632FD000B04273 /* OCMock-Prefix.pch */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
030EF0C714632FD000B04273 /* OCMockTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
03B316241463350E0052CD09 /* OCMockObjectTests.h */,
|
||||
03B316251463350E0052CD09 /* OCMockObjectTests.m */,
|
||||
03AC5C1316DF9FA500D82ECD /* OCMockObjectPartialMocksTests.h */,
|
||||
03AC5C1416DF9FA500D82ECD /* OCMockObjectPartialMocksTests.m */,
|
||||
039F91C416EFB493006C3D70 /* OCMockObjectClassMethodMockingTests.h */,
|
||||
039F91C516EFB493006C3D70 /* OCMockObjectClassMethodMockingTests.m */,
|
||||
0354D71E16F23AF5001766BB /* OCMockObjectForwardingTargetTests.h */,
|
||||
0354D71F16F23AF5001766BB /* OCMockObjectForwardingTargetTests.m */,
|
||||
03B316221463350E0052CD09 /* OCMockObjectHamcrestTests.h */,
|
||||
03B316231463350E0052CD09 /* OCMockObjectHamcrestTests.mm */,
|
||||
03B316201463350E0052CD09 /* OCMConstraintTests.h */,
|
||||
03B316211463350E0052CD09 /* OCMConstraintTests.m */,
|
||||
03B316261463350E0052CD09 /* OCMockRecorderTests.h */,
|
||||
03B316271463350E0052CD09 /* OCMockRecorderTests.m */,
|
||||
03B316281463350E0052CD09 /* OCObserverMockObjectTests.h */,
|
||||
03B316291463350E0052CD09 /* OCObserverMockObjectTests.m */,
|
||||
03B3161E1463350E0052CD09 /* NSInvocationOCMAdditionsTests.h */,
|
||||
03B3161F1463350E0052CD09 /* NSInvocationOCMAdditionsTests.m */,
|
||||
030EF0C814632FD000B04273 /* Supporting Files */,
|
||||
030EF0AA14632FD000B04273 /* Frameworks */,
|
||||
);
|
||||
path = OCMockTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
030EF0C814632FD000B04273 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
030EF0C914632FD000B04273 /* OCMockTests-Info.plist */,
|
||||
030EF0CA14632FD000B04273 /* InfoPlist.strings */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
030EF0DF14632FF700B04273 /* OCMockLib */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
030EF0E014632FF700B04273 /* Supporting Files */,
|
||||
033E1FF814FEF6F4004456B0 /* Frameworks */,
|
||||
);
|
||||
path = OCMockLib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
030EF0E014632FF700B04273 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
030EF0E114632FF700B04273 /* OCMockLib-Prefix.pch */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
033E1FF814FEF6F4004456B0 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
033E1FF614FEF60C004456B0 /* Foundation.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
033E1FF914FEF724004456B0 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
033E1FF314FEF5E0004456B0 /* Foundation.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
03B315841463334E0052CD09 /* Core Mocks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
03B3159D146333BF0052CD09 /* OCMockObject.h */,
|
||||
03B3159E146333BF0052CD09 /* OCMockObject.m */,
|
||||
03B3158B146333BF0052CD09 /* OCClassMockObject.h */,
|
||||
03B3158C146333BF0052CD09 /* OCClassMockObject.m */,
|
||||
03B315AD146333BF0052CD09 /* OCProtocolMockObject.h */,
|
||||
03B315AE146333BF0052CD09 /* OCProtocolMockObject.m */,
|
||||
03B3159F146333BF0052CD09 /* OCMockRecorder.h */,
|
||||
03B315A0146333BF0052CD09 /* OCMockRecorder.m */,
|
||||
03B31619146334040052CD09 /* Invocation Handler */,
|
||||
);
|
||||
name = "Core Mocks";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
03B31618146333CA0052CD09 /* Foundation Additions */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
03B31585146333BF0052CD09 /* NSInvocation+OCMAdditions.h */,
|
||||
03B31586146333BF0052CD09 /* NSInvocation+OCMAdditions.m */,
|
||||
03B31587146333BF0052CD09 /* NSMethodSignature+OCMAdditions.h */,
|
||||
03B31588146333BF0052CD09 /* NSMethodSignature+OCMAdditions.m */,
|
||||
03B31589146333BF0052CD09 /* NSNotificationCenter+OCMAdditions.h */,
|
||||
03B3158A146333BF0052CD09 /* NSNotificationCenter+OCMAdditions.m */,
|
||||
);
|
||||
name = "Foundation Additions";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
03B31619146334040052CD09 /* Invocation Handler */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
03B3158F146333BF0052CD09 /* OCMBlockCaller.h */,
|
||||
03B31590146333BF0052CD09 /* OCMBlockCaller.m */,
|
||||
03B31591146333BF0052CD09 /* OCMBoxedReturnValueProvider.h */,
|
||||
03B31592146333BF0052CD09 /* OCMBoxedReturnValueProvider.m */,
|
||||
03B31595146333BF0052CD09 /* OCMExceptionReturnValueProvider.h */,
|
||||
03B31596146333BF0052CD09 /* OCMExceptionReturnValueProvider.m */,
|
||||
03B31597146333BF0052CD09 /* OCMIndirectReturnValueProvider.h */,
|
||||
03B31598146333BF0052CD09 /* OCMIndirectReturnValueProvider.m */,
|
||||
03B31599146333BF0052CD09 /* OCMNotificationPoster.h */,
|
||||
03B3159A146333BF0052CD09 /* OCMNotificationPoster.m */,
|
||||
03B315A5146333BF0052CD09 /* OCMReturnValueProvider.h */,
|
||||
03B315A6146333BF0052CD09 /* OCMReturnValueProvider.m */,
|
||||
);
|
||||
name = "Invocation Handler";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
03B3161A146334320052CD09 /* Argument Handling */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
03B3158D146333BF0052CD09 /* OCMArg.h */,
|
||||
03B3158E146333BF0052CD09 /* OCMArg.m */,
|
||||
03B31593146333BF0052CD09 /* OCMConstraint.h */,
|
||||
03B31594146333BF0052CD09 /* OCMConstraint.m */,
|
||||
03B315A1146333BF0052CD09 /* OCMPassByRefSetter.h */,
|
||||
03B315A2146333BF0052CD09 /* OCMPassByRefSetter.m */,
|
||||
);
|
||||
name = "Argument Handling";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
03B3161B146334530052CD09 /* Observer Mocks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
03B315A7146333BF0052CD09 /* OCObserverMockObject.h */,
|
||||
03B315A8146333BF0052CD09 /* OCObserverMockObject.m */,
|
||||
03B3159B146333BF0052CD09 /* OCMObserverRecorder.h */,
|
||||
03B3159C146333BF0052CD09 /* OCMObserverRecorder.m */,
|
||||
);
|
||||
name = "Observer Mocks";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
03B3161C1463348F0052CD09 /* Partial Mocks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
03B315A9146333BF0052CD09 /* OCPartialMockObject.h */,
|
||||
03B315AA146333BF0052CD09 /* OCPartialMockObject.m */,
|
||||
03B315AB146333BF0052CD09 /* OCPartialMockRecorder.h */,
|
||||
03B315AC146333BF0052CD09 /* OCPartialMockRecorder.m */,
|
||||
03B3161D146334AD0052CD09 /* Invocation Handler */,
|
||||
);
|
||||
name = "Partial Mocks";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
03B3161D146334AD0052CD09 /* Invocation Handler */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
03B315A3146333BF0052CD09 /* OCMRealObjectForwarder.h */,
|
||||
03B315A4146333BF0052CD09 /* OCMRealObjectForwarder.m */,
|
||||
);
|
||||
name = "Invocation Handler";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
030EF0A514632FD000B04273 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
03B3168B14633A4F0052CD09 /* OCMock.h in Headers */,
|
||||
03B315EB146333C00052CD09 /* OCMockObject.h in Headers */,
|
||||
03B315F0146333C00052CD09 /* OCMockRecorder.h in Headers */,
|
||||
03B315C3146333BF0052CD09 /* OCMArg.h in Headers */,
|
||||
03B315D2146333BF0052CD09 /* OCMConstraint.h in Headers */,
|
||||
03B315B9146333BF0052CD09 /* NSNotificationCenter+OCMAdditions.h in Headers */,
|
||||
03B315AF146333BF0052CD09 /* NSInvocation+OCMAdditions.h in Headers */,
|
||||
03B315B4146333BF0052CD09 /* NSMethodSignature+OCMAdditions.h in Headers */,
|
||||
03B315BE146333BF0052CD09 /* OCClassMockObject.h in Headers */,
|
||||
03B315C8146333BF0052CD09 /* OCMBlockCaller.h in Headers */,
|
||||
03B315CD146333BF0052CD09 /* OCMBoxedReturnValueProvider.h in Headers */,
|
||||
03B315D7146333BF0052CD09 /* OCMExceptionReturnValueProvider.h in Headers */,
|
||||
03B315DC146333BF0052CD09 /* OCMIndirectReturnValueProvider.h in Headers */,
|
||||
03B315E1146333BF0052CD09 /* OCMNotificationPoster.h in Headers */,
|
||||
03B315E6146333BF0052CD09 /* OCMObserverRecorder.h in Headers */,
|
||||
03B315F5146333C00052CD09 /* OCMPassByRefSetter.h in Headers */,
|
||||
03B315FA146333C00052CD09 /* OCMRealObjectForwarder.h in Headers */,
|
||||
03B315FF146333C00052CD09 /* OCMReturnValueProvider.h in Headers */,
|
||||
03B31604146333C00052CD09 /* OCObserverMockObject.h in Headers */,
|
||||
03B31609146333C00052CD09 /* OCPartialMockObject.h in Headers */,
|
||||
03B3160E146333C00052CD09 /* OCPartialMockRecorder.h in Headers */,
|
||||
03B31613146333C00052CD09 /* OCProtocolMockObject.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
030EF0DA14632FF700B04273 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
03B3168E14633D9C0052CD09 /* OCMock.h in Headers */,
|
||||
03B315EC146333C00052CD09 /* OCMockObject.h in Headers */,
|
||||
03B315F1146333C00052CD09 /* OCMockRecorder.h in Headers */,
|
||||
03B315C4146333BF0052CD09 /* OCMArg.h in Headers */,
|
||||
03B315D3146333BF0052CD09 /* OCMConstraint.h in Headers */,
|
||||
03B315BA146333BF0052CD09 /* NSNotificationCenter+OCMAdditions.h in Headers */,
|
||||
03B315B0146333BF0052CD09 /* NSInvocation+OCMAdditions.h in Headers */,
|
||||
03B315B5146333BF0052CD09 /* NSMethodSignature+OCMAdditions.h in Headers */,
|
||||
03B315BF146333BF0052CD09 /* OCClassMockObject.h in Headers */,
|
||||
03B315C9146333BF0052CD09 /* OCMBlockCaller.h in Headers */,
|
||||
03B315CE146333BF0052CD09 /* OCMBoxedReturnValueProvider.h in Headers */,
|
||||
03B315D8146333BF0052CD09 /* OCMExceptionReturnValueProvider.h in Headers */,
|
||||
03B315DD146333BF0052CD09 /* OCMIndirectReturnValueProvider.h in Headers */,
|
||||
03B315E2146333BF0052CD09 /* OCMNotificationPoster.h in Headers */,
|
||||
03B315E7146333BF0052CD09 /* OCMObserverRecorder.h in Headers */,
|
||||
03B315F6146333C00052CD09 /* OCMPassByRefSetter.h in Headers */,
|
||||
03B315FB146333C00052CD09 /* OCMRealObjectForwarder.h in Headers */,
|
||||
03B31600146333C00052CD09 /* OCMReturnValueProvider.h in Headers */,
|
||||
03B31605146333C00052CD09 /* OCObserverMockObject.h in Headers */,
|
||||
03B3160A146333C00052CD09 /* OCPartialMockObject.h in Headers */,
|
||||
03B3160F146333C00052CD09 /* OCPartialMockRecorder.h in Headers */,
|
||||
03B31614146333C00052CD09 /* OCProtocolMockObject.h in Headers */,
|
||||
03B3162B1463350E0052CD09 /* NSInvocationOCMAdditionsTests.h in Headers */,
|
||||
03B316301463350E0052CD09 /* OCMConstraintTests.h in Headers */,
|
||||
03B316351463350E0052CD09 /* OCMockObjectHamcrestTests.h in Headers */,
|
||||
03B3163A1463350E0052CD09 /* OCMockObjectTests.h in Headers */,
|
||||
03B3163F1463350E0052CD09 /* OCMockRecorderTests.h in Headers */,
|
||||
03B316441463350E0052CD09 /* OCObserverMockObjectTests.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
030EF0A714632FD000B04273 /* OCMock */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 030EF0D214632FD000B04273 /* Build configuration list for PBXNativeTarget "OCMock" */;
|
||||
buildPhases = (
|
||||
030EF0A314632FD000B04273 /* Sources */,
|
||||
030EF0A414632FD000B04273 /* Frameworks */,
|
||||
030EF0A514632FD000B04273 /* Headers */,
|
||||
030EF0A614632FD000B04273 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = OCMock;
|
||||
productName = OCMock;
|
||||
productReference = 030EF0A814632FD000B04273 /* OCMock.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
030EF0BF14632FD000B04273 /* OCMockTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 030EF0D514632FD000B04273 /* Build configuration list for PBXNativeTarget "OCMockTests" */;
|
||||
buildPhases = (
|
||||
03B3168A146338C10052CD09 /* ShellScript */,
|
||||
030EF0BB14632FD000B04273 /* Sources */,
|
||||
030EF0BC14632FD000B04273 /* Frameworks */,
|
||||
030EF0BD14632FD000B04273 /* Resources */,
|
||||
030EF0BE14632FD000B04273 /* ShellScript */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
030EF0C514632FD000B04273 /* PBXTargetDependency */,
|
||||
);
|
||||
name = OCMockTests;
|
||||
productName = OCMockTests;
|
||||
productReference = 030EF0C014632FD000B04273 /* OCMockTests.octest */;
|
||||
productType = "com.apple.product-type.bundle";
|
||||
};
|
||||
030EF0DB14632FF700B04273 /* OCMockLib */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 030EF0E514632FF700B04273 /* Build configuration list for PBXNativeTarget "OCMockLib" */;
|
||||
buildPhases = (
|
||||
030EF0D814632FF700B04273 /* Sources */,
|
||||
030EF0D914632FF700B04273 /* Frameworks */,
|
||||
030EF0DA14632FF700B04273 /* Headers */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = OCMockLib;
|
||||
productName = OCMockLib;
|
||||
productReference = 030EF0DC14632FF700B04273 /* libOCMock.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
030EF09E14632FD000B04273 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0460;
|
||||
ORGANIZATIONNAME = "Mulle Kybernetik";
|
||||
};
|
||||
buildConfigurationList = 030EF0A114632FD000B04273 /* Build configuration list for PBXProject "OCMock" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 030EF09C14632FD000B04273;
|
||||
productRefGroup = 030EF0A914632FD000B04273 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
030EF0A714632FD000B04273 /* OCMock */,
|
||||
030EF0BF14632FD000B04273 /* OCMockTests */,
|
||||
030EF0DB14632FF700B04273 /* OCMockLib */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
030EF0A614632FD000B04273 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
030EF0B614632FD000B04273 /* InfoPlist.strings in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
030EF0BD14632FD000B04273 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
030EF0CC14632FD000B04273 /* InfoPlist.strings in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
030EF0BE14632FD000B04273 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "# Run the unit tests in this test bundle.\nexport DYLD_FRAMEWORK_PATH=\"${TARGET_BUILD_DIR}/Frameworks\"\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n";
|
||||
};
|
||||
03B3168A146338C10052CD09 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "# Unpack frameworks required for this target\npushd \"${TARGET_BUILD_DIR}\"\nif [ ! -d Frameworks ]; then\nmkdir Frameworks\nfi\ncd Frameworks\nif [ ! -d OCHamcrest.framework ]; then\ngnutar xjf \"${PROJECT_DIR}/Frameworks/OCHamcrest.tar.bz2\"\nfi\npopd\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
030EF0A314632FD000B04273 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
03B315B1146333BF0052CD09 /* NSInvocation+OCMAdditions.m in Sources */,
|
||||
03B315B6146333BF0052CD09 /* NSMethodSignature+OCMAdditions.m in Sources */,
|
||||
03B315BB146333BF0052CD09 /* NSNotificationCenter+OCMAdditions.m in Sources */,
|
||||
03B315C0146333BF0052CD09 /* OCClassMockObject.m in Sources */,
|
||||
03B315C5146333BF0052CD09 /* OCMArg.m in Sources */,
|
||||
03B315CA146333BF0052CD09 /* OCMBlockCaller.m in Sources */,
|
||||
03B315CF146333BF0052CD09 /* OCMBoxedReturnValueProvider.m in Sources */,
|
||||
03B315D4146333BF0052CD09 /* OCMConstraint.m in Sources */,
|
||||
03B315D9146333BF0052CD09 /* OCMExceptionReturnValueProvider.m in Sources */,
|
||||
03B315DE146333BF0052CD09 /* OCMIndirectReturnValueProvider.m in Sources */,
|
||||
03B315E3146333BF0052CD09 /* OCMNotificationPoster.m in Sources */,
|
||||
03B315E8146333BF0052CD09 /* OCMObserverRecorder.m in Sources */,
|
||||
03B315ED146333C00052CD09 /* OCMockObject.m in Sources */,
|
||||
03B315F2146333C00052CD09 /* OCMockRecorder.m in Sources */,
|
||||
03B315F7146333C00052CD09 /* OCMPassByRefSetter.m in Sources */,
|
||||
03B315FC146333C00052CD09 /* OCMRealObjectForwarder.m in Sources */,
|
||||
03B31601146333C00052CD09 /* OCMReturnValueProvider.m in Sources */,
|
||||
03B31606146333C00052CD09 /* OCObserverMockObject.m in Sources */,
|
||||
03B3160B146333C00052CD09 /* OCPartialMockObject.m in Sources */,
|
||||
03B31610146333C00052CD09 /* OCPartialMockRecorder.m in Sources */,
|
||||
03B31615146333C00052CD09 /* OCProtocolMockObject.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
030EF0BB14632FD000B04273 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
03B3162D1463350E0052CD09 /* NSInvocationOCMAdditionsTests.m in Sources */,
|
||||
03B316321463350E0052CD09 /* OCMConstraintTests.m in Sources */,
|
||||
03B316371463350E0052CD09 /* OCMockObjectHamcrestTests.mm in Sources */,
|
||||
03B3163C1463350E0052CD09 /* OCMockObjectTests.m in Sources */,
|
||||
03B316411463350E0052CD09 /* OCMockRecorderTests.m in Sources */,
|
||||
03B316461463350E0052CD09 /* OCObserverMockObjectTests.m in Sources */,
|
||||
03AC5C1516DF9FA500D82ECD /* OCMockObjectPartialMocksTests.m in Sources */,
|
||||
039F91C616EFB493006C3D70 /* OCMockObjectClassMethodMockingTests.m in Sources */,
|
||||
0354D72016F23AF5001766BB /* OCMockObjectForwardingTargetTests.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
030EF0D814632FF700B04273 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
03B315B3146333BF0052CD09 /* NSInvocation+OCMAdditions.m in Sources */,
|
||||
03B315B8146333BF0052CD09 /* NSMethodSignature+OCMAdditions.m in Sources */,
|
||||
03B315BD146333BF0052CD09 /* NSNotificationCenter+OCMAdditions.m in Sources */,
|
||||
03B315C2146333BF0052CD09 /* OCClassMockObject.m in Sources */,
|
||||
03B315C7146333BF0052CD09 /* OCMArg.m in Sources */,
|
||||
03B315CC146333BF0052CD09 /* OCMBlockCaller.m in Sources */,
|
||||
03B315D1146333BF0052CD09 /* OCMBoxedReturnValueProvider.m in Sources */,
|
||||
03B315D6146333BF0052CD09 /* OCMConstraint.m in Sources */,
|
||||
03B315DB146333BF0052CD09 /* OCMExceptionReturnValueProvider.m in Sources */,
|
||||
03B315E0146333BF0052CD09 /* OCMIndirectReturnValueProvider.m in Sources */,
|
||||
03B315E5146333BF0052CD09 /* OCMNotificationPoster.m in Sources */,
|
||||
03B315EA146333BF0052CD09 /* OCMObserverRecorder.m in Sources */,
|
||||
03B315EF146333C00052CD09 /* OCMockObject.m in Sources */,
|
||||
03B315F4146333C00052CD09 /* OCMockRecorder.m in Sources */,
|
||||
03B315F9146333C00052CD09 /* OCMPassByRefSetter.m in Sources */,
|
||||
03B315FE146333C00052CD09 /* OCMRealObjectForwarder.m in Sources */,
|
||||
03B31603146333C00052CD09 /* OCMReturnValueProvider.m in Sources */,
|
||||
03B31608146333C00052CD09 /* OCObserverMockObject.m in Sources */,
|
||||
03B3160D146333C00052CD09 /* OCPartialMockObject.m in Sources */,
|
||||
03B31612146333C00052CD09 /* OCPartialMockRecorder.m in Sources */,
|
||||
03B31617146333C00052CD09 /* OCProtocolMockObject.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
030EF0C514632FD000B04273 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 030EF0A714632FD000B04273 /* OCMock */;
|
||||
targetProxy = 030EF0C414632FD000B04273 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
030EF0B414632FD000B04273 /* InfoPlist.strings */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
030EF0B514632FD000B04273 /* en */,
|
||||
);
|
||||
name = InfoPlist.strings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
030EF0CA14632FD000B04273 /* InfoPlist.strings */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
030EF0CB14632FD000B04273 /* en */,
|
||||
);
|
||||
name = InfoPlist.strings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
030EF0D014632FD000B04273 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||
CLANG_ENABLE_OBJC_ARC = NO;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.6;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
030EF0D114632FD000B04273 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||
CLANG_ENABLE_OBJC_ARC = NO;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.6;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
030EF0D314632FD000B04273 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
FRAMEWORK_VERSION = A;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "OCMock/OCMock-Prefix.pch";
|
||||
INFOPLIST_FILE = "OCMock/OCMock-Info.plist";
|
||||
LD_DYLIB_INSTALL_NAME = "@rpath/$(EXECUTABLE_PATH)";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SYSTEM_LIBRARY_DIR)/Frameworks/Foundation.framework/Versions/C\"",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = framework;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
030EF0D414632FD000B04273 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
FRAMEWORK_VERSION = A;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "OCMock/OCMock-Prefix.pch";
|
||||
INFOPLIST_FILE = "OCMock/OCMock-Info.plist";
|
||||
LD_DYLIB_INSTALL_NAME = "@rpath/$(EXECUTABLE_PATH)";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SYSTEM_LIBRARY_DIR)/Frameworks/Foundation.framework/Versions/C\"",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = framework;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
030EF0D614632FD000B04273 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"\"$(TARGET_BUILD_DIR)/Frameworks\"",
|
||||
"$(DEVELOPER_LIBRARY_DIR)/Frameworks",
|
||||
);
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "OCMock/OCMock-Prefix.pch";
|
||||
INFOPLIST_FILE = "OCMockTests/OCMockTests-Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../../../Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"${TARGET_BUILD_DIR}/Frameworks\"",
|
||||
"\"$(SYSTEM_LIBRARY_DIR)/Frameworks/Foundation.framework/Versions/C\"",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = octest;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
030EF0D714632FD000B04273 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"\"${TARGET_BUILD_DIR}/Frameworks\"",
|
||||
"$(DEVELOPER_LIBRARY_DIR)/Frameworks",
|
||||
);
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "OCMock/OCMock-Prefix.pch";
|
||||
INFOPLIST_FILE = "OCMockTests/OCMockTests-Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../../../Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"${TARGET_BUILD_DIR}/Frameworks",
|
||||
"\"$(SYSTEM_LIBRARY_DIR)/Frameworks/Foundation.framework/Versions/C\"",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = octest;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
030EF0E614632FF700B04273 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||
DSTROOT = /tmp/OCMockLib.dst;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "OCMockLib/OCMockLib-Prefix.pch";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SYSTEM_LIBRARY_DIR)/Frameworks/Foundation.framework/Versions/C\"",
|
||||
);
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = OCMock;
|
||||
PUBLIC_HEADERS_FOLDER_PATH = "$(PRODUCT_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
030EF0E714632FF700B04273 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||
DSTROOT = /tmp/OCMockLib.dst;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "OCMockLib/OCMockLib-Prefix.pch";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SYSTEM_LIBRARY_DIR)/Frameworks/Foundation.framework/Versions/C\"",
|
||||
);
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = OCMock;
|
||||
PUBLIC_HEADERS_FOLDER_PATH = "$(PRODUCT_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
030EF0A114632FD000B04273 /* Build configuration list for PBXProject "OCMock" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
030EF0D014632FD000B04273 /* Debug */,
|
||||
030EF0D114632FD000B04273 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
030EF0D214632FD000B04273 /* Build configuration list for PBXNativeTarget "OCMock" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
030EF0D314632FD000B04273 /* Debug */,
|
||||
030EF0D414632FD000B04273 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
030EF0D514632FD000B04273 /* Build configuration list for PBXNativeTarget "OCMockTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
030EF0D614632FD000B04273 /* Debug */,
|
||||
030EF0D714632FD000B04273 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
030EF0E514632FF700B04273 /* Build configuration list for PBXNativeTarget "OCMockLib" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
030EF0E614632FF700B04273 /* Debug */,
|
||||
030EF0E714632FF700B04273 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 030EF09E14632FD000B04273 /* Project object */;
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2006-2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSInvocation(OCMAdditions)
|
||||
|
||||
- (id)getArgumentAtIndexAsObject:(int)argIndex;
|
||||
|
||||
- (NSString *)invocationDescription;
|
||||
|
||||
- (NSString *)argumentDescriptionAtIndex:(int)argIndex;
|
||||
|
||||
- (NSString *)objectDescriptionAtIndex:(int)anInt;
|
||||
- (NSString *)charDescriptionAtIndex:(int)anInt;
|
||||
- (NSString *)unsignedCharDescriptionAtIndex:(int)anInt;
|
||||
- (NSString *)intDescriptionAtIndex:(int)anInt;
|
||||
- (NSString *)unsignedIntDescriptionAtIndex:(int)anInt;
|
||||
- (NSString *)shortDescriptionAtIndex:(int)anInt;
|
||||
- (NSString *)unsignedShortDescriptionAtIndex:(int)anInt;
|
||||
- (NSString *)longDescriptionAtIndex:(int)anInt;
|
||||
- (NSString *)unsignedLongDescriptionAtIndex:(int)anInt;
|
||||
- (NSString *)longLongDescriptionAtIndex:(int)anInt;
|
||||
- (NSString *)unsignedLongLongDescriptionAtIndex:(int)anInt;
|
||||
- (NSString *)doubleDescriptionAtIndex:(int)anInt;
|
||||
- (NSString *)floatDescriptionAtIndex:(int)anInt;
|
||||
- (NSString *)structDescriptionAtIndex:(int)anInt;
|
||||
- (NSString *)pointerDescriptionAtIndex:(int)anInt;
|
||||
- (NSString *)cStringDescriptionAtIndex:(int)anInt;
|
||||
- (NSString *)selectorDescriptionAtIndex:(int)anInt;
|
||||
|
||||
@end
|
||||
+337
@@ -0,0 +1,337 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2006-2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import "NSInvocation+OCMAdditions.h"
|
||||
|
||||
|
||||
@implementation NSInvocation(OCMAdditions)
|
||||
|
||||
- (id)getArgumentAtIndexAsObject:(int)argIndex
|
||||
{
|
||||
const char* argType;
|
||||
|
||||
argType = [[self methodSignature] getArgumentTypeAtIndex:argIndex];
|
||||
while(strchr("rnNoORV", argType[0]) != NULL)
|
||||
argType += 1;
|
||||
|
||||
if((strlen(argType) > 1) && (strchr("{^", argType[0]) == NULL) && (strcmp("@?", argType) != 0))
|
||||
[NSException raise:NSInvalidArgumentException format:@"Cannot handle argument type '%s'.", argType];
|
||||
|
||||
switch (argType[0])
|
||||
{
|
||||
case '#':
|
||||
case '@':
|
||||
{
|
||||
id value;
|
||||
[self getArgument:&value atIndex:argIndex];
|
||||
return value;
|
||||
}
|
||||
case ':':
|
||||
{
|
||||
SEL s = (SEL)0;
|
||||
[self getArgument:&s atIndex:argIndex];
|
||||
id value = NSStringFromSelector(s);
|
||||
return value;
|
||||
}
|
||||
case 'i':
|
||||
{
|
||||
int value;
|
||||
[self getArgument:&value atIndex:argIndex];
|
||||
return [NSNumber numberWithInt:value];
|
||||
}
|
||||
case 's':
|
||||
{
|
||||
short value;
|
||||
[self getArgument:&value atIndex:argIndex];
|
||||
return [NSNumber numberWithShort:value];
|
||||
}
|
||||
case 'l':
|
||||
{
|
||||
long value;
|
||||
[self getArgument:&value atIndex:argIndex];
|
||||
return [NSNumber numberWithLong:value];
|
||||
}
|
||||
case 'q':
|
||||
{
|
||||
long long value;
|
||||
[self getArgument:&value atIndex:argIndex];
|
||||
return [NSNumber numberWithLongLong:value];
|
||||
}
|
||||
case 'c':
|
||||
{
|
||||
char value;
|
||||
[self getArgument:&value atIndex:argIndex];
|
||||
return [NSNumber numberWithChar:value];
|
||||
}
|
||||
case 'C':
|
||||
{
|
||||
unsigned char value;
|
||||
[self getArgument:&value atIndex:argIndex];
|
||||
return [NSNumber numberWithUnsignedChar:value];
|
||||
}
|
||||
case 'I':
|
||||
{
|
||||
unsigned int value;
|
||||
[self getArgument:&value atIndex:argIndex];
|
||||
return [NSNumber numberWithUnsignedInt:value];
|
||||
}
|
||||
case 'S':
|
||||
{
|
||||
unsigned short value;
|
||||
[self getArgument:&value atIndex:argIndex];
|
||||
return [NSNumber numberWithUnsignedShort:value];
|
||||
}
|
||||
case 'L':
|
||||
{
|
||||
unsigned long value;
|
||||
[self getArgument:&value atIndex:argIndex];
|
||||
return [NSNumber numberWithUnsignedLong:value];
|
||||
}
|
||||
case 'Q':
|
||||
{
|
||||
unsigned long long value;
|
||||
[self getArgument:&value atIndex:argIndex];
|
||||
return [NSNumber numberWithUnsignedLongLong:value];
|
||||
}
|
||||
case 'f':
|
||||
{
|
||||
float value;
|
||||
[self getArgument:&value atIndex:argIndex];
|
||||
return [NSNumber numberWithFloat:value];
|
||||
}
|
||||
case 'd':
|
||||
{
|
||||
double value;
|
||||
[self getArgument:&value atIndex:argIndex];
|
||||
return [NSNumber numberWithDouble:value];
|
||||
}
|
||||
case 'B':
|
||||
{
|
||||
bool value;
|
||||
[self getArgument:&value atIndex:argIndex];
|
||||
return [NSNumber numberWithBool:value];
|
||||
}
|
||||
case '^':
|
||||
{
|
||||
void *value = NULL;
|
||||
[self getArgument:&value atIndex:argIndex];
|
||||
return [NSValue valueWithPointer:value];
|
||||
}
|
||||
case '{': // structure
|
||||
{
|
||||
NSUInteger maxArgSize = [[self methodSignature] frameLength];
|
||||
NSMutableData *argumentData = [[[NSMutableData alloc] initWithLength:maxArgSize] autorelease];
|
||||
[self getArgument:[argumentData mutableBytes] atIndex:argIndex];
|
||||
return [NSValue valueWithBytes:[argumentData bytes] objCType:argType];
|
||||
}
|
||||
|
||||
}
|
||||
[NSException raise:NSInvalidArgumentException format:@"Argument type '%s' not supported", argType];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *)invocationDescription
|
||||
{
|
||||
NSMethodSignature *methodSignature = [self methodSignature];
|
||||
NSUInteger numberOfArgs = [methodSignature numberOfArguments];
|
||||
|
||||
if (numberOfArgs == 2)
|
||||
return NSStringFromSelector([self selector]);
|
||||
|
||||
NSArray *selectorParts = [NSStringFromSelector([self selector]) componentsSeparatedByString:@":"];
|
||||
NSMutableString *description = [[NSMutableString alloc] init];
|
||||
unsigned int i;
|
||||
for(i = 2; i < numberOfArgs; i++)
|
||||
{
|
||||
[description appendFormat:@"%@%@:", (i > 2 ? @" " : @""), [selectorParts objectAtIndex:(i - 2)]];
|
||||
[description appendString:[self argumentDescriptionAtIndex:i]];
|
||||
}
|
||||
|
||||
return [description autorelease];
|
||||
}
|
||||
|
||||
- (NSString *)argumentDescriptionAtIndex:(int)argIndex
|
||||
{
|
||||
const char *argType = [[self methodSignature] getArgumentTypeAtIndex:argIndex];
|
||||
if(strchr("rnNoORV", argType[0]) != NULL)
|
||||
argType += 1;
|
||||
|
||||
switch(*argType)
|
||||
{
|
||||
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:argIndex];
|
||||
case '*': return [self cStringDescriptionAtIndex:argIndex];
|
||||
case ':': return [self selectorDescriptionAtIndex:argIndex];
|
||||
default: return [@"<??" stringByAppendingString:@">"]; // avoid confusion with trigraphs...
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (NSString *)objectDescriptionAtIndex:(int)anInt
|
||||
{
|
||||
id object;
|
||||
|
||||
[self getArgument:&object atIndex:anInt];
|
||||
if (object == nil)
|
||||
return @"nil";
|
||||
else if(![object isProxy] && [object isKindOfClass:[NSString class]])
|
||||
return [NSString stringWithFormat:@"@\"%@\"", [object description]];
|
||||
else
|
||||
return [object description];
|
||||
}
|
||||
|
||||
- (NSString *)charDescriptionAtIndex:(int)anInt
|
||||
{
|
||||
unsigned char buffer[128];
|
||||
memset(buffer, 0x0, 128);
|
||||
|
||||
[self getArgument:&buffer atIndex:anInt];
|
||||
|
||||
// If there's only one character in the buffer, and it's 0 or 1, then we have a BOOL
|
||||
if (buffer[1] == '\0' && (buffer[0] == 0 || buffer[0] == 1))
|
||||
return [NSString stringWithFormat:@"%@", (buffer[0] == 1 ? @"YES" : @"NO")];
|
||||
else
|
||||
return [NSString stringWithFormat:@"'%c'", *buffer];
|
||||
}
|
||||
|
||||
- (NSString *)unsignedCharDescriptionAtIndex:(int)anInt
|
||||
{
|
||||
unsigned char buffer[128];
|
||||
memset(buffer, 0x0, 128);
|
||||
|
||||
[self getArgument:&buffer atIndex:anInt];
|
||||
return [NSString stringWithFormat:@"'%c'", *buffer];
|
||||
}
|
||||
|
||||
- (NSString *)intDescriptionAtIndex:(int)anInt
|
||||
{
|
||||
int intValue;
|
||||
|
||||
[self getArgument:&intValue atIndex:anInt];
|
||||
return [NSString stringWithFormat:@"%d", intValue];
|
||||
}
|
||||
|
||||
- (NSString *)unsignedIntDescriptionAtIndex:(int)anInt
|
||||
{
|
||||
unsigned int intValue;
|
||||
|
||||
[self getArgument:&intValue atIndex:anInt];
|
||||
return [NSString stringWithFormat:@"%d", intValue];
|
||||
}
|
||||
|
||||
- (NSString *)shortDescriptionAtIndex:(int)anInt
|
||||
{
|
||||
short shortValue;
|
||||
|
||||
[self getArgument:&shortValue atIndex:anInt];
|
||||
return [NSString stringWithFormat:@"%hi", shortValue];
|
||||
}
|
||||
|
||||
- (NSString *)unsignedShortDescriptionAtIndex:(int)anInt
|
||||
{
|
||||
unsigned short shortValue;
|
||||
|
||||
[self getArgument:&shortValue atIndex:anInt];
|
||||
return [NSString stringWithFormat:@"%hu", shortValue];
|
||||
}
|
||||
|
||||
- (NSString *)longDescriptionAtIndex:(int)anInt
|
||||
{
|
||||
long longValue;
|
||||
|
||||
[self getArgument:&longValue atIndex:anInt];
|
||||
return [NSString stringWithFormat:@"%ld", longValue];
|
||||
}
|
||||
|
||||
- (NSString *)unsignedLongDescriptionAtIndex:(int)anInt
|
||||
{
|
||||
unsigned long longValue;
|
||||
|
||||
[self getArgument:&longValue atIndex:anInt];
|
||||
return [NSString stringWithFormat:@"%lu", longValue];
|
||||
}
|
||||
|
||||
- (NSString *)longLongDescriptionAtIndex:(int)anInt
|
||||
{
|
||||
long long longLongValue;
|
||||
|
||||
[self getArgument:&longLongValue atIndex:anInt];
|
||||
return [NSString stringWithFormat:@"%qi", longLongValue];
|
||||
}
|
||||
|
||||
- (NSString *)unsignedLongLongDescriptionAtIndex:(int)anInt
|
||||
{
|
||||
unsigned long long longLongValue;
|
||||
|
||||
[self getArgument:&longLongValue atIndex:anInt];
|
||||
return [NSString stringWithFormat:@"%qu", longLongValue];
|
||||
}
|
||||
|
||||
- (NSString *)doubleDescriptionAtIndex:(int)anInt;
|
||||
{
|
||||
double doubleValue;
|
||||
|
||||
[self getArgument:&doubleValue atIndex:anInt];
|
||||
return [NSString stringWithFormat:@"%f", doubleValue];
|
||||
}
|
||||
|
||||
- (NSString *)floatDescriptionAtIndex:(int)anInt
|
||||
{
|
||||
float floatValue;
|
||||
|
||||
[self getArgument:&floatValue atIndex:anInt];
|
||||
return [NSString stringWithFormat:@"%f", floatValue];
|
||||
}
|
||||
|
||||
- (NSString *)structDescriptionAtIndex:(int)anInt;
|
||||
{
|
||||
void *buffer;
|
||||
|
||||
[self getArgument:&buffer atIndex:anInt];
|
||||
return [NSString stringWithFormat:@":(struct)%p", buffer];
|
||||
}
|
||||
|
||||
- (NSString *)pointerDescriptionAtIndex:(int)anInt
|
||||
{
|
||||
void *buffer;
|
||||
|
||||
[self getArgument:&buffer atIndex:anInt];
|
||||
return [NSString stringWithFormat:@"%p", buffer];
|
||||
}
|
||||
|
||||
- (NSString *)cStringDescriptionAtIndex:(int)anInt
|
||||
{
|
||||
char buffer[128];
|
||||
|
||||
memset(buffer, 0x0, 128);
|
||||
|
||||
[self getArgument:&buffer atIndex:anInt];
|
||||
return [NSString stringWithFormat:@"\"%s\"", buffer];
|
||||
}
|
||||
|
||||
- (NSString *)selectorDescriptionAtIndex:(int)anInt
|
||||
{
|
||||
SEL selectorValue;
|
||||
|
||||
[self getArgument:&selectorValue atIndex:anInt];
|
||||
return [NSString stringWithFormat:@"@selector(%@)", NSStringFromSelector(selectorValue)];
|
||||
}
|
||||
|
||||
@end
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSMethodSignature(PrivateAPI)
|
||||
|
||||
+ (id)signatureWithObjCTypes:(const char *)types;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSMethodSignature(OCMAdditions)
|
||||
|
||||
- (const char *)methodReturnTypeWithoutQualifiers;
|
||||
|
||||
@end
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import "NSMethodSignature+OCMAdditions.h"
|
||||
|
||||
|
||||
@implementation NSMethodSignature(OCMAdditions)
|
||||
|
||||
- (const char *)methodReturnTypeWithoutQualifiers
|
||||
{
|
||||
const char *returnType = [self methodReturnType];
|
||||
while(strchr("rnNoORV", returnType[0]) != NULL)
|
||||
returnType += 1;
|
||||
return returnType;
|
||||
}
|
||||
|
||||
@end
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class OCMockObserver;
|
||||
|
||||
|
||||
@interface NSNotificationCenter(OCMAdditions)
|
||||
|
||||
- (void)addMockObserver:(OCMockObserver *)notificationObserver name:(NSString *)notificationName object:(id)notificationSender;
|
||||
|
||||
@end
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import "NSNotificationCenter+OCMAdditions.h"
|
||||
#import "OCObserverMockObject.h"
|
||||
|
||||
|
||||
@implementation NSNotificationCenter(OCMAdditions)
|
||||
|
||||
- (void)addMockObserver:(OCMockObserver *)notificationObserver name:(NSString *)notificationName object:(id)notificationSender
|
||||
{
|
||||
[self addObserver:notificationObserver selector:@selector(handleNotification:) name:notificationName object:notificationSender];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,21 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2005-2013 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <OCMock/OCMockObject.h>
|
||||
|
||||
@interface OCClassMockObject : OCMockObject
|
||||
{
|
||||
Class mockedClass;
|
||||
NSMutableDictionary *replacedClassMethods;
|
||||
}
|
||||
|
||||
- (id)initWithClass:(Class)aClass;
|
||||
|
||||
- (Class)mockedClass;
|
||||
|
||||
- (void)setupClassForClassMethodMocking;
|
||||
- (void)setupForwarderForClassMethodSelector:(SEL)selector;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,160 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2005-2013 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <objc/runtime.h>
|
||||
#import "OCClassMockObject.h"
|
||||
|
||||
|
||||
@implementation OCClassMockObject
|
||||
|
||||
#pragma mark Mock table
|
||||
|
||||
static NSMutableDictionary *mockTable;
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if(self == [OCClassMockObject class])
|
||||
mockTable = [[NSMutableDictionary alloc] init];
|
||||
}
|
||||
|
||||
+ (void)rememberMock:(OCClassMockObject *)mock forClass:(Class)aClass
|
||||
{
|
||||
@synchronized(mockTable)
|
||||
{
|
||||
[mockTable setObject:[NSValue valueWithNonretainedObject:mock] forKey:[NSValue valueWithNonretainedObject:aClass]];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)forgetMockForClass:(Class)aClass
|
||||
{
|
||||
@synchronized(mockTable)
|
||||
{
|
||||
[mockTable removeObjectForKey:[NSValue valueWithNonretainedObject:aClass]];
|
||||
}
|
||||
}
|
||||
|
||||
+ (OCClassMockObject *)existingMockForClass:(Class)aClass
|
||||
{
|
||||
@synchronized(mockTable)
|
||||
{
|
||||
OCClassMockObject *mock = [[mockTable objectForKey:[NSValue valueWithNonretainedObject:aClass]] nonretainedObjectValue];
|
||||
if(mock == nil)
|
||||
[NSException raise:NSInternalInconsistencyException format:@"No mock for class %p", aClass];
|
||||
return mock;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark Initialisers, description, accessors, etc.
|
||||
|
||||
- (id)initWithClass:(Class)aClass
|
||||
{
|
||||
[super init];
|
||||
mockedClass = aClass;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
if(replacedClassMethods != nil)
|
||||
{
|
||||
[self stopMocking];
|
||||
[[self class] forgetMockForClass:mockedClass];
|
||||
[replacedClassMethods release];
|
||||
}
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"OCMockObject[%@]", NSStringFromClass(mockedClass)];
|
||||
}
|
||||
|
||||
- (Class)mockedClass
|
||||
{
|
||||
return mockedClass;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Class method mocking
|
||||
|
||||
- (void)setupClassForClassMethodMocking
|
||||
{
|
||||
if(replacedClassMethods != nil)
|
||||
return;
|
||||
|
||||
replacedClassMethods = [[NSMutableDictionary alloc] init];
|
||||
[[self class] rememberMock:self forClass:mockedClass];
|
||||
|
||||
Method myForwardInvocationMethod = class_getInstanceMethod([self class], @selector(forwardInvocationForClassObject:));
|
||||
IMP myForwardInvocationImp = method_getImplementation(myForwardInvocationMethod);
|
||||
const char *forwardInvocationTypes = method_getTypeEncoding(myForwardInvocationMethod);
|
||||
Class metaClass = objc_getMetaClass(class_getName(mockedClass));
|
||||
|
||||
IMP replacedForwardInvocationImp = class_replaceMethod(metaClass, @selector(forwardInvocation:), myForwardInvocationImp, forwardInvocationTypes);
|
||||
|
||||
[replacedClassMethods setObject:[NSValue valueWithPointer:replacedForwardInvocationImp] forKey:NSStringFromSelector(@selector(forwardInvocation:))];
|
||||
}
|
||||
|
||||
- (void)setupForwarderForClassMethodSelector:(SEL)selector
|
||||
{
|
||||
Method originalMethod = class_getClassMethod(mockedClass, selector);
|
||||
Class metaClass = objc_getMetaClass(class_getName(mockedClass));
|
||||
|
||||
IMP forwarderImp = [metaClass instanceMethodForSelector:@selector(aMethodThatMustNotExist)];
|
||||
IMP replacedMethod = class_replaceMethod(metaClass, method_getName(originalMethod), forwarderImp, method_getTypeEncoding(originalMethod));
|
||||
|
||||
[replacedClassMethods setObject:[NSValue valueWithPointer:replacedMethod] forKey:NSStringFromSelector(selector)];
|
||||
}
|
||||
|
||||
- (void)removeForwarderForClassMethodSelector:(SEL)selector
|
||||
{
|
||||
Class metaClass = objc_getMetaClass(class_getName(mockedClass));
|
||||
NSValue *originalMethodPointer = [replacedClassMethods objectForKey:NSStringFromSelector(selector)];
|
||||
IMP originalMethod = [originalMethodPointer pointerValue];
|
||||
if(originalMethod) {
|
||||
class_replaceMethod(metaClass, selector, originalMethod, 0);
|
||||
} else {
|
||||
IMP forwarderImp = [metaClass instanceMethodForSelector:@selector(aMethodThatMustNotExist)];
|
||||
class_replaceMethod(metaClass, selector, forwarderImp, 0);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)forwardInvocationForClassObject:(NSInvocation *)anInvocation
|
||||
{
|
||||
// in here "self" is a reference to the real class, not the mock
|
||||
OCClassMockObject *mock = [OCClassMockObject existingMockForClass:(Class)self];
|
||||
if([mock handleInvocation:anInvocation] == NO)
|
||||
{
|
||||
// if mock doesn't want to handle the invocation, maybe all expects have occurred, we remove the forwarder and try again
|
||||
[mock removeForwarderForClassMethodSelector:[anInvocation selector]];
|
||||
[anInvocation invoke];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)stopMocking
|
||||
{
|
||||
for(NSString *replacedMethod in replacedClassMethods)
|
||||
[self removeForwarderForClassMethodSelector:NSSelectorFromString(replacedMethod)];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Proxy API
|
||||
|
||||
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
|
||||
{
|
||||
return [mockedClass instanceMethodSignatureForSelector:aSelector];
|
||||
}
|
||||
|
||||
- (BOOL)respondsToSelector:(SEL)selector
|
||||
{
|
||||
return [mockedClass instancesRespondToSelector:selector];
|
||||
}
|
||||
|
||||
- (BOOL)isKindOfClass:(Class)aClass
|
||||
{
|
||||
return [mockedClass isSubclassOfClass:aClass];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,34 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009-2013 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface OCMArg : NSObject
|
||||
|
||||
// constraining arguments
|
||||
|
||||
+ (id)any;
|
||||
+ (void *)anyPointer;
|
||||
+ (id)isNil;
|
||||
+ (id)isNotNil;
|
||||
+ (id)isNotEqual:(id)value;
|
||||
+ (id)checkWithSelector:(SEL)selector onObject:(id)anObject;
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
+ (id)checkWithBlock:(BOOL (^)(id obj))block;
|
||||
#endif
|
||||
|
||||
// manipulating arguments
|
||||
|
||||
+ (id *)setTo:(id)value;
|
||||
+ (void *)setToValue:(NSValue *)value;
|
||||
|
||||
// internal use only
|
||||
|
||||
+ (id)resolveSpecialValues:(NSValue *)value;
|
||||
|
||||
@end
|
||||
|
||||
#define OCMOCK_ANY [OCMArg any]
|
||||
#define OCMOCK_VALUE(variable) [NSValue value:&variable withObjCType:@encode(__typeof__(variable))]
|
||||
@@ -0,0 +1,79 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009-2013 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <objc/runtime.h>
|
||||
#import <OCMock/OCMArg.h>
|
||||
#import <OCMock/OCMConstraint.h>
|
||||
#import "OCMPassByRefSetter.h"
|
||||
#import "OCMConstraint.h"
|
||||
|
||||
@implementation OCMArg
|
||||
|
||||
+ (id)any
|
||||
{
|
||||
return [OCMAnyConstraint constraint];
|
||||
}
|
||||
|
||||
+ (void *)anyPointer
|
||||
{
|
||||
return (void *)0x01234567;
|
||||
}
|
||||
|
||||
+ (id)isNil
|
||||
{
|
||||
return [OCMIsNilConstraint constraint];
|
||||
}
|
||||
|
||||
+ (id)isNotNil
|
||||
{
|
||||
return [OCMIsNotNilConstraint constraint];
|
||||
}
|
||||
|
||||
+ (id)isNotEqual:(id)value
|
||||
{
|
||||
OCMIsNotEqualConstraint *constraint = [OCMIsNotEqualConstraint constraint];
|
||||
constraint->testValue = value;
|
||||
return constraint;
|
||||
}
|
||||
|
||||
+ (id)checkWithSelector:(SEL)selector onObject:(id)anObject
|
||||
{
|
||||
return [OCMConstraint constraintWithSelector:selector onObject:anObject];
|
||||
}
|
||||
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
|
||||
+ (id)checkWithBlock:(BOOL (^)(id))block
|
||||
{
|
||||
return [[[OCMBlockConstraint alloc] initWithConstraintBlock:block] autorelease];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+ (id *)setTo:(id)value
|
||||
{
|
||||
return (id *)[[[OCMPassByRefSetter alloc] initWithValue:value] autorelease];
|
||||
}
|
||||
|
||||
+ (void *)setToValue:(NSValue *)value
|
||||
{
|
||||
return (id *)[[[OCMPassByRefSetter alloc] initWithValue:value] autorelease];
|
||||
}
|
||||
|
||||
+ (id)resolveSpecialValues:(NSValue *)value
|
||||
{
|
||||
const char *type = [value objCType];
|
||||
if(type[0] == '^')
|
||||
{
|
||||
void *pointer = [value pointerValue];
|
||||
if(pointer == (void *)0x01234567)
|
||||
return [OCMArg any];
|
||||
if((pointer != NULL) && (object_getClass((id)pointer) == [OCMPassByRefSetter class]))
|
||||
return (id)pointer;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,21 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2010 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
|
||||
@interface OCMBlockCaller : NSObject
|
||||
{
|
||||
void (^block)(NSInvocation *);
|
||||
}
|
||||
|
||||
- (id)initWithCallBlock:(void (^)(NSInvocation *))theBlock;
|
||||
|
||||
- (void)handleInvocation:(NSInvocation *)anInvocation;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,32 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2010 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import "OCMBlockCaller.h"
|
||||
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
|
||||
@implementation OCMBlockCaller
|
||||
|
||||
-(id)initWithCallBlock:(void (^)(NSInvocation *))theBlock
|
||||
{
|
||||
self = [super init];
|
||||
block = [theBlock copy];
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)dealloc
|
||||
{
|
||||
[block release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)handleInvocation:(NSInvocation *)anInvocation
|
||||
{
|
||||
block(anInvocation);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import "OCMReturnValueProvider.h"
|
||||
|
||||
@interface OCMBoxedReturnValueProvider : OCMReturnValueProvider
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import "OCMBoxedReturnValueProvider.h"
|
||||
|
||||
|
||||
@implementation OCMBoxedReturnValueProvider
|
||||
|
||||
- (void)handleInvocation:(NSInvocation *)anInvocation
|
||||
{
|
||||
if(strcmp([[anInvocation methodSignature] methodReturnType], [(NSValue *)returnValue objCType]) != 0)
|
||||
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:[NSString stringWithFormat:@"Return value does not match method signature; signature declares '%s' but value is '%s'.", [[anInvocation methodSignature] methodReturnType], [(NSValue *)returnValue objCType]] userInfo:nil];
|
||||
void *buffer = malloc([[anInvocation methodSignature] methodReturnLength]);
|
||||
[returnValue getValue:buffer];
|
||||
[anInvocation setReturnValue:buffer];
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,64 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2007-2010 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@interface OCMConstraint : NSObject
|
||||
|
||||
+ (id)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;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@interface OCMAnyConstraint : OCMConstraint
|
||||
@end
|
||||
|
||||
@interface OCMIsNilConstraint : OCMConstraint
|
||||
@end
|
||||
|
||||
@interface OCMIsNotNilConstraint : OCMConstraint
|
||||
@end
|
||||
|
||||
@interface OCMIsNotEqualConstraint : OCMConstraint
|
||||
{
|
||||
@public
|
||||
id testValue;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface OCMInvocationConstraint : OCMConstraint
|
||||
{
|
||||
@public
|
||||
NSInvocation *invocation;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
|
||||
@interface OCMBlockConstraint : OCMConstraint
|
||||
{
|
||||
BOOL (^block)(id);
|
||||
}
|
||||
|
||||
- (id)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)]
|
||||
@@ -0,0 +1,142 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2007-2010 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <OCMock/OCMConstraint.h>
|
||||
|
||||
|
||||
@implementation OCMConstraint
|
||||
|
||||
+ (id)constraint
|
||||
{
|
||||
return [[[self alloc] init] autorelease];
|
||||
}
|
||||
|
||||
- (BOOL)evaluate:(id)value
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
+ (id)constraintWithSelector:(SEL)aSelector onObject:(id)anObject
|
||||
{
|
||||
OCMInvocationConstraint *constraint = [OCMInvocationConstraint constraint];
|
||||
NSMethodSignature *signature = [anObject methodSignatureForSelector:aSelector];
|
||||
if(signature == nil)
|
||||
[NSException raise:NSInvalidArgumentException format:@"Unkown selector %@ used in constraint.", NSStringFromSelector(aSelector)];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setTarget:anObject];
|
||||
[invocation setSelector:aSelector];
|
||||
constraint->invocation = invocation;
|
||||
return constraint;
|
||||
}
|
||||
|
||||
+ (id)constraintWithSelector:(SEL)aSelector onObject:(id)anObject withValue:(id)aValue
|
||||
{
|
||||
OCMInvocationConstraint *constraint = [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];
|
||||
return constraint;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@implementation OCMAnyConstraint
|
||||
|
||||
- (BOOL)evaluate:(id)value
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@implementation OCMIsNilConstraint
|
||||
|
||||
- (BOOL)evaluate:(id)value
|
||||
{
|
||||
return value == nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@implementation OCMIsNotNilConstraint
|
||||
|
||||
- (BOOL)evaluate:(id)value
|
||||
{
|
||||
return value != nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@implementation OCMIsNotEqualConstraint
|
||||
|
||||
- (BOOL)evaluate:(id)value
|
||||
{
|
||||
return ![value isEqual:testValue];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@implementation OCMInvocationConstraint
|
||||
|
||||
- (BOOL)evaluate:(id)value
|
||||
{
|
||||
[invocation setArgument:&value atIndex:2]; // should test if constraint takes arg
|
||||
[invocation invoke];
|
||||
BOOL returnValue;
|
||||
[invocation getReturnValue:&returnValue];
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
|
||||
@implementation OCMBlockConstraint
|
||||
|
||||
- (id)initWithConstraintBlock:(BOOL (^)(id))aBlock;
|
||||
{
|
||||
self = [super init];
|
||||
block = [aBlock copy];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[block release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (BOOL)evaluate:(id)value
|
||||
{
|
||||
return block(value);
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import "OCMReturnValueProvider.h"
|
||||
|
||||
@interface OCMExceptionReturnValueProvider : OCMReturnValueProvider
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import "OCMExceptionReturnValueProvider.h"
|
||||
|
||||
|
||||
@implementation OCMExceptionReturnValueProvider
|
||||
|
||||
- (void)handleInvocation:(NSInvocation *)anInvocation
|
||||
{
|
||||
@throw returnValue;
|
||||
}
|
||||
|
||||
@end
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface OCMIndirectReturnValueProvider : NSObject
|
||||
{
|
||||
id provider;
|
||||
SEL selector;
|
||||
}
|
||||
|
||||
- (id)initWithProvider:(id)aProvider andSelector:(SEL)aSelector;
|
||||
|
||||
- (void)handleInvocation:(NSInvocation *)anInvocation;
|
||||
|
||||
@end
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import "NSMethodSignature+OCMAdditions.h"
|
||||
#import "OCMIndirectReturnValueProvider.h"
|
||||
|
||||
|
||||
@implementation OCMIndirectReturnValueProvider
|
||||
|
||||
- (id)initWithProvider:(id)aProvider andSelector:(SEL)aSelector
|
||||
{
|
||||
self = [super init];
|
||||
provider = [aProvider retain];
|
||||
selector = aSelector;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[provider release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)handleInvocation:(NSInvocation *)anInvocation
|
||||
{
|
||||
[anInvocation setTarget:provider];
|
||||
[anInvocation setSelector:selector];
|
||||
[anInvocation invoke];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,17 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface OCMNotificationPoster : NSObject
|
||||
{
|
||||
NSNotification *notification;
|
||||
}
|
||||
|
||||
- (id)initWithNotification:(id)aNotification;
|
||||
|
||||
- (void)handleInvocation:(NSInvocation *)anInvocation;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,30 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import "OCMNotificationPoster.h"
|
||||
|
||||
|
||||
@implementation OCMNotificationPoster
|
||||
|
||||
- (id)initWithNotification:(id)aNotification
|
||||
{
|
||||
self = [super init];
|
||||
notification = [aNotification retain];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[notification release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)handleInvocation:(NSInvocation *)anInvocation
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] postNotification:notification];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,19 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface OCMObserverRecorder : NSObject
|
||||
{
|
||||
NSNotification *recordedNotification;
|
||||
}
|
||||
|
||||
- (void)notificationWithName:(NSString *)name object:(id)sender;
|
||||
|
||||
- (BOOL)matchesNotification:(NSNotification *)aNotification;
|
||||
|
||||
- (BOOL)argument:(id)expectedArg matchesArgument:(id)observedArg;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,75 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <objc/runtime.h>
|
||||
#import <OCMock/OCMConstraint.h>
|
||||
#import "NSInvocation+OCMAdditions.h"
|
||||
#import "OCMObserverRecorder.h"
|
||||
|
||||
@interface NSObject(HCMatcherDummy)
|
||||
- (BOOL)matches:(id)item;
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
|
||||
@implementation OCMObserverRecorder
|
||||
|
||||
#pragma mark Initialisers, description, accessors, etc.
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[recordedNotification release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Recording
|
||||
|
||||
- (void)notificationWithName:(NSString *)name object:(id)sender
|
||||
{
|
||||
recordedNotification = [[NSNotification notificationWithName:name object:sender] retain];
|
||||
}
|
||||
|
||||
- (void)notificationWithName:(NSString *)name object:(id)sender userInfo:(NSDictionary *)userInfo
|
||||
{
|
||||
recordedNotification = [[NSNotification notificationWithName:name object:sender userInfo:userInfo] retain];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Verification
|
||||
|
||||
- (BOOL)matchesNotification:(NSNotification *)aNotification
|
||||
{
|
||||
return [self argument:[recordedNotification name] matchesArgument:[aNotification name]] &&
|
||||
[self argument:[recordedNotification object] matchesArgument:[aNotification object]] &&
|
||||
[self argument:[recordedNotification userInfo] matchesArgument:[aNotification userInfo]];
|
||||
}
|
||||
|
||||
- (BOOL)argument:(id)expectedArg matchesArgument:(id)observedArg
|
||||
{
|
||||
if([expectedArg isKindOfClass:[OCMConstraint class]])
|
||||
{
|
||||
if([expectedArg evaluate:observedArg] == NO)
|
||||
return NO;
|
||||
}
|
||||
else if([expectedArg conformsToProtocol:objc_getProtocol("HCMatcher")])
|
||||
{
|
||||
if([expectedArg matches:observedArg] == NO)
|
||||
return NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
if([expectedArg class] != [observedArg class])
|
||||
return NO;
|
||||
if(([expectedArg isEqual:observedArg] == NO) &&
|
||||
!((expectedArg == nil) && (observedArg == nil)))
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,17 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface OCMPassByRefSetter : NSObject
|
||||
{
|
||||
id value;
|
||||
}
|
||||
|
||||
- (id)initWithValue:(id)value;
|
||||
|
||||
- (id)value;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,29 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import "OCMPassByRefSetter.h"
|
||||
|
||||
|
||||
@implementation OCMPassByRefSetter
|
||||
|
||||
- (id)initWithValue:(id)aValue
|
||||
{
|
||||
self = [super init];
|
||||
value = [aValue retain];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[value release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)value
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,14 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2010 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface OCMRealObjectForwarder : NSObject
|
||||
{
|
||||
}
|
||||
|
||||
- (void)handleInvocation:(NSInvocation *)anInvocation;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,29 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2010 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <objc/runtime.h>
|
||||
#import "OCPartialMockObject.h"
|
||||
#import "OCMRealObjectForwarder.h"
|
||||
|
||||
|
||||
@implementation OCMRealObjectForwarder
|
||||
|
||||
- (void)handleInvocation:(NSInvocation *)anInvocation
|
||||
{
|
||||
id invocationTarget = [anInvocation target];
|
||||
SEL invocationSelector = [anInvocation selector];
|
||||
SEL aliasedSelector = NSSelectorFromString([OCMRealMethodAliasPrefix stringByAppendingString:NSStringFromSelector(invocationSelector)]);
|
||||
|
||||
[anInvocation setSelector:aliasedSelector];
|
||||
if([invocationTarget isProxy] && (class_getInstanceMethod([invocationTarget class], @selector(realObject))))
|
||||
{
|
||||
// the method has been invoked on the mock, we need to change the target to the real object
|
||||
[anInvocation setTarget:[(OCPartialMockObject *)invocationTarget realObject]];
|
||||
}
|
||||
[anInvocation invoke];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,17 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface OCMReturnValueProvider : NSObject
|
||||
{
|
||||
id returnValue;
|
||||
}
|
||||
|
||||
- (id)initWithValue:(id)aValue;
|
||||
|
||||
- (void)handleInvocation:(NSInvocation *)anInvocation;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,47 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import "NSMethodSignature+OCMAdditions.h"
|
||||
#import "OCMReturnValueProvider.h"
|
||||
|
||||
|
||||
@implementation OCMReturnValueProvider
|
||||
|
||||
- (id)initWithValue:(id)aValue
|
||||
{
|
||||
self = [super init];
|
||||
returnValue = [aValue retain];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[returnValue release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)handleInvocation:(NSInvocation *)anInvocation
|
||||
{
|
||||
const char *returnType = [[anInvocation methodSignature] methodReturnTypeWithoutQualifiers];
|
||||
if(strcmp(returnType, @encode(id)) != 0) {
|
||||
// if the returnType is a typedef to an object, it has the form ^{OriginalClass=#}
|
||||
NSString *regexString = @"^\\^\\{(.*)=#\\}";
|
||||
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:regexString options:0 error:NULL];
|
||||
NSString *type = [NSString stringWithCString:returnType encoding:NSASCIIStringEncoding];
|
||||
if([regex numberOfMatchesInString:type options:0 range:NSMakeRange(0, type.length)] == 0)
|
||||
{
|
||||
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"Expected invocation with object return type. Did you mean to use andReturnValue: instead?" userInfo:nil];
|
||||
}
|
||||
}
|
||||
NSString *sel = NSStringFromSelector([anInvocation selector]);
|
||||
if([sel hasPrefix:@"alloc"] || [sel hasPrefix:@"new"] || [sel hasPrefix:@"copy"] || [sel hasPrefix:@"mutableCopy"])
|
||||
{
|
||||
// methods that "create" an object return it with an extra retain count
|
||||
[returnValue retain];
|
||||
}
|
||||
[anInvocation setReturnValue:&returnValue];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.mulle-kybernetik.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2004-2013 Mulle Kybernetik.</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,7 @@
|
||||
//
|
||||
// Prefix header for all source files of the 'OCMock' target in the 'OCMock' project
|
||||
//
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
@@ -0,0 +1,10 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2004-2008 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <OCMock/OCMockObject.h>
|
||||
#import <OCMock/OCMockRecorder.h>
|
||||
#import <OCMock/OCMConstraint.h>
|
||||
#import <OCMock/OCMArg.h>
|
||||
#import <OCMock/NSNotificationCenter+OCMAdditions.h>
|
||||
@@ -0,0 +1,46 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2004-2008 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface OCMockObject : NSProxy
|
||||
{
|
||||
BOOL isNice;
|
||||
BOOL expectationOrderMatters;
|
||||
NSMutableArray *recorders;
|
||||
NSMutableArray *expectations;
|
||||
NSMutableArray *rejections;
|
||||
NSMutableArray *exceptions;
|
||||
}
|
||||
|
||||
+ (id)mockForClass:(Class)aClass;
|
||||
+ (id)mockForProtocol:(Protocol *)aProtocol;
|
||||
+ (id)partialMockForObject:(NSObject *)anObject;
|
||||
|
||||
+ (id)niceMockForClass:(Class)aClass;
|
||||
+ (id)niceMockForProtocol:(Protocol *)aProtocol;
|
||||
|
||||
+ (id)observerMock;
|
||||
|
||||
- (id)init;
|
||||
|
||||
- (void)setExpectationOrderMatters:(BOOL)flag;
|
||||
|
||||
- (id)stub;
|
||||
- (id)expect;
|
||||
- (id)reject;
|
||||
|
||||
- (void)verify;
|
||||
|
||||
- (void)stopMocking;
|
||||
|
||||
// internal use only
|
||||
|
||||
- (id)getNewRecorder;
|
||||
- (BOOL)handleInvocation:(NSInvocation *)anInvocation;
|
||||
- (void)handleUnRecordedInvocation:(NSInvocation *)anInvocation;
|
||||
- (BOOL)handleSelector:(SEL)sel;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,269 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2004-2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <OCMock/OCMockObject.h>
|
||||
#import "OCClassMockObject.h"
|
||||
#import "OCProtocolMockObject.h"
|
||||
#import "OCPartialMockObject.h"
|
||||
#import "OCObserverMockObject.h"
|
||||
#import <OCMock/OCMockRecorder.h>
|
||||
#import "NSInvocation+OCMAdditions.h"
|
||||
|
||||
@interface OCMockObject(Private)
|
||||
+ (id)_makeNice:(OCMockObject *)mock;
|
||||
- (NSString *)_recorderDescriptions:(BOOL)onlyExpectations;
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
|
||||
@implementation OCMockObject
|
||||
|
||||
#pragma mark Class initialisation
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if([[NSInvocation class] instanceMethodSignatureForSelector:@selector(getArgumentAtIndexAsObject:)] == NULL)
|
||||
[NSException raise:NSInternalInconsistencyException format:@"** Expected method not present; the method getArgumentAtIndexAsObject: is not implemented by NSInvocation. If you see this exception it is likely that you are using the static library version of OCMock and your project is not configured correctly to load categories from static libraries. Did you forget to add the -force_load linker flag?"];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Factory methods
|
||||
|
||||
+ (id)mockForClass:(Class)aClass
|
||||
{
|
||||
return [[[OCClassMockObject alloc] initWithClass:aClass] autorelease];
|
||||
}
|
||||
|
||||
+ (id)mockForProtocol:(Protocol *)aProtocol
|
||||
{
|
||||
return [[[OCProtocolMockObject alloc] initWithProtocol:aProtocol] autorelease];
|
||||
}
|
||||
|
||||
+ (id)partialMockForObject:(NSObject *)anObject
|
||||
{
|
||||
return [[[OCPartialMockObject alloc] initWithObject:anObject] autorelease];
|
||||
}
|
||||
|
||||
|
||||
+ (id)niceMockForClass:(Class)aClass
|
||||
{
|
||||
return [self _makeNice:[self mockForClass:aClass]];
|
||||
}
|
||||
|
||||
+ (id)niceMockForProtocol:(Protocol *)aProtocol
|
||||
{
|
||||
return [self _makeNice:[self mockForProtocol:aProtocol]];
|
||||
}
|
||||
|
||||
|
||||
+ (id)_makeNice:(OCMockObject *)mock
|
||||
{
|
||||
mock->isNice = YES;
|
||||
return mock;
|
||||
}
|
||||
|
||||
|
||||
+ (id)observerMock
|
||||
{
|
||||
return [[[OCObserverMockObject alloc] init] autorelease];
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark Initialisers, description, accessors, etc.
|
||||
|
||||
- (id)init
|
||||
{
|
||||
// no [super init], we're inheriting from NSProxy
|
||||
expectationOrderMatters = NO;
|
||||
recorders = [[NSMutableArray alloc] init];
|
||||
expectations = [[NSMutableArray alloc] init];
|
||||
rejections = [[NSMutableArray alloc] init];
|
||||
exceptions = [[NSMutableArray alloc] init];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[recorders release];
|
||||
[expectations release];
|
||||
[rejections release];
|
||||
[exceptions release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return @"OCMockObject";
|
||||
}
|
||||
|
||||
|
||||
- (void)setExpectationOrderMatters:(BOOL)flag
|
||||
{
|
||||
expectationOrderMatters = flag;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Public API
|
||||
|
||||
- (id)stub
|
||||
{
|
||||
OCMockRecorder *recorder = [self getNewRecorder];
|
||||
[recorders addObject:recorder];
|
||||
return recorder;
|
||||
}
|
||||
|
||||
|
||||
- (id)expect
|
||||
{
|
||||
OCMockRecorder *recorder = [self stub];
|
||||
[expectations addObject:recorder];
|
||||
return recorder;
|
||||
}
|
||||
|
||||
|
||||
- (id)reject
|
||||
{
|
||||
OCMockRecorder *recorder = [self stub];
|
||||
[rejections addObject:recorder];
|
||||
return recorder;
|
||||
}
|
||||
|
||||
|
||||
- (void)verify
|
||||
{
|
||||
if([expectations count] == 1)
|
||||
{
|
||||
[NSException raise:NSInternalInconsistencyException format:@"%@: expected method was not invoked: %@",
|
||||
[self description], [[expectations objectAtIndex:0] description]];
|
||||
}
|
||||
if([expectations count] > 0)
|
||||
{
|
||||
[NSException raise:NSInternalInconsistencyException format:@"%@ : %@ expected methods were not invoked: %@",
|
||||
[self description], @([expectations count]), [self _recorderDescriptions:YES]];
|
||||
}
|
||||
if([exceptions count] > 0)
|
||||
{
|
||||
[[exceptions objectAtIndex:0] raise];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)stopMocking
|
||||
{
|
||||
// no-op for mock objects that are not class object or partial mocks
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Handling invocations
|
||||
|
||||
- (BOOL)handleSelector:(SEL)sel
|
||||
{
|
||||
for (OCMockRecorder *recorder in recorders)
|
||||
if ([recorder matchesSelector:sel])
|
||||
return YES;
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)forwardInvocation:(NSInvocation *)anInvocation
|
||||
{
|
||||
if([self handleInvocation:anInvocation] == NO)
|
||||
[self handleUnRecordedInvocation:anInvocation];
|
||||
}
|
||||
|
||||
- (BOOL)handleInvocation:(NSInvocation *)anInvocation
|
||||
{
|
||||
OCMockRecorder *recorder = nil;
|
||||
unsigned int i;
|
||||
|
||||
for(i = 0; i < [recorders count]; i++)
|
||||
{
|
||||
recorder = [recorders objectAtIndex:i];
|
||||
if([recorder matchesInvocation:anInvocation])
|
||||
break;
|
||||
}
|
||||
|
||||
if(i == [recorders count])
|
||||
return NO;
|
||||
|
||||
if([rejections containsObject:recorder])
|
||||
{
|
||||
NSException *exception = [NSException exceptionWithName:NSInternalInconsistencyException reason:
|
||||
[NSString stringWithFormat:@"%@: explicitly disallowed method invoked: %@", [self description],
|
||||
[anInvocation invocationDescription]] userInfo:nil];
|
||||
[exceptions addObject:exception];
|
||||
[exception raise];
|
||||
}
|
||||
|
||||
if([expectations containsObject:recorder])
|
||||
{
|
||||
if(expectationOrderMatters && ([expectations objectAtIndex:0] != recorder))
|
||||
{
|
||||
[NSException raise:NSInternalInconsistencyException format:@"%@: unexpected method invoked: %@\n\texpected:\t%@",
|
||||
[self description], [recorder description], [[expectations objectAtIndex:0] description]];
|
||||
|
||||
}
|
||||
[[recorder retain] autorelease];
|
||||
[expectations removeObject:recorder];
|
||||
[recorders removeObjectAtIndex:i];
|
||||
}
|
||||
[[recorder invocationHandlers] makeObjectsPerformSelector:@selector(handleInvocation:) withObject:anInvocation];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)handleUnRecordedInvocation:(NSInvocation *)anInvocation
|
||||
{
|
||||
if(isNice == NO)
|
||||
{
|
||||
NSException *exception = [NSException exceptionWithName:NSInternalInconsistencyException reason:
|
||||
[NSString stringWithFormat:@"%@: unexpected method invoked: %@ %@", [self description],
|
||||
[anInvocation invocationDescription], [self _recorderDescriptions:NO]] userInfo:nil];
|
||||
[exceptions addObject:exception];
|
||||
[exception raise];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Helper methods
|
||||
|
||||
- (id)getNewRecorder
|
||||
{
|
||||
return [[[OCMockRecorder alloc] initWithSignatureResolver:self] autorelease];
|
||||
}
|
||||
|
||||
|
||||
- (NSString *)_recorderDescriptions:(BOOL)onlyExpectations
|
||||
{
|
||||
NSMutableString *outputString = [NSMutableString string];
|
||||
|
||||
OCMockRecorder *currentObject;
|
||||
NSEnumerator *recorderEnumerator = [recorders objectEnumerator];
|
||||
while((currentObject = [recorderEnumerator nextObject]) != nil)
|
||||
{
|
||||
NSString *prefix;
|
||||
|
||||
if(onlyExpectations)
|
||||
{
|
||||
if(![expectations containsObject:currentObject])
|
||||
continue;
|
||||
prefix = @" ";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([expectations containsObject:currentObject])
|
||||
prefix = @"expected: ";
|
||||
else
|
||||
prefix = @"stubbed: ";
|
||||
}
|
||||
[outputString appendFormat:@"\n\t%@\t%@", prefix, [currentObject description]];
|
||||
}
|
||||
|
||||
return outputString;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,36 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2004-2013 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface OCMockRecorder : NSProxy
|
||||
{
|
||||
id signatureResolver;
|
||||
BOOL recordedAsClassMethod;
|
||||
NSInvocation *recordedInvocation;
|
||||
NSMutableArray *invocationHandlers;
|
||||
}
|
||||
|
||||
- (id)initWithSignatureResolver:(id)anObject;
|
||||
|
||||
- (BOOL)matchesSelector:(SEL)sel;
|
||||
- (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;
|
||||
|
||||
- (id)classMethod;
|
||||
|
||||
- (NSArray *)invocationHandlers;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,229 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2004-2013 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <objc/runtime.h>
|
||||
#import <OCMock/OCMockRecorder.h>
|
||||
#import <OCMock/OCMArg.h>
|
||||
#import <OCMock/OCMConstraint.h>
|
||||
#import "OCClassMockObject.h"
|
||||
#import "OCMPassByRefSetter.h"
|
||||
#import "OCMReturnValueProvider.h"
|
||||
#import "OCMBoxedReturnValueProvider.h"
|
||||
#import "OCMExceptionReturnValueProvider.h"
|
||||
#import "OCMIndirectReturnValueProvider.h"
|
||||
#import "OCMNotificationPoster.h"
|
||||
#import "OCMBlockCaller.h"
|
||||
#import "NSInvocation+OCMAdditions.h"
|
||||
|
||||
@interface NSObject(HCMatcherDummy)
|
||||
- (BOOL)matches:(id)item;
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
|
||||
@implementation OCMockRecorder
|
||||
|
||||
#pragma mark Initialisers, description, accessors, etc.
|
||||
|
||||
- (id)initWithSignatureResolver:(id)anObject
|
||||
{
|
||||
signatureResolver = anObject;
|
||||
invocationHandlers = [[NSMutableArray alloc] init];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[recordedInvocation release];
|
||||
[invocationHandlers release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [recordedInvocation invocationDescription];
|
||||
}
|
||||
|
||||
- (void)releaseInvocation
|
||||
{
|
||||
[recordedInvocation release];
|
||||
recordedInvocation = nil;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Recording invocation handlers
|
||||
|
||||
- (id)andReturn:(id)anObject
|
||||
{
|
||||
[invocationHandlers addObject:[[[OCMReturnValueProvider alloc] initWithValue:anObject] autorelease]];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)andReturnValue:(NSValue *)aValue
|
||||
{
|
||||
[invocationHandlers addObject:[[[OCMBoxedReturnValueProvider alloc] initWithValue:aValue] autorelease]];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)andThrow:(NSException *)anException
|
||||
{
|
||||
[invocationHandlers addObject:[[[OCMExceptionReturnValueProvider alloc] initWithValue:anException] autorelease]];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)andPost:(NSNotification *)aNotification
|
||||
{
|
||||
[invocationHandlers addObject:[[[OCMNotificationPoster alloc] initWithNotification:aNotification] autorelease]];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)andCall:(SEL)selector onObject:(id)anObject
|
||||
{
|
||||
[invocationHandlers addObject:[[[OCMIndirectReturnValueProvider alloc] initWithProvider:anObject andSelector:selector] autorelease]];
|
||||
return self;
|
||||
}
|
||||
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
|
||||
- (id)andDo:(void (^)(NSInvocation *))aBlock
|
||||
{
|
||||
[invocationHandlers addObject:[[[OCMBlockCaller alloc] initWithCallBlock:aBlock] autorelease]];
|
||||
return self;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
- (id)andForwardToRealObject
|
||||
{
|
||||
[NSException raise:NSInternalInconsistencyException format:@"Method %@ can only be used with partial mocks.",
|
||||
NSStringFromSelector(_cmd)];
|
||||
return self; // keep compiler happy
|
||||
}
|
||||
|
||||
|
||||
- (NSArray *)invocationHandlers
|
||||
{
|
||||
return invocationHandlers;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Switching to class methods
|
||||
|
||||
- (id)classMethod
|
||||
{
|
||||
recordedAsClassMethod = YES;
|
||||
[signatureResolver setupClassForClassMethodMocking];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Recording the actual invocation
|
||||
|
||||
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
|
||||
{
|
||||
if(recordedAsClassMethod)
|
||||
return [[signatureResolver mockedClass] methodSignatureForSelector:aSelector];
|
||||
|
||||
NSMethodSignature *signature = [signatureResolver methodSignatureForSelector:aSelector];
|
||||
if(signature == nil)
|
||||
{
|
||||
// if we're a working with a class mock and there is a class method, auto-switch
|
||||
if(([[signatureResolver class] isSubclassOfClass:[OCClassMockObject class]]) &&
|
||||
([[signatureResolver mockedClass] respondsToSelector:aSelector]))
|
||||
{
|
||||
[self classMethod];
|
||||
signature = [self methodSignatureForSelector:aSelector];
|
||||
}
|
||||
}
|
||||
return signature;
|
||||
}
|
||||
|
||||
- (void)forwardInvocation:(NSInvocation *)anInvocation
|
||||
{
|
||||
if(recordedAsClassMethod)
|
||||
[signatureResolver setupForwarderForClassMethodSelector:[anInvocation selector]];
|
||||
if(recordedInvocation != nil)
|
||||
[NSException raise:NSInternalInconsistencyException format:@"Recorder received two methods to record."];
|
||||
[anInvocation setTarget:nil];
|
||||
[anInvocation retainArguments];
|
||||
recordedInvocation = [anInvocation retain];
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark Checking the invocation
|
||||
|
||||
- (BOOL)matchesSelector:(SEL)sel
|
||||
{
|
||||
return (sel == [recordedInvocation selector]);
|
||||
}
|
||||
|
||||
- (BOOL)matchesInvocation:(NSInvocation *)anInvocation
|
||||
{
|
||||
id target, recordedArg, passedArg;
|
||||
int i, n;
|
||||
BOOL isClassMethodInvocation;
|
||||
|
||||
target = [anInvocation target];
|
||||
isClassMethodInvocation = (target != nil) && (target == [target class]);
|
||||
if(isClassMethodInvocation != recordedAsClassMethod)
|
||||
return NO;
|
||||
|
||||
if([anInvocation selector] != [recordedInvocation selector])
|
||||
return NO;
|
||||
|
||||
n = (int)[[recordedInvocation methodSignature] numberOfArguments];
|
||||
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];
|
||||
|
||||
if([recordedArg isKindOfClass:[OCMConstraint class]])
|
||||
{
|
||||
if([recordedArg evaluate:passedArg] == NO)
|
||||
return NO;
|
||||
}
|
||||
else if([recordedArg isKindOfClass:[OCMPassByRefSetter class]])
|
||||
{
|
||||
id valueToSet = [(OCMPassByRefSetter *)recordedArg value];
|
||||
// side effect but easier to do here than in handleInvocation
|
||||
if(![valueToSet isKindOfClass:[NSValue class]])
|
||||
*(id *)[passedArg pointerValue] = valueToSet;
|
||||
else
|
||||
[(NSValue *)valueToSet getValue:[passedArg pointerValue]];
|
||||
}
|
||||
else if([recordedArg conformsToProtocol:objc_getProtocol("HCMatcher")])
|
||||
{
|
||||
if([recordedArg matches:passedArg] == NO)
|
||||
return NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(([recordedArg class] == [NSNumber class]) &&
|
||||
([(NSNumber*)recordedArg compare:(NSNumber*)passedArg] != NSOrderedSame))
|
||||
return NO;
|
||||
if(([recordedArg isEqual:passedArg] == NO) &&
|
||||
!((recordedArg == nil) && (passedArg == nil)))
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,22 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface OCObserverMockObject : NSObject
|
||||
{
|
||||
BOOL expectationOrderMatters;
|
||||
NSMutableArray *recorders;
|
||||
}
|
||||
|
||||
- (void)setExpectationOrderMatters:(BOOL)flag;
|
||||
|
||||
- (id)expect;
|
||||
|
||||
- (void)verify;
|
||||
|
||||
- (void)handleNotification:(NSNotification *)aNotification;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,83 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import "OCObserverMockObject.h"
|
||||
#import "OCMObserverRecorder.h"
|
||||
|
||||
|
||||
@implementation OCObserverMockObject
|
||||
|
||||
#pragma mark Initialisers, description, accessors, etc.
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
recorders = [[NSMutableArray alloc] init];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[recorders release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return @"OCMockObserver";
|
||||
}
|
||||
|
||||
- (void)setExpectationOrderMatters:(BOOL)flag
|
||||
{
|
||||
expectationOrderMatters = flag;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Public API
|
||||
|
||||
- (id)expect
|
||||
{
|
||||
OCMObserverRecorder *recorder = [[[OCMObserverRecorder alloc] init] autorelease];
|
||||
[recorders addObject:recorder];
|
||||
return recorder;
|
||||
}
|
||||
|
||||
- (void)verify
|
||||
{
|
||||
if([recorders count] == 1)
|
||||
{
|
||||
[NSException raise:NSInternalInconsistencyException format:@"%@: expected notification was not observed: %@",
|
||||
[self description], [[recorders lastObject] description]];
|
||||
}
|
||||
if([recorders count] > 0)
|
||||
{
|
||||
[NSException raise:NSInternalInconsistencyException format:@"%@ : %@ expected notifications were not observed.",
|
||||
[self description], @([recorders count])];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark Receiving notifications
|
||||
|
||||
- (void)handleNotification:(NSNotification *)aNotification
|
||||
{
|
||||
NSUInteger i, limit;
|
||||
|
||||
limit = expectationOrderMatters ? 1 : [recorders count];
|
||||
for(i = 0; i < limit; i++)
|
||||
{
|
||||
if([[recorders objectAtIndex:i] matchesNotification:aNotification])
|
||||
{
|
||||
[recorders removeObjectAtIndex:i];
|
||||
return;
|
||||
}
|
||||
}
|
||||
[NSException raise:NSInternalInconsistencyException format:@"%@: unexpected notification observed: %@", [self description],
|
||||
[aNotification description]];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,25 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import "OCClassMockObject.h"
|
||||
|
||||
@interface OCPartialMockObject : OCClassMockObject
|
||||
{
|
||||
NSObject *realObject;
|
||||
}
|
||||
|
||||
- (id)initWithObject:(NSObject *)anObject;
|
||||
|
||||
- (NSObject *)realObject;
|
||||
|
||||
- (void)stopMocking;
|
||||
|
||||
- (void)setupSubclassForObject:(id)anObject;
|
||||
- (void)setupForwarderForSelector:(SEL)selector;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
extern NSString *OCMRealMethodAliasPrefix;
|
||||
@@ -0,0 +1,190 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <objc/runtime.h>
|
||||
#import "OCPartialMockRecorder.h"
|
||||
#import "OCPartialMockObject.h"
|
||||
|
||||
|
||||
@interface OCPartialMockObject (Private)
|
||||
- (void)forwardInvocationForRealObject:(NSInvocation *)anInvocation;
|
||||
@end
|
||||
|
||||
|
||||
NSString *OCMRealMethodAliasPrefix = @"ocmock_replaced_";
|
||||
|
||||
@implementation OCPartialMockObject
|
||||
|
||||
|
||||
#pragma mark Mock table
|
||||
|
||||
static NSMutableDictionary *mockTable;
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if(self == [OCPartialMockObject class])
|
||||
mockTable = [[NSMutableDictionary alloc] init];
|
||||
}
|
||||
|
||||
+ (void)rememberPartialMock:(OCPartialMockObject *)mock forObject:(id)anObject
|
||||
{
|
||||
@synchronized(mockTable)
|
||||
{
|
||||
[mockTable setObject:[NSValue valueWithNonretainedObject:mock] forKey:[NSValue valueWithNonretainedObject:anObject]];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)forgetPartialMockForObject:(id)anObject
|
||||
{
|
||||
@synchronized(mockTable)
|
||||
{
|
||||
[mockTable removeObjectForKey:[NSValue valueWithNonretainedObject:anObject]];
|
||||
}
|
||||
}
|
||||
|
||||
+ (OCPartialMockObject *)existingPartialMockForObject:(id)anObject
|
||||
{
|
||||
@synchronized(mockTable)
|
||||
{
|
||||
OCPartialMockObject *mock = [[mockTable objectForKey:[NSValue valueWithNonretainedObject:anObject]] nonretainedObjectValue];
|
||||
if(mock == nil)
|
||||
[NSException raise:NSInternalInconsistencyException format:@"No partial mock for object %p", anObject];
|
||||
return mock;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark Initialisers, description, accessors, etc.
|
||||
|
||||
- (id)initWithObject:(NSObject *)anObject
|
||||
{
|
||||
[super initWithClass:[anObject class]];
|
||||
realObject = [anObject retain];
|
||||
[[self class] rememberPartialMock:self forObject:anObject];
|
||||
[self setupSubclassForObject:realObject];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
if(realObject != nil)
|
||||
[self stopMocking];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"OCPartialMockObject[%@]", NSStringFromClass(mockedClass)];
|
||||
}
|
||||
|
||||
- (NSObject *)realObject
|
||||
{
|
||||
return realObject;
|
||||
}
|
||||
|
||||
- (void)stopMocking
|
||||
{
|
||||
object_setClass(realObject, [self mockedClass]);
|
||||
[realObject release];
|
||||
[[self class] forgetPartialMockForObject:realObject];
|
||||
realObject = nil;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Subclass management
|
||||
|
||||
- (void)setupSubclassForObject:(id)anObject
|
||||
{
|
||||
Class realClass = [anObject class];
|
||||
double timestamp = [NSDate timeIntervalSinceReferenceDate];
|
||||
const char *className = [[NSString stringWithFormat:@"%@-%p-%f", realClass, anObject, timestamp] UTF8String];
|
||||
Class subclass = objc_allocateClassPair(realClass, className, 0);
|
||||
objc_registerClassPair(subclass);
|
||||
object_setClass(anObject, subclass);
|
||||
|
||||
Method myForwardInvocationMethod = class_getInstanceMethod([self class], @selector(forwardInvocationForRealObject:));
|
||||
IMP myForwardInvocationImp = method_getImplementation(myForwardInvocationMethod);
|
||||
const char *forwardInvocationTypes = method_getTypeEncoding(myForwardInvocationMethod);
|
||||
class_addMethod(subclass, @selector(forwardInvocation:), myForwardInvocationImp, forwardInvocationTypes);
|
||||
|
||||
|
||||
Method myForwardingTargetForSelectorMethod = class_getInstanceMethod([self class], @selector(forwardingTargetForSelectorForRealObject:));
|
||||
IMP myForwardingTargetForSelectorImp = method_getImplementation(myForwardingTargetForSelectorMethod);
|
||||
const char *forwardingTargetForSelectorTypes = method_getTypeEncoding(myForwardingTargetForSelectorMethod);
|
||||
|
||||
IMP originalForwardingTargetForSelectorImp = [realClass instanceMethodForSelector:@selector(forwardingTargetForSelector:)];
|
||||
|
||||
class_addMethod(subclass, @selector(forwardingTargetForSelector:), myForwardingTargetForSelectorImp, forwardingTargetForSelectorTypes);
|
||||
class_addMethod(subclass, @selector(forwardingTargetForSelector_Original:), originalForwardingTargetForSelectorImp, forwardingTargetForSelectorTypes);
|
||||
}
|
||||
|
||||
- (void)setupForwarderForSelector:(SEL)selector
|
||||
{
|
||||
Class subclass = [[self realObject] class];
|
||||
Method originalMethod = class_getInstanceMethod([subclass superclass], selector);
|
||||
IMP originalImp = method_getImplementation(originalMethod);
|
||||
|
||||
IMP forwarderImp = [subclass instanceMethodForSelector:@selector(aMethodThatMustNotExist)];
|
||||
class_addMethod(subclass, method_getName(originalMethod), forwarderImp, method_getTypeEncoding(originalMethod));
|
||||
|
||||
SEL aliasSelector = NSSelectorFromString([OCMRealMethodAliasPrefix stringByAppendingString:NSStringFromSelector(selector)]);
|
||||
class_addMethod(subclass, aliasSelector, originalImp, method_getTypeEncoding(originalMethod));
|
||||
}
|
||||
|
||||
- (void)removeForwarderForSelector:(SEL)selector
|
||||
{
|
||||
Class subclass = [[self realObject] class];
|
||||
SEL aliasSelector = NSSelectorFromString([OCMRealMethodAliasPrefix stringByAppendingString:NSStringFromSelector(selector)]);
|
||||
Method originalMethod = class_getInstanceMethod([subclass superclass], aliasSelector);
|
||||
IMP originalImp = method_getImplementation(originalMethod);
|
||||
class_replaceMethod(subclass, selector, originalImp, method_getTypeEncoding(originalMethod));
|
||||
}
|
||||
|
||||
// Make the compiler happy in -forwardingTargetForSelectorForRealObject: because it can't find the message…
|
||||
- (id)forwardingTargetForSelector_Original:(SEL)sel
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id)forwardingTargetForSelectorForRealObject:(SEL)sel
|
||||
{
|
||||
// in here "self" is a reference to the real object, not the mock
|
||||
OCPartialMockObject *mock = [OCPartialMockObject existingPartialMockForObject:self];
|
||||
if ([mock handleSelector:sel])
|
||||
return self;
|
||||
|
||||
return [self forwardingTargetForSelector_Original:sel];
|
||||
}
|
||||
|
||||
- (void)forwardInvocationForRealObject:(NSInvocation *)anInvocation
|
||||
{
|
||||
// in here "self" is a reference to the real object, not the mock
|
||||
OCPartialMockObject *mock = [OCPartialMockObject existingPartialMockForObject:self];
|
||||
if([mock handleInvocation:anInvocation] == NO)
|
||||
{
|
||||
// if mock doesn't want to handle the invocation, maybe all expects have occurred, we forward to real object
|
||||
SEL aliasSelector = NSSelectorFromString([OCMRealMethodAliasPrefix stringByAppendingString:NSStringFromSelector([anInvocation selector])]);
|
||||
[anInvocation setSelector:aliasSelector];
|
||||
[anInvocation invoke];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark Overrides
|
||||
|
||||
- (id)getNewRecorder
|
||||
{
|
||||
return [[[OCPartialMockRecorder alloc] initWithSignatureResolver:self] autorelease];
|
||||
}
|
||||
|
||||
- (void)handleUnRecordedInvocation:(NSInvocation *)anInvocation
|
||||
{
|
||||
[anInvocation invokeWithTarget:realObject];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,12 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import "OCMockRecorder.h"
|
||||
|
||||
@interface OCPartialMockRecorder : OCMockRecorder
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,27 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009-2010 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import "OCPartialMockObject.h"
|
||||
#import "OCMRealObjectForwarder.h"
|
||||
#import "OCPartialMockRecorder.h"
|
||||
|
||||
|
||||
@implementation OCPartialMockRecorder
|
||||
|
||||
- (id)andForwardToRealObject
|
||||
{
|
||||
[invocationHandlers addObject:[[[OCMRealObjectForwarder alloc] init] autorelease]];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (void)forwardInvocation:(NSInvocation *)anInvocation
|
||||
{
|
||||
[super forwardInvocation:anInvocation];
|
||||
// not as clean as I'd wish...
|
||||
[(OCPartialMockObject *)signatureResolver setupForwarderForSelector:[anInvocation selector]];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,16 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2005-2008 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <OCMock/OCMockObject.h>
|
||||
|
||||
@interface OCProtocolMockObject : OCMockObject
|
||||
{
|
||||
Protocol *mockedProtocol;
|
||||
}
|
||||
|
||||
- (id)initWithProtocol:(Protocol *)aProtocol;
|
||||
|
||||
@end
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2005-2008 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <objc/runtime.h>
|
||||
#import "NSMethodSignature+OCMAdditions.h"
|
||||
#import "OCProtocolMockObject.h"
|
||||
|
||||
@implementation OCProtocolMockObject
|
||||
|
||||
#pragma mark Initialisers, description, accessors, etc.
|
||||
|
||||
- (id)initWithProtocol:(Protocol *)aProtocol
|
||||
{
|
||||
[super init];
|
||||
mockedProtocol = aProtocol;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
const char* name = protocol_getName(mockedProtocol);
|
||||
return [NSString stringWithFormat:@"OCMockObject[%s]", name];
|
||||
}
|
||||
|
||||
#pragma mark Proxy API
|
||||
|
||||
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
|
||||
{
|
||||
struct objc_method_description methodDescription = protocol_getMethodDescription(mockedProtocol, aSelector, YES, YES);
|
||||
if(methodDescription.name == NULL)
|
||||
{
|
||||
methodDescription = protocol_getMethodDescription(mockedProtocol, aSelector, NO, YES);
|
||||
}
|
||||
if(methodDescription.name == NULL)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
return [NSMethodSignature signatureWithObjCTypes:methodDescription.types];
|
||||
}
|
||||
|
||||
- (BOOL)conformsToProtocol:(Protocol *)aProtocol
|
||||
{
|
||||
return protocol_conformsToProtocol(mockedProtocol, aProtocol);
|
||||
}
|
||||
|
||||
- (BOOL)respondsToSelector:(SEL)selector
|
||||
{
|
||||
return ([self methodSignatureForSelector:selector] != nil);
|
||||
}
|
||||
|
||||
@end
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
/* Localized versions of Info.plist keys */
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
//
|
||||
// Prefix header for all source files of the 'OCMockLib' target in the 'OCMockLib' project
|
||||
//
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2006-2008 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <SenTestingKit/SenTestingKit.h>
|
||||
|
||||
@interface NSInvocationOCMAdditionsTests : SenTestCase
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
+346
@@ -0,0 +1,346 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2006-2008 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import "NSInvocationOCMAdditionsTests.h"
|
||||
#import "NSInvocation+OCMAdditions.h"
|
||||
|
||||
#define TestString @"foo"
|
||||
#define TestInt 1
|
||||
|
||||
@implementation NSInvocationOCMAdditionsTests
|
||||
|
||||
- (void)testInvocationDescriptionWithNoArguments
|
||||
{
|
||||
SEL selector = @selector(lowercaseString);
|
||||
NSMethodSignature *signature = [[NSString string] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
|
||||
STAssertEqualObjects(@"lowercaseString", [invocation invocationDescription], @"");
|
||||
}
|
||||
|
||||
- (void)testInvocationDescriptionWithObjectArgument
|
||||
{
|
||||
SEL selector = @selector(isEqualToNumber:);
|
||||
NSMethodSignature *signature = [[NSNumber alloc] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it one argument (starts at index 2)
|
||||
NSNumber *argument = [NSNumber numberWithInt:TestInt];
|
||||
[invocation setArgument:&argument atIndex:2];
|
||||
|
||||
NSString *expected = [NSString stringWithFormat:@"isEqualToNumber:%d", TestInt];
|
||||
STAssertEqualObjects(expected, [invocation invocationDescription], @"");
|
||||
}
|
||||
|
||||
- (void)testInvocationDescriptionWithNSStringArgument
|
||||
{
|
||||
SEL selector = @selector(isEqualToString:);
|
||||
NSMethodSignature *signature = [[NSString string] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it one argument (starts at index 2)
|
||||
NSString *argument = TestString;
|
||||
[invocation setArgument:&argument atIndex:2];
|
||||
|
||||
NSString *expected = [NSString stringWithFormat:@"isEqualToString:@\"%@\"", TestString];
|
||||
STAssertEqualObjects(expected, [invocation invocationDescription], @"");
|
||||
}
|
||||
|
||||
- (void)testInvocationDescriptionWithObjectArguments
|
||||
{
|
||||
SEL selector = @selector(setValue:forKey:);
|
||||
NSMethodSignature *signature = [[NSArray array] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it two arguments
|
||||
NSNumber *argumentOne = [NSNumber numberWithInt:TestInt];
|
||||
NSString *argumentTwo = TestString;
|
||||
[invocation setArgument:&argumentOne atIndex:2];
|
||||
[invocation setArgument:&argumentTwo atIndex:3];
|
||||
|
||||
NSString *expected = [NSString stringWithFormat:@"setValue:%d forKey:@\"%@\"", TestInt, TestString];
|
||||
STAssertEqualObjects(expected, [invocation invocationDescription], @"");
|
||||
}
|
||||
|
||||
- (void)testInvocationDescriptionWithArrayArgument
|
||||
{
|
||||
SEL selector = @selector(addObjectsFromArray:);
|
||||
NSMethodSignature *signature = [[NSMutableArray array] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it one argument (starts at index 2)
|
||||
NSArray *argument = [NSArray arrayWithObject:TestString];
|
||||
[invocation setArgument:&argument atIndex:2];
|
||||
|
||||
NSString *expected = [NSString stringWithFormat:@"addObjectsFromArray:%@", [argument description]];
|
||||
STAssertEqualObjects(expected, [invocation invocationDescription], @"");
|
||||
}
|
||||
|
||||
- (void)testInvocationDescriptionWithIntArgument
|
||||
{
|
||||
SEL selector = @selector(initWithInt:);
|
||||
NSMethodSignature *signature = [[NSNumber alloc] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it an argument
|
||||
int argumentOne = TestInt;
|
||||
[invocation setArgument:&argumentOne atIndex:2];
|
||||
|
||||
NSString *expected = [NSString stringWithFormat:@"initWithInt:%d", TestInt];
|
||||
STAssertEqualObjects(expected, [invocation invocationDescription], @"");
|
||||
}
|
||||
|
||||
- (void)testInvocationDescriptionWithUnsignedIntArgument
|
||||
{
|
||||
SEL selector = @selector(initWithUnsignedInt:);
|
||||
NSMethodSignature *signature = [[NSNumber alloc] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it an argument
|
||||
unsigned int argumentOne = TestInt;
|
||||
[invocation setArgument:&argumentOne atIndex:2];
|
||||
|
||||
NSString *expected = [NSString stringWithFormat:@"initWithUnsignedInt:%d", TestInt];
|
||||
STAssertEqualObjects(expected, [invocation invocationDescription], @"");
|
||||
}
|
||||
|
||||
- (void)testInvocationDescriptionWithBoolArgument
|
||||
{
|
||||
SEL selector = @selector(initWithBool:);
|
||||
NSMethodSignature *signature = [[NSNumber alloc] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it an argument
|
||||
BOOL argumentOne = TRUE;
|
||||
[invocation setArgument:&argumentOne atIndex:2];
|
||||
|
||||
NSString *expected = [NSString stringWithFormat:@"initWithBool:YES"];
|
||||
STAssertEqualObjects(expected, [invocation invocationDescription], @"");
|
||||
}
|
||||
|
||||
- (void)testInvocationDescriptionWithCharArgument
|
||||
{
|
||||
SEL selector = @selector(initWithChar:);
|
||||
NSMethodSignature *signature = [[NSNumber alloc] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it an argument
|
||||
char argumentOne = 'd';
|
||||
[invocation setArgument:&argumentOne atIndex:2];
|
||||
|
||||
NSString *expected = [NSString stringWithFormat:@"initWithChar:'%c'", argumentOne];
|
||||
STAssertEqualObjects(expected, [invocation invocationDescription], @"");
|
||||
}
|
||||
|
||||
- (void)testInvocationDescriptionWithUnsignedCharArgument
|
||||
{
|
||||
NSNumber *dummyNumber = [NSNumber alloc];
|
||||
|
||||
SEL selector = @selector(initWithUnsignedChar:);
|
||||
NSMethodSignature *signature = [dummyNumber methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it an argument
|
||||
unsigned char argumentOne = 'd';
|
||||
[invocation setArgument:&argumentOne atIndex:2];
|
||||
|
||||
NSString *expected = [NSString stringWithFormat:@"initWithUnsignedChar:'%c'", argumentOne];
|
||||
STAssertEqualObjects(expected, [invocation invocationDescription], @"");
|
||||
}
|
||||
|
||||
- (void)testInvocationDescriptionWithDoubleArgument
|
||||
{
|
||||
SEL selector = @selector(initWithDouble:);
|
||||
NSMethodSignature *signature = [[NSNumber alloc] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it an argument
|
||||
double argumentOne = 1;
|
||||
[invocation setArgument:&argumentOne atIndex:2];
|
||||
|
||||
NSString *expected = [NSString stringWithFormat:@"initWithDouble:%f", argumentOne];
|
||||
STAssertEqualObjects(expected, [invocation invocationDescription], @"");
|
||||
}
|
||||
|
||||
- (void)testInvocationDescriptionWithFloatArgument
|
||||
{
|
||||
SEL selector = @selector(initWithFloat:);
|
||||
NSMethodSignature *signature = [[NSNumber alloc] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it an argument
|
||||
float argumentOne = 1;
|
||||
[invocation setArgument:&argumentOne atIndex:2];
|
||||
|
||||
NSString *expected = [NSString stringWithFormat:@"initWithFloat:%f", argumentOne];
|
||||
STAssertEqualObjects(expected, [invocation invocationDescription], @"");
|
||||
}
|
||||
|
||||
- (void)testInvocationDescriptionWithLongArgument
|
||||
{
|
||||
SEL selector = @selector(initWithLong:);
|
||||
NSMethodSignature *signature = [[NSNumber alloc] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it an argument
|
||||
long argumentOne = 1;
|
||||
[invocation setArgument:&argumentOne atIndex:2];
|
||||
|
||||
NSString *expected = [NSString stringWithFormat:@"initWithLong:%ld", argumentOne];
|
||||
STAssertEqualObjects(expected, [invocation invocationDescription], @"");
|
||||
}
|
||||
|
||||
- (void)testInvocationDescriptionWithUnsignedLongArgument
|
||||
{
|
||||
SEL selector = @selector(initWithUnsignedLong:);
|
||||
NSMethodSignature *signature = [[NSNumber alloc] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it an argument
|
||||
unsigned long argumentOne = 1;
|
||||
[invocation setArgument:&argumentOne atIndex:2];
|
||||
|
||||
NSString *expected = [NSString stringWithFormat:@"initWithUnsignedLong:%lu", argumentOne];
|
||||
STAssertEqualObjects(expected, [invocation invocationDescription], @"");
|
||||
}
|
||||
|
||||
- (void)testInvocationDescriptionWithLongLongArgument
|
||||
{
|
||||
SEL selector = @selector(initWithLongLong:);
|
||||
NSMethodSignature *signature = [[NSNumber alloc] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it an argument
|
||||
long long argumentOne = 1;
|
||||
[invocation setArgument:&argumentOne atIndex:2];
|
||||
|
||||
NSString *expected = [NSString stringWithFormat:@"initWithLongLong:%qi", argumentOne];
|
||||
STAssertEqualObjects(expected, [invocation invocationDescription], @"");
|
||||
}
|
||||
|
||||
- (void)testInvocationDescriptionWithUnsignedLongLongArgument
|
||||
{
|
||||
SEL selector = @selector(initWithUnsignedLongLong:);
|
||||
NSMethodSignature *signature = [[NSNumber alloc] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it an argument
|
||||
unsigned long long argumentOne = 1;
|
||||
[invocation setArgument:&argumentOne atIndex:2];
|
||||
|
||||
NSString *expected = [NSString stringWithFormat:@"initWithUnsignedLongLong:%qu", argumentOne];
|
||||
STAssertEqualObjects(expected, [invocation invocationDescription], @"");
|
||||
}
|
||||
|
||||
- (void)testInvocationDescriptionWithShortArgument
|
||||
{
|
||||
SEL selector = @selector(initWithShort:);
|
||||
NSMethodSignature *signature = [[NSNumber alloc] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it an argument
|
||||
short argumentOne = 1;
|
||||
[invocation setArgument:&argumentOne atIndex:2];
|
||||
|
||||
NSString *expected = [NSString stringWithFormat:@"initWithShort:%hi", argumentOne];
|
||||
STAssertEqualObjects(expected, [invocation invocationDescription], @"");
|
||||
}
|
||||
|
||||
- (void)testInvocationDescriptionWithUnsignedShortArgument
|
||||
{
|
||||
SEL selector = @selector(initWithUnsignedShort:);
|
||||
NSMethodSignature *signature = [[NSNumber alloc] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it an argument
|
||||
unsigned short argumentOne = 1;
|
||||
[invocation setArgument:&argumentOne atIndex:2];
|
||||
|
||||
NSString *expected = [NSString stringWithFormat:@"initWithUnsignedShort:%hu", argumentOne];
|
||||
STAssertEqualObjects(expected, [invocation invocationDescription], @"");
|
||||
}
|
||||
/*
|
||||
- (void)testInvocationDescriptionWithStructArgument
|
||||
{
|
||||
SEL selector = @selector(setFrameSize:);
|
||||
NSMethodSignature *signature = [[[NSView alloc] init] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it an argument
|
||||
NSSize size;
|
||||
size.width = 1;
|
||||
size.height = 1;
|
||||
[invocation setArgument:&size atIndex:2];
|
||||
|
||||
NSString *expected = [NSString stringWithFormat:@"setFrameSize:(struct)"];
|
||||
STAssertTrue(expected, [[invocation invocationDescription] rangeOfString:description].length > 0, @"");
|
||||
}
|
||||
*/
|
||||
/*
|
||||
- (void)testInvocationDescriptionWithCStringArgument
|
||||
{
|
||||
SEL selector = @selector(initWithUTF8String:);
|
||||
NSMethodSignature *signature = [[NSString alloc] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it an argument
|
||||
NSString *string = [NSString stringWithString:@"foo"];
|
||||
const char *cString = [string UTF8String];
|
||||
[invocation setArgument:&cString atIndex:2];
|
||||
|
||||
NSString *expected = @"initWithUTF8String:\"foo\"";
|
||||
STAssertEqualObjects(expected, [invocation invocationDescription], @"");
|
||||
}
|
||||
*/
|
||||
- (void)testInvocationDescriptionWithSelectorArgument
|
||||
{
|
||||
SEL selector = @selector(respondsToSelector:);
|
||||
NSMethodSignature *signature = [[NSString alloc] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it an argument
|
||||
SEL selectorValue = @selector(foo);
|
||||
[invocation setArgument:&selectorValue atIndex:2];
|
||||
|
||||
NSString *expected = [NSString stringWithFormat:@"respondsToSelector:@selector(%@)", NSStringFromSelector(selectorValue)];
|
||||
STAssertEqualObjects(expected, [invocation invocationDescription], @"");
|
||||
}
|
||||
|
||||
- (void)testInvocationDescriptionWithPointerArgument
|
||||
{
|
||||
SEL selector = @selector(initWithBytes:length:);
|
||||
NSMethodSignature *signature = [[NSData alloc] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it an argument
|
||||
NSData *data = [@"foo" dataUsingEncoding:NSUTF8StringEncoding];
|
||||
const void *bytes = [[@"foo" dataUsingEncoding:NSUTF8StringEncoding] bytes];
|
||||
NSUInteger length = [data length];
|
||||
[invocation setArgument:&bytes atIndex:2];
|
||||
[invocation setArgument:&length atIndex:3];
|
||||
|
||||
NSString *expected1 = [NSString stringWithFormat:@"initWithBytes:"];
|
||||
NSString *expected2 = [NSString stringWithFormat:@"length:%ld", length];
|
||||
NSString *invocationDescription = [invocation invocationDescription];
|
||||
STAssertTrue([invocationDescription rangeOfString:expected1].length > 0, @"");
|
||||
STAssertTrue([invocationDescription rangeOfString:expected2].length > 0, @"");
|
||||
}
|
||||
|
||||
- (void)testInvocationDescriptionWithNilArgument
|
||||
{
|
||||
SEL selector = @selector(initWithString:);
|
||||
NSMethodSignature *signature = [[NSString alloc] methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setSelector:selector];
|
||||
// Give it an argument
|
||||
NSString *argString = nil;
|
||||
[invocation setArgument:&argString atIndex:2];
|
||||
|
||||
NSString *expected = [NSString stringWithFormat:@"initWithString:nil"];
|
||||
STAssertEqualObjects(expected, [invocation invocationDescription], @"");
|
||||
}
|
||||
|
||||
@end
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2004-2008 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <SenTestingKit/SenTestingKit.h>
|
||||
|
||||
|
||||
@interface OCMConstraintTests : SenTestCase
|
||||
{
|
||||
BOOL didCallCustomConstraint;
|
||||
}
|
||||
|
||||
@end
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2004-2010 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import "OCMConstraintTests.h"
|
||||
#import <OCMock/OCMConstraint.h>
|
||||
|
||||
|
||||
@implementation OCMConstraintTests
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
didCallCustomConstraint = NO;
|
||||
}
|
||||
|
||||
- (void)testAnyAcceptsAnything
|
||||
{
|
||||
OCMConstraint *constraint = [OCMAnyConstraint constraint];
|
||||
|
||||
STAssertTrue([constraint evaluate:@"foo"], @"Should have accepted a value.");
|
||||
STAssertTrue([constraint evaluate:@"foo"], @"Should have accepted another value.");
|
||||
STAssertTrue([constraint evaluate:@"foo"], @"Should have accepted nil.");
|
||||
}
|
||||
|
||||
- (void)testIsNilAcceptsOnlyNil
|
||||
{
|
||||
OCMConstraint *constraint = [OCMIsNilConstraint constraint];
|
||||
|
||||
STAssertFalse([constraint evaluate:@"foo"], @"Should not have accepted a value.");
|
||||
STAssertTrue([constraint evaluate:nil], @"Should have accepted nil.");
|
||||
}
|
||||
|
||||
- (void)testIsNotNilAcceptsAnythingButNil
|
||||
{
|
||||
OCMConstraint *constraint = [OCMIsNotNilConstraint constraint];
|
||||
|
||||
STAssertTrue([constraint evaluate:@"foo"], @"Should have accepted a value.");
|
||||
STAssertFalse([constraint evaluate:nil], @"Should not have accepted nil.");
|
||||
}
|
||||
|
||||
- (void)testNotEqualAcceptsAnythingButValue
|
||||
{
|
||||
OCMIsNotEqualConstraint *constraint = [OCMIsNotEqualConstraint constraint];
|
||||
constraint->testValue = @"foo";
|
||||
|
||||
STAssertFalse([constraint evaluate:@"foo"], @"Should not have accepted value.");
|
||||
STAssertTrue([constraint evaluate:@"bar"], @"Should have accepted other value.");
|
||||
STAssertTrue([constraint evaluate:nil], @"Should have accepted nil.");
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)checkArg:(id)theArg
|
||||
{
|
||||
didCallCustomConstraint = YES;
|
||||
return [theArg isEqualToString:@"foo"];
|
||||
}
|
||||
|
||||
- (void)testUsesPlainMethod
|
||||
{
|
||||
OCMConstraint *constraint = CONSTRAINT(@selector(checkArg:));
|
||||
|
||||
STAssertTrue([constraint evaluate:@"foo"], @"Should have accepted foo.");
|
||||
STAssertTrue(didCallCustomConstraint, @"Should have used custom method.");
|
||||
STAssertFalse([constraint evaluate:@"bar"], @"Should not have accepted bar.");
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)checkArg:(id)theArg withValue:(id)value
|
||||
{
|
||||
didCallCustomConstraint = YES;
|
||||
return [theArg isEqual:value];
|
||||
}
|
||||
|
||||
- (void)testUsesMethodWithValue
|
||||
{
|
||||
OCMConstraint *constraint = CONSTRAINTV(@selector(checkArg:withValue:), @"foo");
|
||||
|
||||
STAssertTrue([constraint evaluate:@"foo"], @"Should have accepted foo.");
|
||||
STAssertTrue(didCallCustomConstraint, @"Should have used custom method.");
|
||||
STAssertFalse([constraint evaluate:@"bar"], @"Should not have accepted bar.");
|
||||
}
|
||||
|
||||
|
||||
- (void)testRaisesExceptionWhenConstraintMethodDoesNotTakeArgument
|
||||
{
|
||||
STAssertThrows(CONSTRAINTV(@selector(checkArg:), @"bar"), @"Should have thrown for invalid constraint method.");
|
||||
}
|
||||
|
||||
|
||||
- (void)testRaisesExceptionOnUnknownSelector
|
||||
{
|
||||
STAssertThrows(CONSTRAINTV(@selector(checkArgXXX:), @"bar"), @"Should have thrown for unknown constraint method.");
|
||||
}
|
||||
|
||||
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
|
||||
-(void)testUsesBlock
|
||||
{
|
||||
BOOL (^checkForFooBlock)(id) = ^(id value)
|
||||
{
|
||||
return [value isEqualToString:@"foo"];
|
||||
};
|
||||
|
||||
OCMBlockConstraint *constraint = [[[OCMBlockConstraint alloc] initWithConstraintBlock:checkForFooBlock] autorelease];
|
||||
|
||||
STAssertTrue([constraint evaluate:@"foo"], @"Should have accepted foo.");
|
||||
STAssertFalse([constraint evaluate:@"bar"], @"Should not have accepted bar.");
|
||||
}
|
||||
|
||||
-(void)testBlockConstraintCanCaptureArgument
|
||||
{
|
||||
__block NSString *captured;
|
||||
BOOL (^captureArgBlock)(id) = ^(id value)
|
||||
{
|
||||
captured = value;
|
||||
return YES;
|
||||
};
|
||||
|
||||
OCMBlockConstraint *constraint = [[[OCMBlockConstraint alloc] initWithConstraintBlock:captureArgBlock] autorelease];
|
||||
|
||||
[constraint evaluate:@"foo"];
|
||||
STAssertEqualObjects(@"foo", captured, @"Should have captured value from last invocation.");
|
||||
[constraint evaluate:@"bar"];
|
||||
STAssertEqualObjects(@"bar", captured, @"Should have captured value from last invocation.");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@end
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2013 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <SenTestingKit/SenTestingKit.h>
|
||||
|
||||
@interface OCMockObjectClassMethodMockingTests : SenTestCase
|
||||
|
||||
@end
|
||||
Vendored
+119
@@ -0,0 +1,119 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2013 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <OCMock/OCMock.h>
|
||||
#import "OCClassMockObject.h"
|
||||
#import "OCMockObjectClassMethodMockingTests.h"
|
||||
|
||||
#pragma mark Helper classes
|
||||
|
||||
@interface TestClassWithClassMethods : NSObject
|
||||
+ (NSString *)foo;
|
||||
+ (NSString *)bar;
|
||||
- (NSString *)bar;
|
||||
@end
|
||||
|
||||
@implementation TestClassWithClassMethods
|
||||
|
||||
+ (NSString *)foo
|
||||
{
|
||||
return @"Foo-ClassMethod";
|
||||
}
|
||||
|
||||
+ (NSString *)bar
|
||||
{
|
||||
return @"Bar-ClassMethod";
|
||||
}
|
||||
|
||||
- (NSString *)bar
|
||||
{
|
||||
return @"Bar";
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@implementation OCMockObjectClassMethodMockingTests
|
||||
|
||||
#pragma mark Tests stubbing class methods
|
||||
|
||||
- (void)testCanStubClassMethod
|
||||
{
|
||||
id mock = [OCMockObject mockForClass:[TestClassWithClassMethods class]];
|
||||
|
||||
[[[[mock stub] classMethod] andReturn:@"mocked"] foo];
|
||||
|
||||
STAssertEqualObjects(@"mocked", [TestClassWithClassMethods foo], @"Should have stubbed class method.");
|
||||
}
|
||||
|
||||
- (void)testClassReceivesMethodsAfterStopWasCalled
|
||||
{
|
||||
id mock = [OCMockObject mockForClass:[TestClassWithClassMethods class]];
|
||||
|
||||
[[[[mock stub] classMethod] andReturn:@"mocked"] foo];
|
||||
[mock stopMocking];
|
||||
|
||||
STAssertEqualObjects(@"Foo-ClassMethod", [TestClassWithClassMethods foo], @"Should not have stubbed class method.");
|
||||
}
|
||||
|
||||
- (void)testClassReceivesMethodAgainWhenExpectedCallOccurred
|
||||
{
|
||||
id mock = [OCMockObject mockForClass:[TestClassWithClassMethods class]];
|
||||
|
||||
[[[[mock expect] classMethod] andReturn:@"mocked"] foo];
|
||||
|
||||
STAssertEqualObjects(@"mocked", [TestClassWithClassMethods foo], @"Should have stubbed method.");
|
||||
STAssertEqualObjects(@"Foo-ClassMethod", [TestClassWithClassMethods foo], @"Should have 'unstubbed' method.");
|
||||
}
|
||||
|
||||
- (void)testStubsOnlyClassMethodWhenInstanceMethodWithSameNameExists
|
||||
{
|
||||
id mock = [OCMockObject mockForClass:[TestClassWithClassMethods class]];
|
||||
|
||||
[[[[mock stub] classMethod] andReturn:@"mocked"] bar];
|
||||
|
||||
STAssertEqualObjects(@"mocked", [TestClassWithClassMethods bar], @"Should have stubbed class method.");
|
||||
STAssertThrows([mock bar], @"Should not have stubbed instance method.");
|
||||
}
|
||||
|
||||
- (void)testStubsClassMethodWhenNoInstanceMethodExistsWithName
|
||||
{
|
||||
id mock = [OCMockObject mockForClass:[TestClassWithClassMethods class]];
|
||||
|
||||
[[[mock stub] andReturn:@"mocked"] foo];
|
||||
|
||||
STAssertEqualObjects(@"mocked", [TestClassWithClassMethods foo], @"Should have stubbed class method.");
|
||||
}
|
||||
|
||||
- (void)testStubsCanDistinguishInstanceAndClassMethods
|
||||
{
|
||||
id mock = [OCMockObject mockForClass:[TestClassWithClassMethods class]];
|
||||
|
||||
[[[[mock stub] classMethod] andReturn:@"mocked-class"] bar];
|
||||
[[[mock stub] andReturn:@"mocked-instance"] bar];
|
||||
|
||||
STAssertEqualObjects(@"mocked-class", [TestClassWithClassMethods bar], @"Should have stubbed class method.");
|
||||
STAssertEqualObjects(@"mocked-instance", [mock bar], @"Should have stubbed instance method.");
|
||||
}
|
||||
|
||||
- (void)testRevertsAllStubbedMethodsOnDealloc
|
||||
{
|
||||
id mock = [[OCClassMockObject alloc] initWithClass:[TestClassWithClassMethods class]];
|
||||
|
||||
[[[[mock stub] classMethod] andReturn:@"mocked-foo"] foo];
|
||||
[[[[mock stub] classMethod] andReturn:@"mocked-bar"] bar];
|
||||
|
||||
STAssertEqualObjects(@"mocked-foo", [TestClassWithClassMethods foo], @"Should have stubbed class method 'foo'.");
|
||||
STAssertEqualObjects(@"mocked-bar", [TestClassWithClassMethods bar], @"Should have stubbed class method 'bar'.");
|
||||
|
||||
[mock release];
|
||||
|
||||
STAssertEqualObjects(@"Foo-ClassMethod", [TestClassWithClassMethods foo], @"Should have 'unstubbed' class method 'foo'.");
|
||||
STAssertEqualObjects(@"Bar-ClassMethod", [TestClassWithClassMethods bar], @"Should have 'unstubbed' class method 'bar'.");
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2013 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <SenTestingKit/SenTestingKit.h>
|
||||
|
||||
@interface OCMockForwardingTargetTests : SenTestCase
|
||||
|
||||
@end
|
||||
Vendored
+136
@@ -0,0 +1,136 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2013 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import "OCMockObjectForwardingTargetTests.h"
|
||||
#import <OCMock/OCMock.h>
|
||||
#import <objc/runtime.h>
|
||||
|
||||
#pragma mark Helper classes
|
||||
|
||||
@interface InternalObject : NSObject
|
||||
@property (nonatomic, strong) NSString *name;
|
||||
@end
|
||||
|
||||
@interface PublicObject : NSObject
|
||||
@property (nonatomic, strong) NSString *name;
|
||||
@end
|
||||
|
||||
@implementation InternalObject
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[_name release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation PublicObject
|
||||
{
|
||||
InternalObject *_internal;
|
||||
};
|
||||
|
||||
@dynamic name;
|
||||
|
||||
- (instancetype)initWithInternal:(InternalObject *)internal
|
||||
{
|
||||
self = [super init];
|
||||
if (!self)
|
||||
return self;
|
||||
|
||||
_internal = internal;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
return [self initWithInternal:[[InternalObject alloc] init]];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[_internal release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)forwardingTargetForSelector:(SEL)selector
|
||||
{
|
||||
if (selector == @selector(name) ||
|
||||
selector == @selector(setName:))
|
||||
return _internal;
|
||||
return [super forwardingTargetForSelector:selector];
|
||||
}
|
||||
|
||||
+ (NSMethodSignature *)instanceMethodSignatureForSelector:(SEL)selector
|
||||
{
|
||||
NSMethodSignature *signature = [super instanceMethodSignatureForSelector:selector];
|
||||
if (signature)
|
||||
return signature;
|
||||
else
|
||||
return [InternalObject instanceMethodSignatureForSelector:selector];
|
||||
}
|
||||
|
||||
- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector
|
||||
{
|
||||
NSMethodSignature *signature = [super methodSignatureForSelector:selector];
|
||||
if (signature)
|
||||
return signature;
|
||||
|
||||
return [[self forwardingTargetForSelector:selector] methodSignatureForSelector:selector];
|
||||
}
|
||||
|
||||
- (BOOL)respondsToSelector:(SEL)selector
|
||||
{
|
||||
if ([super respondsToSelector:selector])
|
||||
return YES;
|
||||
|
||||
return [[self forwardingTargetForSelector:selector] respondsToSelector:selector];
|
||||
}
|
||||
|
||||
+ (BOOL)instancesRespondToSelector:(SEL)selector
|
||||
{
|
||||
if (class_respondsToSelector(self, selector))
|
||||
return YES;
|
||||
|
||||
return [InternalObject instancesRespondToSelector:selector];
|
||||
}
|
||||
|
||||
- (id)valueForUndefinedKey:(NSString *)key
|
||||
{
|
||||
return [_internal valueForKey:key];
|
||||
}
|
||||
|
||||
- (void)setValue:(id)value forUndefinedKey:(NSString *)key
|
||||
{
|
||||
[_internal setValue:value forKey:key];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#pragma mark Tests
|
||||
|
||||
|
||||
@implementation OCMockForwardingTargetTests
|
||||
|
||||
- (void)testNameShouldForwardToInternal
|
||||
{
|
||||
InternalObject *internal = [[InternalObject alloc] init];
|
||||
internal.name = @"Internal Object";
|
||||
PublicObject *public = [[PublicObject alloc] initWithInternal:internal];
|
||||
STAssertEqualObjects(@"Internal Object", public.name, nil);
|
||||
}
|
||||
|
||||
- (void)testStubsMethodImplementation
|
||||
{
|
||||
PublicObject *public = [[PublicObject alloc] init];
|
||||
id mock = [OCMockObject partialMockForObject:public];
|
||||
|
||||
[[[mock stub] andReturn:@"FOO"] name];
|
||||
STAssertEqualObjects(@"FOO", [mock name], nil);
|
||||
}
|
||||
|
||||
@end
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2004-2008 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <SenTestingKit/SenTestingKit.h>
|
||||
|
||||
|
||||
@interface OCMockObjectHamcrestTests : SenTestCase
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id: OCMockObjectTests.m 21 2008-01-24 18:59:39Z erik $
|
||||
// Copyright (c) 2004-2008 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <OCMock/OCMock.h>
|
||||
#import "OCMockObjectHamcrestTests.h"
|
||||
|
||||
#define HC_SHORTHAND
|
||||
#import <OCHamcrest/OCHamcrest.h>
|
||||
|
||||
|
||||
@implementation OCMockObjectHamcrestTests
|
||||
|
||||
- (void)testAcceptsStubbedMethodWithHamcrestConstraint
|
||||
{
|
||||
id mock = [OCMockObject mockForClass:[NSString class]];
|
||||
[[mock stub] hasSuffix:(id)startsWith(@"foo")];
|
||||
[mock hasSuffix:@"foobar"];
|
||||
}
|
||||
|
||||
|
||||
- (void)testRejectsUnstubbedMethodWithHamcrestConstraint
|
||||
{
|
||||
id mock = [OCMockObject mockForClass:[NSString class]];
|
||||
[[mock stub] hasSuffix:(id)anyOf(equalTo(@"foo"), equalTo(@"bar"), NULL)];
|
||||
STAssertThrows([mock hasSuffix:@"foobar"], @"Should have raised an exception.");
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2013 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <SenTestingKit/SenTestingKit.h>
|
||||
|
||||
@interface OCMockObjectPartialMocksTests : SenTestCase
|
||||
|
||||
@end
|
||||
+174
@@ -0,0 +1,174 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2013 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <OCMock/OCMock.h>
|
||||
#import "OCMockObjectPartialMocksTests.h"
|
||||
|
||||
#pragma mark Helper classes
|
||||
|
||||
@interface TestClassWithSimpleMethod : NSObject
|
||||
- (NSString *)foo;
|
||||
@end
|
||||
|
||||
@implementation TestClassWithSimpleMethod
|
||||
|
||||
- (NSString *)foo
|
||||
{
|
||||
return @"Foo";
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface TestClassThatCallsSelf : NSObject
|
||||
- (NSString *)method1;
|
||||
- (NSString *)method2;
|
||||
@end
|
||||
|
||||
@implementation TestClassThatCallsSelf
|
||||
|
||||
- (NSString *)method1
|
||||
{
|
||||
id retVal = [self method2];
|
||||
return retVal;
|
||||
}
|
||||
|
||||
- (NSString *)method2
|
||||
{
|
||||
return @"Foo";
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@implementation OCMockObjectPartialMocksTests
|
||||
|
||||
#pragma mark Tests for stubbing with partial mocks
|
||||
|
||||
- (void)testStubsMethodsOnPartialMock
|
||||
{
|
||||
TestClassWithSimpleMethod *object = [[[TestClassWithSimpleMethod alloc] init] autorelease];
|
||||
id mock = [OCMockObject partialMockForObject:object];
|
||||
[[[mock stub] andReturn:@"hi"] foo];
|
||||
STAssertEqualObjects(@"hi", [mock foo], @"Should have returned stubbed value");
|
||||
}
|
||||
|
||||
//- (void)testStubsMethodsOnPartialMockForTollFreeBridgedClasses
|
||||
//{
|
||||
// mock = [OCMockObject partialMockForObject:[NSString stringWithString:@"hello"]];
|
||||
// [[[mock stub] andReturn:@"hi"] uppercaseString];
|
||||
// STAssertEqualObjects(@"hi", [mock uppercaseString], @"Should have returned stubbed value");
|
||||
//}
|
||||
|
||||
- (void)testForwardsUnstubbedMethodsCallsToRealObjectOnPartialMock
|
||||
{
|
||||
TestClassWithSimpleMethod *object = [[[TestClassWithSimpleMethod alloc] init] autorelease];
|
||||
id mock = [OCMockObject partialMockForObject:object];
|
||||
STAssertEqualObjects(@"Foo", [mock foo], @"Should have returned value from real object.");
|
||||
}
|
||||
|
||||
//- (void)testForwardsUnstubbedMethodsCallsToRealObjectOnPartialMockForTollFreeBridgedClasses
|
||||
//{
|
||||
// mock = [OCMockObject partialMockForObject:[NSString stringWithString:@"hello2"]];
|
||||
// STAssertEqualObjects(@"HELLO2", [mock uppercaseString], @"Should have returned value from real object.");
|
||||
//}
|
||||
|
||||
- (void)testStubsMethodOnRealObjectReference
|
||||
{
|
||||
TestClassWithSimpleMethod *realObject = [[[TestClassWithSimpleMethod alloc] init] autorelease];
|
||||
id mock = [OCMockObject partialMockForObject:realObject];
|
||||
[[[mock stub] andReturn:@"TestFoo"] foo];
|
||||
STAssertEqualObjects(@"TestFoo", [realObject foo], @"Should have stubbed method.");
|
||||
}
|
||||
|
||||
- (void)testCallsToSelfInRealObjectAreShadowedByPartialMock
|
||||
{
|
||||
TestClassThatCallsSelf *realObject = [[[TestClassThatCallsSelf alloc] init] autorelease];
|
||||
id mock = [OCMockObject partialMockForObject:realObject];
|
||||
[[[mock stub] andReturn:@"FooFoo"] method2];
|
||||
STAssertEqualObjects(@"FooFoo", [mock method1], @"Should have called through to stubbed method.");
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Tests for end of stubbing with partial mocks
|
||||
|
||||
- (void)testReturnsToRealImplementationWhenExpectedCallOccurred
|
||||
{
|
||||
TestClassWithSimpleMethod *realObject = [[[TestClassWithSimpleMethod alloc] init] autorelease];
|
||||
id mock = [OCMockObject partialMockForObject:realObject];
|
||||
[[[mock expect] andReturn:@"TestFoo"] foo];
|
||||
STAssertEqualObjects(@"TestFoo", [realObject foo], @"Should have stubbed method.");
|
||||
STAssertEqualObjects(@"Foo", [realObject foo], @"Should have 'unstubbed' method.");
|
||||
}
|
||||
|
||||
- (void)testRestoresObjectWhenStopped
|
||||
{
|
||||
TestClassWithSimpleMethod *realObject = [[[TestClassWithSimpleMethod alloc] init] autorelease];
|
||||
id mock = [OCMockObject partialMockForObject:realObject];
|
||||
[[[mock stub] andReturn:@"TestFoo"] foo];
|
||||
STAssertEqualObjects(@"TestFoo", [realObject foo], @"Should have stubbed method.");
|
||||
STAssertEqualObjects(@"TestFoo", [realObject foo], @"Should have stubbed method.");
|
||||
[mock stopMocking];
|
||||
STAssertEqualObjects(@"Foo", [realObject foo], @"Should have 'unstubbed' method.");
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Tests for explicit forward to real object with partial mocks
|
||||
|
||||
- (void)testForwardsToRealObjectWhenSetUpAndCalledOnMock
|
||||
{
|
||||
TestClassWithSimpleMethod *realObject = [[[TestClassWithSimpleMethod alloc] init] autorelease];
|
||||
id mock = [OCMockObject partialMockForObject:realObject];
|
||||
|
||||
[[[mock expect] andForwardToRealObject] foo];
|
||||
STAssertEquals(@"Foo", [mock foo], @"Should have called method on real object.");
|
||||
|
||||
[mock verify];
|
||||
}
|
||||
|
||||
- (void)testForwardsToRealObjectWhenSetUpAndCalledOnRealObject
|
||||
{
|
||||
TestClassWithSimpleMethod *realObject = [[[TestClassWithSimpleMethod alloc] init] autorelease];
|
||||
id mock = [OCMockObject partialMockForObject:realObject];
|
||||
|
||||
[[[mock expect] andForwardToRealObject] foo];
|
||||
STAssertEquals(@"Foo", [realObject foo], @"Should have called method on real object.");
|
||||
|
||||
[mock verify];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Tests for method swizzling with partial mocks
|
||||
|
||||
- (NSString *)differentMethodInDifferentClass
|
||||
{
|
||||
return @"swizzled!";
|
||||
}
|
||||
|
||||
- (void)testImplementsMethodSwizzling
|
||||
{
|
||||
// using partial mocks and the indirect return value provider
|
||||
TestClassThatCallsSelf *foo = [[[TestClassThatCallsSelf alloc] init] autorelease];
|
||||
id mock = [OCMockObject partialMockForObject:foo];
|
||||
[[[mock stub] andCall:@selector(differentMethodInDifferentClass) onObject:self] method1];
|
||||
STAssertEqualObjects(@"swizzled!", [foo method1], @"Should have returned value from different method");
|
||||
}
|
||||
|
||||
|
||||
- (void)aMethodWithVoidReturn
|
||||
{
|
||||
}
|
||||
|
||||
- (void)testMethodSwizzlingWorksForVoidReturns
|
||||
{
|
||||
TestClassThatCallsSelf *foo = [[[TestClassThatCallsSelf alloc] init] autorelease];
|
||||
id mock = [OCMockObject partialMockForObject:foo];
|
||||
[[[mock stub] andCall:@selector(aMethodWithVoidReturn) onObject:self] method1];
|
||||
STAssertNoThrow([foo method1], @"Should have worked.");
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,13 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2004-2008 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <SenTestingKit/SenTestingKit.h>
|
||||
|
||||
@interface OCMockObjectTests : SenTestCase
|
||||
{
|
||||
id mock;
|
||||
}
|
||||
|
||||
@end
|
||||
+812
@@ -0,0 +1,812 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2004-2010 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <OCMock/OCMock.h>
|
||||
#import "OCMockObjectTests.h"
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Helper classes and protocols for testing
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
@interface InterfaceForTypedef : NSObject
|
||||
@end
|
||||
|
||||
@implementation InterfaceForTypedef
|
||||
@end
|
||||
|
||||
typedef InterfaceForTypedef TypedefInterface;
|
||||
typedef InterfaceForTypedef* PointerTypedefInterface;
|
||||
typedef int intTypedef;
|
||||
|
||||
@protocol TestProtocol
|
||||
- (int)primitiveValue;
|
||||
@optional
|
||||
- (id)objectValue;
|
||||
@end
|
||||
|
||||
@protocol ProtocolWithTypeQualifierMethod
|
||||
- (void)aSpecialMethod:(byref in void *)someArg;
|
||||
@end
|
||||
|
||||
@protocol ProtocolWithTypedefs
|
||||
- (TypedefInterface*)typedefReturnValue1;
|
||||
- (PointerTypedefInterface)typedefReturnValue2;
|
||||
- (void)typedefParameter:(TypedefInterface*)parameter;
|
||||
- (void)typedefPointerParameter:(PointerTypedefInterface)parameter;
|
||||
@end
|
||||
|
||||
@interface ProtocolWithTypedefsImplementation : NSObject<ProtocolWithTypedefs>
|
||||
- (TypedefInterface*)typedefReturnValue1;
|
||||
- (PointerTypedefInterface)typedefReturnValue2;
|
||||
- (void)typedefParameter:(TypedefInterface*)parameter;
|
||||
- (void)typedefPointerParameter:(PointerTypedefInterface)parameter;
|
||||
@end
|
||||
|
||||
@implementation ProtocolWithTypedefsImplementation
|
||||
|
||||
- (TypedefInterface*)typedefReturnValue1 {
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (PointerTypedefInterface)typedefReturnValue2 {
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)typedefParameter:(TypedefInterface*)parameter {
|
||||
}
|
||||
|
||||
-(void)typedefPointerParameter:(PointerTypedefInterface)parameter {
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface TestClassWithIntPointerMethod : NSObject
|
||||
|
||||
- (void)returnValueInPointer:(int *)ptr;
|
||||
|
||||
@end
|
||||
|
||||
@implementation TestClassWithIntPointerMethod
|
||||
|
||||
- (void)returnValueInPointer:(int *)ptr
|
||||
{
|
||||
*ptr = 555;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@interface TestObserver : NSObject
|
||||
{
|
||||
@public
|
||||
NSNotification *notification;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TestObserver
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[notification release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)receiveNotification:(NSNotification *)aNotification
|
||||
{
|
||||
notification = [aNotification retain];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
static NSString *TestNotification = @"TestNotification";
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// setup
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@implementation OCMockObjectTests
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
mock = [OCMockObject mockForClass:[NSString class]];
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// accepting stubbed methods / rejecting methods not stubbed
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
- (void)testAcceptsStubbedMethod
|
||||
{
|
||||
[[mock stub] lowercaseString];
|
||||
[mock lowercaseString];
|
||||
}
|
||||
|
||||
- (void)testRaisesExceptionWhenUnknownMethodIsCalled
|
||||
{
|
||||
[[mock stub] lowercaseString];
|
||||
STAssertThrows([mock uppercaseString], @"Should have raised an exception.");
|
||||
}
|
||||
|
||||
|
||||
- (void)testAcceptsStubbedMethodWithSpecificArgument
|
||||
{
|
||||
[[mock stub] hasSuffix:@"foo"];
|
||||
[mock hasSuffix:@"foo"];
|
||||
}
|
||||
|
||||
|
||||
- (void)testAcceptsStubbedMethodWithConstraint
|
||||
{
|
||||
[[mock stub] hasSuffix:[OCMArg any]];
|
||||
[mock hasSuffix:@"foo"];
|
||||
[mock hasSuffix:@"bar"];
|
||||
}
|
||||
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
|
||||
- (void)testAcceptsStubbedMethodWithBlockArgument
|
||||
{
|
||||
mock = [OCMockObject mockForClass:[NSArray class]];
|
||||
[[mock stub] indexesOfObjectsPassingTest:[OCMArg any]];
|
||||
[mock indexesOfObjectsPassingTest:^(id obj, NSUInteger idx, BOOL *stop) { return YES; }];
|
||||
}
|
||||
|
||||
|
||||
- (void)testAcceptsStubbedMethodWithBlockConstraint
|
||||
{
|
||||
[[mock stub] hasSuffix:[OCMArg checkWithBlock:^(id value) { return [value isEqualToString:@"foo"]; }]];
|
||||
|
||||
STAssertNoThrow([mock hasSuffix:@"foo"], @"Should not have thrown a exception");
|
||||
STAssertThrows([mock hasSuffix:@"bar"], @"Should have thrown a exception");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
- (void)testAcceptsStubbedMethodWithNilArgument
|
||||
{
|
||||
[[mock stub] hasSuffix:nil];
|
||||
|
||||
[mock hasSuffix:nil];
|
||||
}
|
||||
|
||||
- (void)testRaisesExceptionWhenMethodWithWrongArgumentIsCalled
|
||||
{
|
||||
[[mock stub] hasSuffix:@"foo"];
|
||||
STAssertThrows([mock hasSuffix:@"xyz"], @"Should have raised an exception.");
|
||||
}
|
||||
|
||||
|
||||
- (void)testAcceptsStubbedMethodWithScalarArgument
|
||||
{
|
||||
[[mock stub] stringByPaddingToLength:20 withString:@"foo" startingAtIndex:5];
|
||||
[mock stringByPaddingToLength:20 withString:@"foo" startingAtIndex:5];
|
||||
}
|
||||
|
||||
|
||||
- (void)testRaisesExceptionWhenMethodWithOneWrongScalarArgumentIsCalled
|
||||
{
|
||||
[[mock stub] stringByPaddingToLength:20 withString:@"foo" startingAtIndex:5];
|
||||
STAssertThrows([mock stringByPaddingToLength:20 withString:@"foo" startingAtIndex:3], @"Should have raised an exception.");
|
||||
}
|
||||
|
||||
- (void)testAcceptsStubbedMethodWithPointerArgument
|
||||
{
|
||||
NSError *error;
|
||||
[[[mock stub] andReturnValue:OCMOCK_VALUE((BOOL){YES})] writeToFile:OCMOCK_ANY atomically:YES encoding:NSMacOSRomanStringEncoding error:&error];
|
||||
|
||||
STAssertTrue([mock writeToFile:@"foo" atomically:YES encoding:NSMacOSRomanStringEncoding error:&error], nil);
|
||||
}
|
||||
|
||||
- (void)testAcceptsStubbedMethodWithAnyPointerArgument
|
||||
{
|
||||
NSError *error;
|
||||
[[[mock stub] andReturnValue:OCMOCK_VALUE((BOOL){YES})] writeToFile:OCMOCK_ANY atomically:YES encoding:NSMacOSRomanStringEncoding error:[OCMArg anyPointer]];
|
||||
|
||||
STAssertTrue([mock writeToFile:@"foo" atomically:YES encoding:NSMacOSRomanStringEncoding error:&error], nil);
|
||||
}
|
||||
|
||||
- (void)testRaisesExceptionWhenMethodWithWrongPointerArgumentIsCalled
|
||||
{
|
||||
NSString *string;
|
||||
NSString *anotherString;
|
||||
NSArray *array;
|
||||
|
||||
[[mock stub] completePathIntoString:&string caseSensitive:YES matchesIntoArray:&array filterTypes:OCMOCK_ANY];
|
||||
|
||||
STAssertThrows([mock completePathIntoString:&anotherString caseSensitive:YES matchesIntoArray:&array filterTypes:OCMOCK_ANY], nil);
|
||||
}
|
||||
|
||||
- (void)testAcceptsStubbedMethodWithVoidPointerArgument
|
||||
{
|
||||
mock = [OCMockObject mockForClass:[NSMutableData class]];
|
||||
[[mock stub] appendBytes:NULL length:0];
|
||||
[mock appendBytes:NULL length:0];
|
||||
}
|
||||
|
||||
|
||||
- (void)testRaisesExceptionWhenMethodWithWrongVoidPointerArgumentIsCalled
|
||||
{
|
||||
mock = [OCMockObject mockForClass:[NSMutableData class]];
|
||||
[[mock stub] appendBytes:"foo" length:3];
|
||||
STAssertThrows([mock appendBytes:"bar" length:3], @"Should have raised an exception.");
|
||||
}
|
||||
|
||||
|
||||
- (void)testAcceptsStubbedMethodWithPointerPointerArgument
|
||||
{
|
||||
NSError *error = nil;
|
||||
[[mock stub] initWithContentsOfFile:@"foo.txt" encoding:NSASCIIStringEncoding error:&error];
|
||||
[mock initWithContentsOfFile:@"foo.txt" encoding:NSASCIIStringEncoding error:&error];
|
||||
}
|
||||
|
||||
|
||||
- (void)testRaisesExceptionWhenMethodWithWrongPointerPointerArgumentIsCalled
|
||||
{
|
||||
NSError *error = nil, *error2;
|
||||
[[mock stub] initWithContentsOfFile:@"foo.txt" encoding:NSASCIIStringEncoding error:&error];
|
||||
STAssertThrows([mock initWithContentsOfFile:@"foo.txt" encoding:NSASCIIStringEncoding error:&error2], @"Should have raised.");
|
||||
}
|
||||
|
||||
|
||||
- (void)testAcceptsStubbedMethodWithStructArgument
|
||||
{
|
||||
NSRange range = NSMakeRange(0,20);
|
||||
[[mock stub] substringWithRange:range];
|
||||
[mock substringWithRange:range];
|
||||
}
|
||||
|
||||
|
||||
- (void)testRaisesExceptionWhenMethodWithWrongStructArgumentIsCalled
|
||||
{
|
||||
NSRange range = NSMakeRange(0,20);
|
||||
NSRange otherRange = NSMakeRange(0,10);
|
||||
[[mock stub] substringWithRange:range];
|
||||
STAssertThrows([mock substringWithRange:otherRange], @"Should have raised an exception.");
|
||||
}
|
||||
|
||||
|
||||
- (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
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
- (void)testReturnsStubbedReturnValue
|
||||
{
|
||||
id returnValue;
|
||||
|
||||
[[[mock stub] andReturn:@"megamock"] lowercaseString];
|
||||
returnValue = [mock lowercaseString];
|
||||
|
||||
STAssertEqualObjects(@"megamock", returnValue, @"Should have returned stubbed value.");
|
||||
|
||||
}
|
||||
|
||||
- (void)testReturnsStubbedIntReturnValue
|
||||
{
|
||||
int expectedValue = 42;
|
||||
[[[mock stub] andReturnValue:OCMOCK_VALUE(expectedValue)] intValue];
|
||||
int returnValue = [mock intValue];
|
||||
|
||||
STAssertEquals(expectedValue, returnValue, @"Should have returned stubbed value.");
|
||||
}
|
||||
|
||||
- (void)testRaisesWhenBoxedValueTypesDoNotMatch
|
||||
{
|
||||
double expectedValue = 42;
|
||||
[[[mock stub] andReturnValue:OCMOCK_VALUE(expectedValue)] intValue];
|
||||
|
||||
STAssertThrows([mock intValue], @"Should have raised an exception.");
|
||||
}
|
||||
|
||||
- (void)testReturnsStubbedNilReturnValue
|
||||
{
|
||||
[[[mock stub] andReturn:nil] uppercaseString];
|
||||
|
||||
id returnValue = [mock uppercaseString];
|
||||
|
||||
STAssertNil(returnValue, @"Should have returned stubbed value, which is nil.");
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// raising exceptions, posting notifications, etc.
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
- (void)testRaisesExceptionWhenAskedTo
|
||||
{
|
||||
NSException *exception = [NSException exceptionWithName:@"TestException" reason:@"test" userInfo:nil];
|
||||
[[[mock expect] andThrow:exception] lowercaseString];
|
||||
|
||||
STAssertThrows([mock lowercaseString], @"Should have raised an exception.");
|
||||
}
|
||||
|
||||
- (void)testPostsNotificationWhenAskedTo
|
||||
{
|
||||
TestObserver *observer = [[[TestObserver alloc] init] autorelease];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:observer selector:@selector(receiveNotification:) name:TestNotification object:nil];
|
||||
|
||||
NSNotification *notification = [NSNotification notificationWithName:TestNotification object:self];
|
||||
[[[mock stub] andPost:notification] lowercaseString];
|
||||
|
||||
[mock lowercaseString];
|
||||
|
||||
STAssertNotNil(observer->notification, @"Should have sent a notification.");
|
||||
STAssertEqualObjects(TestNotification, [observer->notification name], @"Name should match posted one.");
|
||||
STAssertEqualObjects(self, [observer->notification object], @"Object should match posted one.");
|
||||
}
|
||||
|
||||
- (void)testPostsNotificationInAddtionToReturningValue
|
||||
{
|
||||
TestObserver *observer = [[[TestObserver alloc] init] autorelease];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:observer selector:@selector(receiveNotification:) name:TestNotification object:nil];
|
||||
|
||||
NSNotification *notification = [NSNotification notificationWithName:TestNotification object:self];
|
||||
[[[[mock stub] andReturn:@"foo"] andPost:notification] lowercaseString];
|
||||
|
||||
STAssertEqualObjects(@"foo", [mock lowercaseString], @"Should have returned stubbed value.");
|
||||
STAssertNotNil(observer->notification, @"Should have sent a notification.");
|
||||
}
|
||||
|
||||
|
||||
- (NSString *)valueForString:(NSString *)aString andMask:(NSStringCompareOptions)mask
|
||||
{
|
||||
return [NSString stringWithFormat:@"[%@, %ld]", aString, mask];
|
||||
}
|
||||
|
||||
- (void)testCallsAlternativeMethodAndPassesOriginalArgumentsAndReturnsValue
|
||||
{
|
||||
[[[mock stub] andCall:@selector(valueForString:andMask:) onObject:self] commonPrefixWithString:@"FOO" options:NSCaseInsensitiveSearch];
|
||||
|
||||
NSString *returnValue = [mock commonPrefixWithString:@"FOO" options:NSCaseInsensitiveSearch];
|
||||
|
||||
STAssertEqualObjects(@"[FOO, 1]", returnValue, @"Should have passed and returned invocation.");
|
||||
}
|
||||
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
|
||||
- (void)testCallsBlockWhichCanSetUpReturnValue
|
||||
{
|
||||
void (^theBlock)(NSInvocation *) = ^(NSInvocation *invocation)
|
||||
{
|
||||
NSString *value;
|
||||
[invocation getArgument:&value atIndex:2];
|
||||
value = [NSString stringWithFormat:@"MOCK %@", value];
|
||||
[invocation setReturnValue:&value];
|
||||
};
|
||||
|
||||
[[[mock stub] andDo:theBlock] stringByAppendingString:[OCMArg any]];
|
||||
|
||||
STAssertEqualObjects(@"MOCK foo", [mock stringByAppendingString:@"foo"], @"Should have called block.");
|
||||
STAssertEqualObjects(@"MOCK bar", [mock stringByAppendingString:@"bar"], @"Should have called block.");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
- (void)testThrowsWhenTryingToUseForwardToRealObjectOnNonPartialMock
|
||||
{
|
||||
STAssertThrows([[[mock expect] andForwardToRealObject] name], @"Should have raised and exception.");
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// returning values in pass-by-reference arguments
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
- (void)testReturnsValuesInPassByReferenceArguments
|
||||
{
|
||||
NSString *expectedName = @"Test";
|
||||
NSArray *expectedArray = [NSArray array];
|
||||
|
||||
[[mock expect] completePathIntoString:[OCMArg setTo:expectedName] caseSensitive:YES
|
||||
matchesIntoArray:[OCMArg setTo:expectedArray] filterTypes:OCMOCK_ANY];
|
||||
|
||||
NSString *actualName = nil;
|
||||
NSArray *actualArray = nil;
|
||||
[mock completePathIntoString:&actualName caseSensitive:YES matchesIntoArray:&actualArray filterTypes:nil];
|
||||
|
||||
STAssertNoThrow([mock verify], @"An unexpected exception was thrown");
|
||||
STAssertEqualObjects(expectedName, actualName, @"The two string objects should be equal");
|
||||
STAssertEqualObjects(expectedArray, actualArray, @"The two array objects should be equal");
|
||||
}
|
||||
|
||||
|
||||
- (void)testReturnsValuesInNonObjectPassByReferenceArguments
|
||||
{
|
||||
int expectedValue = 1234;
|
||||
mock = [OCMockObject mockForClass:[TestClassWithIntPointerMethod class]];
|
||||
[[mock stub] returnValueInPointer:[OCMArg setToValue:[NSValue value:&expectedValue withObjCType:@encode(int)]]];
|
||||
|
||||
int actualValue = 0;
|
||||
[mock returnValueInPointer:&actualValue];
|
||||
|
||||
STAssertEquals(expectedValue, actualValue, @"Should have returned value via pass by ref argument.");
|
||||
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// accepting expected methods
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
- (void)testAcceptsExpectedMethod
|
||||
{
|
||||
[[mock expect] lowercaseString];
|
||||
[mock lowercaseString];
|
||||
}
|
||||
|
||||
|
||||
- (void)testAcceptsExpectedMethodAndReturnsValue
|
||||
{
|
||||
id returnValue;
|
||||
|
||||
[[[mock expect] andReturn:@"Objective-C"] lowercaseString];
|
||||
returnValue = [mock lowercaseString];
|
||||
|
||||
STAssertEqualObjects(@"Objective-C", returnValue, @"Should have returned stubbed value.");
|
||||
}
|
||||
|
||||
|
||||
- (void)testAcceptsExpectedMethodsInRecordedSequence
|
||||
{
|
||||
[[mock expect] lowercaseString];
|
||||
[[mock expect] uppercaseString];
|
||||
|
||||
[mock lowercaseString];
|
||||
[mock uppercaseString];
|
||||
}
|
||||
|
||||
|
||||
- (void)testAcceptsExpectedMethodsInDifferentSequence
|
||||
{
|
||||
[[mock expect] lowercaseString];
|
||||
[[mock expect] uppercaseString];
|
||||
|
||||
[mock uppercaseString];
|
||||
[mock lowercaseString];
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// verifying expected methods
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
- (void)testAcceptsAndVerifiesExpectedMethods
|
||||
{
|
||||
[[mock expect] lowercaseString];
|
||||
[[mock expect] uppercaseString];
|
||||
|
||||
[mock lowercaseString];
|
||||
[mock uppercaseString];
|
||||
|
||||
[mock verify];
|
||||
}
|
||||
|
||||
|
||||
- (void)testRaisesExceptionOnVerifyWhenNotAllExpectedMethodsWereCalled
|
||||
{
|
||||
[[mock expect] lowercaseString];
|
||||
[[mock expect] uppercaseString];
|
||||
|
||||
[mock lowercaseString];
|
||||
|
||||
STAssertThrows([mock verify], @"Should have raised an exception.");
|
||||
}
|
||||
|
||||
- (void)testAcceptsAndVerifiesTwoExpectedInvocationsOfSameMethod
|
||||
{
|
||||
[[mock expect] lowercaseString];
|
||||
[[mock expect] lowercaseString];
|
||||
|
||||
[mock lowercaseString];
|
||||
[mock lowercaseString];
|
||||
|
||||
[mock verify];
|
||||
}
|
||||
|
||||
|
||||
- (void)testAcceptsAndVerifiesTwoExpectedInvocationsOfSameMethodAndReturnsCorrespondingValues
|
||||
{
|
||||
[[[mock expect] andReturn:@"foo"] lowercaseString];
|
||||
[[[mock expect] andReturn:@"bar"] lowercaseString];
|
||||
|
||||
STAssertEqualObjects(@"foo", [mock lowercaseString], @"Should have returned first stubbed value");
|
||||
STAssertEqualObjects(@"bar", [mock lowercaseString], @"Should have returned seconds stubbed value");
|
||||
|
||||
[mock verify];
|
||||
}
|
||||
|
||||
- (void)testReturnsStubbedValuesIndependentOfExpectations
|
||||
{
|
||||
[[mock stub] hasSuffix:@"foo"];
|
||||
[[mock expect] hasSuffix:@"bar"];
|
||||
|
||||
[mock hasSuffix:@"foo"];
|
||||
[mock hasSuffix:@"bar"];
|
||||
[mock hasSuffix:@"foo"]; // Since it's a stub, shouldn't matter how many times we call this
|
||||
|
||||
[mock verify];
|
||||
}
|
||||
|
||||
-(void)testAcceptsAndVerifiesMethodsWithSelectorArgument
|
||||
{
|
||||
[[mock expect] performSelector:@selector(lowercaseString)];
|
||||
[mock performSelector:@selector(lowercaseString)];
|
||||
[mock verify];
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// ordered expectations
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
- (void)testAcceptsExpectedMethodsInRecordedSequenceWhenOrderMatters
|
||||
{
|
||||
[mock setExpectationOrderMatters:YES];
|
||||
|
||||
[[mock expect] lowercaseString];
|
||||
[[mock expect] uppercaseString];
|
||||
|
||||
STAssertNoThrow([mock lowercaseString], @"Should have accepted expected method in sequence.");
|
||||
STAssertNoThrow([mock uppercaseString], @"Should have accepted expected method in sequence.");
|
||||
}
|
||||
|
||||
- (void)testRaisesExceptionWhenSequenceIsWrongAndOrderMatters
|
||||
{
|
||||
[mock setExpectationOrderMatters:YES];
|
||||
|
||||
[[mock expect] lowercaseString];
|
||||
[[mock expect] uppercaseString];
|
||||
|
||||
STAssertThrows([mock uppercaseString], @"Should have complained about wrong sequence.");
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// explicitly rejecting methods (mostly for nice mocks, see below)
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
- (void)testThrowsWhenRejectedMethodIsCalledOnNiceMock
|
||||
{
|
||||
mock = [OCMockObject niceMockForClass:[NSString class]];
|
||||
|
||||
[[mock reject] uppercaseString];
|
||||
STAssertThrows([mock uppercaseString], @"Should have complained about rejected method being called.");
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// protocol mocks
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
- (void)testCanMockFormalProtocol
|
||||
{
|
||||
mock = [OCMockObject mockForProtocol:@protocol(NSLocking)];
|
||||
[[mock expect] lock];
|
||||
|
||||
[mock lock];
|
||||
|
||||
[mock verify];
|
||||
}
|
||||
|
||||
- (void)testSetsCorrectNameForProtocolMockObjects
|
||||
{
|
||||
mock = [OCMockObject mockForProtocol:@protocol(NSLocking)];
|
||||
STAssertEqualObjects(@"OCMockObject[NSLocking]", [mock description], @"Should have returned correct description.");
|
||||
}
|
||||
|
||||
- (void)testRaisesWhenUnknownMethodIsCalledOnProtocol
|
||||
{
|
||||
mock = [OCMockObject mockForProtocol:@protocol(NSLocking)];
|
||||
STAssertThrows([mock lowercaseString], @"Should have raised an exception.");
|
||||
}
|
||||
|
||||
- (void)testConformsToMockedProtocol
|
||||
{
|
||||
mock = [OCMockObject mockForProtocol:@protocol(NSLocking)];
|
||||
STAssertTrue([mock conformsToProtocol:@protocol(NSLocking)], nil);
|
||||
}
|
||||
|
||||
- (void)testRespondsToValidProtocolRequiredSelector
|
||||
{
|
||||
mock = [OCMockObject mockForProtocol:@protocol(TestProtocol)];
|
||||
STAssertTrue([mock respondsToSelector:@selector(primitiveValue)], nil);
|
||||
}
|
||||
|
||||
- (void)testRespondsToValidProtocolOptionalSelector
|
||||
{
|
||||
mock = [OCMockObject mockForProtocol:@protocol(TestProtocol)];
|
||||
STAssertTrue([mock respondsToSelector:@selector(objectValue)], nil);
|
||||
}
|
||||
|
||||
- (void)testDoesNotRespondToInvalidProtocolSelector
|
||||
{
|
||||
mock = [OCMockObject mockForProtocol:@protocol(TestProtocol)];
|
||||
STAssertFalse([mock respondsToSelector:@selector(fooBar)], nil);
|
||||
}
|
||||
|
||||
- (void)testWithTypedefReturnType {
|
||||
mock = [OCMockObject mockForProtocol:@protocol(ProtocolWithTypedefs)];
|
||||
STAssertNoThrow([[[mock stub] andReturn:[TypedefInterface new]] typedefReturnValue1], @"Should accept a typedefed return-type");
|
||||
STAssertNoThrow([mock typedefReturnValue1], @"bla");
|
||||
}
|
||||
|
||||
- (void)testWithTypedefPointerReturnType {
|
||||
mock = [OCMockObject mockForProtocol:@protocol(ProtocolWithTypedefs)];
|
||||
STAssertNoThrow([[[mock stub] andReturn:[TypedefInterface new]] typedefReturnValue2], @"Should accept a typedefed return-type");
|
||||
STAssertNoThrow([mock typedefReturnValue2], @"bla");
|
||||
}
|
||||
|
||||
- (void)testWithTypedefParameter {
|
||||
mock = [OCMockObject mockForProtocol:@protocol(ProtocolWithTypedefs)];
|
||||
STAssertNoThrow([[mock stub] typedefParameter:nil], @"Should accept a typedefed parameter-type");
|
||||
STAssertNoThrow([mock typedefParameter:nil], @"bla");
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// nice mocks don't complain about unknown methods
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
- (void)testReturnsDefaultValueWhenUnknownMethodIsCalledOnNiceClassMock
|
||||
{
|
||||
mock = [OCMockObject niceMockForClass:[NSString class]];
|
||||
STAssertNil([mock lowercaseString], @"Should return nil on unexpected method call (for nice mock).");
|
||||
[mock verify];
|
||||
}
|
||||
|
||||
- (void)testRaisesAnExceptionWhenAnExpectedMethodIsNotCalledOnNiceClassMock
|
||||
{
|
||||
mock = [OCMockObject niceMockForClass:[NSString class]];
|
||||
[[[mock expect] andReturn:@"HELLO!"] uppercaseString];
|
||||
STAssertThrows([mock verify], @"Should have raised an exception because method was not called.");
|
||||
}
|
||||
|
||||
- (void)testReturnDefaultValueWhenUnknownMethodIsCalledOnProtocolMock
|
||||
{
|
||||
mock = [OCMockObject niceMockForProtocol:@protocol(TestProtocol)];
|
||||
STAssertTrue(0 == [mock primitiveValue], @"Should return 0 on unexpected method call (for nice mock).");
|
||||
[mock verify];
|
||||
}
|
||||
|
||||
- (void)testRaisesAnExceptionWenAnExpectedMethodIsNotCalledOnNiceProtocolMock
|
||||
{
|
||||
mock = [OCMockObject niceMockForProtocol:@protocol(TestProtocol)];
|
||||
[[mock expect] primitiveValue];
|
||||
STAssertThrows([mock verify], @"Should have raised an exception because method was not called.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// mocks should honour the NSObject contract, etc.
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
- (void)testRespondsToValidSelector
|
||||
{
|
||||
STAssertTrue([mock respondsToSelector:@selector(lowercaseString)], nil);
|
||||
}
|
||||
|
||||
- (void)testDoesNotRespondToInvalidSelector
|
||||
{
|
||||
STAssertFalse([mock respondsToSelector:@selector(fooBar)], nil);
|
||||
}
|
||||
|
||||
- (void)testCanStubValueForKeyMethod
|
||||
{
|
||||
id returnValue;
|
||||
|
||||
mock = [OCMockObject mockForClass:[NSObject class]];
|
||||
[[[mock stub] andReturn:@"SomeValue"] valueForKey:@"SomeKey"];
|
||||
|
||||
returnValue = [mock valueForKey:@"SomeKey"];
|
||||
|
||||
STAssertEqualObjects(@"SomeValue", returnValue, @"Should have returned value that was set up.");
|
||||
}
|
||||
|
||||
- (void)testForwardsIsKindOfClass
|
||||
{
|
||||
STAssertTrue([mock isKindOfClass:[NSString class]], @"Should have pretended to be the mocked class.");
|
||||
}
|
||||
|
||||
- (void)testWorksWithTypeQualifiers
|
||||
{
|
||||
id myMock = [OCMockObject mockForProtocol:@protocol(ProtocolWithTypeQualifierMethod)];
|
||||
|
||||
STAssertNoThrow([[myMock expect] aSpecialMethod:"foo"], @"Should not complain about method with type qualifiers.");
|
||||
STAssertNoThrow([myMock aSpecialMethod:"foo"], @"Should not complain about method with type qualifiers.");
|
||||
}
|
||||
|
||||
|
||||
- (void)testAdjustsRetainCountWhenStubbingMethodsThatCreateObjects
|
||||
{
|
||||
NSString *objectToReturn = [NSString stringWithFormat:@"This is not a %@.", @"string constant"];
|
||||
[[[mock stub] andReturn:objectToReturn] mutableCopy];
|
||||
|
||||
NSUInteger retainCountBefore = [objectToReturn retainCount];
|
||||
id returnedObject = [mock mutableCopy];
|
||||
[returnedObject release]; // the expectation is that we have to call release after a copy
|
||||
NSUInteger retainCountAfter = [objectToReturn retainCount];
|
||||
|
||||
STAssertEqualObjects(objectToReturn, returnedObject, @"Should not stubbed copy method");
|
||||
STAssertEquals(retainCountBefore, retainCountAfter, @"Should have incremented retain count in copy stub.");
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// some internal tests
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
- (void)testReRaisesFailFastExceptionsOnVerify
|
||||
{
|
||||
@try
|
||||
{
|
||||
[mock lowercaseString];
|
||||
}
|
||||
@catch(NSException *exception)
|
||||
{
|
||||
// expected
|
||||
}
|
||||
STAssertThrows([mock verify], @"Should have reraised the exception.");
|
||||
}
|
||||
|
||||
- (void)testReRaisesRejectExceptionsOnVerify
|
||||
{
|
||||
mock = [OCMockObject niceMockForClass:[NSString class]];
|
||||
[[mock reject] uppercaseString];
|
||||
@try
|
||||
{
|
||||
[mock uppercaseString];
|
||||
}
|
||||
@catch(NSException *exception)
|
||||
{
|
||||
// expected
|
||||
}
|
||||
STAssertThrows([mock verify], @"Should have reraised the exception.");
|
||||
}
|
||||
|
||||
|
||||
- (void)testCanCreateExpectationsAfterInvocations
|
||||
{
|
||||
[[mock expect] lowercaseString];
|
||||
[mock lowercaseString];
|
||||
[mock expect];
|
||||
}
|
||||
|
||||
@end
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2004-2008 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <SenTestingKit/SenTestingKit.h>
|
||||
|
||||
@interface OCMockRecorderTests : SenTestCase
|
||||
{
|
||||
NSInvocation *testInvocation;
|
||||
}
|
||||
|
||||
@end
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2004-2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import "OCMockRecorderTests.h"
|
||||
#import <OCMock/OCMockRecorder.h>
|
||||
#import "OCMReturnValueProvider.h"
|
||||
#import "OCMExceptionReturnValueProvider.h"
|
||||
|
||||
|
||||
@implementation OCMockRecorderTests
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
NSMethodSignature *signature;
|
||||
|
||||
signature = [NSString instanceMethodSignatureForSelector:@selector(initWithString:)];
|
||||
testInvocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[testInvocation setSelector:@selector(initWithString:)];
|
||||
}
|
||||
|
||||
|
||||
- (void)testStoresAndMatchesInvocation
|
||||
{
|
||||
OCMockRecorder *recorder;
|
||||
NSString *arg;
|
||||
|
||||
arg = @"I love mocks.";
|
||||
[testInvocation setArgument:&arg atIndex:2];
|
||||
|
||||
recorder = [[[OCMockRecorder alloc] initWithSignatureResolver:[NSString string]] autorelease];
|
||||
[(id)recorder initWithString:arg];
|
||||
|
||||
STAssertTrue([recorder matchesInvocation:testInvocation], @"Should match.");
|
||||
}
|
||||
|
||||
|
||||
- (void)testOnlyMatchesInvocationWithRightArguments
|
||||
{
|
||||
OCMockRecorder *recorder;
|
||||
NSString *arg;
|
||||
|
||||
arg = @"I love mocks.";
|
||||
[testInvocation setArgument:&arg atIndex:2];
|
||||
|
||||
recorder = [[[OCMockRecorder alloc] initWithSignatureResolver:[NSString string]] autorelease];
|
||||
[(id)recorder initWithString:@"whatever"];
|
||||
|
||||
STAssertFalse([recorder matchesInvocation:testInvocation], @"Should not match.");
|
||||
}
|
||||
|
||||
|
||||
- (void)testAddsReturnValueProvider
|
||||
{
|
||||
OCMockRecorder *recorder;
|
||||
NSArray *handlerList;
|
||||
|
||||
recorder = [[[OCMockRecorder alloc] initWithSignatureResolver:[NSString string]] autorelease];
|
||||
[recorder andReturn:@"foo"];
|
||||
handlerList = [recorder invocationHandlers];
|
||||
|
||||
STAssertEquals((NSUInteger)1, [handlerList count], @"Should have added one handler.");
|
||||
STAssertEqualObjects([OCMReturnValueProvider class], [[handlerList objectAtIndex:0] class], @"Should have added correct handler.");
|
||||
}
|
||||
|
||||
- (void)testAddsExceptionReturnValueProvider
|
||||
{
|
||||
OCMockRecorder *recorder;
|
||||
NSArray *handlerList;
|
||||
|
||||
recorder = [[[OCMockRecorder alloc] initWithSignatureResolver:[NSString string]] autorelease];
|
||||
[recorder andThrow:[NSException exceptionWithName:@"TestException" reason:@"A reason" userInfo:nil]];
|
||||
handlerList = [recorder invocationHandlers];
|
||||
|
||||
STAssertEquals((NSUInteger)1, [handlerList count], @"Should have added one handler.");
|
||||
STAssertEqualObjects([OCMExceptionReturnValueProvider class], [[handlerList objectAtIndex:0] class], @"Should have added correct handler.");
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.mulle-kybernetik.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <SenTestingKit/SenTestingKit.h>
|
||||
|
||||
|
||||
@interface OCObserverMockObjectTest : SenTestCase
|
||||
{
|
||||
NSNotificationCenter *center;
|
||||
|
||||
id mock;
|
||||
}
|
||||
|
||||
@end
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
// $Id$
|
||||
// Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
#import <OCMock/OCMock.h>
|
||||
#import "OCObserverMockObjectTests.h"
|
||||
|
||||
static NSString *TestNotificationOne = @"TestNotificationOne";
|
||||
|
||||
|
||||
@implementation OCObserverMockObjectTest
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
center = [[[NSNotificationCenter alloc] init] autorelease];
|
||||
mock = [OCMockObject observerMock];
|
||||
}
|
||||
|
||||
- (void)testAcceptsExpectedNotification
|
||||
{
|
||||
[center addMockObserver:mock name:TestNotificationOne object:nil];
|
||||
[[mock expect] notificationWithName:TestNotificationOne object:[OCMArg any]];
|
||||
|
||||
[center postNotificationName:TestNotificationOne object:self];
|
||||
|
||||
[mock verify];
|
||||
}
|
||||
|
||||
- (void)testAcceptsExpectedNotificationWithSpecifiedObjectAndUserInfo
|
||||
{
|
||||
[center addMockObserver:mock name:TestNotificationOne object:nil];
|
||||
NSDictionary *info = [NSDictionary dictionaryWithObject:@"foo" forKey:@"key"];
|
||||
[[mock expect] notificationWithName:TestNotificationOne object:self userInfo:info];
|
||||
|
||||
[center postNotificationName:TestNotificationOne object:self userInfo:info];
|
||||
|
||||
[mock verify];
|
||||
}
|
||||
|
||||
- (void)testAcceptsNotificationsInAnyOrder
|
||||
{
|
||||
[center addMockObserver:mock name:TestNotificationOne object:nil];
|
||||
[[mock expect] notificationWithName:TestNotificationOne object:self];
|
||||
[[mock expect] notificationWithName:TestNotificationOne object:[OCMArg any]];
|
||||
|
||||
[center postNotificationName:TestNotificationOne object:[NSString string]];
|
||||
[center postNotificationName:TestNotificationOne object:self];
|
||||
}
|
||||
|
||||
- (void)testAcceptsNotificationsInCorrectOrderWhenOrderMatters
|
||||
{
|
||||
[mock setExpectationOrderMatters:YES];
|
||||
|
||||
[center addMockObserver:mock name:TestNotificationOne object:nil];
|
||||
[[mock expect] notificationWithName:TestNotificationOne object:self];
|
||||
[[mock expect] notificationWithName:TestNotificationOne object:[OCMArg any]];
|
||||
|
||||
[center postNotificationName:TestNotificationOne object:self];
|
||||
[center postNotificationName:TestNotificationOne object:[NSString string]];
|
||||
}
|
||||
|
||||
- (void)testRaisesExceptionWhenSequenceIsWrongAndOrderMatters
|
||||
{
|
||||
[mock setExpectationOrderMatters:YES];
|
||||
|
||||
[center addMockObserver:mock name:TestNotificationOne object:nil];
|
||||
[[mock expect] notificationWithName:TestNotificationOne object:self];
|
||||
[[mock expect] notificationWithName:TestNotificationOne object:[OCMArg any]];
|
||||
|
||||
STAssertThrows([center postNotificationName:TestNotificationOne object:[NSString string]], @"Should have complained about sequence.");
|
||||
}
|
||||
|
||||
- (void)testRaisesEvenThoughOverlappingExpectationsCouldHaveBeenSatisfied
|
||||
{
|
||||
// this test demonstrates a shortcoming, not a feature
|
||||
[center addMockObserver:mock name:TestNotificationOne object:nil];
|
||||
[[mock expect] notificationWithName:TestNotificationOne object:[OCMArg any]];
|
||||
[[mock expect] notificationWithName:TestNotificationOne object:self];
|
||||
|
||||
[center postNotificationName:TestNotificationOne object:self];
|
||||
STAssertThrows([center postNotificationName:TestNotificationOne object:[NSString string]], nil);
|
||||
}
|
||||
|
||||
- (void)testRaisesExceptionWhenUnexpectedNotificationIsReceived
|
||||
{
|
||||
[center addMockObserver:mock name:TestNotificationOne object:nil];
|
||||
|
||||
STAssertThrows([center postNotificationName:TestNotificationOne object:self], nil);
|
||||
}
|
||||
|
||||
- (void)testRaisesWhenNotificationWithWrongObjectIsReceived
|
||||
{
|
||||
[center addMockObserver:mock name:TestNotificationOne object:nil];
|
||||
[[mock expect] notificationWithName:TestNotificationOne object:self];
|
||||
|
||||
STAssertThrows([center postNotificationName:TestNotificationOne object:[NSString string]], nil);
|
||||
}
|
||||
|
||||
- (void)testRaisesWhenNotificationWithWrongUserInfoIsReceived
|
||||
{
|
||||
[center addMockObserver:mock name:TestNotificationOne object:nil];
|
||||
[[mock expect] notificationWithName:TestNotificationOne object:self
|
||||
userInfo:[NSDictionary dictionaryWithObject:@"foo" forKey:@"key"]];
|
||||
STAssertThrows([center postNotificationName:TestNotificationOne object:[NSString string]
|
||||
userInfo:[NSDictionary dictionaryWithObject:@"bar" forKey:@"key"]], nil);
|
||||
}
|
||||
|
||||
- (void)testRaisesOnVerifyWhenExpectedNotificationIsNotSent
|
||||
{
|
||||
[center addMockObserver:mock name:TestNotificationOne object:nil];
|
||||
[[mock expect] notificationWithName:TestNotificationOne object:[OCMArg any]];
|
||||
|
||||
STAssertThrows([mock verify], nil);
|
||||
}
|
||||
|
||||
- (void)testRaisesOnVerifyWhenNotAllNotificationsWereSent
|
||||
{
|
||||
[center addMockObserver:mock name:TestNotificationOne object:nil];
|
||||
[[mock expect] notificationWithName:TestNotificationOne object:[OCMArg any]];
|
||||
[[mock expect] notificationWithName:TestNotificationOne object:self];
|
||||
|
||||
[center postNotificationName:TestNotificationOne object:self];
|
||||
STAssertThrows([mock verify], nil);
|
||||
}
|
||||
|
||||
@end
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
/* Localized versions of Info.plist keys */
|
||||
|
||||
Reference in new issue
Block a user