diff --git a/.travis.yml b/.travis.yml index 428dc73..1a18892 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c -osx_image: xcode7 +osx_image: xcode8 before_install: - gem i slather --no-rdoc script: diff --git a/Specta/Specta.xcodeproj/project.pbxproj b/Specta/Specta.xcodeproj/project.pbxproj index 34c6c57..21231bb 100644 --- a/Specta/Specta.xcodeproj/project.pbxproj +++ b/Specta/Specta.xcodeproj/project.pbxproj @@ -703,7 +703,7 @@ E9536CCF1968D30B003D1FBA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0600; + LastUpgradeCheck = 0800; ORGANIZATIONNAME = "Specta Team"; TargetAttributes = { E91713F019DF07BB00921712 = { @@ -1018,6 +1018,7 @@ MACOSX_DEPLOYMENT_TARGET = 10.8; MTL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = "-ObjC"; + PRODUCT_BUNDLE_IDENTIFIER = "com.github.specta.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = Specta; }; name = Debug; @@ -1037,6 +1038,7 @@ MACOSX_DEPLOYMENT_TARGET = 10.8; MTL_ENABLE_DEBUG_INFO = NO; OTHER_LDFLAGS = "-ObjC"; + PRODUCT_BUNDLE_IDENTIFIER = "com.github.specta.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = Specta; }; name = Release; @@ -1055,9 +1057,10 @@ "$(inherited)", ); INFOPLIST_FILE = Specta/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = "-ObjC"; + PRODUCT_BUNDLE_IDENTIFIER = "com.github.specta.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = Specta; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -1075,9 +1078,10 @@ GCC_GENERATE_TEST_COVERAGE_FILES = NO; GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO; INFOPLIST_FILE = Specta/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; OTHER_LDFLAGS = "-ObjC"; + PRODUCT_BUNDLE_IDENTIFIER = "com.github.specta.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = Specta; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -1099,8 +1103,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_RESOURCE_RULES_PATH = "$(SDKROOT)/ResourceRules.plist"; @@ -1108,10 +1114,12 @@ CURRENT_PROJECT_VERSION = 1; ENABLE_BITCODE = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_GENERATE_TEST_COVERAGE_FILES = YES; GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -1147,8 +1155,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_RESOURCE_RULES_PATH = "$(SDKROOT)/ResourceRules.plist"; @@ -1161,6 +1171,7 @@ GCC_C_LANGUAGE_STANDARD = gnu99; GCC_GENERATE_TEST_COVERAGE_FILES = YES; GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES; + GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -1197,6 +1208,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; OTHER_LDFLAGS = "-ObjC"; + PRODUCT_BUNDLE_IDENTIFIER = "com.github.specta.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Specta; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -1226,6 +1238,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; OTHER_LDFLAGS = "-ObjC"; + PRODUCT_BUNDLE_IDENTIFIER = "com.github.specta.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Specta; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -1250,6 +1263,7 @@ INFOPLIST_FILE = SpectaTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; METAL_ENABLE_DEBUG_INFO = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.github.specta.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; @@ -1269,6 +1283,7 @@ INFOPLIST_FILE = SpectaTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; METAL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = "com.github.specta.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; @@ -1277,6 +1292,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -1299,6 +1315,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = "-ObjC"; + PRODUCT_BUNDLE_IDENTIFIER = "com.github.specta.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Specta; PRODUCT_NAME = Specta; SDKROOT = iphoneos; @@ -1312,6 +1329,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -1330,6 +1348,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = NO; OTHER_LDFLAGS = "-ObjC"; + PRODUCT_BUNDLE_IDENTIFIER = "com.github.specta.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Specta; PRODUCT_NAME = Specta; SDKROOT = iphoneos; @@ -1358,6 +1377,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.github.specta.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -1378,6 +1398,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = "com.github.specta.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; diff --git a/Specta/Specta.xcodeproj/xcshareddata/xcschemes/Specta-iOS.xcscheme b/Specta/Specta.xcodeproj/xcshareddata/xcschemes/Specta-iOS.xcscheme index 8597054..0f1067d 100644 --- a/Specta/Specta.xcodeproj/xcshareddata/xcschemes/Specta-iOS.xcscheme +++ b/Specta/Specta.xcodeproj/xcshareddata/xcschemes/Specta-iOS.xcscheme @@ -1,6 +1,6 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -39,15 +39,18 @@ + + + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -39,15 +39,18 @@ + + + shouldUseLaunchSchemeArgsEnv = "YES"> + + + shouldUseLaunchSchemeArgsEnv = "YES"> + + CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.github.specta.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/Specta/SpectaTests/FailingSpecTest.m b/Specta/SpectaTests/FailingSpecTest.m index ccbc6b9..e953d64 100644 --- a/Specta/SpectaTests/FailingSpecTest.m +++ b/Specta/SpectaTests/FailingSpecTest.m @@ -25,7 +25,7 @@ @implementation FailingSpecTest - (void)testFailingSpec { foo = @"not foo"; bar = @"not bar"; - XCTestSuiteRun *result = RunSpec(_FailingSpecTestSpec); + XCTestRun *result = RunSpec(_FailingSpecTestSpec); assertEqual([result unexpectedExceptionCount], 0); assertEqual([result failureCount], 2); assertFalse([result hasSucceeded]); diff --git a/Specta/SpectaTests/FocusedSpecTest.m b/Specta/SpectaTests/FocusedSpecTest.m index f587123..9f47f32 100644 --- a/Specta/SpectaTests/FocusedSpecTest.m +++ b/Specta/SpectaTests/FocusedSpecTest.m @@ -68,7 +68,7 @@ - (void)test_compiled_examples_are_focused { - (void)test_focused_specs_are_run_exclusively { [_FocusedSpecTestSpec spt_setDisabled:NO]; - XCTestSuiteRun *result = RunSpec(_FocusedSpecTestSpec); + XCTestRun *result = RunSpec(_FocusedSpecTestSpec); [_FocusedSpecTestSpec spt_setDisabled:YES]; assertEqual([result testCaseCount], 3); diff --git a/Specta/SpectaTests/Info.plist b/Specta/SpectaTests/Info.plist index 63e711a..6d32c15 100644 --- a/Specta/SpectaTests/Info.plist +++ b/Specta/SpectaTests/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.github.specta.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/Specta/SpectaTests/PendingSpecTest1.m b/Specta/SpectaTests/PendingSpecTest1.m index 1f117ff..2ea40f0 100644 --- a/Specta/SpectaTests/PendingSpecTest1.m +++ b/Specta/SpectaTests/PendingSpecTest1.m @@ -21,7 +21,7 @@ @interface PendingSpecTest1 : XCTestCase; @end @implementation PendingSpecTest1 - (void)testPendingSpec { - XCTestSuiteRun *result = RunSpec(_PendingSpecTest1Spec); + XCTestRun *result = RunSpec(_PendingSpecTest1Spec); assertEqual([result testCaseCount], 5); assertEqual([result unexpectedExceptionCount], 0); assertEqual([result failureCount], 0); diff --git a/Specta/SpectaTests/PendingSpecTest2.m b/Specta/SpectaTests/PendingSpecTest2.m index fb959bf..73891f9 100644 --- a/Specta/SpectaTests/PendingSpecTest2.m +++ b/Specta/SpectaTests/PendingSpecTest2.m @@ -27,7 +27,7 @@ @interface PendingSpecTest2 : XCTestCase; @end @implementation PendingSpecTest2 - (void)testPendingSpec { - XCTestSuiteRun *result = RunSpec(_PendingSpecTest2Spec); + XCTestRun *result = RunSpec(_PendingSpecTest2Spec); assertEqual([result testCaseCount], 12); assertEqual([result unexpectedExceptionCount], 0); assertEqual([result failureCount], 0); diff --git a/Specta/SpectaTests/PendingSpecTest3.m b/Specta/SpectaTests/PendingSpecTest3.m index 65cc633..ed04216 100644 --- a/Specta/SpectaTests/PendingSpecTest3.m +++ b/Specta/SpectaTests/PendingSpecTest3.m @@ -16,7 +16,7 @@ @interface PendingSpecTest3 : XCTestCase; @end @implementation PendingSpecTest3 - (void)testPendingSpec { - XCTestSuiteRun *result = RunSpec(_PendingSpecTest3Spec); + XCTestRun *result = RunSpec(_PendingSpecTest3Spec); assertEqual([result testCaseCount], 2); assertEqual([result unexpectedExceptionCount], 0); assertEqual([result failureCount], 0); diff --git a/Specta/SpectaTests/PendingSpecTest4.m b/Specta/SpectaTests/PendingSpecTest4.m index 078a5e4..9365830 100644 --- a/Specta/SpectaTests/PendingSpecTest4.m +++ b/Specta/SpectaTests/PendingSpecTest4.m @@ -18,7 +18,7 @@ @interface PendingSpecTest4 : XCTestCase; @end @implementation PendingSpecTest4 - (void)testPendingSpec { - XCTestSuiteRun *result = RunSpec(_PendingSpecTest4Spec); + XCTestRun *result = RunSpec(_PendingSpecTest4Spec); assertEqual([result testCaseCount], 1); assertEqual([result unexpectedExceptionCount], 0); assertEqual([result failureCount], 0); diff --git a/Specta/SpectaTests/SharedExamplesTest1.m b/Specta/SpectaTests/SharedExamplesTest1.m index 6ce6bb9..043f760 100644 --- a/Specta/SpectaTests/SharedExamplesTest1.m +++ b/Specta/SpectaTests/SharedExamplesTest1.m @@ -43,7 +43,7 @@ @implementation SharedExamplesTest1 - (void)testSharedExamples { items = [[NSMutableArray alloc] init]; - XCTestSuiteRun *result = RunSpec(_SharedExamplesTest1Spec); + XCTestRun *result = RunSpec(_SharedExamplesTest1Spec); assertEqual([result testCaseCount], 4); assertEqual([result unexpectedExceptionCount], 0); assertEqual([result failureCount], 0); diff --git a/Specta/SpectaTests/SharedExamplesTest2.m b/Specta/SpectaTests/SharedExamplesTest2.m index 3b0c7ec..657d9ac 100644 --- a/Specta/SpectaTests/SharedExamplesTest2.m +++ b/Specta/SpectaTests/SharedExamplesTest2.m @@ -53,7 +53,7 @@ @implementation SharedExamplesTest2 - (void)testSharedExamples { foo = @"Not Foo"; items = [[NSMutableArray alloc] init]; - XCTestSuiteRun *result = RunSpec(_SharedExamplesTest2Spec); + XCTestRun *result = RunSpec(_SharedExamplesTest2Spec); assertEqual([result testCaseCount], 4); assertEqual([result unexpectedExceptionCount], 0); assertEqual([result failureCount], 1); diff --git a/Specta/SpectaTests/SharedExamplesTest4.m b/Specta/SpectaTests/SharedExamplesTest4.m index 910b734..8950a5d 100644 --- a/Specta/SpectaTests/SharedExamplesTest4.m +++ b/Specta/SpectaTests/SharedExamplesTest4.m @@ -36,7 +36,7 @@ @interface SharedExamplesTest4 : XCTestCase; @end @implementation SharedExamplesTest4 - (void)testSharedExamples { - XCTestSuiteRun *result = RunSpec(_SharedExamplesTest4Spec); + XCTestRun *result = RunSpec(_SharedExamplesTest4Spec); assertEqual([result testCaseCount], 2); assertEqual([result unexpectedExceptionCount], 0); assertEqual([result failureCount], 0); diff --git a/Specta/SpectaTests/SharedExamplesTest5.m b/Specta/SpectaTests/SharedExamplesTest5.m index 8712a79..e564d5a 100644 --- a/Specta/SpectaTests/SharedExamplesTest5.m +++ b/Specta/SpectaTests/SharedExamplesTest5.m @@ -21,7 +21,7 @@ @implementation SharedExamplesTest5 - (void)testSharedExamplesFailingIfCalledInsideAnItBlock { shouldInvokeItShouldBehaveLike = YES; - XCTestSuiteRun *result = RunSpec(_SharedExamplesTest5Spec); + XCTestRun *result = RunSpec(_SharedExamplesTest5Spec); assertEqual([result testCaseCount], 1); assertEqual([result unexpectedExceptionCount], 1); assertEqual([result failureCount], 0); diff --git a/Specta/SpectaTests/SharedExamplesTest6.m b/Specta/SpectaTests/SharedExamplesTest6.m index df77838..fcecdd7 100644 --- a/Specta/SpectaTests/SharedExamplesTest6.m +++ b/Specta/SpectaTests/SharedExamplesTest6.m @@ -20,7 +20,7 @@ @implementation SharedExamplesTest6 - (void)testSharedExamplesFailingIfNonexistent { shouldInvokeItBehavesLike = YES; - XCTestSuiteRun *result = RunSpec(_SharedExamplesTest6Spec); + XCTestRun *result = RunSpec(_SharedExamplesTest6Spec); assertEqual([result testCaseCount], 1); assertEqual([result unexpectedExceptionCount], 1); assertEqual([result failureCount], 0); diff --git a/Specta/SpectaTests/TestHelper.h b/Specta/SpectaTests/TestHelper.h index a770799..f15ff3b 100644 --- a/Specta/SpectaTests/TestHelper.h +++ b/Specta/SpectaTests/TestHelper.h @@ -22,7 +22,7 @@ #define RunSpec(TestClass) RunSpecClass([TestClass class]) -XCTestSuiteRun *RunSpecClass(Class testClass); +XCTestRun *RunSpecClass(Class testClass); #define assertTrue(expression) XCTAssertTrue((expression), @"") #define assertFalse(expression) XCTAssertFalse((expression), @"") diff --git a/Specta/SpectaTests/TestHelper.m b/Specta/SpectaTests/TestHelper.m index 9ab1a14..a6046a1 100644 --- a/Specta/SpectaTests/TestHelper.m +++ b/Specta/SpectaTests/TestHelper.m @@ -1,7 +1,12 @@ #import "TestHelper.h" -XCTestSuiteRun *RunSpecClass(Class testClass) { - __block XCTestSuiteRun *result; +@interface TestSuitable : NSObject +- (XCTestRun *)run; +@end + + +XCTestRun *RunSpecClass(Class testClass) { + __block XCTestRun *result; #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000 || __MAC_OS_X_VERSION_MAX_ALLOWED >= 101100 XCTestObservationCenter *observationCenter = [XCTestObservationCenter sharedTestObservationCenter]; @@ -9,7 +14,15 @@ XCTestObservationCenter *observationCenter = [XCTestObservationCenter sharedObservationCenter]; #endif [observationCenter _suspendObservationForBlock:^{ - result = (id)[(XCTestSuite *)[XCTestSuite testSuiteForTestCaseClass:testClass] run]; + id suite = [XCTestSuite testSuiteForTestCaseClass:testClass]; + // Xcode 8 support + if ([suite respondsToSelector:@selector(runTest)]) { + [suite runTest]; + result = [suite testRun]; + // Xcode 7 support + } else if ([suite respondsToSelector:@selector(run)]) { + result = [(TestSuitable *)suite run]; + } }]; return result; diff --git a/Specta/SpectaTests/UnexpectedExceptionTest.m b/Specta/SpectaTests/UnexpectedExceptionTest.m index da77087..875fde2 100644 --- a/Specta/SpectaTests/UnexpectedExceptionTest.m +++ b/Specta/SpectaTests/UnexpectedExceptionTest.m @@ -41,7 +41,7 @@ - (void)setUp { - (void)testUnexpectedExceptionHandling { shouldRaiseException = YES; - XCTestSuiteRun *result = RunSpec(_UnexpectedExceptionTestSpec); + XCTestRun *result = RunSpec(_UnexpectedExceptionTestSpec); assertEqual([result failureCount], 0); assertEqual([result unexpectedExceptionCount], 1); assertFalse([result hasSucceeded]);