Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: third_party/ocmock/OCMock/OCMStubRecorder.h

Issue 2410583002: Test update OCMock (Closed)
Patch Set: Patch in exactly 3.1.5 Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2004-2015 Erik Doernenburg and contributors
3 *
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 */
16
17 #import "OCMRecorder.h"
18 #import <objc/runtime.h>
19
20 @interface OCMStubRecorder : OCMRecorder
21
22 - (id)andReturn:(id)anObject;
23 - (id)andReturnValue:(NSValue*)aValue;
24 - (id)andThrow:(NSException*)anException;
25 - (id)andPost:(NSNotification*)aNotification;
26 - (id)andCall:(SEL)selector onObject:(id)anObject;
27 - (id)andDo:(void (^)(NSInvocation* invocation))block;
28 - (id)andForwardToRealObject;
29
30 @end
31
32 @interface OCMStubRecorder (Properties)
33
34 #define andReturn(aValue) \
35 _andReturn(({ \
36 __typeof__(aValue) _val = (aValue); \
37 NSValue* _nsval = \
38 [NSValue value:&_val withObjCType:@encode(__typeof__(_val))]; \
39 if (__builtin_types_compatible_p(__typeof__(_val), id)) { \
40 objc_setAssociatedObject(_nsval, "OCMAssociatedBoxedValue", \
41 *(__unsafe_unretained id*)(void*)&_val, \
42 OBJC_ASSOCIATION_RETAIN); \
43 } \
44 _nsval; \
45 }))
46 @property(nonatomic, readonly) OCMStubRecorder* (^_andReturn)(NSValue*);
47
48 #define andThrow(anException) _andThrow(anException)
49 @property(nonatomic, readonly) OCMStubRecorder* (^_andThrow)(NSException*);
50
51 #define andPost(aNotification) _andPost(aNotification)
52 @property(nonatomic, readonly) OCMStubRecorder* (^_andPost)(NSNotification*);
53
54 #define andCall(anObject, aSelector) _andCall(anObject, aSelector)
55 @property(nonatomic, readonly) OCMStubRecorder* (^_andCall)(id, SEL);
56
57 #define andDo(aBlock) _andDo(aBlock)
58 @property(nonatomic, readonly) OCMStubRecorder* (^_andDo)
59 (void (^)(NSInvocation*));
60
61 #define andForwardToRealObject() _andForwardToRealObject()
62 @property(nonatomic, readonly) OCMStubRecorder* (^_andForwardToRealObject)(void)
63 ;
64
65 @end
OLDNEW
« no previous file with comments | « third_party/ocmock/OCMock/OCMReturnValueProvider.m ('k') | third_party/ocmock/OCMock/OCMStubRecorder.m » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698