diff --git a/.travis.yml b/.travis.yml index bc1942c..2c346d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: swift -osx_image: xcode8.2 +osx_image: xcode9 before_install: - gem install fastlane -NV script: diff --git a/Playgrounds/Spry-Xcode.zip b/Playgrounds/Spry-Xcode.zip index fc5a733..ef49ca3 100644 Binary files a/Playgrounds/Spry-Xcode.zip and b/Playgrounds/Spry-Xcode.zip differ diff --git a/Playgrounds/Spry-iPad.zip b/Playgrounds/Spry-iPad.zip index 9f4a0bc..f1010fe 100644 Binary files a/Playgrounds/Spry-iPad.zip and b/Playgrounds/Spry-iPad.zip differ diff --git a/Source/Spry/Core/Comparable+Extension.swift b/Source/Spry/Core/Comparable+Extension.swift index 35a44ce..08595ea 100644 --- a/Source/Spry/Core/Comparable+Extension.swift +++ b/Source/Spry/Core/Comparable+Extension.swift @@ -17,7 +17,7 @@ extension NSNumber : Comparable { /// - lhs: A value to compare. /// - rhs: Another value to compare. public static func <(lhs: NSNumber, rhs: NSNumber) -> Bool { - return Double(lhs) < Double(rhs) + return Double(truncating: lhs) < Double(truncating: rhs) } /// Returns a Boolean value indicating whether the value of the first @@ -27,7 +27,7 @@ extension NSNumber : Comparable { /// - lhs: A value to compare. /// - rhs: Another value to compare. public static func <=(lhs: NSNumber, rhs: NSNumber) -> Bool { - return Double(lhs) <= Double(rhs) + return Double(truncating: lhs) <= Double(truncating: rhs) } /// Returns a Boolean value indicating whether the value of the first @@ -37,7 +37,7 @@ extension NSNumber : Comparable { /// - lhs: A value to compare. /// - rhs: Another value to compare. public static func >=(lhs: NSNumber, rhs: NSNumber) -> Bool { - return Double(lhs) >= Double(rhs) + return Double(truncating: lhs) >= Double(truncating: rhs) } /// Returns a Boolean value indicating whether the value of the first @@ -47,7 +47,7 @@ extension NSNumber : Comparable { /// - lhs: A value to compare. /// - rhs: Another value to compare. public static func >(lhs: NSNumber, rhs: NSNumber) -> Bool { - return Double(lhs) > Double(rhs) + return Double(truncating: lhs) > Double(truncating: rhs) } } diff --git a/Source/Spry/Matchers/beCloseTo.swift b/Source/Spry/Matchers/beCloseTo.swift index f2d885d..69d94a3 100644 --- a/Source/Spry/Matchers/beCloseTo.swift +++ b/Source/Spry/Matchers/beCloseTo.swift @@ -8,7 +8,7 @@ import Foundation -internal let DefaultDelta = 0.0001 +public let DefaultDelta = 0.0001 private func isCloseTo(_ actualValue: ConvertibleToDouble?, expectedValue: ConvertibleToDouble, delta: Double) -> Bool { return actualValue != nil && abs(actualValue!.doubleValue - expectedValue.doubleValue) < delta diff --git a/Source/Spry/Matchers/equal.swift b/Source/Spry/Matchers/equal.swift index 7306a1b..a7938c7 100644 --- a/Source/Spry/Matchers/equal.swift +++ b/Source/Spry/Matchers/equal.swift @@ -23,7 +23,7 @@ public func equal(_ expectedValue: T) -> Matcher { /// Values can support equal by supporting the Equatable protocol. /// /// @see beCloseTo if you want to match imprecise types (eg - floats, doubles). -public func equal(_ expectedValue: [T: C]) -> Matcher<[T: C]> { +public func equal(_ expectedValue: [T: C]) -> Matcher<[T: C]> { return Matcher { expression in guard let actualValue = try expression.evaluate() else { return false } return expectedValue == actualValue @@ -152,7 +152,7 @@ public func !=(lhs: Expectation>, rhs: Set?) -> Expecta /// /// @see beCloseTo if you want to match imprecise types (eg - floats, doubles). @discardableResult -public func ==(lhs: Expectation<[T: C]>, rhs: [T: C]?) -> ExpectationResult { +public func ==(lhs: Expectation<[T: C]>, rhs: [T: C]?) -> ExpectationResult { return lhs.to(equal(rhs!)) } @@ -161,6 +161,6 @@ public func ==(lhs: Expectation<[T: C]>, rhs: [T: C] /// /// @see beCloseTo if you want to match imprecise types (eg - floats, doubles). @discardableResult -public func !=(lhs: Expectation<[T: C]>, rhs: [T: C]?) -> ExpectationResult { +public func !=(lhs: Expectation<[T: C]>, rhs: [T: C]?) -> ExpectationResult { return lhs.toNot(equal(rhs!)) } diff --git a/Spry.xcodeproj/project.pbxproj b/Spry.xcodeproj/project.pbxproj index 4254bb2..3ab33ca 100644 --- a/Spry.xcodeproj/project.pbxproj +++ b/Spry.xcodeproj/project.pbxproj @@ -476,24 +476,26 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0820; - LastUpgradeCheck = 0820; + LastUpgradeCheck = 0900; TargetAttributes = { 549BF8C61E5DA9DC00308A6C = { CreatedOnToolsVersion = 8.2.1; - LastSwiftMigration = 0820; + LastSwiftMigration = 0900; ProvisioningStyle = Manual; }; 549BF8CF1E5DA9DD00308A6C = { CreatedOnToolsVersion = 8.2.1; - LastSwiftMigration = 0820; + LastSwiftMigration = 0900; ProvisioningStyle = Automatic; }; 549BF8FD1E5DB9E100308A6C = { CreatedOnToolsVersion = 8.2.1; + LastSwiftMigration = 0900; ProvisioningStyle = Automatic; }; 549BF9051E5DB9E100308A6C = { CreatedOnToolsVersion = 8.2.1; + LastSwiftMigration = 0900; ProvisioningStyle = Automatic; }; }; @@ -706,20 +708,27 @@ ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; 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_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + 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; CODE_SIGNING_REQUIRED = NO; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; + ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; @@ -732,6 +741,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.9; + ONLY_ACTIVE_ARCH = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 3.0; TVOS_DEPLOYMENT_TARGET = 9.0; @@ -745,19 +755,26 @@ ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; 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_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + 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; CODE_SIGNING_REQUIRED = NO; CURRENT_PROJECT_VERSION = 1; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -811,7 +828,8 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; VALID_ARCHS = x86_64; VERSION_INFO_PREFIX = ""; }; @@ -847,7 +865,8 @@ SDKROOT = macosx; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; VALID_ARCHS = x86_64; VERSION_INFO_PREFIX = ""; }; @@ -884,7 +903,8 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OBJC_BRIDGING_HEADER = "Tests/Spry-macOSTests-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -913,7 +933,8 @@ SDKROOT = macosx; SWIFT_OBJC_BRIDGING_HEADER = "Tests/Spry-macOSTests-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; }; name = Release; }; @@ -946,7 +967,8 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSION_INFO_PREFIX = ""; }; @@ -976,7 +998,8 @@ PRODUCT_NAME = Spry; SDKROOT = iphoneos; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSION_INFO_PREFIX = ""; }; @@ -1007,7 +1030,8 @@ SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -1030,7 +1054,8 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.152percent.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = SpryTests; SDKROOT = iphoneos; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; }; name = Release; }; diff --git a/Spry.xcodeproj/xcshareddata/xcschemes/Spry-iOS.xcscheme b/Spry.xcodeproj/xcshareddata/xcschemes/Spry-iOS.xcscheme index 1d2dd34..469421e 100644 --- a/Spry.xcodeproj/xcshareddata/xcschemes/Spry-iOS.xcscheme +++ b/Spry.xcodeproj/xcshareddata/xcschemes/Spry-iOS.xcscheme @@ -1,6 +1,6 @@