| OLD | NEW |
| 1 //------------------------------------------------------------------------------
--------- | 1 /* |
| 2 // $Id$ | 2 * Copyright (c) 2004-2015 Erik Doernenburg and contributors |
| 3 // Copyright (c) 2004-2008 by Mulle Kybernetik. See License file for details. | 3 * |
| 4 //------------------------------------------------------------------------------
--------- | 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 5 * not use these files except in compliance with the License. You may obtain |
| 6 * a copy of the License at |
| 7 * |
| 8 * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 * |
| 10 * Unless required by applicable law or agreed to in writing, software |
| 11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 * License for the specific language governing permissions and limitations |
| 14 * under the License. |
| 15 */ |
| 5 | 16 |
| 6 #import <OCMock/OCMockObject.h> | 17 #import <OCMock/OCMockObject.h> |
| 7 #import <OCMock/OCMockRecorder.h> | 18 #import <OCMock/OCMRecorder.h> |
| 19 #import <OCMock/OCMStubRecorder.h> |
| 8 #import <OCMock/OCMConstraint.h> | 20 #import <OCMock/OCMConstraint.h> |
| 9 #import <OCMock/OCMArg.h> | 21 #import <OCMock/OCMArg.h> |
| 22 #import <OCMock/OCMLocation.h> |
| 23 #import <OCMock/OCMMacroState.h> |
| 10 #import <OCMock/NSNotificationCenter+OCMAdditions.h> | 24 #import <OCMock/NSNotificationCenter+OCMAdditions.h> |
| 25 |
| 26 #define OCMClassMock(cls) [OCMockObject niceMockForClass:cls] |
| 27 |
| 28 #define OCMStrictClassMock(cls) [OCMockObject mockForClass:cls] |
| 29 |
| 30 #define OCMProtocolMock(protocol) [OCMockObject niceMockForProtocol:protocol] |
| 31 |
| 32 #define OCMStrictProtocolMock(protocol) [OCMockObject mockForProtocol:protocol] |
| 33 |
| 34 #define OCMPartialMock(obj) [OCMockObject partialMockForObject:obj] |
| 35 |
| 36 #define OCMObserverMock() [OCMockObject observerMock] |
| 37 |
| 38 #define OCMStub(invocation) \ |
| 39 ({ \ |
| 40 _OCMSilenceWarnings([OCMMacroState beginStubMacro]; invocation; \ |
| 41 [OCMMacroState endStubMacro];); \ |
| 42 }) |
| 43 |
| 44 #define OCMExpect(invocation) \ |
| 45 ({ \ |
| 46 _OCMSilenceWarnings([OCMMacroState beginExpectMacro]; invocation; \ |
| 47 [OCMMacroState endExpectMacro];); \ |
| 48 }) |
| 49 |
| 50 #define ClassMethod(invocation) \ |
| 51 _OCMSilenceWarnings([[OCMMacroState globalState] switchToClassMethod]; \ |
| 52 invocation;); |
| 53 |
| 54 #define OCMVerifyAll(mock) \ |
| 55 [mock verifyAtLocation:OCMMakeLocation(self, __FILE__, __LINE__)] |
| 56 |
| 57 #define OCMVerifyAllWithDelay(mock, delay) \ |
| 58 [mock verifyWithDelay:delay \ |
| 59 atLocation:OCMMakeLocation(self, __FILE__, __LINE__)] |
| 60 |
| 61 #define OCMVerify(invocation) \ |
| 62 ({ \ |
| 63 _OCMSilenceWarnings( \ |
| 64 [OCMMacroState \ |
| 65 beginVerifyMacroAtLocation:OCMMakeLocation(self, __FILE__, \ |
| 66 __LINE__)]; \ |
| 67 invocation;[OCMMacroState endVerifyMacro];); \ |
| 68 }) |
| 69 |
| 70 #define _OCMSilenceWarnings(macro) \ |
| 71 ({_Pragma("clang diagnostic push") \ |
| 72 _Pragma("clang diagnostic ignored \"-Wunused-value\"") _Pragma( \ |
| 73 "clang diagnostic ignored \"-Wunused-getter-return-value\"") \ |
| 74 macro _Pragma("clang diagnostic pop")}) |
| OLD | NEW |