Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial investigation reveals that direct use of the function API (wi…

…thout callsites), results

in accurate error reporting, meaning that the macros may be redundant.

Not using the macros means that Xcode 4's auto-completion works correctly.

You can try the direct-function API by defining KIWI_DISABLE_MACRO_API before importing Kiwi.h
  • Loading branch information...
commit 855f05ccbcf0929c76279e68938199a9a5cec695 1 parent 53395a7
@lukeredpath lukeredpath authored
View
8 Kiwi.xcodeproj/project.pbxproj
@@ -103,7 +103,6 @@
A352EA0E12EDC6F20049C691 /* KWHamrestMatchingAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = A352EA0D12EDC6F20049C691 /* KWHamrestMatchingAdditions.m */; };
A352EA1B12EDC8380049C691 /* KWHamcrestMatcherTest.m in Sources */ = {isa = PBXBuildFile; fileRef = A352EA1A12EDC8380049C691 /* KWHamcrestMatcherTest.m */; };
A35B033213CB30FF0045500C /* OneTestPerSpecExample.m in Sources */ = {isa = PBXBuildFile; fileRef = A35B033113CB30FF0045500C /* OneTestPerSpecExample.m */; };
- A35B033413CB31250045500C /* KiwiNewMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = A35B033313CB31250045500C /* KiwiNewMacros.h */; settings = {ATTRIBUTES = (Public, ); }; };
A385CAE813AA7EA200DCA951 /* KWUserDefinedMatcherTest.m in Sources */ = {isa = PBXBuildFile; fileRef = A385CAE713AA7EA200DCA951 /* KWUserDefinedMatcherTest.m */; };
A385CAEC13AA7EDD00DCA951 /* KWUserDefinedMatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = A385CAEA13AA7ED800DCA951 /* KWUserDefinedMatcher.m */; };
A385CAF013AAC9B800DCA951 /* KWMatchers.m in Sources */ = {isa = PBXBuildFile; fileRef = A385CAEE13AAC9B700DCA951 /* KWMatchers.m */; };
@@ -130,6 +129,7 @@
A3EB7FF9131EA227001860F5 /* KWHaveValueMatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = A352E9EA12EDC33C0049C691 /* KWHaveValueMatcher.m */; };
A3EB8064131EA572001860F5 /* KWDeviceInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = F5D7C8CA11643B9700758FEA /* KWDeviceInfo.m */; };
A3EB8065131EA574001860F5 /* KWHamrestMatchingAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = A352EA0D12EDC6F20049C691 /* KWHamrestMatchingAdditions.m */; };
+ A3FABFAF13CBB187002003F7 /* KiwiBlockMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = A3FABFAE13CBB187002003F7 /* KiwiBlockMacros.h */; settings = {ATTRIBUTES = (Public, ); }; };
F5015BB911583ABD002E9A98 /* KWCallSite.m in Sources */ = {isa = PBXBuildFile; fileRef = F5015B581158398E002E9A98 /* KWCallSite.m */; };
F5015BBA11583ABD002E9A98 /* KWContainMatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = F5015B5A1158398E002E9A98 /* KWContainMatcher.m */; };
F5015BBB11583ABD002E9A98 /* KWEqualMatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = F5015B5C1158398E002E9A98 /* KWEqualMatcher.m */; };
@@ -273,7 +273,6 @@
A352EA1812EDC8160049C691 /* KWHamcrestMatcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWHamcrestMatcher.m; sourceTree = "<group>"; };
A352EA1A12EDC8380049C691 /* KWHamcrestMatcherTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWHamcrestMatcherTest.m; sourceTree = "<group>"; };
A35B033113CB30FF0045500C /* OneTestPerSpecExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OneTestPerSpecExample.m; sourceTree = "<group>"; };
- A35B033313CB31250045500C /* KiwiNewMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KiwiNewMacros.h; sourceTree = "<group>"; };
A385CAE713AA7EA200DCA951 /* KWUserDefinedMatcherTest.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = KWUserDefinedMatcherTest.m; sourceTree = "<group>"; tabWidth = 4; };
A385CAE913AA7ED800DCA951 /* KWUserDefinedMatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWUserDefinedMatcher.h; sourceTree = "<group>"; tabWidth = 4; };
A385CAEA13AA7ED800DCA951 /* KWUserDefinedMatcher.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = KWUserDefinedMatcher.m; sourceTree = "<group>"; tabWidth = 4; };
@@ -290,6 +289,7 @@
A3A1757512E498D8004DFD70 /* KWBeNonNilMatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWBeNonNilMatcher.h; sourceTree = "<group>"; };
A3A1757612E49900004DFD70 /* KWBeNonNilMatcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWBeNonNilMatcher.m; sourceTree = "<group>"; };
A3B16542139967B800E9CC6E /* KiwiExamples.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KiwiExamples.octest; sourceTree = BUILT_PRODUCTS_DIR; };
+ A3FABFAE13CBB187002003F7 /* KiwiBlockMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KiwiBlockMacros.h; sourceTree = "<group>"; };
F5015B501158398E002E9A98 /* Kiwi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Kiwi.h; sourceTree = "<group>"; };
F5015B571158398E002E9A98 /* KWCallSite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWCallSite.h; sourceTree = "<group>"; };
F5015B581158398E002E9A98 /* KWCallSite.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWCallSite.m; sourceTree = "<group>"; };
@@ -620,7 +620,7 @@
F5015B501158398E002E9A98 /* Kiwi.h */,
F57C754C11B030E300C3015B /* KiwiConfiguration.h */,
F55252AD116CD4BA0028A401 /* KiwiMacros.h */,
- A35B033313CB31250045500C /* KiwiNewMacros.h */,
+ A3FABFAE13CBB187002003F7 /* KiwiBlockMacros.h */,
);
path = Kiwi;
sourceTree = "<group>";
@@ -998,7 +998,7 @@
A34FADAA13BBF4A4003968B2 /* Kiwi.h in Headers */,
A34FADAB13BBF4A4003968B2 /* KiwiConfiguration.h in Headers */,
A34FADAC13BBF4A4003968B2 /* KiwiMacros.h in Headers */,
- A35B033413CB31250045500C /* KiwiNewMacros.h in Headers */,
+ A3FABFAF13CBB187002003F7 /* KiwiBlockMacros.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
8 Kiwi/Kiwi.h
@@ -75,11 +75,11 @@
#import "NSObject+KiwiStubAdditions.h"
#import "NSObject+KiwiVerifierAdditions.h"
+#import "KiwiMacros.h"
+
// Some Foundation headers use Kiwi keywords (e.g. 'should') as identifiers for
// parameter names. Including this last allows the use of Kiwi keywords without
// conflicting with these headers (hopefully!).
-#ifdef KIWI_USE_NEW_MACROS
- #import "KiwiNewMacros.h"
-#else
- #import "KiwiMacros.h"
+#ifndef KIWI_DISABLE_MACRO_API
+ #import "KiwiBlockMacros.h"
#endif
View
33 Kiwi/KiwiBlockMacros.h
@@ -0,0 +1,33 @@
+//
+// KiwiBuilderMacros.h
+// Kiwi
+//
+// Created by Luke Redpath on 11/07/2011.
+// Copyright 2011 Allen Ding. All rights reserved.
+//
+
+#if KW_BLOCKS_ENABLED
+// Kiwi macros used in specs to create example groups. Because these macros
+// hide functions of the same name, they can be undefined at the expense of
+// getting call site information injected into output messages.
+#define describe(...) describeWithCallSite(KW_THIS_CALLSITE, __VA_ARGS__)
+#define context(...) contextWithCallSite(KW_THIS_CALLSITE, __VA_ARGS__)
+#define registerMatchers(...) registerMatchersWithCallSite(KW_THIS_CALLSITE, __VA_ARGS__)
+#define beforeAll(...) beforeAllWithCallSite(KW_THIS_CALLSITE, __VA_ARGS__)
+#define afterAll(...) afterAllWithCallSite(KW_THIS_CALLSITE, __VA_ARGS__)
+#define beforeEach(...) beforeEachWithCallSite(KW_THIS_CALLSITE, __VA_ARGS__)
+#define afterEach(...) afterEachWithCallSite(KW_THIS_CALLSITE, __VA_ARGS__)
+#define it(...) itWithCallSite(KW_THIS_CALLSITE, __VA_ARGS__)
+#define pending(...) pendingWithCallSite(KW_THIS_CALLSITE, __VA_ARGS__)
+#define xit(...) pendingWithCallSite(KW_THIS_CALLSITE, __VA_ARGS__)
+
+// user defined matchers
+#define registerMatcher(name) \
+\
+@interface NSObject (KWUserDefinedMatchersDefinitions) \
+- (void)name; \
+@end \
+
+#define defineMatcher(...) KWDefineMatchers(__VA_ARGS__)
+#endif // #if KW_BLOCKS_ENABLED
+
View
25 Kiwi/KiwiMacros.h
@@ -32,31 +32,6 @@
#define theObject(objectPtr) [KWFutureObject objectWithObjectPointer:objectPtr]
#define theReturnValueOfBlock(block) [KWFutureObject objectWithReturnValueOfBlock:block]
-#if KW_BLOCKS_ENABLED
- // Kiwi macros used in specs to create example groups. Because these macros
- // hide functions of the same name, they can be undefined at the expense of
- // getting call site information injected into output messages.
- #define describe(...) describeWithCallSite(KW_THIS_CALLSITE, __VA_ARGS__)
- #define context(...) contextWithCallSite(KW_THIS_CALLSITE, __VA_ARGS__)
- #define registerMatchers(...) registerMatchersWithCallSite(KW_THIS_CALLSITE, __VA_ARGS__)
- #define beforeAll(...) beforeAllWithCallSite(KW_THIS_CALLSITE, __VA_ARGS__)
- #define afterAll(...) afterAllWithCallSite(KW_THIS_CALLSITE, __VA_ARGS__)
- #define beforeEach(...) beforeEachWithCallSite(KW_THIS_CALLSITE, __VA_ARGS__)
- #define afterEach(...) afterEachWithCallSite(KW_THIS_CALLSITE, __VA_ARGS__)
- #define it(...) itWithCallSite(KW_THIS_CALLSITE, __VA_ARGS__)
- #define pending(...) pendingWithCallSite(KW_THIS_CALLSITE, __VA_ARGS__)
- #define xit(...) pendingWithCallSite(KW_THIS_CALLSITE, __VA_ARGS__)
-
- // user defined matchers
- #define registerMatcher(name) \
- \
- @interface NSObject (KWUserDefinedMatchersDefinitions) \
- - (void)name; \
- @end \
-
- #define defineMatcher(...) KWDefineMatchers(__VA_ARGS__)
-#endif // #if KW_BLOCKS_ENABLED
-
// If a gcc compatible compiler is available, use the statement and
// declarations in expression extension to provide a convenient catch-all macro
// to create KWValues.

0 comments on commit 855f05c

Please sign in to comment.
Something went wrong with that request. Please try again.