aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--GTM.xcodeproj/project.pbxproj1
-rw-r--r--GTMiPhone.xcodeproj/project.pbxproj1
-rw-r--r--UnitTesting/GTMSenTestCase.h16
-rw-r--r--UnitTesting/GTMSenTestCaseTest.m15
4 files changed, 33 insertions, 0 deletions
diff --git a/GTM.xcodeproj/project.pbxproj b/GTM.xcodeproj/project.pbxproj
index 148019d..438943c 100644
--- a/GTM.xcodeproj/project.pbxproj
+++ b/GTM.xcodeproj/project.pbxproj
@@ -1407,6 +1407,7 @@
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
diff --git a/GTMiPhone.xcodeproj/project.pbxproj b/GTMiPhone.xcodeproj/project.pbxproj
index 5974e05..995fe81 100644
--- a/GTMiPhone.xcodeproj/project.pbxproj
+++ b/GTMiPhone.xcodeproj/project.pbxproj
@@ -823,6 +823,7 @@
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
diff --git a/UnitTesting/GTMSenTestCase.h b/UnitTesting/GTMSenTestCase.h
index dad549c..1034830 100644
--- a/UnitTesting/GTMSenTestCase.h
+++ b/UnitTesting/GTMSenTestCase.h
@@ -350,6 +350,22 @@
})
#endif // XCTAssertNotEqualCStrings
+/*!
+ * @define XCTAssertAsserts(expression, ...)
+ * Generates a failure when ((\a expression) does not assert.
+ * If NS_BLOCK_ASSERTIONS is enabled, this test will always pass.
+ * @param expression An expression.
+ * @param ... An optional supplementary description of the failure. A literal NSString, optionally
+ with string format specifiers. This parameter can be completely omitted.
+ */
+#ifndef NS_BLOCK_ASSERTIONS
+ #define XCTAssertAsserts(expression, ...) \
+ _XCTPrimitiveAssertThrowsSpecificNamed(self, expression, @#expression, NSException, \
+ NSInternalInconsistencyException, __VA_ARGS__)
+#else
+ #define XCTAssertAsserts(expression, ...)
+#endif
+
#else // GTM_USING_XCTEST
// Generates a failure when a1 != noErr
diff --git a/UnitTesting/GTMSenTestCaseTest.m b/UnitTesting/GTMSenTestCaseTest.m
index 33055ad..edaa180 100644
--- a/UnitTesting/GTMSenTestCaseTest.m
+++ b/UnitTesting/GTMSenTestCaseTest.m
@@ -80,3 +80,18 @@ static int gZzCheckCalls_ = 0;
}
@end
+
+@interface GTMSenTestCase : GTMTestCase
+@end
+
+@implementation GTMSenTestCase
+- (void)funcThatAsserts {
+ NSAssert(nil, @"Should be nil");
+}
+
+- (void)testXCTAssertAsserts {
+ XCTAssertAsserts([self funcThatAsserts]);
+}
+
+@end
+