From a03a0a7e0ebce18205437c4ead7407bb1b1b2523 Mon Sep 17 00:00:00 2001 From: Sergey Kuryanov Date: Thu, 14 Dec 2017 00:37:33 +0300 Subject: [PATCH 1/9] Update project to recommended settings --- Kiwi.xcodeproj/project.pbxproj | 37 +++++++++++++++---- .../xcshareddata/xcschemes/Kiwi-OSX.xcscheme | 4 +- .../xcshareddata/xcschemes/Kiwi-iOS.xcscheme | 4 +- 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/Kiwi.xcodeproj/project.pbxproj b/Kiwi.xcodeproj/project.pbxproj index 510c03a5..5f3b96a1 100755 --- a/Kiwi.xcodeproj/project.pbxproj +++ b/Kiwi.xcodeproj/project.pbxproj @@ -247,8 +247,8 @@ 4AE030C81AEB494400556381 /* KWValueTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F5C6FD2311782A290068BBC8 /* KWValueTest.m */; }; 4AE030C91AEB494400556381 /* NSNumber_KiwiAdditionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA9C69F7190CA6EE002C4DC0 /* NSNumber_KiwiAdditionsTests.m */; }; 4AE030CA1AEB4DCF00556381 /* NSObject+KiwiSpyAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F982CD916A802920030A0B1 /* NSObject+KiwiSpyAdditions.m */; }; - 50ACAF651BBA28D000F29B0F /* DoNotUseMe.m in Sources */ = {isa = PBXBuildFile; fileRef = 50ACAF641BBA28D000F29B0F /* DoNotUseMe.m */; settings = {ASSET_TAGS = (); }; }; - 50ACAF661BBA28D000F29B0F /* DoNotUseMe.m in Sources */ = {isa = PBXBuildFile; fileRef = 50ACAF641BBA28D000F29B0F /* DoNotUseMe.m */; settings = {ASSET_TAGS = (); }; }; + 50ACAF651BBA28D000F29B0F /* DoNotUseMe.m in Sources */ = {isa = PBXBuildFile; fileRef = 50ACAF641BBA28D000F29B0F /* DoNotUseMe.m */; }; + 50ACAF661BBA28D000F29B0F /* DoNotUseMe.m in Sources */ = {isa = PBXBuildFile; fileRef = 50ACAF641BBA28D000F29B0F /* DoNotUseMe.m */; }; CE0736B41B8577140023EBEA /* Expecta.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE0736B31B8577140023EBEA /* Expecta.framework */; }; CE0736B61B85771E0023EBEA /* Expecta.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE0736B51B85771E0023EBEA /* Expecta.framework */; }; CE0736B81B8577490023EBEA /* KWExpectaTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CE0736B71B8577490023EBEA /* KWExpectaTests.m */; }; @@ -1665,7 +1665,7 @@ attributes = { LastSwiftUpdateCheck = 0700; LastTestingUpgradeCheck = 0600; - LastUpgradeCheck = 0700; + LastUpgradeCheck = 0920; ORGANIZATIONNAME = "Allen Ding"; TargetAttributes = { 4AE02FBC1AEB45EB00556381 = { @@ -2211,6 +2211,7 @@ PRODUCT_NAME = "$(KIWI_TESTS_PRODUCT_NAME)"; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -2243,17 +2244,27 @@ MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_NAME = "$(KIWI_TESTS_PRODUCT_NAME)"; SDKROOT = macosx; + SWIFT_VERSION = 4.0; }; name = Release; }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; ENABLE_BITCODE = NO; @@ -2271,7 +2282,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 5.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; KIWI_PRODUCT_NAME = Kiwi; KIWI_TESTS_PRODUCT_NAME = KiwiTests; ONLY_ACTIVE_ARCH = YES; @@ -2286,11 +2297,20 @@ C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; ENABLE_BITCODE = NO; @@ -2306,12 +2326,13 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 5.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; KIWI_PRODUCT_NAME = Kiwi; KIWI_TESTS_PRODUCT_NAME = KiwiTests; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; PRODUCT_BUNDLE_IDENTIFIER = "org.kiwi-bdd.$(PRODUCT_NAME:rfc1034identifier)"; SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = "-Wall"; }; @@ -2327,7 +2348,7 @@ CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; @@ -2371,7 +2392,7 @@ CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; @@ -2433,6 +2454,7 @@ MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_NAME = "$(KIWI_TESTS_PRODUCT_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -2462,6 +2484,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_NAME = "$(KIWI_TESTS_PRODUCT_NAME)"; + SWIFT_VERSION = 4.0; VALIDATE_PRODUCT = YES; }; name = Release; diff --git a/Kiwi.xcodeproj/xcshareddata/xcschemes/Kiwi-OSX.xcscheme b/Kiwi.xcodeproj/xcshareddata/xcschemes/Kiwi-OSX.xcscheme index 6976526d..357eca07 100644 --- a/Kiwi.xcodeproj/xcshareddata/xcschemes/Kiwi-OSX.xcscheme +++ b/Kiwi.xcodeproj/xcshareddata/xcschemes/Kiwi-OSX.xcscheme @@ -1,6 +1,6 @@ Date: Thu, 14 Dec 2017 00:55:58 +0300 Subject: [PATCH 2/9] Update dependencies --- Cartfile.resolved | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cartfile.resolved b/Cartfile.resolved index 42f5e9f1..9012d6e8 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,2 +1,2 @@ -github "Quick/Nimble" "v4.0.1" -github "specta/expecta" "v1.0.5" +github "Quick/Nimble" "v7.0.3" +github "specta/expecta" "v1.0.6" From 3463d479128d33b655f393a3c73239e51429963b Mon Sep 17 00:00:00 2001 From: Sergey Kuryanov Date: Thu, 14 Dec 2017 01:16:13 +0300 Subject: [PATCH 3/9] Resolve project warnings --- Classes/Core/KWFutureObject.m | 2 +- Classes/Matchers/KWChangeMatcher.h | 2 +- Classes/Matchers/KWUserDefinedMatcher.h | 3 +++ Tests/KWExampleTest.m | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Classes/Core/KWFutureObject.m b/Classes/Core/KWFutureObject.m index 52c654b5..f1c98f36 100644 --- a/Classes/Core/KWFutureObject.m +++ b/Classes/Core/KWFutureObject.m @@ -16,7 +16,7 @@ @interface KWFutureObject() @implementation KWFutureObject -+ (id)objectWithObjectPointer:(id *)pointer { ++ (id)objectWithObjectPointer:(id __autoreleasing *)pointer { return [self futureObjectWithBlock:^{ return *pointer; }]; } diff --git a/Classes/Matchers/KWChangeMatcher.h b/Classes/Matchers/KWChangeMatcher.h index 89d37d68..6aa19e42 100644 --- a/Classes/Matchers/KWChangeMatcher.h +++ b/Classes/Matchers/KWChangeMatcher.h @@ -8,7 +8,7 @@ #import "KWMatcher.h" -typedef NSInteger (^KWChangeMatcherCountBlock)(); +typedef NSInteger (^KWChangeMatcherCountBlock)(void); @interface KWChangeMatcher : KWMatcher diff --git a/Classes/Matchers/KWUserDefinedMatcher.h b/Classes/Matchers/KWUserDefinedMatcher.h index 85a62fc8..ef16ca6a 100644 --- a/Classes/Matchers/KWUserDefinedMatcher.h +++ b/Classes/Matchers/KWUserDefinedMatcher.h @@ -9,7 +9,10 @@ #import #import "KWMatcher.h" +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wstrict-prototypes" typedef BOOL (^KWUserDefinedMatcherBlock)(); +#pragma clang diagnostic pop @interface KWUserDefinedMatcher : KWMatcher diff --git a/Tests/KWExampleTest.m b/Tests/KWExampleTest.m index f2b85e16..1b09d190 100644 --- a/Tests/KWExampleTest.m +++ b/Tests/KWExampleTest.m @@ -17,7 +17,7 @@ @implementation KWExampleTest - (void)testItDoesntThrowExceptionWhenMakingExpectationsOnNilSubject { KWExample *example = [[KWExample alloc] initWithExampleNode:nil]; - void (^itNodeImitation)() = ^{ + void (^itNodeImitation)(void) = ^{ [[(id)nil attachToVerifier:[example addMatchVerifierWithExpectationType:KWExpectationTypeShould callSite:nil]] equal:@"foo"]; [[(id)nil attachToVerifier:[example addMatchVerifierWithExpectationType:KWExpectationTypeShouldNot callSite:nil]] containString:@"bar"]; }; From cdde45a6118ed2057bf9936006627792dea51001 Mon Sep 17 00:00:00 2001 From: Sergey Kuryanov Date: Thu, 14 Dec 2017 02:04:31 +0300 Subject: [PATCH 4/9] Update travis image to 9.1 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cbfec1a7..fbd4e586 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,3 @@ language: objective-c -osx_image: xcode7.3 +osx_image: xcode9.1 script: make ci From c20d44c91b50cdbf93865266ed7be191b3de85b3 Mon Sep 17 00:00:00 2001 From: Edu Caselles Date: Tue, 9 Jan 2018 15:58:02 +0000 Subject: [PATCH 5/9] Updates travis configuration use Xcode 9.2 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fbd4e586..62769a51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,3 @@ language: objective-c -osx_image: xcode9.1 +osx_image: xcode9.2 script: make ci From 1019fb815ae1de223c9d03ae0382140d3f4892e3 Mon Sep 17 00:00:00 2001 From: Edu Caselles Date: Wed, 10 Jan 2018 11:54:21 +0000 Subject: [PATCH 6/9] Refactors test to use numbers since for some odd reason, using an NSString here causes a EXC_BAD_ACCESS crash in iOS 10 (it works fine in iOS 11) --- Tests/KWLetNodeTest.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/KWLetNodeTest.m b/Tests/KWLetNodeTest.m index 2507c4f6..55b50435 100644 --- a/Tests/KWLetNodeTest.m +++ b/Tests/KWLetNodeTest.m @@ -106,14 +106,14 @@ - (void)testItSetsAllObjectRefsToTheChildsValueWhenEvaluated { - (void)testItEvaluatesTheDeepestChild { __block NSNumber *number = nil; - __block NSString *string = nil; + __block NSNumber *anotherNumber = nil; KWLetNode *letNode1 = [KWLetNode letNodeWithSymbolName:@"number" objectRef:KW_LET_REF(number) block:^{ return @1; }]; - KWLetNode *letNode2 = [KWLetNode letNodeWithSymbolName:@"string" objectRef:KW_LET_REF(string) block:^{ return [number stringValue]; }]; + KWLetNode *letNode2 = [KWLetNode letNodeWithSymbolName:@"string" objectRef:KW_LET_REF(anotherNumber) block:^{ return [number copy]; }]; KWLetNode *letNode3 = [KWLetNode letNodeWithSymbolName:@"number" objectRef:KW_LET_REF(number) block:^{ return @2; }]; [letNode1 addLetNode:letNode2]; [letNode1 addLetNode:letNode3]; [letNode1 evaluateTree]; - XCTAssertEqualObjects(string, @"2", @"expected the last node to be based on the value of the deepest previous child"); + XCTAssertEqualObjects(anotherNumber, @2, @"expected the last node to be based on the value of the deepest previous child"); } #pragma mark - Example node visiting From 5db9a51ae9567f0c6cde768da3a4b1d0c18b53ac Mon Sep 17 00:00:00 2001 From: Edu Caselles Date: Wed, 10 Jan 2018 11:56:10 +0000 Subject: [PATCH 7/9] Returns empty array in KWSpec since testInvocations is no longer nullable --- Classes/Core/KWSpec.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Core/KWSpec.m b/Classes/Core/KWSpec.m index 3e845170..53fcea71 100644 --- a/Classes/Core/KWSpec.m +++ b/Classes/Core/KWSpec.m @@ -48,7 +48,7 @@ + (NSArray *)testInvocations { // Only return invocation if the receiver is a concrete spec that has overridden -buildExampleGroups. if ([self methodForSelector:buildExampleGroups] == [KWSpec methodForSelector:buildExampleGroups]) - return nil; + return @[]; KWExampleSuite *exampleSuite = [[KWExampleSuiteBuilder sharedExampleSuiteBuilder] buildExampleSuite:^{ [self buildExampleGroups]; From f8628616f6f926f669bc829972b75d2c6b298d75 Mon Sep 17 00:00:00 2001 From: Edu Caselles Date: Wed, 10 Jan 2018 12:05:51 +0000 Subject: [PATCH 8/9] Avoids assigning nil in the let macro helper, as we can't assume now that all lets will be nullable. --- Classes/Core/KWExample.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Core/KWExample.h b/Classes/Core/KWExample.h index 58777f61..1c7cf0c7 100644 --- a/Classes/Core/KWExample.h +++ b/Classes/Core/KWExample.h @@ -141,7 +141,7 @@ void pendingWithCallSite(KWCallSite *aCallSite, NSString *aDescription, void (^b */ void let(id name, id (^block)(void)); // coax Xcode into autocompleting #define let(var, ...) \ - __block __typeof__((__VA_ARGS__)()) var = nil; \ + __block __typeof__((__VA_ARGS__)()) var; \ let_(KW_LET_REF(var), #var, __VA_ARGS__) #define PRAGMA(x) _Pragma (#x) From 500dc8158042e6cd3b8958587b31eddfabf2f0d3 Mon Sep 17 00:00:00 2001 From: Edu Caselles Date: Wed, 10 Jan 2018 13:28:32 +0000 Subject: [PATCH 9/9] Bumps Kiwi deployment targets to the minimum allowed nowadays (iOS 8.0 and MacOSX 10.8) --- Kiwi.podspec | 5 ++--- Kiwi.xcodeproj/project.pbxproj | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Kiwi.podspec b/Kiwi.podspec index b95b46fa..7dd7d6c0 100644 --- a/Kiwi.podspec +++ b/Kiwi.podspec @@ -16,8 +16,8 @@ Pod::Spec.new do |s| 'Adam Sharp' => 'adsharp@me.com', } - s.ios.deployment_target = '5.1.1' - s.osx.deployment_target = '10.7' + s.ios.deployment_target = '8.0' + s.osx.deployment_target = '10.8' s.framework = 'XCTest' s.source_files = 'Classes/**/*.{h,m}' @@ -25,4 +25,3 @@ Pod::Spec.new do |s| s.prefix_header_contents = '#import ' end - diff --git a/Kiwi.xcodeproj/project.pbxproj b/Kiwi.xcodeproj/project.pbxproj index 5f3b96a1..90e8797f 100755 --- a/Kiwi.xcodeproj/project.pbxproj +++ b/Kiwi.xcodeproj/project.pbxproj @@ -2121,7 +2121,7 @@ INFOPLIST_FILE = "Supporting Files/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.8; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; PRODUCT_NAME = "$(KIWI_PRODUCT_NAME)"; @@ -2165,7 +2165,7 @@ INFOPLIST_FILE = "Supporting Files/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.8; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_NAME = "$(KIWI_PRODUCT_NAME)"; SDKROOT = macosx; @@ -2285,6 +2285,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; KIWI_PRODUCT_NAME = Kiwi; KIWI_TESTS_PRODUCT_NAME = KiwiTests; + MACOSX_DEPLOYMENT_TARGET = 10.8; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = "org.kiwi-bdd.$(PRODUCT_NAME:rfc1034identifier)"; RUN_CLANG_STATIC_ANALYZER = YES; @@ -2329,6 +2330,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; KIWI_PRODUCT_NAME = Kiwi; KIWI_TESTS_PRODUCT_NAME = KiwiTests; + MACOSX_DEPLOYMENT_TARGET = 10.8; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; PRODUCT_BUNDLE_IDENTIFIER = "org.kiwi-bdd.$(PRODUCT_NAME:rfc1034identifier)"; SDKROOT = iphoneos;