From 38f5ff69d130c60e93b4dc609e0450d458d87f73 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Sat, 16 Mar 2019 18:53:13 -0600 Subject: [PATCH 01/25] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Quick=20(2.0.0),=20N?= =?UTF-8?q?imble=20(8.0.1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cartfile.resolved | 4 +- Carthage/Checkouts/Nimble/.swift-version | 2 +- Carthage/Checkouts/Nimble/.swiftlint.yml | 20 +- Carthage/Checkouts/Nimble/.travis.yml | 81 ++-- Carthage/Checkouts/Nimble/Gemfile | 2 +- Carthage/Checkouts/Nimble/Gemfile.lock | 48 +-- Carthage/Checkouts/Nimble/Nimble.podspec | 5 +- .../Nimble/Nimble.xcodeproj/project.pbxproj | 28 +- .../xcshareddata/WorkspaceSettings.xcsettings | 8 + Carthage/Checkouts/Nimble/Package.swift | 22 +- .../Checkouts/Nimble/Package@swift-4.swift | 22 - Carthage/Checkouts/Nimble/README.md | 29 +- .../Nimble/Adapters/AdapterProtocols.swift | 1 + .../Nimble/Adapters/AssertionRecorder.swift | 33 +- .../Nimble/Adapters/NMBExpectation.swift | 6 +- .../Nimble/Adapters/NMBObjCMatcher.swift | 4 +- .../Nimble/Adapters/NimbleEnvironment.swift | 9 +- .../Nimble/Adapters/NimbleXCTestHandler.swift | 13 +- .../NonObjectiveC/ExceptionCapture.swift | 2 +- .../Nimble/Sources/Nimble/DSL+Wait.swift | 14 +- .../Checkouts/Nimble/Sources/Nimble/DSL.swift | 18 +- .../Sources/Nimble/ExpectationMessage.swift | 29 +- .../Nimble/Sources/Nimble/Expression.swift | 2 + .../Sources/Nimble/FailureMessage.swift | 1 + .../Sources/Nimble/Matchers/AllPass.swift | 3 +- .../Sources/Nimble/Matchers/Async.swift | 6 +- .../Sources/Nimble/Matchers/BeAKindOf.swift | 2 +- .../Nimble/Matchers/BeAnInstanceOf.swift | 4 +- .../Sources/Nimble/Matchers/BeCloseTo.swift | 9 +- .../Sources/Nimble/Matchers/BeEmpty.swift | 29 +- .../Nimble/Matchers/BeGreaterThan.swift | 8 +- .../Matchers/BeGreaterThanOrEqualTo.swift | 8 +- .../Nimble/Matchers/BeIdenticalTo.swift | 40 +- .../Sources/Nimble/Matchers/BeLessThan.swift | 8 +- .../Nimble/Matchers/BeLessThanOrEqual.swift | 8 +- .../Sources/Nimble/Matchers/BeLogical.swift | 47 +-- .../Sources/Nimble/Matchers/BeNil.swift | 8 +- .../Sources/Nimble/Matchers/BeVoid.swift | 12 +- .../Sources/Nimble/Matchers/BeginWith.swift | 16 +- .../Sources/Nimble/Matchers/Contain.swift | 85 +++- .../Matchers/ContainElementSatisfying.swift | 26 +- .../Nimble/Matchers/ElementsEqual.swift | 16 + .../Sources/Nimble/Matchers/EndWith.swift | 13 +- .../Sources/Nimble/Matchers/Equal.swift | 164 +++----- .../Sources/Nimble/Matchers/HaveCount.swift | 27 +- .../Sources/Nimble/Matchers/Match.swift | 2 +- .../Nimble/Matchers/MatcherProtocols.swift | 13 +- .../Nimble/Matchers/PostNotification.swift | 37 +- .../Sources/Nimble/Matchers/Predicate.swift | 5 +- .../Nimble/Matchers/RaisesException.swift | 12 +- .../Nimble/Matchers/SatisfyAllOf.swift | 10 +- .../Nimble/Matchers/SatisfyAnyOf.swift | 10 +- .../Nimble/Matchers/ThrowAssertion.swift | 7 +- .../Nimble/Sources/Nimble/Utils/Await.swift | 32 +- .../Sources/Nimble/Utils/Functional.swift | 6 +- .../Sources/Nimble/Utils/Stringers.swift | 19 +- .../Checkouts/Nimble/Tests/LinuxMain.swift | 37 +- .../Tests/NimbleTests/AsynchronousTest.swift | 68 +-- .../Helpers/XCTestCaseProvider.swift | 20 +- .../Tests/NimbleTests/Helpers/utils.swift | 9 +- .../NimbleTests/Matchers/AllPassTest.swift | 11 - .../NimbleTests/Matchers/BeAKindOfTest.swift | 22 +- .../Matchers/BeAnInstanceOfTest.swift | 9 - .../NimbleTests/Matchers/BeCloseToTest.swift | 54 +-- .../NimbleTests/Matchers/BeEmptyTest.swift | 80 +++- .../Matchers/BeGreaterThanOrEqualToTest.swift | 7 - .../Matchers/BeGreaterThanTest.swift | 7 - .../Matchers/BeIdenticalToObjectTest.swift | 11 - .../Matchers/BeIdenticalToTest.swift | 11 - .../Matchers/BeLessThanOrEqualToTest.swift | 7 - .../NimbleTests/Matchers/BeLessThanTest.swift | 7 - .../NimbleTests/Matchers/BeLogicalTest.swift | 38 -- .../NimbleTests/Matchers/BeNilTest.swift | 6 - .../NimbleTests/Matchers/BeVoidTest.swift | 6 - .../NimbleTests/Matchers/BeginWithTest.swift | 7 - .../ContainElementSatisfyingTest.swift | 14 - .../NimbleTests/Matchers/ContainTest.swift | 74 +++- .../Matchers/ElementsEqualTest.swift | 27 ++ .../NimbleTests/Matchers/EndWithTest.swift | 7 - .../NimbleTests/Matchers/EqualTest.swift | 19 +- .../NimbleTests/Matchers/HaveCountTest.swift | 59 ++- .../NimbleTests/Matchers/MatchErrorTest.swift | 16 +- .../NimbleTests/Matchers/MatchTest.swift | 10 - .../Matchers/PostNotificationTest.swift | 12 - .../Matchers/RaisesExceptionTest.swift | 12 +- .../Matchers/SatisfyAllOfTest.swift | 7 - .../Matchers/SatisfyAnyOfTest.swift | 7 - .../Matchers/ThrowAssertionTest.swift | 13 +- .../NimbleTests/Matchers/ThrowErrorTest.swift | 14 +- .../NimbleTests/Matchers/ToSucceedTest.swift | 6 - .../Tests/NimbleTests/SynchronousTest.swift | 19 - .../NimbleTests/UserDescriptionTest.swift | 65 +-- .../Tests/NimbleTests/XCTestManifests.swift | 387 ++++++++++++++++++ .../Tests/NimbleTests/objc/ObjCAsyncTest.m | 5 + .../Tests/NimbleTests/objc/ObjCContainTest.m | 9 + .../Tests/NimbleTests/objc/ObjCEndWithTest.m | 1 - .../NimbleTests/objc/ObjCHaveCountTest.m | 9 + Carthage/Checkouts/Nimble/test | 10 +- Carthage/Checkouts/Quick/.hound.yml | 4 +- Carthage/Checkouts/Quick/.swift-version | 2 +- Carthage/Checkouts/Quick/.travis.yml | 84 ++-- Carthage/Checkouts/Quick/Dangerfile | 4 +- .../Documentation/en-us/SharedExamples.md | 2 +- .../Documentation/ko-kr/BehavioralTesting.md | 2 +- .../Documentation/ko-kr/InstallingQuick.md | 2 +- .../Quick/Externals/Nimble/.swift-version | 2 +- .../Quick/Externals/Nimble/.swiftlint.yml | 20 +- .../Quick/Externals/Nimble/.travis.yml | 59 +-- .../Checkouts/Quick/Externals/Nimble/Gemfile | 2 +- .../Quick/Externals/Nimble/Gemfile.lock | 48 +-- .../Quick/Externals/Nimble/Nimble.podspec | 5 +- .../Nimble/Nimble.xcodeproj/project.pbxproj | 82 ++-- .../xcshareddata/WorkspaceSettings.xcsettings | 8 + .../Quick/Externals/Nimble/Package.swift | 22 +- .../Externals/Nimble/Package@swift-4.swift | 22 - .../Quick/Externals/Nimble/README.md | 29 +- .../Nimble/Adapters/AdapterProtocols.swift | 1 + .../Nimble/Adapters/AssertionRecorder.swift | 37 +- .../Nimble/Adapters/NMBExpectation.swift | 8 +- .../Nimble/Adapters/NMBObjCMatcher.swift | 36 +- .../Nimble/Adapters/NimbleEnvironment.swift | 18 +- .../Nimble/Adapters/NimbleXCTestHandler.swift | 15 +- .../NonObjectiveC/ExceptionCapture.swift | 2 +- .../Nimble/Sources/Nimble/DSL+Wait.swift | 14 +- .../Externals/Nimble/Sources/Nimble/DSL.swift | 18 +- .../Nimble/Sources/Nimble/Expectation.swift | 35 +- .../Sources/Nimble/ExpectationMessage.swift | 33 +- .../Nimble/Sources/Nimble/Expression.swift | 2 + .../Sources/Nimble/FailureMessage.swift | 1 + .../Sources/Nimble/Matchers/AllPass.swift | 9 +- ...{AsyncMatcherWrapper.swift => Async.swift} | 113 ++--- .../Sources/Nimble/Matchers/BeAKindOf.swift | 4 +- .../Nimble/Matchers/BeAnInstanceOf.swift | 6 +- .../Sources/Nimble/Matchers/BeCloseTo.swift | 25 +- .../Sources/Nimble/Matchers/BeEmpty.swift | 19 +- .../Nimble/Matchers/BeGreaterThan.swift | 8 +- .../Matchers/BeGreaterThanOrEqualTo.swift | 26 +- .../Nimble/Matchers/BeIdenticalTo.swift | 12 +- .../Sources/Nimble/Matchers/BeLessThan.swift | 26 +- .../Nimble/Matchers/BeLessThanOrEqual.swift | 25 +- .../Sources/Nimble/Matchers/BeLogical.swift | 47 +-- .../Sources/Nimble/Matchers/BeNil.swift | 8 +- .../Sources/Nimble/Matchers/BeVoid.swift | 12 +- .../Sources/Nimble/Matchers/BeginWith.swift | 18 +- .../Sources/Nimble/Matchers/Contain.swift | 101 +++-- .../Matchers/ContainElementSatisfying.swift | 46 +-- .../Nimble/Matchers/ElementsEqual.swift | 16 + .../Sources/Nimble/Matchers/EndWith.swift | 47 +-- .../Sources/Nimble/Matchers/Equal.swift | 166 +++----- .../Sources/Nimble/Matchers/HaveCount.swift | 65 +-- .../Sources/Nimble/Matchers/Match.swift | 4 +- .../Sources/Nimble/Matchers/MatchError.swift | 46 ++- .../Nimble/Matchers/MatcherProtocols.swift | 13 +- .../Nimble/Matchers/PostNotification.swift | 43 +- .../Sources/Nimble/Matchers/Predicate.swift | 15 +- .../Nimble/Matchers/RaisesException.swift | 38 +- .../Nimble/Matchers/SatisfyAllOf.swift | 47 +-- .../Nimble/Matchers/SatisfyAnyOf.swift | 47 +-- .../Nimble/Matchers/ThrowAssertion.swift | 35 +- .../Sources/Nimble/Matchers/ThrowError.swift | 84 ++-- .../Nimble/Utils/{Async.swift => Await.swift} | 32 +- .../Sources/Nimble/Utils/Functional.swift | 6 +- .../Sources/Nimble/Utils/Stringers.swift | 5 +- .../Externals/Nimble/Tests/LinuxMain.swift | 37 +- .../Tests/NimbleTests/AsynchronousTest.swift | 68 +-- .../Helpers/XCTestCaseProvider.swift | 20 +- .../Tests/NimbleTests/Helpers/utils.swift | 21 +- .../NimbleTests/Matchers/AllPassTest.swift | 11 - .../NimbleTests/Matchers/BeAKindOfTest.swift | 22 +- .../Matchers/BeAnInstanceOfTest.swift | 9 - .../NimbleTests/Matchers/BeCloseToTest.swift | 54 +-- .../NimbleTests/Matchers/BeEmptyTest.swift | 63 ++- .../Matchers/BeGreaterThanOrEqualToTest.swift | 7 - .../Matchers/BeGreaterThanTest.swift | 7 - .../Matchers/BeIdenticalToObjectTest.swift | 11 - .../Matchers/BeIdenticalToTest.swift | 11 - .../Matchers/BeLessThanOrEqualToTest.swift | 7 - .../NimbleTests/Matchers/BeLessThanTest.swift | 7 - .../NimbleTests/Matchers/BeLogicalTest.swift | 38 -- .../NimbleTests/Matchers/BeNilTest.swift | 6 - .../NimbleTests/Matchers/BeVoidTest.swift | 6 - .../NimbleTests/Matchers/BeginWithTest.swift | 7 - .../ContainElementSatisfyingTest.swift | 14 - .../NimbleTests/Matchers/ContainTest.swift | 53 ++- .../Matchers/ElementsEqualTest.swift | 27 ++ .../NimbleTests/Matchers/EndWithTest.swift | 7 - .../NimbleTests/Matchers/EqualTest.swift | 19 +- .../NimbleTests/Matchers/HaveCountTest.swift | 59 ++- .../NimbleTests/Matchers/MatchErrorTest.swift | 16 +- .../NimbleTests/Matchers/MatchTest.swift | 10 - .../Matchers/PostNotificationTest.swift | 12 - .../Matchers/RaisesExceptionTest.swift | 12 +- .../Matchers/SatisfyAllOfTest.swift | 7 - .../Matchers/SatisfyAnyOfTest.swift | 7 - .../Matchers/ThrowAssertionTest.swift | 19 +- .../NimbleTests/Matchers/ThrowErrorTest.swift | 14 +- .../NimbleTests/Matchers/ToSucceedTest.swift | 6 - ...onousTests.swift => SynchronousTest.swift} | 50 ++- .../NimbleTests/UserDescriptionTest.swift | 65 +-- .../Tests/NimbleTests/XCTestManifests.swift | 386 +++++++++++++++++ .../Tests/NimbleTests/objc/ObjCAsyncTest.m | 5 + .../Tests/NimbleTests/objc/ObjCContainTest.m | 9 + .../Tests/NimbleTests/objc/ObjCEndWithTest.m | 1 - .../NimbleTests/objc/ObjCHaveCountTest.m | 9 + .../Checkouts/Quick/Externals/Nimble/test | 10 +- Carthage/Checkouts/Quick/Gemfile | 2 +- Carthage/Checkouts/Quick/Gemfile.lock | 52 +-- Carthage/Checkouts/Quick/Package.resolved | 4 +- Carthage/Checkouts/Quick/Package.swift | 67 ++- .../Checkouts/Quick/Package@swift-4.swift | 40 -- .../Objective-C/___FILEBASENAME___.h | 2 +- .../Objective-C/___FILEBASENAME___.m | 2 +- .../Swift/___FILEBASENAME___.swift | 2 +- .../Objective-C/___FILEBASENAME___.m | 2 +- .../Swift/___FILEBASENAME___.swift | 2 +- Carthage/Checkouts/Quick/Quick.podspec | 7 +- .../Quick/Quick.xcodeproj/project.pbxproj | 12 +- .../xcshareddata/WorkspaceSettings.xcsettings | 8 + Carthage/Checkouts/Quick/README.md | 4 +- Carthage/Checkouts/Quick/Rakefile | 15 +- .../Quick/Sources/Quick/Behavior.swift | 2 +- .../Quick/Sources/Quick/Callsite.swift | 12 +- .../Quick/Configuration/Configuration.swift | 4 +- .../Configuration/QuickConfiguration.swift | 2 +- .../Quick/Sources/Quick/DSL/World+DSL.swift | 6 +- .../Quick/Sources/Quick/ErrorUtility.swift | 2 +- .../Quick/Sources/Quick/Example.swift | 12 +- .../Quick/Sources/Quick/ExampleMetadata.swift | 12 +- .../Quick/Sources/Quick/Filter.swift | 12 +- .../Quick/NSBundle+CurrentTestBundle.swift | 2 +- .../NSString+C99ExtendedIdentifier.swift | 4 +- .../Quick/Sources/Quick/QuickMain.swift | 4 +- .../Quick/QuickSelectedTestSuiteBuilder.swift | 2 +- .../Quick/Sources/Quick/QuickSpec.swift | 12 +- .../Quick/Sources/Quick/QuickTestSuite.swift | 2 +- .../Checkouts/Quick/Sources/Quick/World.swift | 16 +- .../QuickTestHelpers/XCTestCaseProvider.swift | 2 +- .../FunctionalTests/AfterEachTests.swift | 2 +- .../FunctionalTests/BeforeEachTests.swift | 2 +- .../FunctionalTests/BehaviorTests.swift | 2 +- .../FunctionalTests/ContextTests.swift | 2 +- .../FunctionalTests/DescribeTests.swift | 2 +- .../QuickTests/FunctionalTests/ItTests.swift | 4 +- .../FunctionalTests/SharedExamplesTests.swift | 2 +- Carthage/Checkouts/Quick/script/release | 2 +- .../Quick/script/travis-install-macos | 4 - 246 files changed, 3040 insertions(+), 2687 deletions(-) create mode 100644 Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings delete mode 100644 Carthage/Checkouts/Nimble/Package@swift-4.swift create mode 100644 Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ElementsEqual.swift create mode 100644 Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ElementsEqualTest.swift create mode 100644 Carthage/Checkouts/Nimble/Tests/NimbleTests/XCTestManifests.swift create mode 100644 Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings delete mode 100644 Carthage/Checkouts/Quick/Externals/Nimble/Package@swift-4.swift rename Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/{AsyncMatcherWrapper.swift => Async.swift} (63%) create mode 100644 Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ElementsEqual.swift rename Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/{Async.swift => Await.swift} (93%) create mode 100644 Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ElementsEqualTest.swift rename Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/{SynchronousTests.swift => SynchronousTest.swift} (71%) create mode 100644 Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/XCTestManifests.swift delete mode 100644 Carthage/Checkouts/Quick/Package@swift-4.swift create mode 100644 Carthage/Checkouts/Quick/Quick.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings delete mode 100755 Carthage/Checkouts/Quick/script/travis-install-macos diff --git a/Cartfile.resolved b/Cartfile.resolved index fe3aa22..994d4bc 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ github "Carthage/Commandant" "0.15.0" -github "Quick/Nimble" "v7.3.2" -github "Quick/Quick" "v1.3.2" +github "Quick/Nimble" "v8.0.1" +github "Quick/Quick" "v2.0.0" github "antitypical/Result" "4.1.0" diff --git a/Carthage/Checkouts/Nimble/.swift-version b/Carthage/Checkouts/Nimble/.swift-version index 9f55b2c..bf77d54 100644 --- a/Carthage/Checkouts/Nimble/.swift-version +++ b/Carthage/Checkouts/Nimble/.swift-version @@ -1 +1 @@ -3.0 +4.2 diff --git a/Carthage/Checkouts/Nimble/.swiftlint.yml b/Carthage/Checkouts/Nimble/.swiftlint.yml index cb105e7..146ea6a 100644 --- a/Carthage/Checkouts/Nimble/.swiftlint.yml +++ b/Carthage/Checkouts/Nimble/.swiftlint.yml @@ -1,8 +1,5 @@ disabled_rules: - - todo - - variable_name - - force_try - - force_cast + - included: - Sources @@ -10,6 +7,8 @@ included: excluded: - Carthage/Checkouts + - Tests/NimbleTests/XCTestManifests.swift + - Tests/NimbleTests/Helpers/XCTestCaseProvider.swift trailing_comma: mandatory_comma: true @@ -17,3 +16,16 @@ trailing_comma: line_length: ignores_comments: true ignores_function_declarations: true + +identifier_name: + max_length: 50 + excluded: + - x + - l + - r + - e + - n1 + - n2 + - to + allowed_symbols: + - _ diff --git a/Carthage/Checkouts/Nimble/.travis.yml b/Carthage/Checkouts/Nimble/.travis.yml index 76f92a1..fb72977 100644 --- a/Carthage/Checkouts/Nimble/.travis.yml +++ b/Carthage/Checkouts/Nimble/.travis.yml @@ -1,65 +1,35 @@ -osx_image: xcode8.3 +osx_image: xcode10.1 language: generic matrix: include: - os: osx sudo: required env: TYPE=podspec + install: bundle install + name: CocoaPods Lint - os: osx - env: TYPE=ios NIMBLE_RUNTIME_IOS_SDK_VERSION=10.0 + env: TYPE=ios + name: iOS / Swift 4.2.1 - os: osx - env: TYPE=tvos NIMBLE_RUNTIME_TVOS_SDK_VERSION=10.0 + env: TYPE=tvos + name: tvOS / Swift 4.2.1 - os: osx env: TYPE=macos + name: macOS / Swift 4.2.1 - os: osx env: TYPE=macos - osx_image: xcode9 + osx_image: xcode10.2 + name: macOS / Swift 5.0 - os: osx - env: TYPE=macos - osx_image: xcode9.1 - - os: osx - env: TYPE=macos - osx_image: xcode9.2 - - os: osx - env: TYPE=macos - osx_image: xcode9.3 - - os: osx - env: TYPE=macos - osx_image: xcode9.4 - - os: osx - env: TYPE=macos - osx_image: xcode10.1 - - os: osx - env: TYPE=swiftpm - - os: osx - env: TYPE=swiftpm - osx_image: xcode9 - - os: osx - env: TYPE=swiftpm - osx_image: xcode10.1 - - os: linux - dist: trusty - sudo: required - env: TYPE=swiftpm - install: - - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" - - os: linux - dist: trusty - sudo: required env: - TYPE=swiftpm - - SWIFT_VERSION=4.0.3 - install: - - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" - - os: linux - dist: trusty - sudo: required + - os: osx env: - TYPE=swiftpm - - SWIFT_VERSION=4.1.3 - install: - - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" - - os: linux + osx_image: xcode10.2 + - &linux + name: Linux / Swift 4.2.1 + os: linux dist: trusty sudo: required env: @@ -67,15 +37,16 @@ matrix: - SWIFT_VERSION=4.2.1 install: - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" -# - os: linux -# dist: trusty -# sudo: required -# env: -# - TYPE=swiftpm -# - SWIFT_VERSION=5.0-DEVELOPMENT-SNAPSHOT-2019-01-13-a -# install: -# - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" -install: - - if [[ "$TYPE" == "podspec" ]]; then sudo gem install bundler; bundle install; fi + - <<: *linux + name: Linux / Swift 5.0 Development + env: + - TYPE=swiftpm + - SWIFT_VERSION=5.0-DEVELOPMENT-SNAPSHOT-2019-02-28-a + install: + - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" +install: true script: - ./test $TYPE + +notifications: + email: false diff --git a/Carthage/Checkouts/Nimble/Gemfile b/Carthage/Checkouts/Nimble/Gemfile index eca9219..206f109 100644 --- a/Carthage/Checkouts/Nimble/Gemfile +++ b/Carthage/Checkouts/Nimble/Gemfile @@ -1,4 +1,4 @@ # A sample Gemfile source "https://rubygems.org" -gem 'cocoapods', '1.5.0' +gem 'cocoapods', '~> 1.6.0.rc.2' diff --git a/Carthage/Checkouts/Nimble/Gemfile.lock b/Carthage/Checkouts/Nimble/Gemfile.lock index 36a0839..cc03cbf 100644 --- a/Carthage/Checkouts/Nimble/Gemfile.lock +++ b/Carthage/Checkouts/Nimble/Gemfile.lock @@ -2,75 +2,75 @@ GEM remote: https://rubygems.org/ specs: CFPropertyList (3.0.0) - activesupport (4.2.10) + activesupport (4.2.11) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - atomos (0.1.2) + atomos (0.1.3) claide (1.0.2) - cocoapods (1.5.0) + cocoapods (1.6.0.rc.2) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.5.0) + cocoapods-core (= 1.6.0.rc.2) cocoapods-deintegrate (>= 1.0.2, < 2.0) - cocoapods-downloader (>= 1.2.0, < 2.0) + cocoapods-downloader (>= 1.2.2, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) cocoapods-stats (>= 1.0.0, < 2.0) - cocoapods-trunk (>= 1.3.0, < 2.0) + cocoapods-trunk (>= 1.3.1, < 2.0) cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) - fourflusher (~> 2.0.1) + fourflusher (>= 2.2.0, < 3.0) gh_inspector (~> 1.0) - molinillo (~> 0.6.5) + molinillo (~> 0.6.6) nap (~> 1.0) - ruby-macho (~> 1.1) - xcodeproj (>= 1.5.7, < 2.0) - cocoapods-core (1.5.0) + ruby-macho (~> 1.3, >= 1.3.1) + xcodeproj (>= 1.8.0, < 2.0) + cocoapods-core (1.6.0.rc.2) activesupport (>= 4.0.2, < 6) fuzzy_match (~> 2.0.4) nap (~> 1.0) cocoapods-deintegrate (1.0.2) - cocoapods-downloader (1.2.0) + cocoapods-downloader (1.2.2) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) - cocoapods-stats (1.0.0) - cocoapods-trunk (1.3.0) + cocoapods-stats (1.1.0) + cocoapods-trunk (1.3.1) nap (>= 0.8, < 2.0) netrc (~> 0.11) cocoapods-try (1.1.0) colored2 (3.1.2) - concurrent-ruby (1.0.5) + concurrent-ruby (1.1.4) escape (0.0.4) - fourflusher (2.0.1) + fourflusher (2.2.0) fuzzy_match (2.0.4) gh_inspector (1.1.3) i18n (0.9.5) concurrent-ruby (~> 1.0) minitest (5.11.3) - molinillo (0.6.5) - nanaimo (0.2.5) + molinillo (0.6.6) + nanaimo (0.2.6) nap (1.1.0) netrc (0.11.0) - ruby-macho (1.1.0) + ruby-macho (1.3.1) thread_safe (0.3.6) tzinfo (1.2.5) thread_safe (~> 0.1) - xcodeproj (1.5.7) + xcodeproj (1.8.0) CFPropertyList (>= 2.3.3, < 4.0) - atomos (~> 0.1.2) + atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) - nanaimo (~> 0.2.4) + nanaimo (~> 0.2.6) PLATFORMS ruby DEPENDENCIES - cocoapods (= 1.5.0) + cocoapods (~> 1.6.0.rc.2) BUNDLED WITH - 1.16.1 + 1.17.2 diff --git a/Carthage/Checkouts/Nimble/Nimble.podspec b/Carthage/Checkouts/Nimble/Nimble.podspec index 8e0c5e3..69c5d56 100644 --- a/Carthage/Checkouts/Nimble/Nimble.podspec +++ b/Carthage/Checkouts/Nimble/Nimble.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Nimble" - s.version = "7.3.2" + s.version = "8.0.1" s.summary = "A Matcher Framework for Swift and Objective-C" s.description = <<-DESC Use Nimble to express the expected outcomes of Swift or Objective-C expressions. Inspired by Cedar. @@ -49,4 +49,7 @@ Pod::Spec.new do |s| 'OTHER_SWIFT_FLAGS' => '$(inherited) -suppress-warnings', 'FRAMEWORK_SEARCH_PATHS' => '$(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks"', } + + s.cocoapods_version = '>= 1.4.0' + s.swift_version = '4.2' end diff --git a/Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.pbxproj b/Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.pbxproj index 9bbba40..2bf9a6a 100644 --- a/Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.pbxproj +++ b/Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.pbxproj @@ -347,6 +347,13 @@ AE7ADE491C80C00D00B94CD3 /* MatchErrorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */; }; AE7ADE4A1C80C00D00B94CD3 /* MatchErrorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */; }; AE7ADE4B1C80C00D00B94CD3 /* MatchErrorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */; }; + B20058C120E92C7500C1264D /* ElementsEqual.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C020E92C7500C1264D /* ElementsEqual.swift */; }; + B20058C220E92CA900C1264D /* ElementsEqual.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C020E92C7500C1264D /* ElementsEqual.swift */; }; + B20058C320E92CA900C1264D /* ElementsEqual.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C020E92C7500C1264D /* ElementsEqual.swift */; }; + B20058C520E92CE400C1264D /* ElementsEqualTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C420E92CE400C1264D /* ElementsEqualTest.swift */; }; + B20058C620E92CE400C1264D /* ElementsEqualTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C420E92CE400C1264D /* ElementsEqualTest.swift */; }; + B20058C720E92CE400C1264D /* ElementsEqualTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C420E92CE400C1264D /* ElementsEqualTest.swift */; }; + CD037213207DCC580047AF28 /* XCTestManifests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD037212207DCC580047AF28 /* XCTestManifests.swift */; }; CD79C99E1D2CC832004B6F9A /* ObjCAsyncTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F4A56651A3B305F009E1637 /* ObjCAsyncTest.m */; }; CD79C99F1D2CC835004B6F9A /* ObjCSyncTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F8A37AF1B7C5042001C8357 /* ObjCSyncTest.m */; }; CD79C9A01D2CC839004B6F9A /* ObjCBeAnInstanceOfTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F4A56691A3B3108009E1637 /* ObjCBeAnInstanceOfTest.m */; }; @@ -612,6 +619,9 @@ AE4BA9AC1C88DDB500B73906 /* Errors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Errors.swift; sourceTree = ""; }; AE7ADE441C80BF8000B94CD3 /* MatchError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatchError.swift; sourceTree = ""; }; AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatchErrorTest.swift; sourceTree = ""; }; + B20058C020E92C7500C1264D /* ElementsEqual.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementsEqual.swift; sourceTree = ""; }; + B20058C420E92CE400C1264D /* ElementsEqualTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementsEqualTest.swift; sourceTree = ""; }; + CD037212207DCC580047AF28 /* XCTestManifests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTestManifests.swift; sourceTree = ""; }; CDFB6A1E1F7E07C600AD8CC7 /* CwlCatchException.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlCatchException.swift; sourceTree = ""; }; CDFB6A201F7E07C600AD8CC7 /* CwlCatchException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CwlCatchException.m; sourceTree = ""; }; CDFB6A221F7E07C600AD8CC7 /* CwlCatchException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlCatchException.h; sourceTree = ""; }; @@ -771,6 +781,7 @@ 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */, 965B0D0B1B62C06D0005AE66 /* UserDescriptionTest.swift */, 6CAEDD091CAEA86F003F1584 /* LinuxSupport.swift */, + CD037212207DCC580047AF28 /* XCTestManifests.swift */, 1FFD729A1963FC8200CD29A2 /* objc */, 1F14FB61194180A7009F2A08 /* Helpers */, 1F925EE3195C11B000ED456B /* Matchers */, @@ -810,6 +821,7 @@ 1F925F01195C189500ED456B /* ContainTest.swift */, 1F925EFE195C187600ED456B /* EndWithTest.swift */, 1F925F04195C18B700ED456B /* EqualTest.swift */, + B20058C420E92CE400C1264D /* ElementsEqualTest.swift */, 472FD1361B9E094B00C7B8DA /* HaveCountTest.swift */, DDB4D5EF19FE442800E9D9FE /* MatchTest.swift */, 1F925EEB195C12C800ED456B /* RaisesExceptionTest.swift */, @@ -861,6 +873,7 @@ 7B13BA051DD360AA00C9098C /* ContainElementSatisfying.swift */, 1FD8CD1B1968AB07008ED995 /* EndWith.swift */, 1FD8CD1C1968AB07008ED995 /* Equal.swift */, + B20058C020E92C7500C1264D /* ElementsEqual.swift */, 472FD1341B9E085700C7B8DA /* HaveCount.swift */, DDB4D5EC19FE43C200E9D9FE /* Match.swift */, 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */, @@ -1343,6 +1356,7 @@ DDB4D5ED19FE43C200E9D9FE /* Match.swift in Sources */, 1F91DD311C74BF61002C309F /* BeVoid.swift in Sources */, 7B13BA0B1DD361D200C9098C /* ContainElementSatisfying.swift in Sources */, + B20058C220E92CA900C1264D /* ElementsEqual.swift in Sources */, 1FCF91531C61C8A400B15DCB /* PostNotification.swift in Sources */, 1FD8CD2E1968AB07008ED995 /* AssertionRecorder.swift in Sources */, 29EA59661B551EE6002D767E /* ThrowError.swift in Sources */, @@ -1427,6 +1441,7 @@ 1F4A56911A3B344A009E1637 /* ObjCBeNilTest.m in Sources */, 1F8A37B01B7C5042001C8357 /* ObjCSyncTest.m in Sources */, 1F4A56941A3B346F009E1637 /* ObjCContainTest.m in Sources */, + B20058C620E92CE400C1264D /* ElementsEqualTest.swift in Sources */, 1F299EAB19627B2D002641AF /* BeEmptyTest.swift in Sources */, 7B13BA111DD361EB00C9098C /* ObjCContainElementSatisfyingTest.m in Sources */, 1F925EF6195C147800ED456B /* BeCloseToTest.swift in Sources */, @@ -1510,6 +1525,7 @@ 1F5DF16F1BDCA0F500C3A531 /* AssertionDispatcher.swift in Sources */, 964CFEFF1C4FF48900513336 /* ThrowAssertion.swift in Sources */, 1F5DF1841BDCA0F500C3A531 /* EndWith.swift in Sources */, + B20058C320E92CA900C1264D /* ElementsEqual.swift in Sources */, 1F5DF18D1BDCA0F500C3A531 /* SourceLocation.swift in Sources */, 1F5DF1701BDCA0F500C3A531 /* DSL.swift in Sources */, CDD80B851F20307B0002CD65 /* MatcherProtocols.swift in Sources */, @@ -1562,6 +1578,7 @@ 1F5DF19C1BDCA10200C3A531 /* BeginWithTest.swift in Sources */, 1F5DF1A01BDCA10200C3A531 /* BeIdenticalToTest.swift in Sources */, 1F5DF19A1BDCA10200C3A531 /* BeCloseToTest.swift in Sources */, + B20058C720E92CE400C1264D /* ElementsEqualTest.swift in Sources */, 1F5DF1A61BDCA10200C3A531 /* EndWithTest.swift in Sources */, CD79C9A31D2CC841004B6F9A /* ObjCBeFalseTest.m in Sources */, 1F5DF1A71BDCA10200C3A531 /* EqualTest.swift in Sources */, @@ -1618,6 +1635,7 @@ 1FD8CD2F1968AB07008ED995 /* AssertionRecorder.swift in Sources */, 7B13BA061DD360AA00C9098C /* ContainElementSatisfying.swift in Sources */, 1F91DD321C74BF61002C309F /* BeVoid.swift in Sources */, + B20058C120E92C7500C1264D /* ElementsEqual.swift in Sources */, 1FCF91541C61C8A400B15DCB /* PostNotification.swift in Sources */, DDB4D5EE19FE43C200E9D9FE /* Match.swift in Sources */, 29EA59671B551EE6002D767E /* ThrowError.swift in Sources */, @@ -1676,10 +1694,12 @@ DDB4D5F119FE442800E9D9FE /* MatchTest.swift in Sources */, 1F4A56741A3B3210009E1637 /* ObjCBeginWithTest.m in Sources */, 1F4A56831A3B336F009E1637 /* ObjCBeLessThanOrEqualToTest.m in Sources */, + CD037213207DCC580047AF28 /* XCTestManifests.swift in Sources */, 7B13BA0D1DD361DE00C9098C /* ContainElementSatisfyingTest.swift in Sources */, 1F925F03195C189500ED456B /* ContainTest.swift in Sources */, A8A3B6FD2073644700E25A08 /* ObjcStringersTest.m in Sources */, 1F4A56891A3B33CB009E1637 /* ObjCBeFalsyTest.m in Sources */, + B20058C520E92CE400C1264D /* ElementsEqualTest.swift in Sources */, 1F4A568F1A3B342B009E1637 /* ObjCBeFalseTest.m in Sources */, 1F925F12195C190B00ED456B /* BeGreaterThanOrEqualToTest.swift in Sources */, 1F925EF0195C136500ED456B /* BeLogicalTest.swift in Sources */, @@ -1836,13 +1856,13 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; TVOS_DEPLOYMENT_TARGET = 9.0; VERSIONING_SYSTEM = "apple-generic"; @@ -1895,12 +1915,12 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; diff --git a/Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..3ddf867 --- /dev/null +++ b/Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + BuildSystemType + Latest + + diff --git a/Carthage/Checkouts/Nimble/Package.swift b/Carthage/Checkouts/Nimble/Package.swift index 8d0b745..dfa6226 100644 --- a/Carthage/Checkouts/Nimble/Package.swift +++ b/Carthage/Checkouts/Nimble/Package.swift @@ -1,11 +1,21 @@ -// swift-tools-version:3.0 - +// swift-tools-version:4.2 import PackageDescription let package = Package( name: "Nimble", - exclude: [ - "Sources/NimbleObjectiveC", - "Tests/NimbleTests/objc", - ] + products: [ + .library(name: "Nimble", targets: ["Nimble"]), + ], + targets: [ + .target( + name: "Nimble", + dependencies: [] + ), + .testTarget( + name: "NimbleTests", + dependencies: ["Nimble"], + exclude: ["objc"] + ), + ], + swiftLanguageVersions: [.v4_2] ) diff --git a/Carthage/Checkouts/Nimble/Package@swift-4.swift b/Carthage/Checkouts/Nimble/Package@swift-4.swift deleted file mode 100644 index 740b842..0000000 --- a/Carthage/Checkouts/Nimble/Package@swift-4.swift +++ /dev/null @@ -1,22 +0,0 @@ -// swift-tools-version:4.0 - -import PackageDescription - -let package = Package( - name: "Nimble", - products: [ - .library(name: "Nimble", targets: ["Nimble"]), - ], - targets: [ - .target( - name: "Nimble", - dependencies: [] - ), - .testTarget( - name: "NimbleTests", - dependencies: ["Nimble"], - exclude: ["objc"] - ), - ], - swiftLanguageVersions: [4] -) diff --git a/Carthage/Checkouts/Nimble/README.md b/Carthage/Checkouts/Nimble/README.md index 19c562f..dde7fc4 100644 --- a/Carthage/Checkouts/Nimble/README.md +++ b/Carthage/Checkouts/Nimble/README.md @@ -4,6 +4,7 @@ [![CocoaPods](https://img.shields.io/cocoapods/v/Nimble.svg)](https://cocoapods.org/pods/Nimble) [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Platforms](https://img.shields.io/cocoapods/p/Nimble.svg)](https://cocoapods.org/pods/Nimble) +[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com) Use Nimble to express the expected outcomes of Swift or Objective-C expressions. Inspired by @@ -306,8 +307,7 @@ In Nimble, it's easy to make expectations on values that are updated asynchronously. Just use `toEventually` or `toEventuallyNot`: ```swift -// Swift 3.0 and later - +// Swift DispatchQueue.main.async { ocean.add("dolphins") ocean.add("whales") @@ -316,17 +316,6 @@ expect(ocean).toEventually(contain("dolphins", "whales")) ``` -```swift -// Swift 2.3 and earlier - -dispatch_async(dispatch_get_main_queue()) { - ocean.add("dolphins") - ocean.add("whales") -} -expect(ocean).toEventually(contain("dolphins", "whales")) -``` - - ```objc // Objective-C @@ -857,11 +846,7 @@ Notes: ## Swift Error Handling -If you're using Swift 2.0 or newer, you can use the `throwError` matcher to check if an error is thrown. - -Note: -The following code sample references the `Swift.Error` protocol. -This is `Swift.ErrorProtocol` in versions of Swift prior to version 3.0. +You can use the `throwError` matcher to check if an error is thrown. ```swift // Swift @@ -1277,7 +1262,7 @@ public func equal(expectedValue: T?) -> Predicate { // Predicate { actual in ... } // // But shown with types here for clarity. - return Predicate { (actual: Expression) throws -> PredicateResult in + return Predicate { (actualExpression: Expression) throws -> PredicateResult in let msg = ExpectationMessage.expectedActualValueTo("equal <\(expectedValue)>") if let actualValue = try actualExpression.evaluate() { return PredicateResult( @@ -1673,11 +1658,11 @@ backported. The deprecating plan is a 3 major versions removal. Which is as follows: 1. Introduce new `Predicate` API, deprecation warning for old matcher APIs. - (Nimble `v7.x.x`) + (Nimble `v7.x.x` and `v8.x.x`) 2. Introduce warnings on migration-path features (`.predicate`, `Predicate`-constructors with similar arguments to old API). (Nimble - `v8.x.x`) - 3. Remove old API. (Nimble `v9.x.x`) + `v9.x.x`) + 3. Remove old API. (Nimble `v10.x.x`) # Installing Nimble diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift index 2e58fdf..abaf532 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift @@ -13,5 +13,6 @@ public protocol AssertionHandler { /// /// @see AssertionHandler public var NimbleAssertionHandler: AssertionHandler = { () -> AssertionHandler in + // swiftlint:disable:previous identifier_name return isXCTestAvailable() ? NimbleXCTestHandler() : NimbleXCTestUnavailableHandler() }() diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift index cc39636..0f5df59 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift @@ -37,21 +37,48 @@ public class AssertionRecorder: AssertionHandler { } } +extension NMBExceptionCapture { + internal func tryBlockThrows(_ unsafeBlock: () throws -> Void) throws { + var catchedError: Error? + tryBlock { + do { + try unsafeBlock() + } catch { + catchedError = error + } + } + if let error = catchedError { + throw error + } + } +} + /// Allows you to temporarily replace the current Nimble assertion handler with /// the one provided for the scope of the closure. /// /// Once the closure finishes, then the original Nimble assertion handler is restored. /// /// @see AssertionHandler -public func withAssertionHandler(_ tempAssertionHandler: AssertionHandler, closure: () throws -> Void) { +public func withAssertionHandler(_ tempAssertionHandler: AssertionHandler, + file: FileString = #file, + line: UInt = #line, + closure: () throws -> Void) { let environment = NimbleEnvironment.activeInstance let oldRecorder = environment.assertionHandler let capturer = NMBExceptionCapture(handler: nil, finally: ({ environment.assertionHandler = oldRecorder })) environment.assertionHandler = tempAssertionHandler - capturer.tryBlock { - try! closure() + + do { + try capturer.tryBlockThrows { + try closure() + } + } catch { + let failureMessage = FailureMessage() + failureMessage.stringValue = "unexpected error thrown: <\(error)>" + let location = SourceLocation(file: file, line: line) + tempAssertionHandler.assert(false, message: failureMessage, location: location) } } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift index add7d3f..b3eb09a 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift @@ -1,6 +1,6 @@ import Foundation -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE private func from(objcPredicate: NMBPredicate) -> Predicate { return Predicate { actualExpression in @@ -15,6 +15,7 @@ internal struct ObjCMatcherWrapper: Matcher { func matches(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { return matcher.matches( + // swiftlint:disable:next force_try ({ try! actualExpression.evaluate() }), failureMessage: failureMessage, location: actualExpression.location) @@ -22,6 +23,7 @@ internal struct ObjCMatcherWrapper: Matcher { func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { return matcher.doesNotMatch( + // swiftlint:disable:next force_try ({ try! actualExpression.evaluate() }), failureMessage: failureMessage, location: actualExpression.location) @@ -30,11 +32,13 @@ internal struct ObjCMatcherWrapper: Matcher { // Equivalent to Expectation, but for Nimble's Objective-C interface public class NMBExpectation: NSObject { + // swiftlint:disable identifier_name internal let _actualBlock: () -> NSObject? internal var _negative: Bool internal let _file: FileString internal let _line: UInt internal var _timeout: TimeInterval = 1.0 + // swiftlint:enable identifier_name @objc public init(actualBlock: @escaping () -> NSObject?, negative: Bool, file: FileString, line: UInt) { self._actualBlock = actualBlock diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift index a114dff..a91efe3 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift @@ -1,6 +1,6 @@ import Foundation -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) // swiftlint:disable line_length public typealias MatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage) throws -> Bool @@ -8,8 +8,10 @@ public typealias FullMatcherBlock = (_ actualExpression: Expression, _ // swiftlint:enable line_length public class NMBObjCMatcher: NSObject, NMBMatcher { + // swiftlint:disable identifier_name let _match: MatcherBlock let _doesNotMatch: MatcherBlock + // swiftlint:enable identifier_name let canMatchNil: Bool public init(canMatchNil: Bool, matcher: @escaping MatcherBlock, notMatcher: @escaping MatcherBlock) { diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift index 818e478..1b2e8c0 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift @@ -20,6 +20,7 @@ internal class NimbleEnvironment: NSObject { } } + // swiftlint:disable:next todo // TODO: eventually migrate the global to this environment value var assertionHandler: AssertionHandler { get { return NimbleAssertionHandler } @@ -30,13 +31,7 @@ internal class NimbleEnvironment: NSObject { var awaiter: Awaiter override init() { - let timeoutQueue: DispatchQueue - if #available(OSX 10.10, *) { - timeoutQueue = DispatchQueue.global(qos: .userInitiated) - } else { - timeoutQueue = DispatchQueue.global(priority: .high) - } - + let timeoutQueue = DispatchQueue.global(qos: .userInitiated) awaiter = Awaiter( waitLock: AssertionWaitLock(), asyncQueue: .main, diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift index 14bb045..719bf44 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift @@ -64,7 +64,7 @@ class NimbleXCTestUnavailableHandler: AssertionHandler { #endif func isXCTestAvailable() -> Bool { -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) // XCTest is weakly linked and so may not be present return NSClassFromString("XCTestCase") != nil #else @@ -77,15 +77,14 @@ public func recordFailure(_ message: String, location: SourceLocation) { XCTFail("\(message)", file: location.file, line: location.line) #else if let testCase = CurrentTestCaseTracker.sharedInstance.currentTestCase { - #if swift(>=4) let line = Int(location.line) - #else - let line = location.line - #endif testCase.recordFailure(withDescription: message, inFile: location.file, atLine: line, expected: true) } else { - let msg = "Attempted to report a test failure to XCTest while no test case was running. " + - "The failure was:\n\"\(message)\"\nIt occurred at: \(location.file):\(location.line)" + let msg = """ + Attempted to report a test failure to XCTest while no test case was running. The failure was: + \"\(message)\" + It occurred at: \(location.file):\(location.line) + """ NSException(name: .internalInconsistencyException, reason: msg, userInfo: nil).raise() } #endif diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NonObjectiveC/ExceptionCapture.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NonObjectiveC/ExceptionCapture.swift index 8f8d360..d0871fc 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NonObjectiveC/ExceptionCapture.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NonObjectiveC/ExceptionCapture.swift @@ -1,6 +1,6 @@ import Foundation -#if !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) +#if !canImport(Darwin) // swift-corelibs-foundation doesn't provide NSException at all, so provide a dummy class NSException {} #endif diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/DSL+Wait.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/DSL+Wait.swift index e874136..c049417 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/DSL+Wait.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/DSL+Wait.swift @@ -14,7 +14,7 @@ internal class NMBWait: NSObject { // About these kind of lines, `@objc` attributes are only required for Objective-C // support, so that should be conditional on Darwin platforms and normal Xcode builds // (non-SwiftPM builds). -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE @objc internal class func until( timeout: TimeInterval, @@ -87,13 +87,19 @@ internal class NMBWait: NSObject { } } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE @objc(untilFile:line:action:) - internal class func until(_ file: FileString = #file, line: UInt = #line, action: @escaping (() -> Void) -> Void) { + internal class func until( + _ file: FileString = #file, + line: UInt = #line, + action: @escaping (@escaping () -> Void) -> Void) { until(timeout: 1, file: file, line: line, action: action) } #else - internal class func until(_ file: FileString = #file, line: UInt = #line, action: @escaping (() -> Void) -> Void) { + internal class func until( + _ file: FileString = #file, + line: UInt = #line, + action: @escaping (@escaping () -> Void) -> Void) { until(timeout: 1, file: file, line: line, action: action) } #endif diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/DSL.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/DSL.swift index e49bb0c..d6dc9cc 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/DSL.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/DSL.swift @@ -43,12 +43,13 @@ internal func nimblePrecondition( line: UInt = #line) { let result = expr() if !result { -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - let e = NSException( +#if canImport(Darwin) + let exception = NSException( name: NSExceptionName(name()), reason: message(), - userInfo: nil) - e.raise() + userInfo: nil + ) + exception.raise() #else preconditionFailure("\(name()) - \(message())", file: file, line: line) #endif @@ -56,9 +57,12 @@ internal func nimblePrecondition( } internal func internalError(_ msg: String, file: FileString = #file, line: UInt = #line) -> Never { + // swiftlint:disable line_length fatalError( - "Nimble Bug Found: \(msg) at \(file):\(line).\n" + - "Please file a bug to Nimble: https://github.com/Quick/Nimble/issues with the " + - "code snippet that caused this error." + """ + Nimble Bug Found: \(msg) at \(file):\(line). + Please file a bug to Nimble: https://github.com/Quick/Nimble/issues with the code snippet that caused this error. + """ ) + // swiftlint:enable line_length } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/ExpectationMessage.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/ExpectationMessage.swift index 7aae341..b0cbcc3 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/ExpectationMessage.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/ExpectationMessage.swift @@ -75,6 +75,7 @@ public indirect enum ExpectationMessage { } internal func visitLeafs(_ f: (ExpectationMessage) -> ExpectationMessage) -> ExpectationMessage { + // swiftlint:disable:previous identifier_name switch self { case .fail, .expectedTo, .expectedActualValueTo, .expectedCustomValueTo: return f(self) @@ -90,6 +91,7 @@ public indirect enum ExpectationMessage { /// Replaces a primary expectation with one returned by f. Preserves all composite expectations /// that were built upon it (aka - all appended(message:) and appended(details:). public func replacedExpectation(_ f: @escaping (ExpectationMessage) -> ExpectationMessage) -> ExpectationMessage { + // swiftlint:disable:previous identifier_name func walk(_ msg: ExpectationMessage) -> ExpectationMessage { switch msg { case .fail, .expectedTo, .expectedActualValueTo, .expectedCustomValueTo: @@ -124,6 +126,7 @@ public indirect enum ExpectationMessage { return visitLeafs(walk) } + // swiftlint:disable:next todo // TODO: test & verify correct behavior internal func prepended(message: String) -> ExpectationMessage { return .prepends(message, self) @@ -183,32 +186,32 @@ public indirect enum ExpectationMessage { extension FailureMessage { internal func toExpectationMessage() -> ExpectationMessage { - let defaultMsg = FailureMessage() - if expected != defaultMsg.expected || _stringValueOverride != nil { + let defaultMessage = FailureMessage() + if expected != defaultMessage.expected || _stringValueOverride != nil { return .fail(stringValue) } - var msg: ExpectationMessage = .fail(userDescription ?? "") + var message: ExpectationMessage = .fail(userDescription ?? "") if actualValue != "" && actualValue != nil { - msg = .expectedCustomValueTo(postfixMessage, actualValue ?? "") - } else if postfixMessage != defaultMsg.postfixMessage { + message = .expectedCustomValueTo(postfixMessage, actualValue ?? "") + } else if postfixMessage != defaultMessage.postfixMessage { if actualValue == nil { - msg = .expectedTo(postfixMessage) + message = .expectedTo(postfixMessage) } else { - msg = .expectedActualValueTo(postfixMessage) + message = .expectedActualValueTo(postfixMessage) } } - if postfixActual != defaultMsg.postfixActual { - msg = .appends(msg, postfixActual) + if postfixActual != defaultMessage.postfixActual { + message = .appends(message, postfixActual) } - if let m = extendedMessage { - msg = .details(msg, m) + if let extended = extendedMessage { + message = .details(message, extended) } - return msg + return message } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) public class NMBExpectationMessage: NSObject { private let msg: ExpectationMessage diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Expression.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Expression.swift index 5a233fd..b6b2ee3 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Expression.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Expression.swift @@ -24,8 +24,10 @@ internal func memoizedClosure(_ closure: @escaping () throws -> T) -> (Bool) /// This provides a common consumable API for matchers to utilize to allow /// Nimble to change internals to how the captured closure is managed. public struct Expression { + // swiftlint:disable identifier_name internal let _expression: (Bool) throws -> T? internal let _withoutCaching: Bool + // swiftlint:enable identifier_name public let location: SourceLocation public let isClosure: Bool diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/FailureMessage.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/FailureMessage.swift index 2bc57eb..503b540 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/FailureMessage.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/FailureMessage.swift @@ -28,6 +28,7 @@ public class FailureMessage: NSObject { } } + // swiftlint:disable:next identifier_name internal var _stringValueOverride: String? internal var hasOverriddenStringValue: Bool { return _stringValueOverride != nil diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/AllPass.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/AllPass.swift index cc6c24f..dbbccb9 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/AllPass.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/AllPass.swift @@ -63,7 +63,7 @@ private func createPredicate(_ elementMatcher: Predicate) } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func allPassMatcher(_ matcher: NMBMatcher) -> NMBPredicate { return NMBPredicate { actualExpression in @@ -103,6 +103,7 @@ extension NMBObjCMatcher { } else { let failureMessage = FailureMessage() let result = matcher.matches( + // swiftlint:disable:next force_try ({ try! expr.evaluate() }), failureMessage: failureMessage, location: expr.location diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Async.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Async.swift index c70b65e..5022fe2 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Async.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Async.swift @@ -42,8 +42,10 @@ private func async(style: ExpectationStyle, predicate: Predicate, timeout: } private let toEventuallyRequiresClosureError = FailureMessage( - // swiftlint:disable:next line_length - stringValue: "expect(...).toEventually(...) requires an explicit closure (eg - expect { ... }.toEventually(...) )\nSwift 1.2 @autoclosure behavior has changed in an incompatible way for Nimble to function" + stringValue: """ + expect(...).toEventually(...) requires an explicit closure (eg - expect { ... }.toEventually(...) ) + Swift 1.2 @autoclosure behavior has changed in an incompatible way for Nimble to function + """ ) extension Expectation { diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift index 5d0f5a1..3a68b09 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift @@ -29,7 +29,7 @@ public func beAKindOf(_ expectedType: T.Type) -> Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) /// A Nimble matcher that succeeds when the actual value is an instance of the given class. /// @see beAnInstanceOf if you want to match against the exact class diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift index bc1b02c..3cef3a7 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift @@ -33,7 +33,7 @@ public func beAnInstanceOf(_ expectedClass: AnyClass) -> Predicate { } else { actualString = "" } - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) let matches = instance != nil && instance!.isMember(of: expectedClass) #else let matches = instance != nil && type(of: instance!) == expectedClass @@ -45,7 +45,7 @@ public func beAnInstanceOf(_ expectedClass: AnyClass) -> Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func beAnInstanceOfMatcher(_ expected: AnyClass) -> NMBMatcher { return NMBPredicate { actualExpression in diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift index b1e6f4c..d6fd1ee 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift @@ -1,5 +1,6 @@ import Foundation +// swiftlint:disable:next identifier_name public let DefaultDelta = 0.0001 internal func isCloseTo(_ actualValue: NMBDoubleConvertible?, @@ -34,10 +35,12 @@ public func beCloseTo(_ expectedValue: NMBDoubleConvertible, within delta: Doubl } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) public class NMBObjCBeCloseToMatcher: NSObject, NMBMatcher { + // swiftlint:disable identifier_name var _expected: NSNumber var _delta: CDouble + // swiftlint:enable identifier_name init(expected: NSNumber, within: CDouble) { _expected = expected _delta = within @@ -110,14 +113,17 @@ public func beCloseTo(_ expectedValues: [Double], within delta: Double = Default infix operator ≈ : ComparisonPrecedence +// swiftlint:disable:next identifier_name public func ≈(lhs: Expectation<[Double]>, rhs: [Double]) { lhs.to(beCloseTo(rhs)) } +// swiftlint:disable:next identifier_name public func ≈(lhs: Expectation, rhs: NMBDoubleConvertible) { lhs.to(beCloseTo(rhs)) } +// swiftlint:disable:next identifier_name public func ≈(lhs: Expectation, rhs: (expected: NMBDoubleConvertible, delta: Double)) { lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) } @@ -133,6 +139,7 @@ precedencegroup PlusMinusOperatorPrecedence { } infix operator ± : PlusMinusOperatorPrecedence +// swiftlint:disable:next identifier_name public func ±(lhs: NMBDoubleConvertible, rhs: Double) -> (expected: NMBDoubleConvertible, delta: Double) { return (expected: lhs, delta: rhs) } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeEmpty.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeEmpty.swift index 8d73dcc..860287f 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeEmpty.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeEmpty.swift @@ -4,15 +4,36 @@ import Foundation /// means the are no items in that collection. For strings, it is an empty string. public func beEmpty() -> Predicate { return Predicate.simple("be empty") { actualExpression in - let actualSeq = try actualExpression.evaluate() - if actualSeq == nil { + guard let actual = try actualExpression.evaluate() else { return .fail } - var generator = actualSeq!.makeIterator() + var generator = actual.makeIterator() return PredicateStatus(bool: generator.next() == nil) } } +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For strings, it is an empty string. +public func beEmpty() -> Predicate { + return Predicate.simple("be empty") { actualExpression in + guard let actual = try actualExpression.evaluate() else { + return .fail + } + return PredicateStatus(bool: actual.isEmpty) + } +} + +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For strings, it is an empty string. +public func beEmpty() -> Predicate { + return Predicate.simple("be empty") { actualExpression in + guard let actual = try actualExpression.evaluate() else { + return .fail + } + return PredicateStatus(bool: actual.isEmpty) + } +} + /// A Nimble matcher that succeeds when a value is "empty". For collections, this /// means the are no items in that collection. For strings, it is an empty string. public func beEmpty() -> Predicate { @@ -61,7 +82,7 @@ public func beEmpty() -> Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func beEmptyMatcher() -> NMBPredicate { return NMBPredicate { actualExpression in diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift index b86f25d..4a4cdd2 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift @@ -30,12 +30,12 @@ public func > (lhs: Expectation, rhs: NMBComparable?) { lhs.to(beGreaterThan(rhs)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } - return try beGreaterThan(expected).matches(expr, failureMessage: failureMessage) + return try beGreaterThan(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift index 2a3ca4a..39d9e63 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift @@ -32,12 +32,12 @@ public func >=(lhs: Expectation, rhs: T) { lhs.to(beGreaterThanOrEqualTo(rhs)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beGreaterThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func beGreaterThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } - return try beGreaterThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage) + return try beGreaterThanOrEqualTo(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift index dfbcb9e..49e503e 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift @@ -4,39 +4,15 @@ import Foundation /// as the expected instance. public func beIdenticalTo(_ expected: Any?) -> Predicate { return Predicate.define { actualExpression in - #if os(Linux) - #if swift(>=4.0) - #if !swift(>=4.1.50) - let actual = try actualExpression.evaluate() as? AnyObject - #else - let actual = try actualExpression.evaluate() as AnyObject? - #endif - #else - #if !swift(>=3.4) - let actual = try actualExpression.evaluate() as? AnyObject - #else - let actual = try actualExpression.evaluate() as AnyObject? - #endif - #endif + #if os(Linux) && !swift(>=4.1.50) + let actual = try actualExpression.evaluate() as? AnyObject #else let actual = try actualExpression.evaluate() as AnyObject? #endif let bool: Bool - #if os(Linux) - #if swift(>=4.0) - #if !swift(>=4.1.50) - bool = actual === (expected as? AnyObject) && actual !== nil - #else - bool = actual === (expected as AnyObject?) && actual !== nil - #endif - #else - #if !swift(>=3.4) - bool = actual === (expected as? AnyObject) && actual !== nil - #else - bool = actual === (expected as AnyObject?) && actual !== nil - #endif - #endif + #if os(Linux) && !swift(>=4.1.50) + bool = actual === (expected as? AnyObject) && actual !== nil #else bool = actual === (expected as AnyObject?) && actual !== nil #endif @@ -65,12 +41,12 @@ public func be(_ expected: Any?) -> Predicate { return beIdenticalTo(expected) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beIdenticalToMatcher(_ expected: NSObject?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func beIdenticalToMatcher(_ expected: NSObject?) -> NMBMatcher { + return NMBPredicate { actualExpression in let aExpr = actualExpression.cast { $0 as Any? } - return try beIdenticalTo(expected).matches(aExpr, failureMessage: failureMessage) + return try beIdenticalTo(expected).satisfies(aExpr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThan.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThan.swift index e1fbf1e..ef0a7d4 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThan.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThan.swift @@ -29,12 +29,12 @@ public func < (lhs: Expectation, rhs: NMBComparable?) { lhs.to(beLessThan(rhs)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beLessThanMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func beLessThanMatcher(_ expected: NMBComparable?) -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } - return try beLessThan(expected).matches(expr, failureMessage: failureMessage) + return try beLessThan(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift index c37cb16..30ce043 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift @@ -29,12 +29,12 @@ public func <=(lhs: Expectation, rhs: T) { lhs.to(beLessThanOrEqualTo(rhs)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beLessThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func beLessThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } - return try beLessThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage) + return try beLessThanOrEqualTo(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLogical.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLogical.swift index 035500e..788234b 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLogical.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLogical.swift @@ -100,14 +100,6 @@ public func beTruthy() -> Predicate< return Predicate.simpleNilable("be truthy") { actualExpression in let actualValue = try actualExpression.evaluate() if let actualValue = actualValue { - // FIXME: This is a workaround to SR-2290. - // See: - // - https://bugs.swift.org/browse/SR-2290 - // - https://github.com/norio-nomura/Nimble/pull/5#issuecomment-237835873 - if let number = actualValue as? NSNumber { - return PredicateStatus(bool: number.boolValue == true) - } - return PredicateStatus(bool: actualValue == (true as T)) } return PredicateStatus(bool: actualValue != nil) @@ -120,47 +112,42 @@ public func beFalsy() -> Predicate NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in + @objc public class func beTruthyMatcher() -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } - return try beTruthy().matches(expr, failureMessage: failureMessage) + return try beTruthy().satisfies(expr).toObjectiveC() } } - @objc public class func beFalsyMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in + @objc public class func beFalsyMatcher() -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } - return try beFalsy().matches(expr, failureMessage: failureMessage) + return try beFalsy().satisfies(expr).toObjectiveC() } } - @objc public class func beTrueMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in + @objc public class func beTrueMatcher() -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } - return try beTrue().matches(expr, failureMessage: failureMessage) + return try beTrue().satisfies(expr).toObjectiveC() } } - @objc public class func beFalseMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } - return try beFalse().matches(expr, failureMessage: failureMessage) + @objc public class func beFalseMatcher() -> NMBMatcher { + return NMBPredicate { actualExpression in + let expr = actualExpression.cast { value -> Bool? in + guard let value = value else { return nil } + return (value as? NSNumber)?.boolValue ?? false + } + return try beFalse().satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeNil.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeNil.swift index 387420b..0f21d41 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeNil.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeNil.swift @@ -8,11 +8,11 @@ public func beNil() -> Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beNilMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in - return try beNil().matches(actualExpression, failureMessage: failureMessage) + @objc public class func beNilMatcher() -> NMBMatcher { + return NMBPredicate { actualExpression in + return try beNil().satisfies(actualExpression).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeVoid.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeVoid.swift index a9dbc28..9a7eafd 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeVoid.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeVoid.swift @@ -8,10 +8,12 @@ public func beVoid() -> Predicate<()> { } } -public func == (lhs: Expectation<()>, rhs: ()) { - lhs.to(beVoid()) -} +extension Expectation where T == () { + public static func == (lhs: Expectation<()>, rhs: ()) { + lhs.to(beVoid()) + } -public func != (lhs: Expectation<()>, rhs: ()) { - lhs.toNot(beVoid()) + public static func != (lhs: Expectation<()>, rhs: ()) { + lhs.toNot(beVoid()) + } } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeginWith.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeginWith.swift index a013f9f..3183eb9 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeginWith.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeginWith.swift @@ -35,24 +35,24 @@ public func beginWith(_ startingElement: Any) -> Predicate public func beginWith(_ startingSubstring: String) -> Predicate { return Predicate.simple("begin with <\(startingSubstring)>") { actualExpression in if let actual = try actualExpression.evaluate() { - let range = actual.range(of: startingSubstring) - return PredicateStatus(bool: range != nil && range!.lowerBound == actual.startIndex) + return PredicateStatus(bool: actual.hasPrefix(startingSubstring)) } return .fail } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beginWithMatcher(_ expected: Any) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func beginWithMatcher(_ expected: Any) -> NMBMatcher { + return NMBPredicate { actualExpression in let actual = try actualExpression.evaluate() - if (actual as? String) != nil { + if actual is String { let expr = actualExpression.cast { $0 as? String } - return try beginWith(expected as! String).matches(expr, failureMessage: failureMessage) + // swiftlint:disable:next force_cast + return try beginWith(expected as! String).satisfies(expr).toObjectiveC() } else { let expr = actualExpression.cast { $0 as? NMBOrderedCollection } - return try beginWith(expected).matches(expr, failureMessage: failureMessage) + return try beginWith(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Contain.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Contain.swift index 2c84c5c..6974a4d 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Contain.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Contain.swift @@ -1,16 +1,17 @@ import Foundation -/// A Nimble matcher that succeeds when the actual sequence contains the expected value. +/// A Nimble matcher that succeeds when the actual sequence contains the expected values. public func contain(_ items: T...) -> Predicate - where S.Iterator.Element == T { + where S.Element == T { return contain(items) } +/// A Nimble matcher that succeeds when the actual sequence contains the expected values. public func contain(_ items: [T]) -> Predicate - where S.Iterator.Element == T { + where S.Element == T { return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in if let actual = try actualExpression.evaluate() { - let matches = items.all { + let matches = items.allSatisfy { return actual.contains($0) } return PredicateStatus(bool: matches) @@ -19,6 +20,46 @@ public func contain(_ items: [T]) -> Predicate } } +/// A Nimble matcher that succeeds when the actual set contains the expected values. +public func contain(_ items: T...) -> Predicate + where S.Element == T { + return contain(items) +} + +/// A Nimble matcher that succeeds when the actual set contains the expected values. +public func contain(_ items: [T]) -> Predicate + where S.Element == T { + return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in + if let actual = try actualExpression.evaluate() { + let matches = items.allSatisfy { + return actual.contains($0) + } + return PredicateStatus(bool: matches) + } + return .fail + } +} + +/// A Nimble matcher that succeeds when the actual set contains the expected values. +public func contain(_ items: T...) -> Predicate + where S.Element == T { + return contain(items) +} + +/// A Nimble matcher that succeeds when the actual set contains the expected values. +public func contain(_ items: [T]) -> Predicate + where S.Element == T { + return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in + if let actual = try actualExpression.evaluate() { + let matches = items.allSatisfy { + return actual.contains($0) + } + return PredicateStatus(bool: matches) + } + return .fail + } +} + /// A Nimble matcher that succeeds when the actual string contains the expected substring. public func contain(_ substrings: String...) -> Predicate { return contain(substrings) @@ -27,7 +68,7 @@ public func contain(_ substrings: String...) -> Predicate { public func contain(_ substrings: [String]) -> Predicate { return Predicate.simple("contain <\(arrayAsString(substrings))>") { actualExpression in if let actual = try actualExpression.evaluate() { - let matches = substrings.all { + let matches = substrings.allSatisfy { let range = actual.range(of: $0) return range != nil && !range!.isEmpty } @@ -45,7 +86,7 @@ public func contain(_ substrings: NSString...) -> Predicate { public func contain(_ substrings: [NSString]) -> Predicate { return Predicate.simple("contain <\(arrayAsString(substrings))>") { actualExpression in if let actual = try actualExpression.evaluate() { - let matches = substrings.all { actual.range(of: $0.description).length != 0 } + let matches = substrings.allSatisfy { actual.range(of: $0.description).length != 0 } return PredicateStatus(bool: matches) } return .fail @@ -60,17 +101,17 @@ public func contain(_ items: Any?...) -> Predicate { public func contain(_ items: [Any?]) -> Predicate { return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in guard let actual = try actualExpression.evaluate() else { return .fail } - let matches = items.all { item in + let matches = items.allSatisfy { item in return item.map { actual.contains($0) } ?? false } return PredicateStatus(bool: matches) } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func containMatcher(_ expected: [NSObject]) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func containMatcher(_ expected: [NSObject]) -> NMBMatcher { + return NMBPredicate { actualExpression in let location = actualExpression.location let actualValue = try actualExpression.evaluate() if let value = actualValue as? NMBContainer { @@ -78,17 +119,25 @@ extension NMBObjCMatcher { // A straightforward cast on the array causes this to crash, so we have to cast the individual items let expectedOptionals: [Any?] = expected.map({ $0 as Any? }) - return try contain(expectedOptionals).matches(expr, failureMessage: failureMessage) + return try contain(expectedOptionals).satisfies(expr).toObjectiveC() } else if let value = actualValue as? NSString { let expr = Expression(expression: ({ value as String }), location: location) - return try contain(expected as! [String]).matches(expr, failureMessage: failureMessage) - } else if actualValue != nil { - // swiftlint:disable:next line_length - failureMessage.postfixMessage = "contain <\(arrayAsString(expected))> (only works for NSArrays, NSSets, NSHashTables, and NSStrings)" - } else { - failureMessage.postfixMessage = "contain <\(arrayAsString(expected))>" + // swiftlint:disable:next force_cast + return try contain(expected as! [String]).satisfies(expr).toObjectiveC() } - return false + + let message: ExpectationMessage + if actualValue != nil { + message = ExpectationMessage.expectedActualValueTo( + // swiftlint:disable:next line_length + "contain <\(arrayAsString(expected))> (only works for NSArrays, NSSets, NSHashTables, and NSStrings)" + ) + } else { + message = ExpectationMessage + .expectedActualValueTo("contain <\(arrayAsString(expected))>") + .appendedBeNilHint() + } + return NMBPredicateResult(status: .fail, message: message.toObjectiveC()) } } } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift index 8a23a6c..331f3bc 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift @@ -24,20 +24,22 @@ public func containElementSatisfying(_ predicate: @escaping ((T) } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func containElementSatisfyingMatcher(_ predicate: @escaping ((NSObject) -> Bool)) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func containElementSatisfyingMatcher(_ predicate: @escaping ((NSObject) -> Bool)) -> NMBMatcher { + return NMBPredicate { actualExpression in let value = try actualExpression.evaluate() guard let enumeration = value as? NSFastEnumeration else { - // swiftlint:disable:next line_length - failureMessage.postfixMessage = "containElementSatisfying must be provided an NSFastEnumeration object" - failureMessage.actualValue = nil - failureMessage.expected = "" - failureMessage.to = "" - return false + let message = ExpectationMessage.fail( + "containElementSatisfying must be provided an NSFastEnumeration object" + ) + return NMBPredicateResult(status: .fail, message: message.toObjectiveC()) } + let message = ExpectationMessage + .expectedTo("find object in collection that satisfies predicate") + .toObjectiveC() + var iterator = NSFastEnumerationIterator(enumeration) while let item = iterator.next() { guard let object = item as? NSObject else { @@ -45,13 +47,11 @@ public func containElementSatisfying(_ predicate: @escaping ((T) } if predicate(object) { - return true + return NMBPredicateResult(status: .matches, message: message) } } - failureMessage.actualValue = nil - failureMessage.postfixMessage = "find object in collection that satisfies predicate" - return false + return NMBPredicateResult(status: .doesNotMatch, message: message) } } } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ElementsEqual.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ElementsEqual.swift new file mode 100644 index 0000000..1704e94 --- /dev/null +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ElementsEqual.swift @@ -0,0 +1,16 @@ +/// A Nimble matcher that succeeds when the actual sequence contain the same elements in the same order to the exepected sequence. +public func elementsEqual(_ expectedValue: S?) -> Predicate where S.Element: Equatable { + // A matcher abstraction for https://developer.apple.com/documentation/swift/sequence/2949668-elementsequal + return Predicate.define("elementsEqual <\(stringify(expectedValue))>") { (actualExpression, msg) in + let actualValue = try actualExpression.evaluate() + switch (expectedValue, actualValue) { + case (nil, _?): + return PredicateResult(status: .fail, message: msg.appendedBeNilHint()) + case (nil, nil), (_, nil): + return PredicateResult(status: .fail, message: msg) + case (let expected?, let actual?): + let matches = expected.elementsEqual(actual) + return PredicateResult(bool: matches, message: msg) + } + } +} diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/EndWith.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/EndWith.swift index 80a06ca..13bdb31 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/EndWith.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/EndWith.swift @@ -50,17 +50,18 @@ public func endWith(_ endingSubstring: String) -> Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func endWithMatcher(_ expected: Any) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func endWithMatcher(_ expected: Any) -> NMBMatcher { + return NMBPredicate { actualExpression in let actual = try actualExpression.evaluate() - if (actual as? String) != nil { + if actual is String { let expr = actualExpression.cast { $0 as? String } - return try endWith(expected as! String).matches(expr, failureMessage: failureMessage) + // swiftlint:disable:next force_cast + return try endWith(expected as! String).satisfies(expr).toObjectiveC() } else { let expr = actualExpression.cast { $0 as? NMBOrderedCollection } - return try endWith(expected).matches(expr, failureMessage: failureMessage) + return try endWith(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Equal.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Equal.swift index 5f26f49..b08d5f6 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Equal.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Equal.swift @@ -7,103 +7,30 @@ import Foundation public func equal(_ expectedValue: T?) -> Predicate { return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in let actualValue = try actualExpression.evaluate() - let matches = actualValue == expectedValue && expectedValue != nil - if expectedValue == nil || actualValue == nil { - if expectedValue == nil && actualValue != nil { - return PredicateResult( - status: .fail, - message: msg.appendedBeNilHint() - ) - } + switch (expectedValue, actualValue) { + case (nil, _?): + return PredicateResult(status: .fail, message: msg.appendedBeNilHint()) + case (nil, nil), (_, nil): return PredicateResult(status: .fail, message: msg) + case (let expected?, let actual?): + let matches = expected == actual + return PredicateResult(bool: matches, message: msg) } - return PredicateResult(status: PredicateStatus(bool: matches), message: msg) - } -} - -/// A Nimble matcher that succeeds when the actual value is equal to the expected value. -/// 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]?) -> Predicate<[T: C]> { - return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in - let actualValue = try actualExpression.evaluate() - if expectedValue == nil || actualValue == nil { - if expectedValue == nil && actualValue != nil { - return PredicateResult( - status: .fail, - message: msg.appendedBeNilHint() - ) - } - return PredicateResult(status: .fail, message: msg) - } - return PredicateResult( - status: PredicateStatus(bool: expectedValue! == actualValue!), - message: msg - ) - } -} - -/// A Nimble matcher that succeeds when the actual collection is equal to the expected collection. -/// Items must implement the Equatable protocol. -public func equal(_ expectedValue: [T]?) -> Predicate<[T]> { - return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in - let actualValue = try actualExpression.evaluate() - if expectedValue == nil || actualValue == nil { - if expectedValue == nil && actualValue != nil { - return PredicateResult( - status: .fail, - message: msg.appendedBeNilHint() - ) - } - return PredicateResult( - status: .fail, - message: msg - ) - } - return PredicateResult( - bool: expectedValue! == actualValue!, - message: msg - ) } } /// A Nimble matcher allowing comparison of collection with optional type public func equal(_ expectedValue: [T?]) -> Predicate<[T?]> { return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in - if let actualValue = try actualExpression.evaluate() { - let doesNotMatch = PredicateResult( - status: .doesNotMatch, - message: msg - ) - - if expectedValue.count != actualValue.count { - return doesNotMatch - } - - for (index, item) in actualValue.enumerated() { - let otherItem = expectedValue[index] - if item == nil && otherItem == nil { - continue - } else if item == nil && otherItem != nil { - return doesNotMatch - } else if item != nil && otherItem == nil { - return doesNotMatch - } else if item! != otherItem! { - return doesNotMatch - } - } - - return PredicateResult( - status: .matches, - message: msg - ) - } else { + guard let actualValue = try actualExpression.evaluate() else { return PredicateResult( status: .fail, message: msg.appendedBeNilHint() ) } + + let matches = expectedValue == actualValue + return PredicateResult(bool: matches, message: msg) } } @@ -128,44 +55,45 @@ private func equal(_ expectedValue: Set?, stringify: @escaping (Set?) - var errorMessage: ExpectationMessage = .expectedActualValueTo("equal <\(stringify(expectedValue))>") - if let expectedValue = expectedValue { - if let actualValue = try actualExpression.evaluate() { - errorMessage = .expectedCustomValueTo( - "equal <\(stringify(expectedValue))>", - "<\(stringify(actualValue))>" - ) - - if expectedValue == actualValue { - return PredicateResult( - status: .matches, - message: errorMessage - ) - } - - let missing = expectedValue.subtracting(actualValue) - if missing.count > 0 { - errorMessage = errorMessage.appended(message: ", missing <\(stringify(missing))>") - } - - let extra = actualValue.subtracting(expectedValue) - if extra.count > 0 { - errorMessage = errorMessage.appended(message: ", extra <\(stringify(extra))>") - } - return PredicateResult( - status: .doesNotMatch, - message: errorMessage - ) - } - return PredicateResult( - status: .fail, - message: errorMessage.appendedBeNilHint() - ) - } else { + guard let expectedValue = expectedValue else { return PredicateResult( status: .fail, message: errorMessage.appendedBeNilHint() ) } + + guard let actualValue = try actualExpression.evaluate() else { + return PredicateResult( + status: .fail, + message: errorMessage.appendedBeNilHint() + ) + } + + errorMessage = .expectedCustomValueTo( + "equal <\(stringify(expectedValue))>", + "<\(stringify(actualValue))>" + ) + + if expectedValue == actualValue { + return PredicateResult( + status: .matches, + message: errorMessage + ) + } + + let missing = expectedValue.subtracting(actualValue) + if missing.count > 0 { + errorMessage = errorMessage.appended(message: ", missing <\(stringify(missing))>") + } + + let extra = actualValue.subtracting(expectedValue) + if extra.count > 0 { + errorMessage = errorMessage.appended(message: ", extra <\(stringify(extra))>") + } + return PredicateResult( + status: .doesNotMatch, + message: errorMessage + ) } } @@ -209,7 +137,7 @@ public func !=(lhs: Expectation<[T: C]>, rhs: [T: C]?) { lhs.toNot(equal(rhs)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func equalMatcher(_ expected: NSObject) -> NMBMatcher { return NMBPredicate { actualExpression in diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/HaveCount.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/HaveCount.swift index 3529da8..984e2d4 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/HaveCount.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/HaveCount.swift @@ -7,7 +7,7 @@ import Foundation /// A Nimble matcher that succeeds when the actual Collection's count equals /// the expected value -public func haveCount(_ expectedValue: T.IndexDistance) -> Predicate { +public func haveCount(_ expectedValue: Int) -> Predicate { return Predicate.define { actualExpression in if let actualValue = try actualExpression.evaluate() { let message = ExpectationMessage @@ -45,20 +45,29 @@ public func haveCount(_ expectedValue: Int) -> Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func haveCountMatcher(_ expected: NSNumber) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func haveCountMatcher(_ expected: NSNumber) -> NMBMatcher { + return NMBPredicate { actualExpression in let location = actualExpression.location let actualValue = try actualExpression.evaluate() if let value = actualValue as? NMBCollection { let expr = Expression(expression: ({ value as NMBCollection}), location: location) - return try haveCount(expected.intValue).matches(expr, failureMessage: failureMessage) - } else if let actualValue = actualValue { - failureMessage.postfixMessage = "get type of NSArray, NSSet, NSDictionary, or NSHashTable" - failureMessage.actualValue = "\(String(describing: type(of: actualValue)))" + return try haveCount(expected.intValue).satisfies(expr).toObjectiveC() } - return false + + let message: ExpectationMessage + if let actualValue = actualValue { + message = ExpectationMessage.expectedCustomValueTo( + "get type of NSArray, NSSet, NSDictionary, or NSHashTable", + "\(String(describing: type(of: actualValue)))" + ) + } else { + message = ExpectationMessage + .expectedActualValueTo("have a collection with count \(stringify(expected.intValue))") + .appendedBeNilHint() + } + return NMBPredicateResult(status: .fail, message: message.toObjectiveC()) } } } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Match.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Match.swift index f738daf..dbcff09 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Match.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Match.swift @@ -15,7 +15,7 @@ public func match(_ expectedValue: String?) -> Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func matchMatcher(_ expected: NSString) -> NMBMatcher { diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift index 6f8f103..38bb297 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift @@ -1,6 +1,6 @@ import Foundation // `CGFloat` is in Foundation (swift-corelibs-foundation) on Linux. -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) import CoreGraphics #endif @@ -28,7 +28,7 @@ extension Matcher { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) /// Objective-C interface to the Swift variant of Matcher. @objc public protocol NMBMatcher { func matches(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool @@ -41,7 +41,8 @@ public protocol NMBContainer { func contains(_ anObject: Any) -> Bool } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) +// swiftlint:disable:next todo // FIXME: NSHashTable can not conform to NMBContainer since swift-DEVELOPMENT-SNAPSHOT-2016-04-25-a //extension NSHashTable : NMBContainer {} // Corelibs Foundation does not include this class yet #endif @@ -54,7 +55,7 @@ public protocol NMBCollection { var count: Int { get } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NSHashTable: NMBCollection {} // Corelibs Foundation does not include these classes yet extension NSMapTable: NMBCollection {} #endif @@ -131,7 +132,7 @@ extension NSDate: TestOutputStringConvertible { /// beGreaterThan(), beGreaterThanOrEqualTo(), and equal() matchers. /// /// Types that conform to Swift's Comparable protocol will work implicitly too -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) @objc public protocol NMBComparable { func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult } @@ -144,11 +145,13 @@ public protocol NMBComparable { extension NSNumber: NMBComparable { public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult { + // swiftlint:disable:next force_cast return compare(otherObject as! NSNumber) } } extension NSString: NMBComparable { public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult { + // swiftlint:disable:next force_cast return compare(otherObject as! String) } } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/PostNotification.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/PostNotification.swift index 16af011..7d3e44c 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/PostNotification.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/PostNotification.swift @@ -1,36 +1,9 @@ import Foundation -// A workaround to SR-6419. -extension NotificationCenter { -#if !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) - #if swift(>=4.0) - #if swift(>=4.0.2) - #else - func addObserver(forName name: Notification.Name?, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Void) -> NSObjectProtocol { - return addObserver(forName: name, object: obj, queue: queue, usingBlock: block) - } - #endif - #elseif swift(>=3.2) - #if swift(>=3.2.2) - #else - // swiftlint:disable:next line_length - func addObserver(forName name: Notification.Name?, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Void) -> NSObjectProtocol { - return addObserver(forName: name, object: obj, queue: queue, usingBlock: block) - } - #endif - #else - // swiftlint:disable:next line_length - func addObserver(forName name: Notification.Name?, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Void) -> NSObjectProtocol { - return addObserver(forName: name, object: obj, queue: queue, usingBlock: block) - } - #endif -#endif -} - internal class NotificationCollector { private(set) var observedNotifications: [Notification] private let notificationCenter: NotificationCenter - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) private var token: AnyObject? #else private var token: NSObjectProtocol? @@ -43,14 +16,14 @@ internal class NotificationCollector { func startObserving() { // swiftlint:disable:next line_length - self.token = self.notificationCenter.addObserver(forName: nil, object: nil, queue: nil, using: { [weak self] n in + self.token = self.notificationCenter.addObserver(forName: nil, object: nil, queue: nil) { [weak self] notification in // linux-swift gets confused by .append(n) - self?.observedNotifications.append(n) - }) + self?.observedNotifications.append(notification) + } } deinit { - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) if let token = self.token { self.notificationCenter.removeObserver(token) } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Predicate.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Predicate.swift index 19fd322..2604411 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Predicate.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Predicate.swift @@ -218,6 +218,7 @@ extension Predicate: Matcher { extension Predicate { // Someday, make this public? Needs documentation internal func after(f: @escaping (Expression, PredicateResult) throws -> PredicateResult) -> Predicate { + // swiftlint:disable:previous identifier_name return Predicate { actual -> PredicateResult in let result = try self.satisfies(actual) return try f(actual, result) @@ -241,7 +242,7 @@ extension Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) public typealias PredicateBlock = (_ actualExpression: Expression) throws -> NMBPredicateResult public class NMBPredicate: NSObject { @@ -311,7 +312,7 @@ final public class NMBPredicateStatus: NSObject { public static let doesNotMatch: NMBPredicateStatus = NMBPredicateStatus(status: 1) public static let fail: NMBPredicateStatus = NMBPredicateStatus(status: 2) - public override var hashValue: Int { return self.status.hashValue } + public override var hash: Int { return self.status.hashValue } public override func isEqual(_ object: Any?) -> Bool { guard let otherPredicate = object as? NMBPredicateStatus else { diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/RaisesException.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/RaisesException.swift index 459d2cd..f44c810 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/RaisesException.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/RaisesException.swift @@ -1,7 +1,7 @@ import Foundation // This matcher requires the Objective-C, and being built by Xcode rather than the Swift Package Manager -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE /// A Nimble matcher that succeeds when the actual expression raises an /// exception with the specified name, reason, and/or userInfo. @@ -23,8 +23,12 @@ public func raiseException( exception = e }), finally: nil) - capture.tryBlock { - _ = try! actualExpression.evaluate() + do { + try capture.tryBlockThrows { + _ = try actualExpression.evaluate() + } + } catch { + return PredicateResult(status: .fail, message: .fail("unexpected error thrown: <\(error)>")) } let failureMessage = FailureMessage() @@ -118,10 +122,12 @@ internal func exceptionMatchesNonNilFieldsOrClosure( } public class NMBObjCRaiseExceptionMatcher: NSObject, NMBMatcher { + // swiftlint:disable identifier_name internal var _name: String? internal var _reason: String? internal var _userInfo: NSDictionary? internal var _block: ((NSException) -> Void)? + // swiftlint:enable identifier_name internal init(name: String?, reason: String?, userInfo: NSDictionary?, block: ((NSException) -> Void)?) { _name = name diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift index 2b9eb21..da3ea9a 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift @@ -39,7 +39,7 @@ public func && (left: Predicate, right: Predicate) -> Predicate { return satisfyAllOf(left, right) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func satisfyAllOfMatcher(_ matchers: [NMBMatcher]) -> NMBPredicate { return NMBPredicate { actualExpression in @@ -60,8 +60,12 @@ extension NMBObjCMatcher { return predicate.satisfies({ try expression.evaluate() }, location: actualExpression.location).toSwift() } else { let failureMessage = FailureMessage() - // swiftlint:disable:next line_length - let success = matcher.matches({ try! expression.evaluate() }, failureMessage: failureMessage, location: actualExpression.location) + let success = matcher.matches( + // swiftlint:disable:next force_try + { try! expression.evaluate() }, + failureMessage: failureMessage, + location: actualExpression.location + ) return PredicateResult(bool: success, message: failureMessage.toExpectationMessage()) } } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift index 57b15fd..6724956 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift @@ -47,7 +47,7 @@ public func || (left: MatcherFunc, right: MatcherFunc) -> Predicate return satisfyAnyOf(left, right) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func satisfyAnyOfMatcher(_ matchers: [NMBMatcher]) -> NMBPredicate { return NMBPredicate { actualExpression in @@ -68,8 +68,12 @@ extension NMBObjCMatcher { return predicate.satisfies({ try expression.evaluate() }, location: actualExpression.location).toSwift() } else { let failureMessage = FailureMessage() - // swiftlint:disable:next line_length - let success = matcher.matches({ try! expression.evaluate() }, failureMessage: failureMessage, location: actualExpression.location) + let success = matcher.matches( + // swiftlint:disable:next force_try + { try! expression.evaluate() }, + failureMessage: failureMessage, + location: actualExpression.location + ) return PredicateResult(bool: success, message: failureMessage.toExpectationMessage()) } } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift index 035c744..53d9191 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift @@ -2,7 +2,7 @@ import Foundation public func throwAssertion() -> Predicate { return Predicate { actualExpression in - #if arch(x86_64) && (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE + #if arch(x86_64) && canImport(Darwin) && !SWIFT_PACKAGE let message = ExpectationMessage.expectedTo("throw an assertion") var actualError: Error? @@ -44,9 +44,8 @@ public func throwAssertion() -> Predicate { " conditional statement") #else fatalError("The throwAssertion Nimble matcher can only run on x86_64 platforms with " + - "Objective-C (e.g. Mac, iPhone 5s or later simulators). You can silence this error " + - "by placing the test case inside an #if arch(x86_64) or (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) conditional statement") - // swiftlint:disable:previous line_length + "Objective-C (e.g. macOS, iPhone 5s or later simulators). You can silence this error " + + "by placing the test case inside an #if arch(x86_64) or canImport(Darwin) conditional statement") #endif } } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Await.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Await.swift index ad7a6eb..276f618 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Await.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Await.swift @@ -2,7 +2,7 @@ import CoreFoundation import Dispatch import Foundation -#if !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) +#if canImport(CDispatch) import CDispatch #endif @@ -32,7 +32,7 @@ internal class AssertionWaitLock: WaitLock { func acquireWaitingLock(_ fnName: String, file: FileString, line: UInt) { let info = WaitingInfo(name: fnName, file: file, lineNumber: line) - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) let isMainThread = Thread.isMainThread #else let isMainThread = _CFIsMainThread() @@ -45,10 +45,15 @@ internal class AssertionWaitLock: WaitLock { nimblePrecondition( currentWaiter == nil, "InvalidNimbleAPIUsage", - "Nested async expectations are not allowed to avoid creating flaky tests.\n\n" + - "The call to\n\t\(info)\n" + - "triggered this exception because\n\t\(currentWaiter!)\n" + - "is currently managing the main run loop." + """ + Nested async expectations are not allowed to avoid creating flaky tests. + + The call to + \t\(info) + triggered this exception because + \t\(currentWaiter!) + is currently managing the main run loop. + """ ) currentWaiter = info } @@ -180,25 +185,18 @@ internal class AwaitPromiseBuilder { // checked. // // In addition, stopping the run loop is used to halt code executed on the main run loop. - #if swift(>=4.0) trigger.timeoutSource.schedule( deadline: DispatchTime.now() + timeoutInterval, repeating: .never, leeway: timeoutLeeway ) - #else - trigger.timeoutSource.scheduleOneshot( - deadline: DispatchTime.now() + timeoutInterval, - leeway: timeoutLeeway - ) - #endif trigger.timeoutSource.setEventHandler { guard self.promise.asyncResult.isIncomplete() else { return } let timedOutSem = DispatchSemaphore(value: 0) let semTimedOutOrBlocked = DispatchSemaphore(value: 0) semTimedOutOrBlocked.signal() let runLoop = CFRunLoopGetMain() - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) let runLoopMode = CFRunLoopMode.defaultMode.rawValue #else let runLoopMode = kCFRunLoopDefaultMode @@ -263,7 +261,7 @@ internal class AwaitPromiseBuilder { self.trigger.timeoutSource.resume() while self.promise.asyncResult.isIncomplete() { // Stopping the run loop does not work unless we run only 1 mode - #if swift(>=4.2) && (os(macOS) || os(iOS) || os(tvOS)) + #if (swift(>=4.2) && canImport(Darwin)) || compiler(>=5.0) _ = RunLoop.current.run(mode: .default, before: .distantFuture) #else _ = RunLoop.current.run(mode: .defaultRunLoopMode, before: .distantFuture) @@ -333,11 +331,7 @@ internal class Awaiter { let asyncSource = createTimerSource(asyncQueue) let trigger = AwaitTrigger(timeoutSource: timeoutSource, actionSource: asyncSource) { let interval = DispatchTimeInterval.nanoseconds(Int(pollInterval * TimeInterval(NSEC_PER_SEC))) - #if swift(>=4.0) asyncSource.schedule(deadline: .now(), repeating: interval, leeway: pollLeeway) - #else - asyncSource.scheduleRepeating(deadline: .now(), interval: interval, leeway: pollLeeway) - #endif asyncSource.setEventHandler { do { if let result = try closure() { diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Functional.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Functional.swift index 6c5126a..c87af76 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Functional.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Functional.swift @@ -1,12 +1,14 @@ import Foundation +#if !swift(>=4.2) extension Sequence { - internal func all(_ fn: (Iterator.Element) -> Bool) -> Bool { + internal func allSatisfy(_ predicate: (Element) throws -> Bool) rethrows -> Bool { for item in self { - if !fn(item) { + if try !predicate(item) { return false } } return true } } +#endif diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Stringers.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Stringers.swift index ce21eea..4ab18d2 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Stringers.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Stringers.swift @@ -2,20 +2,8 @@ import Foundation internal func identityAsString(_ value: Any?) -> String { let anyObject: AnyObject? -#if os(Linux) - #if swift(>=4.0) - #if !swift(>=4.1.50) - anyObject = value as? AnyObject - #else - anyObject = value as AnyObject? - #endif - #else - #if !swift(>=3.4) - anyObject = value as? AnyObject - #else - anyObject = value as AnyObject? - #endif - #endif +#if os(Linux) && !swift(>=4.1.50) + anyObject = value as? AnyObject #else anyObject = value as AnyObject? #endif @@ -134,6 +122,7 @@ extension String: TestOutputStringConvertible { extension Data: TestOutputStringConvertible { public var testDescription: String { #if os(Linux) + // swiftlint:disable:next todo // FIXME: Swift on Linux triggers a segfault when calling NSData's hash() (last checked on 03-11-16) return "Data" #else @@ -170,7 +159,7 @@ public func stringify(_ value: T?) -> String { return String(describing: value) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) @objc public class NMBStringer: NSObject { @objc public class func stringify(_ obj: Any?) -> String { return Nimble.stringify(obj) diff --git a/Carthage/Checkouts/Nimble/Tests/LinuxMain.swift b/Carthage/Checkouts/Nimble/Tests/LinuxMain.swift index 16c6953..ee03ebd 100644 --- a/Carthage/Checkouts/Nimble/Tests/LinuxMain.swift +++ b/Carthage/Checkouts/Nimble/Tests/LinuxMain.swift @@ -1,37 +1,8 @@ import XCTest -@testable import NimbleTests -// This is the entry point for NimbleTests on Linux +import NimbleTests -XCTMain([ - testCase(AsyncTest.allTests), - testCase(SynchronousTest.allTests), - testCase(UserDescriptionTest.allTests), +var tests = [XCTestCaseEntry]() +tests += NimbleTests.__allTests() - // Matchers - testCase(AllPassTest.allTests), - testCase(BeAKindOfSwiftTest.allTests), - testCase(BeAnInstanceOfTest.allTests), - testCase(BeCloseToTest.allTests), - testCase(BeginWithTest.allTests), - testCase(BeGreaterThanOrEqualToTest.allTests), - testCase(BeGreaterThanTest.allTests), - testCase(BeIdenticalToObjectTest.allTests), - testCase(BeIdenticalToTest.allTests), - testCase(BeLessThanOrEqualToTest.allTests), - testCase(BeLessThanTest.allTests), - testCase(BeTruthyTest.allTests), - testCase(BeTrueTest.allTests), - testCase(BeFalsyTest.allTests), - testCase(BeFalseTest.allTests), - testCase(BeNilTest.allTests), - testCase(ContainTest.allTests), - testCase(EndWithTest.allTests), - testCase(EqualTest.allTests), - testCase(HaveCountTest.allTests), - testCase(MatchTest.allTests), - // testCase(RaisesExceptionTest.allTests), - testCase(ThrowErrorTest.allTests), - testCase(SatisfyAnyOfTest.allTests), - testCase(PostNotificationTest.allTests), -]) +XCTMain(tests) diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/AsynchronousTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/AsynchronousTest.swift index c44b9e6..bfa34c2 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/AsynchronousTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/AsynchronousTest.swift @@ -4,25 +4,6 @@ import XCTest import Nimble final class AsyncTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (AsyncTest) -> () throws -> Void)] { - return [ - ("testToEventuallyPositiveMatches", testToEventuallyPositiveMatches), - ("testToEventuallyNegativeMatches", testToEventuallyNegativeMatches), - ("testWaitUntilWithCustomDefaultsTimeout", testWaitUntilWithCustomDefaultsTimeout), - ("testWaitUntilPositiveMatches", testWaitUntilPositiveMatches), - ("testToEventuallyWithCustomDefaultTimeout", testToEventuallyWithCustomDefaultTimeout), - ("testWaitUntilTimesOutIfNotCalled", testWaitUntilTimesOutIfNotCalled), - ("testWaitUntilTimesOutWhenExceedingItsTime", testWaitUntilTimesOutWhenExceedingItsTime), - ("testWaitUntilNegativeMatches", testWaitUntilNegativeMatches), - ("testWaitUntilDetectsStalledMainThreadActivity", testWaitUntilDetectsStalledMainThreadActivity), - ("testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed", testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed), - ("testWaitUntilErrorsIfDoneIsCalledMultipleTimes", testWaitUntilErrorsIfDoneIsCalledMultipleTimes), - ("testWaitUntilMustBeInMainThread", testWaitUntilMustBeInMainThread), - ("testToEventuallyMustBeInMainThread", testToEventuallyMustBeInMainThread), - ("testSubjectUnderTestIsReleasedFromMemory", testSubjectUnderTestIsReleasedFromMemory), - ] - } - class Error: Swift.Error {} let errorToThrow = Error() @@ -70,20 +51,12 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { var asyncOperation: () -> Void = { sleepThenSetValueTo(1) } - if #available(OSX 10.10, *) { - DispatchQueue.global().async(execute: asyncOperation) - } else { - DispatchQueue.global(priority: .default).async(execute: asyncOperation) - } + DispatchQueue.global().async(execute: asyncOperation) expect { value }.toEventually(equal(1)) asyncOperation = { sleepThenSetValueTo(0) } - if #available(OSX 10.10, *) { - DispatchQueue.global().async(execute: asyncOperation) - } else { - DispatchQueue.global(priority: .default).async(execute: asyncOperation) - } + DispatchQueue.global().async(execute: asyncOperation) expect { value }.toEventuallyNot(equal(1)) } @@ -124,11 +97,7 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { done() waiting = false } - if #available(OSX 10.10, *) { - DispatchQueue.global().async(execute: asyncOperation) - } else { - DispatchQueue.global(priority: .default).async(execute: asyncOperation) - } + DispatchQueue.global().async(execute: asyncOperation) } } @@ -161,15 +130,16 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { func testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed() { // Currently we are unable to catch Objective-C exceptions when built by the Swift Package Manager #if !SWIFT_PACKAGE - let referenceLine = #line + 9 - var msg = "Unexpected exception raised: Nested async expectations are not allowed " - msg += "to avoid creating flaky tests." - msg += "\n\n" - msg += "The call to\n\t" - msg += "expect(...).toEventually(...) at \(#file):\(referenceLine + 7)\n" - msg += "triggered this exception because\n\t" - msg += "waitUntil(...) at \(#file):\(referenceLine + 1)\n" - msg += "is currently managing the main run loop." + let referenceLine = #line + 10 + let msg = """ + Unexpected exception raised: Nested async expectations are not allowed to avoid creating flaky tests. + + The call to + \texpect(...).toEventually(...) at \(#file):\(referenceLine + 7) + triggered this exception because + \twaitUntil(...) at \(#file):\(referenceLine + 1) + is currently managing the main run loop. + """ failsWithErrorMessage(msg) { // reference line waitUntil(timeout: 2.0) { done in var protected: Int = 0 @@ -204,11 +174,7 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { }.to(raiseException(named: "InvalidNimbleAPIUsage")) executedAsyncBlock = true } - if #available(OSX 10.10, *) { - DispatchQueue.global().async(execute: asyncOperation) - } else { - DispatchQueue.global(priority: .default).async(execute: asyncOperation) - } + DispatchQueue.global().async(execute: asyncOperation) expect(executedAsyncBlock).toEventually(beTruthy()) #endif } @@ -222,11 +188,7 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { }.to(raiseException(named: "InvalidNimbleAPIUsage")) executedAsyncBlock = true } - if #available(OSX 10.10, *) { - DispatchQueue.global().async(execute: asyncOperation) - } else { - DispatchQueue.global(priority: .default).async(execute: asyncOperation) - } + DispatchQueue.global().async(execute: asyncOperation) expect(executedAsyncBlock).toEventually(beTruthy()) #endif } diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Helpers/XCTestCaseProvider.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Helpers/XCTestCaseProvider.swift index 08a67c6..08567fd 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Helpers/XCTestCaseProvider.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Helpers/XCTestCaseProvider.swift @@ -4,7 +4,7 @@ import XCTest // XCTestCaseProvider should be adopted by all XCTestCase subclasses. It provides a // mechanism for us to fail tests in Xcode which haven't been included in the `allTests` // list for swift-corelibs-xctest which is unable to dynamically discover tests. Note -// that only `static var allTests` needs to be explicitly implemented, as `allTestNames` +// that only `static var __allTests` needs to be explicitly implemented, as `allTestNames` // has a default implementation provided by a protocol extension. // Implementation note: This is broken down into two separate protocols because we need a @@ -12,7 +12,7 @@ import XCTest public protocol XCTestCaseProviderStatic { // This should be explicitly implemented by XCTestCase subclasses - static var allTests: [(String, (Self) -> () throws -> Void)] { get } + static var __allTests: [(String, (Self) -> () -> ())] { get } } public protocol XCTestCaseNameProvider { @@ -20,17 +20,21 @@ public protocol XCTestCaseNameProvider { var allTestNames: [String] { get } } +#if os(macOS) public protocol XCTestCaseProvider: XCTestCaseProviderStatic, XCTestCaseNameProvider {} extension XCTestCaseProvider { var allTestNames: [String] { - return type(of: self).allTests.map({ name, _ in + return type(of: self).__allTests.map({ name, _ in return name }) } } +#else +public protocol XCTestCaseProvider {} +#endif -#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS) +#if os(macOS) extension XCTestCase { override open func tearDown() { @@ -45,7 +49,13 @@ extension XCTestCase { extension XCTestCaseNameProvider { fileprivate func assertContainsTest(_ name: String) { let contains = self.allTestNames.contains(name) - XCTAssert(contains, "Test '\(name)' is missing from the allTests array") + XCTAssert( + contains, + """ + Test '\(name)' is missing from the __allTests array. + Please run `$ swift test --generate-linuxmain` to update the manifests. + """ + ) } } diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Helpers/utils.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Helpers/utils.swift index 8c042d7..c90b72a 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Helpers/utils.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Helpers/utils.swift @@ -8,7 +8,7 @@ func failsWithErrorMessage(_ messages: [String], file: FileString = #file, line: var lineNumber = line let recorder = AssertionRecorder() - withAssertionHandler(recorder, closure: closure) + withAssertionHandler(recorder, file: file, line: line, closure: closure) for msg in messages { var lastFailure: AssertionRecord? @@ -37,7 +37,12 @@ func failsWithErrorMessage(_ messages: [String], file: FileString = #file, line: } else { let knownFailures = recorder.assertions.filter { !$0.success }.map { $0.message.stringValue } let knownFailuresJoined = knownFailures.joined(separator: ", ") - message = "Expected error message (\(msg)), got (\(knownFailuresJoined))\n\nAssertions Received:\n\(recorder.assertions)" + message = """ + Expected error message (\(msg)), got (\(knownFailuresJoined)) + + Assertions Received: + \(recorder.assertions) + """ } NimbleAssertionHandler.assert(false, message: FailureMessage(stringValue: message), diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/AllPassTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/AllPassTest.swift index 2050881..683121c 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/AllPassTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/AllPassTest.swift @@ -43,17 +43,6 @@ extension Optional where Wrapped: Comparable { } final class AllPassTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (AllPassTest) -> () throws -> Void)] { - return [ - ("testAllPassArray", testAllPassArray), - ("testAllPassMatcher", testAllPassMatcher), - ("testAllPassCollectionsWithOptionalsDontWork", testAllPassCollectionsWithOptionalsDontWork), - ("testAllPassCollectionsWithOptionalsUnwrappingOneOptionalLayer", testAllPassCollectionsWithOptionalsUnwrappingOneOptionalLayer), - ("testAllPassSet", testAllPassSet), - ("testAllPassWithNilAsExpectedValue", testAllPassWithNilAsExpectedValue), - ] - } - func testAllPassArray() { expect([1, 2, 3, 4]).to(allPass({$0 < 5})) expect([1, 2, 3, 4]).toNot(allPass({$0 > 5})) diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift index bb9041b..64a439b 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift @@ -8,13 +8,6 @@ private class TestClassConformingToProtocol: TestProtocol {} private struct TestStructConformingToProtocol: TestProtocol {} final class BeAKindOfSwiftTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeAKindOfSwiftTest) -> () throws -> Void)] { - return [ - ("testPositiveMatch", testPositiveMatch), - ("testFailureMessages", testFailureMessages), - ] - } - enum TestEnum { case one, two } @@ -54,23 +47,17 @@ final class BeAKindOfSwiftTest: XCTestCase, XCTestCaseProvider { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - final class BeAKindOfObjCTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeAKindOfObjCTest) -> () throws -> Void)] { - return [ - ("testPositiveMatch", testPositiveMatch), - ("testFailureMessages", testFailureMessages), - ] - } - func testPositiveMatch() { +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) expect(TestNull()).to(beAKindOf(NSNull.self)) expect(NSObject()).to(beAKindOf(NSObject.self)) expect(NSNumber(value: 1)).toNot(beAKindOf(NSDate.self)) +#endif } func testFailureMessages() { +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) failsWithErrorMessageForNil("expected to not be a kind of NSNull, got ") { expect(nil as NSNull?).toNot(beAKindOf(NSNull.self)) } @@ -83,7 +70,6 @@ final class BeAKindOfObjCTest: XCTestCase, XCTestCaseProvider { failsWithErrorMessage("expected to not be a kind of NSNumber, got <__NSCFNumber instance>") { expect(NSNumber(value: 1)).toNot(beAKindOf(NSNumber.self)) } +#endif } } - -#endif diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift index aeea28a..df431e6 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift @@ -7,15 +7,6 @@ private class TestClassConformingToProtocol: TestProtocol {} private struct TestStructConformingToProtocol: TestProtocol {} final class BeAnInstanceOfTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeAnInstanceOfTest) -> () throws -> Void)] { - return [ - ("testPositiveMatch", testPositiveMatch), - ("testPositiveMatchSwiftTypes", testPositiveMatchSwiftTypes), - ("testFailureMessages", testFailureMessages), - ("testFailureMessagesSwiftTypes", testFailureMessagesSwiftTypes), - ] - } - func testPositiveMatch() { expect(NSNull()).to(beAnInstanceOf(NSNull.self)) expect(NSNumber(value: 1)).toNot(beAnInstanceOf(NSDate.self)) diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeCloseToTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeCloseToTest.swift index cb7a3ec..f724be6 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeCloseToTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeCloseToTest.swift @@ -3,24 +3,6 @@ import XCTest import Nimble final class BeCloseToTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeCloseToTest) -> () throws -> Void)] { - return [ - ("testBeCloseTo", testBeCloseTo), - ("testBeCloseToWithin", testBeCloseToWithin), - ("testBeCloseToWithNSNumber", testBeCloseToWithNSNumber), - ("testBeCloseToWithDate", testBeCloseToWithDate), - ("testBeCloseToWithNSDate", testBeCloseToWithNSDate), - ("testBeCloseToOperator", testBeCloseToOperator), - ("testBeCloseToWithinOperator", testBeCloseToWithinOperator), - ("testPlusMinusOperator", testPlusMinusOperator), - ("testBeCloseToOperatorWithDate", testBeCloseToOperatorWithDate), - ("testBeCloseToWithinOperatorWithDate", testBeCloseToWithinOperatorWithDate), - ("testPlusMinusOperatorWithDate", testPlusMinusOperatorWithDate), - ("testBeCloseToArray", testBeCloseToArray), - ("testBeCloseToWithCGFloat", testBeCloseToWithCGFloat), - ] - } - func testBeCloseTo() { expect(1.2).to(beCloseTo(1.2001)) expect(1.2 as CDouble).to(beCloseTo(1.2001)) @@ -34,8 +16,8 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { func testBeCloseToWithin() { expect(1.2).to(beCloseTo(9.300, within: 10)) - failsWithErrorMessage("expected to not be close to <1.2001> (within 1), got <1.2>") { - expect(1.2).toNot(beCloseTo(1.2001, within: 1.0)) + failsWithErrorMessage("expected to not be close to <1.2001> (within 1.1), got <1.2>") { + expect(1.2).toNot(beCloseTo(1.2001, within: 1.1)) } } @@ -44,8 +26,8 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect(NSNumber(value: 1.2)).to(beCloseTo(NSNumber(value: 9.300), within: 10)) expect(1.2).to(beCloseTo(NSNumber(value: 9.300), within: 10)) - failsWithErrorMessage("expected to not be close to <1.2001> (within 1), got <1.2>") { - expect(NSNumber(value: 1.2)).toNot(beCloseTo(1.2001, within: 1.0)) + failsWithErrorMessage("expected to not be close to <1.2001> (within 1.1), got <1.2>") { + expect(NSNumber(value: 1.2)).toNot(beCloseTo(1.2001, within: 1.1)) } } @@ -53,8 +35,8 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect(CGFloat(1.2)).to(beCloseTo(1.2001)) expect(CGFloat(1.2)).to(beCloseTo(CGFloat(1.2001))) - failsWithErrorMessage("expected to not be close to <1.2001> (within 1), got <1.2>") { - expect(CGFloat(1.2)).toNot(beCloseTo(1.2001, within: 1.0)) + failsWithErrorMessage("expected to not be close to <1.2001> (within 1.1), got <1.2>") { + expect(CGFloat(1.2)).toNot(beCloseTo(1.2001, within: 1.1)) } } @@ -89,11 +71,11 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect(1.2) ≈ (9.300, 10) expect(1.2) == (9.300, 10) - failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") { - expect(1.2) ≈ (1.0, 0.1) + failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") { + expect(1.3) ≈ (1.1, 0.1) } - failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") { - expect(1.2) == (1.0, 0.1) + failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") { + expect(1.3) == (1.1, 0.1) } } @@ -101,11 +83,11 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect(1.2) ≈ 9.300 ± 10 expect(1.2) == 9.300 ± 10 - failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") { - expect(1.2) ≈ 1.0 ± 0.1 + failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") { + expect(1.3) ≈ 1.1 ± 0.1 } - failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") { - expect(1.2) == 1.0 ± 0.1 + failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") { + expect(1.3) == 1.1 ± 0.1 } } @@ -150,11 +132,11 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect([0.0, 1.1, 2.2]) ≈ [0.0001, 1.1001, 2.2001] expect([0.0, 1.1, 2.2]).to(beCloseTo([0.1, 1.2, 2.3], within: 0.1)) - failsWithErrorMessage("expected to be close to <[0, 1]> (each within 0.0001), got <[0, 1.1]>") { - expect([0.0, 1.1]) ≈ [0.0, 1.0] + failsWithErrorMessage("expected to be close to <[0.1, 1.1]> (each within 0.0001), got <[0.1, 1.2]>") { + expect([0.1, 1.2]) ≈ [0.1, 1.1] } - failsWithErrorMessage("expected to be close to <[0.2, 1.2]> (each within 0.1), got <[0, 1.1]>") { - expect([0.0, 1.1]).to(beCloseTo([0.2, 1.2], within: 0.1)) + failsWithErrorMessage("expected to be close to <[0.3, 1.3]> (each within 0.1), got <[0.1, 1.2]>") { + expect([0.1, 1.2]).to(beCloseTo([0.3, 1.3], within: 0.1)) } } } diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift index 067ddeb..aa0300f 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeEmptyTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeEmptyTest) -> () throws -> Void)] { - return [ - ("testBeEmptyPositive", testBeEmptyPositive), - ("testBeEmptyNegative", testBeEmptyNegative), - ] - } - func testBeEmptyPositive() { expect([] as [Int]).to(beEmpty()) expect([1]).toNot(beEmpty()) @@ -17,6 +10,9 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect([] as [CInt]).to(beEmpty()) expect([1] as [CInt]).toNot(beEmpty()) + expect([] as Set).to(beEmpty()) + expect([1] as Set).toNot(beEmpty()) + #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) expect(NSDictionary() as? [Int: Int]).to(beEmpty()) expect(NSDictionary(object: 1, forKey: 1 as NSNumber) as? [Int: Int]).toNot(beEmpty()) @@ -41,16 +37,12 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect("").to(beEmpty()) expect("foo").toNot(beEmpty()) + + expect([] as TestOptionSet).to(beEmpty()) + expect(TestOptionSet.one).toNot(beEmpty()) } func testBeEmptyNegative() { - failsWithErrorMessageForNil("expected to be empty, got ") { - expect(nil as NSString?).to(beEmpty()) - } - failsWithErrorMessageForNil("expected to not be empty, got ") { - expect(nil as [CInt]?).toNot(beEmpty()) - } - failsWithErrorMessage("expected to not be empty, got <()>") { expect(NSArray()).toNot(beEmpty()) } @@ -58,12 +50,21 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect([1]).to(beEmpty()) } + failsWithErrorMessage("expected to not be empty, got ") { + expect([] as Set).toNot(beEmpty()) + } + failsWithErrorMessage("expected to be empty, got ") { + expect([1] as Set).to(beEmpty()) + } + +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) failsWithErrorMessage("expected to not be empty, got <{()}>") { expect(NSSet()).toNot(beEmpty()) } failsWithErrorMessage("expected to be empty, got <{(1)}>") { expect(NSSet(object: NSNumber(value: 1))).to(beEmpty()) } +#endif failsWithErrorMessage("expected to not be empty, got <()>") { expect(NSIndexSet()).toNot(beEmpty()) @@ -78,5 +79,56 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { failsWithErrorMessage("expected to be empty, got ") { expect("foo").to(beEmpty()) } + + failsWithErrorMessage("expected to not be empty, got ") { + expect([] as TestOptionSet).toNot(beEmpty()) + } + failsWithErrorMessage("expected to be empty, got ") { + expect(TestOptionSet.one).to(beEmpty()) + } + } + + func testNilMatches() { + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as NSString?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as NSString?).toNot(beEmpty()) + } + + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as [CInt]?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as [CInt]?).toNot(beEmpty()) + } + + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as Set?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as Set?).toNot(beEmpty()) + } + + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as TestOptionSet?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as TestOptionSet?).toNot(beEmpty()) + } + } +} + +private struct TestOptionSet: OptionSet, CustomStringConvertible { + let rawValue: Int + + static let one = TestOptionSet(rawValue: 1 << 0) + + init(rawValue: Int) { + self.rawValue = rawValue + } + + var description: String { + return "TestOptionSet(rawValue: \(rawValue))" } } diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift index bd73361..4c91fec 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeGreaterThanOrEqualToTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeGreaterThanOrEqualToTest) -> () throws -> Void)] { - return [ - ("testGreaterThanOrEqualTo", testGreaterThanOrEqualTo), - ("testGreaterThanOrEqualToOperator", testGreaterThanOrEqualToOperator), - ] - } - func testGreaterThanOrEqualTo() { expect(10).to(beGreaterThanOrEqualTo(10)) expect(10).to(beGreaterThanOrEqualTo(2)) diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanTest.swift index 9c33e4b..3d742f4 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeGreaterThanTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeGreaterThanTest) -> () throws -> Void)] { - return [ - ("testGreaterThan", testGreaterThan), - ("testGreaterThanOperator", testGreaterThanOperator), - ] - } - func testGreaterThan() { expect(10).to(beGreaterThan(2)) expect(1).toNot(beGreaterThan(2)) diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToObjectTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToObjectTest.swift index 923fa76..b1155fb 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToObjectTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToObjectTest.swift @@ -3,17 +3,6 @@ import XCTest import Nimble final class BeIdenticalToObjectTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeIdenticalToObjectTest) -> () throws -> Void)] { - return [ - ("testBeIdenticalToPositive", testBeIdenticalToPositive), - ("testBeIdenticalToNegative", testBeIdenticalToNegative), - ("testBeIdenticalToPositiveMessage", testBeIdenticalToPositiveMessage), - ("testBeIdenticalToNegativeMessage", testBeIdenticalToNegativeMessage), - ("testFailsOnNils", testFailsOnNils), - ("testOperators", testOperators), - ] - } - private class BeIdenticalToObjectTester {} private let testObjectA = BeIdenticalToObjectTester() private let testObjectB = BeIdenticalToObjectTester() diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift index 6b629b0..8830647 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift @@ -3,17 +3,6 @@ import XCTest @testable import Nimble final class BeIdenticalToTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeIdenticalToTest) -> () throws -> Void)] { - return [ - ("testBeIdenticalToPositive", testBeIdenticalToPositive), - ("testBeIdenticalToNegative", testBeIdenticalToNegative), - ("testBeIdenticalToPositiveMessage", testBeIdenticalToPositiveMessage), - ("testBeIdenticalToNegativeMessage", testBeIdenticalToNegativeMessage), - ("testOperators", testOperators), - ("testBeAlias", testBeAlias), - ] - } - func testBeIdenticalToPositive() { let value = NSDate() expect(value).to(beIdenticalTo(value)) diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift index 428ace4..f389469 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeLessThanOrEqualToTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeLessThanOrEqualToTest) -> () throws -> Void)] { - return [ - ("testLessThanOrEqualTo", testLessThanOrEqualTo), - ("testLessThanOrEqualToOperator", testLessThanOrEqualToOperator), - ] - } - func testLessThanOrEqualTo() { expect(10).to(beLessThanOrEqualTo(10)) expect(2).to(beLessThanOrEqualTo(10)) diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLessThanTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLessThanTest.swift index 90ba1b9..d560232 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLessThanTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLessThanTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeLessThanTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeLessThanTest) -> () throws -> Void)] { - return [ - ("testLessThan", testLessThan), - ("testLessThanOperator", testLessThanOperator), - ] - } - func testLessThan() { expect(2).to(beLessThan(10)) expect(2).toNot(beLessThan(1)) diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLogicalTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLogicalTest.swift index 947a1b4..d9ef8ea 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLogicalTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLogicalTest.swift @@ -30,18 +30,6 @@ enum ConvertsToBool: ExpressibleByBooleanLiteral, CustomStringConvertible { } final class BeTruthyTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeTruthyTest) -> () throws -> Void)] { - return [ - ("testShouldMatchNonNilTypes", testShouldMatchNonNilTypes), - ("testShouldMatchTrue", testShouldMatchTrue), - ("testShouldNotMatchNilTypes", testShouldNotMatchNilTypes), - ("testShouldNotMatchFalse", testShouldNotMatchFalse), - ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), - ("testShouldMatchBoolConvertibleTypesThatConvertToTrue", testShouldMatchBoolConvertibleTypesThatConvertToTrue), - ("testShouldNotMatchBoolConvertibleTypesThatConvertToFalse", testShouldNotMatchBoolConvertibleTypesThatConvertToFalse), - ] - } - func testShouldMatchNonNilTypes() { expect(true as Bool?).to(beTruthy()) @@ -123,14 +111,6 @@ final class BeTruthyTest: XCTestCase, XCTestCaseProvider { } final class BeTrueTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeTrueTest) -> () throws -> Void)] { - return [ - ("testShouldMatchTrue", testShouldMatchTrue), - ("testShouldNotMatchFalse", testShouldNotMatchFalse), - ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), - ] - } - func testShouldMatchTrue() { expect(true).to(beTrue()) @@ -159,16 +139,6 @@ final class BeTrueTest: XCTestCase, XCTestCaseProvider { } final class BeFalsyTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeFalsyTest) -> () throws -> Void)] { - return [ - ("testShouldMatchNilTypes", testShouldMatchNilTypes), - ("testShouldNotMatchTrue", testShouldNotMatchTrue), - ("testShouldNotMatchNonNilTypes", testShouldNotMatchNonNilTypes), - ("testShouldMatchFalse", testShouldMatchFalse), - ("testShouldMatchNilBools", testShouldMatchNilBools), - ] - } - func testShouldMatchNilTypes() { expect(false as Bool?).to(beFalsy()) @@ -234,14 +204,6 @@ final class BeFalsyTest: XCTestCase, XCTestCaseProvider { } final class BeFalseTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeFalseTest) -> () throws -> Void)] { - return [ - ("testShouldNotMatchTrue", testShouldNotMatchTrue), - ("testShouldMatchFalse", testShouldMatchFalse), - ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), - ] - } - func testShouldNotMatchTrue() { expect(true).toNot(beFalse()) diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeNilTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeNilTest.swift index 69f4185..9e37116 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeNilTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeNilTest.swift @@ -2,12 +2,6 @@ import XCTest import Nimble final class BeNilTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeNilTest) -> () throws -> Void)] { - return [ - ("testBeNil", testBeNil), - ] - } - func producesNil() -> [Int]? { return nil } diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeVoidTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeVoidTest.swift index a8eefc1..bb5d324 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeVoidTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeVoidTest.swift @@ -2,12 +2,6 @@ import XCTest import Nimble final class BeVoidTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeVoidTest) -> () throws -> Void)] { - return [ - ("testBeVoid", testBeVoid), - ] - } - func testBeVoid() { expect(()).to(beVoid()) expect(() as ()?).to(beVoid()) diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift index 276c7d0..3a5162e 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeginWithTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeginWithTest) -> () throws -> Void)] { - return [ - ("testPositiveMatches", testPositiveMatches), - ("testNegativeMatches", testNegativeMatches), - ] - } - func testPositiveMatches() { expect([1, 2, 3]).to(beginWith(1)) expect([1, 2, 3]).toNot(beginWith(2)) diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ContainElementSatisfyingTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ContainElementSatisfyingTest.swift index a9fe80e..6944375 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ContainElementSatisfyingTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ContainElementSatisfyingTest.swift @@ -3,20 +3,6 @@ import XCTest import Nimble final class ContainElementSatisfyingTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (ContainElementSatisfyingTest) -> () throws -> Void)] { - return [ - ("testContainElementSatisfying", testContainElementSatisfying), - ("testContainElementSatisfyingDefaultErrorMessage", testContainElementSatisfyingDefaultErrorMessage), - ("testContainElementSatisfyingSpecificErrorMessage", testContainElementSatisfyingSpecificErrorMessage), - ("testContainElementSatisfyingNegativeCase", - testContainElementSatisfyingNegativeCase), - ("testContainElementSatisfyingNegativeCaseDefaultErrorMessage", - testContainElementSatisfyingNegativeCaseDefaultErrorMessage), - ("testContainElementSatisfyingNegativeCaseSpecificErrorMessage", - testContainElementSatisfyingNegativeCaseSpecificErrorMessage), - ] - } - func testContainElementSatisfying() { var orderIndifferentArray = [1, 2, 3] expect(orderIndifferentArray).to(containElementSatisfying({ number in diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift index 1d8a1eb..ab593ad 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift @@ -3,22 +3,12 @@ import XCTest import Nimble final class ContainTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (ContainTest) -> () throws -> Void)] { - return [ - ("testContain", testContain), - ("testContainSubstring", testContainSubstring), - ("testContainObjCSubstring", testContainObjCSubstring), - ("testVariadicArguments", testVariadicArguments), - ("testCollectionArguments", testCollectionArguments), - ] - } - - func testContain() { + func testContainSequence() { expect([1, 2, 3]).to(contain(1)) + expect([1, 2, 3]).toNot(contain(4)) expect([1, 2, 3] as [CInt]).to(contain(1 as CInt)) expect([1, 2, 3] as [CInt]).toNot(contain(4 as CInt)) expect(["foo", "bar", "baz"]).to(contain("baz")) - expect([1, 2, 3]).toNot(contain(4)) expect(["foo", "bar", "baz"]).toNot(contain("ba")) #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) expect(NSArray(array: ["a"])).to(contain(NSString(string: "a"))) @@ -41,6 +31,46 @@ final class ContainTest: XCTestCase, XCTestCaseProvider { } } + func testContainSetAlgebra() { + expect([.a, .b, .c] as TestOptionSet).to(contain(.a)) + expect([.a, .b, .c] as TestOptionSet).toNot(contain(.d)) + + failsWithErrorMessage("expected to contain <8>, got <7>") { + expect([.a, .b, .c] as TestOptionSet).to(contain(.d)) + } + failsWithErrorMessage("expected to not contain <2>, got <7>") { + expect([.a, .b, .c] as TestOptionSet).toNot(contain(.b)) + } + + failsWithErrorMessageForNil("expected to contain <1>, got ") { + expect(nil as TestOptionSet?).to(contain(.a)) + } + failsWithErrorMessageForNil("expected to not contain <1>, got ") { + expect(nil as TestOptionSet?).toNot(contain(.a)) + } + } + + func testContainSequenceAndSetAlgebra() { + let set = [1, 2, 3] as Set + + expect(set).to(contain(1)) + expect(set).toNot(contain(4)) + + failsWithErrorMessage("expected to contain <4>, got <\(set.debugDescription)>") { + expect(set).to(contain(4)) + } + failsWithErrorMessage("expected to not contain <2>, got <\(set.debugDescription)>") { + expect(set).toNot(contain(2)) + } + + failsWithErrorMessageForNil("expected to contain <1>, got ") { + expect(nil as Set?).to(contain(1)) + } + failsWithErrorMessageForNil("expected to not contain <1>, got ") { + expect(nil as Set?).toNot(contain(1)) + } + } + func testContainSubstring() { expect("foo").to(contain("o")) expect("foo").to(contain("oo")) @@ -93,3 +123,23 @@ final class ContainTest: XCTestCase, XCTestCaseProvider { } } } + +private struct TestOptionSet: OptionSet, CustomStringConvertible { + let rawValue: Int + + // swiftlint:disable identifier_name + static let a = TestOptionSet(rawValue: 1 << 0) + static let b = TestOptionSet(rawValue: 1 << 1) + static let c = TestOptionSet(rawValue: 1 << 2) + static let d = TestOptionSet(rawValue: 1 << 3) + static let e = TestOptionSet(rawValue: 1 << 4) + // swiftlint:enable identifier_name + + init(rawValue: Int) { + self.rawValue = rawValue + } + + var description: String { + return "\(rawValue)" + } +} diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ElementsEqualTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ElementsEqualTest.swift new file mode 100644 index 0000000..ec7a0dd --- /dev/null +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ElementsEqualTest.swift @@ -0,0 +1,27 @@ +import Foundation +import XCTest +import Nimble + +final class ElementsEqualTest: XCTestCase, XCTestCaseProvider { + + func testSequenceElementsEquality() { + failsWithErrorMessageForNil("expected to elementsEqual , got ") { + expect(nil as [Int]?).to(elementsEqual(nil as [Int]?)) + } + let sequence = [1, 2] + failsWithErrorMessageForNil("expected to elementsEqual <[1, 2]>, got ") { + expect(nil as [Int]?).to(elementsEqual(sequence)) + } + + failsWithErrorMessageForNil("expected to elementsEqual , got <[1, 2]>") { + expect(sequence).to(elementsEqual(nil as [Int]?)) + } + + let sequence1 = [1, 2, 3] + let sequence2 = [1, 2, 3, 4, 5] + expect(sequence1).toNot(elementsEqual(sequence2)) + expect(sequence1).toNot(elementsEqual([3, 2, 1])) + expect(sequence1).to(elementsEqual([1, 2, 3])) + + } +} diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift index 30e3b26..88005e8 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class EndWithTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (EndWithTest) -> () throws -> Void)] { - return [ - ("testEndWithPositives", testEndWithPositives), - ("testEndWithNegatives", testEndWithNegatives), - ] - } - func testEndWithPositives() { expect([1, 2, 3]).to(endWith(3)) expect([1, 2, 3]).toNot(endWith(2)) diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift index 85be751..18b0647 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift @@ -3,24 +3,6 @@ import XCTest import Nimble final class EqualTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (EqualTest) -> () throws -> Void)] { - return [ - ("testEquality", testEquality), - ("testArrayEquality", testArrayEquality), - ("testSetEquality", testSetEquality), - ("testDoesNotMatchNils", testDoesNotMatchNils), - ("testDictionaryEquality", testDictionaryEquality), - ("testDataEquality", testDataEquality), - ("testNSObjectEquality", testNSObjectEquality), - ("testOperatorEquality", testOperatorEquality), - ("testOperatorEqualityWithArrays", testOperatorEqualityWithArrays), - ("testOperatorEqualityWithDictionaries", testOperatorEqualityWithDictionaries), - ("testOptionalEquality", testOptionalEquality), - ("testArrayOfOptionalsEquality", testArrayOfOptionalsEquality), - ("testDictionariesWithDifferentSequences", testDictionariesWithDifferentSequences), - ] - } - func testEquality() { expect(1 as CInt).to(equal(1 as CInt)) expect(1 as CInt).to(equal(1)) @@ -152,6 +134,7 @@ final class EqualTest: XCTestCase, XCTestCaseProvider { expect(actual).toNot(equal(unexpected)) #if os(Linux) + // swiftlint:disable:next todo // FIXME: Swift on Linux triggers a segfault when calling NSData's hash() (last checked on 03-11) let expectedErrorMessage = "expected to equal >, got >" #else diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/HaveCountTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/HaveCountTest.swift index a0294c3..4ef610e 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/HaveCountTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/HaveCountTest.swift @@ -2,23 +2,25 @@ import XCTest import Nimble final class HaveCountTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (HaveCountTest) -> () throws -> Void)] { - return [ - ("testHaveCountForArray", testHaveCountForArray), - ("testHaveCountForDictionary", testHaveCountForDictionary), - ("testHaveCountForSet", testHaveCountForSet), - ] - } - func testHaveCountForArray() { expect([1, 2, 3]).to(haveCount(3)) expect([1, 2, 3]).notTo(haveCount(1)) - failsWithErrorMessage("expected to have Array with count 1, got 3\nActual Value: [1, 2, 3]") { + failsWithErrorMessage( + """ + expected to have Array with count 1, got 3 + Actual Value: [1, 2, 3] + """ + ) { expect([1, 2, 3]).to(haveCount(1)) } - failsWithErrorMessage("expected to not have Array with count 3, got 3\nActual Value: [1, 2, 3]") { + failsWithErrorMessage( + """ + expected to not have Array with count 3, got 3 + Actual Value: [1, 2, 3] + """ + ) { expect([1, 2, 3]).notTo(haveCount(3)) } } @@ -28,13 +30,22 @@ final class HaveCountTest: XCTestCase, XCTestCaseProvider { expect(dictionary).to(haveCount(3)) expect(dictionary).notTo(haveCount(1)) - failsWithErrorMessage("expected to have Dictionary with count 1, got 3\nActual Value: \(stringify(dictionary))") { + failsWithErrorMessage( + """ + expected to have Dictionary with count 1, got 3 + Actual Value: \(stringify(dictionary)) + """ + ) { expect(dictionary).to(haveCount(1)) } - failsWithErrorMessage("expected to not have Dictionary with count 3, got 3" + - "\nActual Value: \(stringify(dictionary))") { - expect(dictionary).notTo(haveCount(3)) + failsWithErrorMessage( + """ + expected to not have Dictionary with count 3, got 3 + Actual Value: \(stringify(dictionary)) + """ + ) { + expect(dictionary).notTo(haveCount(3)) } } @@ -43,14 +54,22 @@ final class HaveCountTest: XCTestCase, XCTestCaseProvider { expect(set).to(haveCount(3)) expect(set).notTo(haveCount(1)) - failsWithErrorMessage("expected to have Set with count 1, got 3" + - "\nActual Value: \(stringify(set))") { - expect(set).to(haveCount(1)) + failsWithErrorMessage( + """ + expected to have Set with count 1, got 3 + Actual Value: \(stringify(set)) + """ + ) { + expect(set).to(haveCount(1)) } - failsWithErrorMessage("expected to not have Set with count 3, got 3" + - "\nActual Value: \(stringify(set))") { - expect(set).notTo(haveCount(3)) + failsWithErrorMessage( + """ + expected to not have Set with count 3, got 3 + Actual Value: \(stringify(set)) + """ + ) { + expect(set).notTo(haveCount(3)) } } } diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift index 946e4cd..41e5159 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift @@ -3,18 +3,6 @@ import XCTest import Nimble final class MatchErrorTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (MatchErrorTest) -> () throws -> Void)] { - return [ - ("testMatchErrorPositive", testMatchErrorPositive), - ("testMatchErrorNegative", testMatchErrorNegative), - ("testMatchNSErrorPositive", testMatchNSErrorPositive), - ("testMatchNSErrorNegative", testMatchNSErrorNegative), - ("testMatchPositiveMessage", testMatchPositiveMessage), - ("testMatchNegativeMessage", testMatchNegativeMessage), - ("testDoesNotMatchNils", testDoesNotMatchNils), - ] - } - func testMatchErrorPositive() { expect(NimbleError.laugh).to(matchError(NimbleError.laugh)) expect(NimbleError.laugh).to(matchError(NimbleError.self)) @@ -31,10 +19,12 @@ final class MatchErrorTest: XCTestCase, XCTestCaseProvider { } func testMatchNSErrorPositive() { +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) let error1 = NSError(domain: "err", code: 0, userInfo: nil) let error2 = NSError(domain: "err", code: 0, userInfo: nil) expect(error1).to(matchError(error2)) +#endif } func testMatchNSErrorNegative() { @@ -55,11 +45,13 @@ final class MatchErrorTest: XCTestCase, XCTestCaseProvider { expect(CustomDebugStringConvertibleError.a).to(matchError(CustomDebugStringConvertibleError.b)) } +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) failsWithErrorMessage("expected to match error , got ") { let error1 = NSError(domain: "err", code: 0, userInfo: nil) let error2 = NSError(domain: "err", code: 1, userInfo: nil) expect(error1).to(matchError(error2)) } +#endif } func testMatchNegativeMessage() { diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/MatchTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/MatchTest.swift index a95ba56..1285ecc 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/MatchTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/MatchTest.swift @@ -2,16 +2,6 @@ import XCTest import Nimble final class MatchTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (MatchTest) -> () throws -> Void)] { - return [ - ("testMatchPositive", testMatchPositive), - ("testMatchNegative", testMatchNegative), - ("testMatchPositiveMessage", testMatchPositiveMessage), - ("testMatchNegativeMessage", testMatchNegativeMessage), - ("testMatchNils", testMatchNils), - ] - } - func testMatchPositive() { expect("11:14").to(match("\\d{2}:\\d{2}")) } diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift index ac7f9ec..32f5100 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift @@ -3,18 +3,6 @@ import Nimble import Foundation final class PostNotificationTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (PostNotificationTest) -> () throws -> Void)] { - return [ - ("testPassesWhenNoNotificationsArePosted", testPassesWhenNoNotificationsArePosted), - ("testPassesWhenExpectedNotificationIsPosted", testPassesWhenExpectedNotificationIsPosted), - ("testPassesWhenAllExpectedNotificationsArePosted", testPassesWhenAllExpectedNotificationsArePosted), - ("testFailsWhenNoNotificationsArePosted", testFailsWhenNoNotificationsArePosted), - ("testFailsWhenNotificationWithWrongNameIsPosted", testFailsWhenNotificationWithWrongNameIsPosted), - ("testFailsWhenNotificationWithWrongObjectIsPosted", testFailsWhenNotificationWithWrongObjectIsPosted), - ("testPassesWhenExpectedNotificationEventuallyIsPosted", testPassesWhenExpectedNotificationEventuallyIsPosted), - ] - } - let notificationCenter = NotificationCenter() func testPassesWhenNoNotificationsArePosted() { diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift index f62f633..beca75b 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift @@ -3,17 +3,7 @@ import Nimble #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE -final class RaisesExceptionTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (RaisesExceptionTest) -> () throws -> Void)] { - return [ - ("testPositiveMatches", testPositiveMatches), - ("testPositiveMatchesWithClosures", testPositiveMatchesWithClosures), - ("testNegativeMatches", testNegativeMatches), - ("testNegativeMatchesDoNotCallClosureWithoutException", testNegativeMatchesDoNotCallClosureWithoutException), - ("testNegativeMatchesWithClosure", testNegativeMatchesWithClosure), - ] - } - +final class RaisesExceptionTest: XCTestCase { var anException = NSException(name: NSExceptionName("laugh"), reason: "Lulz", userInfo: ["key": "value"]) func testPositiveMatches() { diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/SatisfyAllOfTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/SatisfyAllOfTest.swift index 42ed892..be60a41 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/SatisfyAllOfTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/SatisfyAllOfTest.swift @@ -3,13 +3,6 @@ import Nimble import Foundation final class SatisfyAllOfTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (SatisfyAllOfTest) -> () throws -> Void)] { - return [ - ("testSatisfyAllOf", testSatisfyAllOf), - ("testOperatorAnd", testOperatorAnd), - ] - } - func testSatisfyAllOf() { expect(2).to(satisfyAllOf(equal(2), beLessThan(3))) #if SUPPORT_IMPLICIT_BRIDGING_CONVERSION diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/SatisfyAnyOfTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/SatisfyAnyOfTest.swift index 0bd9495..0cba8d5 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/SatisfyAnyOfTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/SatisfyAnyOfTest.swift @@ -3,13 +3,6 @@ import Nimble import Foundation final class SatisfyAnyOfTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (SatisfyAnyOfTest) -> () throws -> Void)] { - return [ - ("testSatisfyAnyOf", testSatisfyAnyOf), - ("testOperatorOr", testOperatorOr), - ] - } - func testSatisfyAnyOf() { expect(2).to(satisfyAnyOf(equal(2), equal(3))) #if SUPPORT_IMPLICIT_BRIDGING_CONVERSION diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift index 4babde0..edd9e0e 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift @@ -6,18 +6,7 @@ import Nimble private let error: Error = NSError(domain: "test", code: 0, userInfo: nil) -final class ThrowAssertionTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (ThrowAssertionTest) -> () throws -> Void)] { - return [ - ("testPositiveMatch", testPositiveMatch), - ("testErrorThrown", testErrorThrown), - ("testPostAssertionCodeNotRun", testPostAssertionCodeNotRun), - ("testNegativeMatch", testNegativeMatch), - ("testPositiveMessage", testPositiveMessage), - ("testNegativeMessage", testNegativeMessage), - ] - } - +final class ThrowAssertionTest: XCTestCase { func testPositiveMatch() { expect { () -> Void in fatalError() }.to(throwAssertion()) } diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ThrowErrorTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ThrowErrorTest.swift index f862992..7a7253f 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ThrowErrorTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ThrowErrorTest.swift @@ -30,8 +30,10 @@ func == (lhs: EquatableError, rhs: EquatableError) -> Bool { } enum CustomDebugStringConvertibleError: Error { + // swiftlint:disable identifier_name case a case b + // swiftlint:enable identifier_name } extension CustomDebugStringConvertibleError: CustomDebugStringConvertible { @@ -41,18 +43,6 @@ extension CustomDebugStringConvertibleError: CustomDebugStringConvertible { } final class ThrowErrorTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (ThrowErrorTest) -> () throws -> Void)] { - return [ - ("testPositiveMatches", testPositiveMatches), - ("testPositiveMatchesWithClosures", testPositiveMatchesWithClosures), - ("testNegativeMatches", testNegativeMatches), - ("testPositiveNegatedMatches", testPositiveNegatedMatches), - ("testNegativeNegatedMatches", testNegativeNegatedMatches), - ("testNegativeMatchesDoNotCallClosureWithoutError", testNegativeMatchesDoNotCallClosureWithoutError), - ("testNegativeMatchesWithClosure", testNegativeMatchesWithClosure), - ] - } - func testPositiveMatches() { expect { throw NimbleError.laugh }.to(throwError()) expect { throw NimbleError.laugh }.to(throwError(NimbleError.laugh)) diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ToSucceedTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ToSucceedTest.swift index dde999a..0079f23 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ToSucceedTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ToSucceedTest.swift @@ -2,12 +2,6 @@ import XCTest import Nimble final class ToSucceedTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (ToSucceedTest) -> () throws -> Void)] { - return [ - ("testToSucceed", testToSucceed), - ] - } - func testToSucceed() { expect({ return .succeeded diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/SynchronousTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/SynchronousTest.swift index f1ba572..1f412dd 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/SynchronousTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/SynchronousTest.swift @@ -3,25 +3,6 @@ import XCTest import Nimble final class SynchronousTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (SynchronousTest) -> () throws -> Void)] { - return [ - ("testFailAlwaysFails", testFailAlwaysFails), - ("testUnexpectedErrorsThrownFails", testUnexpectedErrorsThrownFails), - ("testToMatchesIfMatcherReturnsTrue", testToMatchesIfMatcherReturnsTrue), - ("testToProvidesActualValueExpression", testToProvidesActualValueExpression), - ("testToProvidesAMemoizedActualValueExpression", testToProvidesActualValueExpression), - ("testToProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl", testToProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl), - ("testToMatchAgainstLazyProperties", testToMatchAgainstLazyProperties), - ("testToNotMatchesIfMatcherReturnsTrue", testToNotMatchesIfMatcherReturnsTrue), - ("testToNotProvidesActualValueExpression", testToNotProvidesActualValueExpression), - ("testToNotProvidesAMemoizedActualValueExpression", testToNotProvidesAMemoizedActualValueExpression), - ("testToNotProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl", testToNotProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl), - ("testToNegativeMatches", testToNegativeMatches), - ("testToNotNegativeMatches", testToNotNegativeMatches), - ("testNotToMatchesLikeToNot", testNotToMatchesLikeToNot), - ] - } - class Error: Swift.Error {} let errorToThrow = Error() diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/UserDescriptionTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/UserDescriptionTest.swift index 9bb64b6..0c451c8 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/UserDescriptionTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/UserDescriptionTest.swift @@ -2,62 +2,69 @@ import XCTest import Nimble final class UserDescriptionTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (UserDescriptionTest) -> () throws -> Void)] { - return [ - ("testToMatcher_CustomFailureMessage", testToMatcher_CustomFailureMessage), - ("testNotToMatcher_CustomFailureMessage", testNotToMatcher_CustomFailureMessage), - ("testToNotMatcher_CustomFailureMessage", testToNotMatcher_CustomFailureMessage), - ("testToEventuallyMatch_CustomFailureMessage", testToEventuallyMatch_CustomFailureMessage), - ("testToEventuallyNotMatch_CustomFailureMessage", testToEventuallyNotMatch_CustomFailureMessage), - ("testToNotEventuallyMatch_CustomFailureMessage", testToNotEventuallyMatch_CustomFailureMessage), - ] - } - func testToMatcher_CustomFailureMessage() { failsWithErrorMessage( - "These aren't equal!\n" + - "expected to match, got <1>") { - expect(1).to(MatcherFunc { _, _ in false }, description: "These aren't equal!") + """ + These aren't equal! + expected to match, got <1> + """ + ) { + expect(1).to(MatcherFunc { _, _ in false }, description: "These aren't equal!") } } func testNotToMatcher_CustomFailureMessage() { failsWithErrorMessage( - "These aren't equal!\n" + - "expected to not match, got <1>") { - expect(1).notTo(MatcherFunc { _, _ in true }, description: "These aren't equal!") + """ + These aren't equal! + expected to not match, got <1> + """ + ) { + expect(1).notTo(MatcherFunc { _, _ in true }, description: "These aren't equal!") } } func testToNotMatcher_CustomFailureMessage() { failsWithErrorMessage( - "These aren't equal!\n" + - "expected to not match, got <1>") { - expect(1).toNot(MatcherFunc { _, _ in true }, description: "These aren't equal!") + """ + These aren't equal! + expected to not match, got <1> + """ + ) { + expect(1).toNot(MatcherFunc { _, _ in true }, description: "These aren't equal!") } } func testToEventuallyMatch_CustomFailureMessage() { failsWithErrorMessage( - "These aren't eventually equal!\n" + - "expected to eventually equal <1>, got <0>") { - expect { 0 }.toEventually(equal(1), description: "These aren't eventually equal!") + """ + These aren't eventually equal! + expected to eventually equal <1>, got <0> + """ + ) { + expect { 0 }.toEventually(equal(1), description: "These aren't eventually equal!") } } func testToEventuallyNotMatch_CustomFailureMessage() { failsWithErrorMessage( - "These are eventually equal!\n" + - "expected to eventually not equal <1>, got <1>") { - expect { 1 }.toEventuallyNot(equal(1), description: "These are eventually equal!") + """ + These are eventually equal! + expected to eventually not equal <1>, got <1> + """ + ) { + expect { 1 }.toEventuallyNot(equal(1), description: "These are eventually equal!") } } func testToNotEventuallyMatch_CustomFailureMessage() { failsWithErrorMessage( - "These are eventually equal!\n" + - "expected to eventually not equal <1>, got <1>") { - expect { 1 }.toEventuallyNot(equal(1), description: "These are eventually equal!") + """ + These are eventually equal! + expected to eventually not equal <1>, got <1> + """ + ) { + expect { 1 }.toEventuallyNot(equal(1), description: "These are eventually equal!") } } diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/XCTestManifests.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/XCTestManifests.swift new file mode 100644 index 0000000..2bd1052 --- /dev/null +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/XCTestManifests.swift @@ -0,0 +1,387 @@ +import XCTest + +extension AllPassTest { + static let __allTests = [ + ("testAllPassArray", testAllPassArray), + ("testAllPassCollectionsWithOptionalsDontWork", testAllPassCollectionsWithOptionalsDontWork), + ("testAllPassCollectionsWithOptionalsUnwrappingOneOptionalLayer", testAllPassCollectionsWithOptionalsUnwrappingOneOptionalLayer), + ("testAllPassMatcher", testAllPassMatcher), + ("testAllPassSet", testAllPassSet), + ("testAllPassWithNilAsExpectedValue", testAllPassWithNilAsExpectedValue), + ] +} + +extension AsyncTest { + static let __allTests = [ + ("testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed", testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed), + ("testSubjectUnderTestIsReleasedFromMemory", testSubjectUnderTestIsReleasedFromMemory), + ("testToEventuallyMustBeInMainThread", testToEventuallyMustBeInMainThread), + ("testToEventuallyNegativeMatches", testToEventuallyNegativeMatches), + ("testToEventuallyPositiveMatches", testToEventuallyPositiveMatches), + ("testToEventuallyWithCustomDefaultTimeout", testToEventuallyWithCustomDefaultTimeout), + ("testWaitUntilDetectsStalledMainThreadActivity", testWaitUntilDetectsStalledMainThreadActivity), + ("testWaitUntilErrorsIfDoneIsCalledMultipleTimes", testWaitUntilErrorsIfDoneIsCalledMultipleTimes), + ("testWaitUntilMustBeInMainThread", testWaitUntilMustBeInMainThread), + ("testWaitUntilNegativeMatches", testWaitUntilNegativeMatches), + ("testWaitUntilPositiveMatches", testWaitUntilPositiveMatches), + ("testWaitUntilTimesOutIfNotCalled", testWaitUntilTimesOutIfNotCalled), + ("testWaitUntilTimesOutWhenExceedingItsTime", testWaitUntilTimesOutWhenExceedingItsTime), + ("testWaitUntilWithCustomDefaultsTimeout", testWaitUntilWithCustomDefaultsTimeout), + ] +} + +extension BeAKindOfObjCTest { + static let __allTests = [ + ("testFailureMessages", testFailureMessages), + ("testPositiveMatch", testPositiveMatch), + ] +} + +extension BeAKindOfSwiftTest { + static let __allTests = [ + ("testFailureMessages", testFailureMessages), + ("testPositiveMatch", testPositiveMatch), + ] +} + +extension BeAnInstanceOfTest { + static let __allTests = [ + ("testFailureMessages", testFailureMessages), + ("testFailureMessagesSwiftTypes", testFailureMessagesSwiftTypes), + ("testPositiveMatch", testPositiveMatch), + ("testPositiveMatchSwiftTypes", testPositiveMatchSwiftTypes), + ] +} + +extension BeCloseToTest { + static let __allTests = [ + ("testBeCloseTo", testBeCloseTo), + ("testBeCloseToArray", testBeCloseToArray), + ("testBeCloseToOperator", testBeCloseToOperator), + ("testBeCloseToOperatorWithDate", testBeCloseToOperatorWithDate), + ("testBeCloseToWithCGFloat", testBeCloseToWithCGFloat), + ("testBeCloseToWithDate", testBeCloseToWithDate), + ("testBeCloseToWithin", testBeCloseToWithin), + ("testBeCloseToWithinOperator", testBeCloseToWithinOperator), + ("testBeCloseToWithinOperatorWithDate", testBeCloseToWithinOperatorWithDate), + ("testBeCloseToWithNSDate", testBeCloseToWithNSDate), + ("testBeCloseToWithNSNumber", testBeCloseToWithNSNumber), + ("testPlusMinusOperator", testPlusMinusOperator), + ("testPlusMinusOperatorWithDate", testPlusMinusOperatorWithDate), + ] +} + +extension BeEmptyTest { + static let __allTests = [ + ("testBeEmptyNegative", testBeEmptyNegative), + ("testBeEmptyPositive", testBeEmptyPositive), + ("testNilMatches", testNilMatches), + ] +} + +extension BeFalseTest { + static let __allTests = [ + ("testShouldMatchFalse", testShouldMatchFalse), + ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), + ("testShouldNotMatchTrue", testShouldNotMatchTrue), + ] +} + +extension BeFalsyTest { + static let __allTests = [ + ("testShouldMatchFalse", testShouldMatchFalse), + ("testShouldMatchNilBools", testShouldMatchNilBools), + ("testShouldMatchNilTypes", testShouldMatchNilTypes), + ("testShouldNotMatchNonNilTypes", testShouldNotMatchNonNilTypes), + ("testShouldNotMatchTrue", testShouldNotMatchTrue), + ] +} + +extension BeGreaterThanOrEqualToTest { + static let __allTests = [ + ("testGreaterThanOrEqualTo", testGreaterThanOrEqualTo), + ("testGreaterThanOrEqualToOperator", testGreaterThanOrEqualToOperator), + ] +} + +extension BeGreaterThanTest { + static let __allTests = [ + ("testGreaterThan", testGreaterThan), + ("testGreaterThanOperator", testGreaterThanOperator), + ] +} + +extension BeIdenticalToObjectTest { + static let __allTests = [ + ("testBeIdenticalToNegative", testBeIdenticalToNegative), + ("testBeIdenticalToNegativeMessage", testBeIdenticalToNegativeMessage), + ("testBeIdenticalToPositive", testBeIdenticalToPositive), + ("testBeIdenticalToPositiveMessage", testBeIdenticalToPositiveMessage), + ("testFailsOnNils", testFailsOnNils), + ("testOperators", testOperators), + ] +} + +extension BeIdenticalToTest { + static let __allTests = [ + ("testBeAlias", testBeAlias), + ("testBeIdenticalToNegative", testBeIdenticalToNegative), + ("testBeIdenticalToNegativeMessage", testBeIdenticalToNegativeMessage), + ("testBeIdenticalToPositive", testBeIdenticalToPositive), + ("testBeIdenticalToPositiveMessage", testBeIdenticalToPositiveMessage), + ("testOperators", testOperators), + ] +} + +extension BeLessThanOrEqualToTest { + static let __allTests = [ + ("testLessThanOrEqualTo", testLessThanOrEqualTo), + ("testLessThanOrEqualToOperator", testLessThanOrEqualToOperator), + ] +} + +extension BeLessThanTest { + static let __allTests = [ + ("testLessThan", testLessThan), + ("testLessThanOperator", testLessThanOperator), + ] +} + +extension BeNilTest { + static let __allTests = [ + ("testBeNil", testBeNil), + ] +} + +extension BeTrueTest { + static let __allTests = [ + ("testShouldMatchTrue", testShouldMatchTrue), + ("testShouldNotMatchFalse", testShouldNotMatchFalse), + ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), + ] +} + +extension BeTruthyTest { + static let __allTests = [ + ("testShouldMatchBoolConvertibleTypesThatConvertToTrue", testShouldMatchBoolConvertibleTypesThatConvertToTrue), + ("testShouldMatchNonNilTypes", testShouldMatchNonNilTypes), + ("testShouldMatchTrue", testShouldMatchTrue), + ("testShouldNotMatchBoolConvertibleTypesThatConvertToFalse", testShouldNotMatchBoolConvertibleTypesThatConvertToFalse), + ("testShouldNotMatchFalse", testShouldNotMatchFalse), + ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), + ("testShouldNotMatchNilTypes", testShouldNotMatchNilTypes), + ] +} + +extension BeVoidTest { + static let __allTests = [ + ("testBeVoid", testBeVoid), + ] +} + +extension BeginWithTest { + static let __allTests = [ + ("testNegativeMatches", testNegativeMatches), + ("testPositiveMatches", testPositiveMatches), + ] +} + +extension ContainElementSatisfyingTest { + static let __allTests = [ + ("testContainElementSatisfying", testContainElementSatisfying), + ("testContainElementSatisfyingDefaultErrorMessage", testContainElementSatisfyingDefaultErrorMessage), + ("testContainElementSatisfyingNegativeCase", testContainElementSatisfyingNegativeCase), + ("testContainElementSatisfyingNegativeCaseDefaultErrorMessage", testContainElementSatisfyingNegativeCaseDefaultErrorMessage), + ("testContainElementSatisfyingNegativeCaseSpecificErrorMessage", testContainElementSatisfyingNegativeCaseSpecificErrorMessage), + ("testContainElementSatisfyingSpecificErrorMessage", testContainElementSatisfyingSpecificErrorMessage), + ] +} + +extension ContainTest { + static let __allTests = [ + ("testCollectionArguments", testCollectionArguments), + ("testContainObjCSubstring", testContainObjCSubstring), + ("testContainSequence", testContainSequence), + ("testContainSequenceAndSetAlgebra", testContainSequenceAndSetAlgebra), + ("testContainSetAlgebra", testContainSetAlgebra), + ("testContainSubstring", testContainSubstring), + ("testVariadicArguments", testVariadicArguments), + ] +} + +extension ElementsEqualTest { + static let __allTests = [ + ("testSequenceElementsEquality", testSequenceElementsEquality), + ] +} + +extension EndWithTest { + static let __allTests = [ + ("testEndWithNegatives", testEndWithNegatives), + ("testEndWithPositives", testEndWithPositives), + ] +} + +extension EqualTest { + static let __allTests = [ + ("testArrayEquality", testArrayEquality), + ("testArrayOfOptionalsEquality", testArrayOfOptionalsEquality), + ("testDataEquality", testDataEquality), + ("testDictionariesWithDifferentSequences", testDictionariesWithDifferentSequences), + ("testDictionaryEquality", testDictionaryEquality), + ("testDoesNotMatchNils", testDoesNotMatchNils), + ("testEquality", testEquality), + ("testNSObjectEquality", testNSObjectEquality), + ("testOperatorEquality", testOperatorEquality), + ("testOperatorEqualityWithArrays", testOperatorEqualityWithArrays), + ("testOperatorEqualityWithDictionaries", testOperatorEqualityWithDictionaries), + ("testOptionalEquality", testOptionalEquality), + ("testSetEquality", testSetEquality), + ] +} + +extension HaveCountTest { + static let __allTests = [ + ("testHaveCountForArray", testHaveCountForArray), + ("testHaveCountForDictionary", testHaveCountForDictionary), + ("testHaveCountForSet", testHaveCountForSet), + ] +} + +extension MatchErrorTest { + static let __allTests = [ + ("testDoesNotMatchNils", testDoesNotMatchNils), + ("testMatchErrorNegative", testMatchErrorNegative), + ("testMatchErrorPositive", testMatchErrorPositive), + ("testMatchNegativeMessage", testMatchNegativeMessage), + ("testMatchNSErrorNegative", testMatchNSErrorNegative), + ("testMatchNSErrorPositive", testMatchNSErrorPositive), + ("testMatchPositiveMessage", testMatchPositiveMessage), + ] +} + +extension MatchTest { + static let __allTests = [ + ("testMatchNegative", testMatchNegative), + ("testMatchNegativeMessage", testMatchNegativeMessage), + ("testMatchNils", testMatchNils), + ("testMatchPositive", testMatchPositive), + ("testMatchPositiveMessage", testMatchPositiveMessage), + ] +} + +extension PostNotificationTest { + static let __allTests = [ + ("testFailsWhenNoNotificationsArePosted", testFailsWhenNoNotificationsArePosted), + ("testFailsWhenNotificationWithWrongNameIsPosted", testFailsWhenNotificationWithWrongNameIsPosted), + ("testFailsWhenNotificationWithWrongObjectIsPosted", testFailsWhenNotificationWithWrongObjectIsPosted), + ("testPassesWhenAllExpectedNotificationsArePosted", testPassesWhenAllExpectedNotificationsArePosted), + ("testPassesWhenExpectedNotificationEventuallyIsPosted", testPassesWhenExpectedNotificationEventuallyIsPosted), + ("testPassesWhenExpectedNotificationIsPosted", testPassesWhenExpectedNotificationIsPosted), + ("testPassesWhenNoNotificationsArePosted", testPassesWhenNoNotificationsArePosted), + ] +} + +extension SatisfyAllOfTest { + static let __allTests = [ + ("testOperatorAnd", testOperatorAnd), + ("testSatisfyAllOf", testSatisfyAllOf), + ] +} + +extension SatisfyAnyOfTest { + static let __allTests = [ + ("testOperatorOr", testOperatorOr), + ("testSatisfyAnyOf", testSatisfyAnyOf), + ] +} + +extension SynchronousTest { + static let __allTests = [ + ("testFailAlwaysFails", testFailAlwaysFails), + ("testNotToMatchesLikeToNot", testNotToMatchesLikeToNot), + ("testToMatchAgainstLazyProperties", testToMatchAgainstLazyProperties), + ("testToMatchesIfMatcherReturnsTrue", testToMatchesIfMatcherReturnsTrue), + ("testToNegativeMatches", testToNegativeMatches), + ("testToNotMatchesIfMatcherReturnsTrue", testToNotMatchesIfMatcherReturnsTrue), + ("testToNotNegativeMatches", testToNotNegativeMatches), + ("testToNotProvidesActualValueExpression", testToNotProvidesActualValueExpression), + ("testToNotProvidesAMemoizedActualValueExpression", testToNotProvidesAMemoizedActualValueExpression), + ("testToNotProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl", testToNotProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl), + ("testToProvidesActualValueExpression", testToProvidesActualValueExpression), + ("testToProvidesAMemoizedActualValueExpression", testToProvidesAMemoizedActualValueExpression), + ("testToProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl", testToProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl), + ("testUnexpectedErrorsThrownFails", testUnexpectedErrorsThrownFails), + ] +} + +extension ThrowErrorTest { + static let __allTests = [ + ("testNegativeMatches", testNegativeMatches), + ("testNegativeMatchesDoNotCallClosureWithoutError", testNegativeMatchesDoNotCallClosureWithoutError), + ("testNegativeMatchesWithClosure", testNegativeMatchesWithClosure), + ("testNegativeNegatedMatches", testNegativeNegatedMatches), + ("testPositiveMatches", testPositiveMatches), + ("testPositiveMatchesWithClosures", testPositiveMatchesWithClosures), + ("testPositiveNegatedMatches", testPositiveNegatedMatches), + ] +} + +extension ToSucceedTest { + static let __allTests = [ + ("testToSucceed", testToSucceed), + ] +} + +extension UserDescriptionTest { + static let __allTests = [ + ("testNotToMatcher_CustomFailureMessage", testNotToMatcher_CustomFailureMessage), + ("testToEventuallyMatch_CustomFailureMessage", testToEventuallyMatch_CustomFailureMessage), + ("testToEventuallyNotMatch_CustomFailureMessage", testToEventuallyNotMatch_CustomFailureMessage), + ("testToMatcher_CustomFailureMessage", testToMatcher_CustomFailureMessage), + ("testToNotEventuallyMatch_CustomFailureMessage", testToNotEventuallyMatch_CustomFailureMessage), + ("testToNotMatcher_CustomFailureMessage", testToNotMatcher_CustomFailureMessage), + ] +} + +#if !os(macOS) +public func __allTests() -> [XCTestCaseEntry] { + return [ + testCase(AllPassTest.__allTests), + testCase(AsyncTest.__allTests), + testCase(BeAKindOfObjCTest.__allTests), + testCase(BeAKindOfSwiftTest.__allTests), + testCase(BeAnInstanceOfTest.__allTests), + testCase(BeCloseToTest.__allTests), + testCase(BeEmptyTest.__allTests), + testCase(BeFalseTest.__allTests), + testCase(BeFalsyTest.__allTests), + testCase(BeGreaterThanOrEqualToTest.__allTests), + testCase(BeGreaterThanTest.__allTests), + testCase(BeIdenticalToObjectTest.__allTests), + testCase(BeIdenticalToTest.__allTests), + testCase(BeLessThanOrEqualToTest.__allTests), + testCase(BeLessThanTest.__allTests), + testCase(BeNilTest.__allTests), + testCase(BeTrueTest.__allTests), + testCase(BeTruthyTest.__allTests), + testCase(BeVoidTest.__allTests), + testCase(BeginWithTest.__allTests), + testCase(ContainElementSatisfyingTest.__allTests), + testCase(ContainTest.__allTests), + testCase(ElementsEqualTest.__allTests), + testCase(EndWithTest.__allTests), + testCase(EqualTest.__allTests), + testCase(HaveCountTest.__allTests), + testCase(MatchErrorTest.__allTests), + testCase(MatchTest.__allTests), + testCase(PostNotificationTest.__allTests), + testCase(SatisfyAllOfTest.__allTests), + testCase(SatisfyAnyOfTest.__allTests), + testCase(SynchronousTest.__allTests), + testCase(ThrowErrorTest.__allTests), + testCase(ToSucceedTest.__allTests), + testCase(UserDescriptionTest.__allTests), + ] +} +#endif diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCAsyncTest.m b/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCAsyncTest.m index f052e74..06f5b32 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCAsyncTest.m +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCAsyncTest.m @@ -29,6 +29,11 @@ waitUntil(^(void (^done)(void)){ done(); }); + waitUntil(^(void (^done)(void)){ + dispatch_async(dispatch_get_main_queue(), ^{ + done(); + }); + }); expectFailureMessage(@"Waited more than 1.0 second", ^{ waitUntil(^(void (^done)(void)){ /* ... */ }); diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCContainTest.m b/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCContainTest.m index 8b954fe..62d6e45 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCContainTest.m +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCContainTest.m @@ -64,4 +64,13 @@ }); } +- (void)testUnsupportedTypes { + expectFailureMessage(@"expected to contain (only works for NSArrays, NSSets, NSHashTables, and NSStrings), got <1>", ^{ + expect(@1).to(contain(@"foo")); + }); + expectFailureMessage(@"expected to not contain (only works for NSArrays, NSSets, NSHashTables, and NSStrings), got <1>", ^{ + expect(@1).toNot(contain(@"foo")); + }); +} + @end diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCEndWithTest.m b/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCEndWithTest.m index b960f01..b48b3fc 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCEndWithTest.m +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCEndWithTest.m @@ -13,7 +13,6 @@ expect(@"hello world!").toNot(endWith(@"hello")); expect(array).to(endWith(@2)); expect(array).toNot(endWith(@1)); - expect(@1).toNot(contain(@"foo")); } - (void)testNegativeMatches { diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCHaveCountTest.m b/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCHaveCountTest.m index 31053c8..ea0e31f 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCHaveCountTest.m +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCHaveCountTest.m @@ -171,4 +171,13 @@ }); } +- (void)testNilMatches { + expectNilFailureMessage(@"expected to have a collection with count 3, got ", ^{ + expect(nil).to(haveCount(3)); + }); + expectNilFailureMessage(@"expected to not have a collection with count 3, got ", ^{ + expect(nil).toNot(haveCount(3)); + }); +} + @end diff --git a/Carthage/Checkouts/Nimble/test b/Carthage/Checkouts/Nimble/test index 92b8f8c..c213afe 100755 --- a/Carthage/Checkouts/Nimble/test +++ b/Carthage/Checkouts/Nimble/test @@ -63,7 +63,7 @@ function test_ios { function test_tvos { run osascript -e 'tell app "Simulator" to quit' - run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-tvOS" -configuration "Debug" -sdk "appletvsimulator$BUILD_TVOS_SDK_VERSION" -destination "name=Apple TV 1080p,OS=$RUNTIME_TVOS_SDK_VERSION" build-for-testing test-without-building + run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-tvOS" -configuration "Debug" -sdk "appletvsimulator$BUILD_TVOS_SDK_VERSION" -destination "name=Apple TV,OS=$RUNTIME_TVOS_SDK_VERSION" build-for-testing test-without-building } function test_macos { @@ -74,13 +74,17 @@ function test_podspec { echo "Gathering CocoaPods installation information..." run bundle exec pod --version echo "Linting podspec..." + # To work around the lint error: "ERROR | swift: Specification `Nimble` specifies an inconsistent `swift_version` (`4.0`) compared to the one present in your `.swift-version` file (`4.1`). Please remove the `.swift-version` file which is now deprecated and only use the `swift_version` attribute within your podspec." + # `.swift-version` is for swiftenv, not for CocoaPods, so we can't remove the file as suggested. + run mv .swift-version .swift-version.backup # Note: remove `--allow-warnings` once old Matcher API has been removed - run bundle exec pod lib lint Nimble.podspec --allow-warnings + run bundle exec pod lib lint Nimble.podspec --allow-warnings --skip-import-validation + run mv .swift-version.backup .swift-version } function test_swiftpm { if [ -d .build ]; then - run swift build --clean || swift package clean + run swift package clean fi run swift build && swift test } diff --git a/Carthage/Checkouts/Quick/.hound.yml b/Carthage/Checkouts/Quick/.hound.yml index b867fd9..5a66441 100644 --- a/Carthage/Checkouts/Quick/.hound.yml +++ b/Carthage/Checkouts/Quick/.hound.yml @@ -1,2 +1,4 @@ swift: - config_file: .swiftlint.yml + config_file: .swiftlint.yml +rubocop: + enabled: false diff --git a/Carthage/Checkouts/Quick/.swift-version b/Carthage/Checkouts/Quick/.swift-version index 8c50098..fae6e3d 100644 --- a/Carthage/Checkouts/Quick/.swift-version +++ b/Carthage/Checkouts/Quick/.swift-version @@ -1 +1 @@ -3.1 +4.2.1 diff --git a/Carthage/Checkouts/Quick/.travis.yml b/Carthage/Checkouts/Quick/.travis.yml index c33dc20..960afba 100644 --- a/Carthage/Checkouts/Quick/.travis.yml +++ b/Carthage/Checkouts/Quick/.travis.yml @@ -1,52 +1,48 @@ -osx_image: xcode8.3 language: generic matrix: include: - - os: osx + - name: CocoaPods Lint & Danger + os: osx + osx_image: xcode10.1 + language: ruby + script: + - PODSPEC=1 ./script/travis-script-macos + - bundle exec danger + - &xcode + name: Xcode 10.1 / Swift 4.2 + os: osx env: - - PLATFORM=macos - XCODE_ACTION="build-for-testing test-without-building" - - os: osx - osx_image: xcode9.3 - env: - - PLATFORM=macos - - XCODE_ACTION="build-for-testing test-without-building" - - os: osx - osx_image: xcode9.3 - env: - - PLATFORM=macos_static - - XCODE_ACTION="build-for-testing test-without-building" - - os: osx - env: - - PLATFORM=ios - - XCODE_ACTION="build-for-testing test-without-building" - - os: osx - env: - - PLATFORM=tvos - - XCODE_ACTION="build-for-testing test-without-building" - - os: osx - env: - - PLATFORM=swiftpm - - os: osx - osx_image: xcode9.3 - env: - - PLATFORM=swiftpm - - os: osx - env: - - PODSPEC=1 - - os: linux - sudo: required - dist: trusty - - os: linux + osx_image: xcode10.1 + script: + - PLATFORM=macos ./script/travis-script-macos + - PLATFORM=macos_static ./script/travis-script-macos + - PLATFORM=ios ./script/travis-script-macos + - PLATFORM=tvos ./script/travis-script-macos + - <<: *xcode + name: Xcode 10.2 / Swift 5.0 + osx_image: xcode10.2 + - &swiftpm_darwin + name: SwiftPM / Darwin / Swift 4.2 + os: osx + osx_image: xcode10.1 + script: PLATFORM=swiftpm ./script/travis-script-macos + - <<: *swiftpm_darwin + name: SwiftPM / Darwin / Swift 5.0 + osx_image: xcode10.2 + - &swiftpm_linux + name: SwiftPM / Linux / Swift 4.2 + os: linux sudo: required dist: trusty env: - - SWIFT_VERSION=4.1 -install: - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./script/travis-install-macos; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./script/travis-install-linux; fi - - if [[ "$PODSPEC" ]]; then gem install bundler; bundle install; fi -script: - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./script/travis-script-macos; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./script/travis-script-linux; fi - - if [[ "$PODSPEC" ]]; then danger; fi + - SWIFT_VERSION=4.2.1 + install: ./script/travis-install-linux + script: ./script/travis-script-linux + - <<: *swiftpm_linux + name: SwiftPM / Linux / Swift 5.0 Development + env: + - SWIFT_VERSION=5.0-DEVELOPMENT-SNAPSHOT-2019-02-28-a + +notifications: + email: false diff --git a/Carthage/Checkouts/Quick/Dangerfile b/Carthage/Checkouts/Quick/Dangerfile index 719de60..ff6259f 100644 --- a/Carthage/Checkouts/Quick/Dangerfile +++ b/Carthage/Checkouts/Quick/Dangerfile @@ -2,11 +2,11 @@ @SDM_DANGER_BIG_PR_LINES = 50 # set the files to watch and fail if there are changes -@SDM_DANGER_IMMUTABLE_FILES = ['LICENSE', 'CONTRIBUTING.md', 'CODE_OF_CONDUCT.md'] +@SDM_DANGER_IMMUTABLE_FILES = ['LICENSE', 'CODE_OF_CONDUCT.md'] # Sometimes it's a README fix, or something like that which is trivial not_declared_trivial = !(github.pr_title.include? "#trivial") -has_app_changes = !git.modified_files.grep(/Sources/).empty? +has_app_changes = git.modified_files.grep(/Sources/).any? { |file| file.end_with?(".swift") || file.end_with?(".h") } no_test_modify = git.modified_files.grep(/Tests/).empty? # Warns when changing source files diff --git a/Carthage/Checkouts/Quick/Documentation/en-us/SharedExamples.md b/Carthage/Checkouts/Quick/Documentation/en-us/SharedExamples.md index 339bf34..1f14e64 100644 --- a/Carthage/Checkouts/Quick/Documentation/en-us/SharedExamples.md +++ b/Carthage/Checkouts/Quick/Documentation/en-us/SharedExamples.md @@ -18,7 +18,7 @@ import Nimble class EdibleSharedExamplesConfiguration: QuickConfiguration { override class func configure(_ configuration: Configuration) { - sharedExamples("something edible") { (sharedExampleContext: SharedExampleContext) in + sharedExamples("something edible") { (sharedExampleContext: @escaping SharedExampleContext) in it("makes dolphins happy") { let dolphin = Dolphin(happy: false) let edible = sharedExampleContext()["edible"] diff --git a/Carthage/Checkouts/Quick/Documentation/ko-kr/BehavioralTesting.md b/Carthage/Checkouts/Quick/Documentation/ko-kr/BehavioralTesting.md index 39dd525..ca2b5e1 100644 --- a/Carthage/Checkouts/Quick/Documentation/ko-kr/BehavioralTesting.md +++ b/Carthage/Checkouts/Quick/Documentation/ko-kr/BehavioralTesting.md @@ -7,7 +7,7 @@ - 동작이 동일하게 유지되더라도 응용 프로그램 코드가 변경되면 중단되는 테스트는 **취약한 테스트 (brittle tests)**입니다. 우리가 `GorillaDB` 라는 바나나 데이터베이스를 가지고 있다고 가정합시다. -`GorillaDB` 는 key-value로 바나나들을 저장하고 있습니다. 우리는 바바나를 다음과 같이 저장할 수 있습니다 : +`GorillaDB` 는 key-value로 바나나들을 저장하고 있습니다. 우리는 바나나를 다음과 같이 저장할 수 있습니다 : ```swift let database = GorillaDB() diff --git a/Carthage/Checkouts/Quick/Documentation/ko-kr/InstallingQuick.md b/Carthage/Checkouts/Quick/Documentation/ko-kr/InstallingQuick.md index 8596930..6b875d5 100644 --- a/Carthage/Checkouts/Quick/Documentation/ko-kr/InstallingQuick.md +++ b/Carthage/Checkouts/Quick/Documentation/ko-kr/InstallingQuick.md @@ -72,7 +72,7 @@ Git 서브모듈에 대한 자세한 내용은 [여기](http://git-scm.com/book 먼저, 코코아팟의 버전을 0.36.0 이상의 버전으로 업데이트하세요. Swift를 사용하여 코코아팟을 설치하는 데 필요합니다. -그리고, Quick과 Nimble을 Podfile 에 추가하세요. 또한, ```use_frameworks!```은 코코아팟에서 Swift를 사용하기 데 필요합니다: +그리고, Quick과 Nimble을 Podfile 에 추가하세요. 또한, ```use_frameworks!```은 코코아팟에서 Swift를 사용하기에 필요합니다: ```rb diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/.swift-version b/Carthage/Checkouts/Quick/Externals/Nimble/.swift-version index 9f55b2c..bf77d54 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/.swift-version +++ b/Carthage/Checkouts/Quick/Externals/Nimble/.swift-version @@ -1 +1 @@ -3.0 +4.2 diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/.swiftlint.yml b/Carthage/Checkouts/Quick/Externals/Nimble/.swiftlint.yml index cb105e7..146ea6a 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/.swiftlint.yml +++ b/Carthage/Checkouts/Quick/Externals/Nimble/.swiftlint.yml @@ -1,8 +1,5 @@ disabled_rules: - - todo - - variable_name - - force_try - - force_cast + - included: - Sources @@ -10,6 +7,8 @@ included: excluded: - Carthage/Checkouts + - Tests/NimbleTests/XCTestManifests.swift + - Tests/NimbleTests/Helpers/XCTestCaseProvider.swift trailing_comma: mandatory_comma: true @@ -17,3 +16,16 @@ trailing_comma: line_length: ignores_comments: true ignores_function_declarations: true + +identifier_name: + max_length: 50 + excluded: + - x + - l + - r + - e + - n1 + - n2 + - to + allowed_symbols: + - _ diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/.travis.yml b/Carthage/Checkouts/Quick/Externals/Nimble/.travis.yml index 23ce159..fb72977 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/.travis.yml +++ b/Carthage/Checkouts/Quick/Externals/Nimble/.travis.yml @@ -1,51 +1,52 @@ -osx_image: xcode8.3 +osx_image: xcode10.1 language: generic matrix: include: - os: osx sudo: required env: TYPE=podspec + install: bundle install + name: CocoaPods Lint - os: osx - env: TYPE=ios NIMBLE_RUNTIME_IOS_SDK_VERSION=10.0 + env: TYPE=ios + name: iOS / Swift 4.2.1 - os: osx - env: TYPE=tvos NIMBLE_RUNTIME_TVOS_SDK_VERSION=10.0 + env: TYPE=tvos + name: tvOS / Swift 4.2.1 - os: osx env: TYPE=macos + name: macOS / Swift 4.2.1 - os: osx env: TYPE=macos - osx_image: xcode9 + osx_image: xcode10.2 + name: macOS / Swift 5.0 - os: osx - env: TYPE=macos - osx_image: xcode9.1 + env: + - TYPE=swiftpm - os: osx - env: TYPE=macos - osx_image: xcode9.2 - - os: osx - env: TYPE=macos - osx_image: xcode9.3 - - os: osx - env: TYPE=macos - osx_image: xcode9.4 - - os: osx - env: TYPE=swiftpm - - os: osx - env: TYPE=swiftpm - osx_image: xcode9 - - os: linux - dist: trusty - sudo: required - env: TYPE=swiftpm - install: - - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" - - os: linux + env: + - TYPE=swiftpm + osx_image: xcode10.2 + - &linux + name: Linux / Swift 4.2.1 + os: linux dist: trusty sudo: required env: - TYPE=swiftpm - - SWIFT_VERSION=4.0.2 + - SWIFT_VERSION=4.2.1 install: - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" -install: - - if [[ "$TYPE" == "podspec" ]]; then sudo gem install bundler; bundle install; fi + - <<: *linux + name: Linux / Swift 5.0 Development + env: + - TYPE=swiftpm + - SWIFT_VERSION=5.0-DEVELOPMENT-SNAPSHOT-2019-02-28-a + install: + - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" +install: true script: - ./test $TYPE + +notifications: + email: false diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile b/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile index eca9219..206f109 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile @@ -1,4 +1,4 @@ # A sample Gemfile source "https://rubygems.org" -gem 'cocoapods', '1.5.0' +gem 'cocoapods', '~> 1.6.0.rc.2' diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile.lock b/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile.lock index 36a0839..cc03cbf 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile.lock +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile.lock @@ -2,75 +2,75 @@ GEM remote: https://rubygems.org/ specs: CFPropertyList (3.0.0) - activesupport (4.2.10) + activesupport (4.2.11) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - atomos (0.1.2) + atomos (0.1.3) claide (1.0.2) - cocoapods (1.5.0) + cocoapods (1.6.0.rc.2) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.5.0) + cocoapods-core (= 1.6.0.rc.2) cocoapods-deintegrate (>= 1.0.2, < 2.0) - cocoapods-downloader (>= 1.2.0, < 2.0) + cocoapods-downloader (>= 1.2.2, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) cocoapods-stats (>= 1.0.0, < 2.0) - cocoapods-trunk (>= 1.3.0, < 2.0) + cocoapods-trunk (>= 1.3.1, < 2.0) cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) - fourflusher (~> 2.0.1) + fourflusher (>= 2.2.0, < 3.0) gh_inspector (~> 1.0) - molinillo (~> 0.6.5) + molinillo (~> 0.6.6) nap (~> 1.0) - ruby-macho (~> 1.1) - xcodeproj (>= 1.5.7, < 2.0) - cocoapods-core (1.5.0) + ruby-macho (~> 1.3, >= 1.3.1) + xcodeproj (>= 1.8.0, < 2.0) + cocoapods-core (1.6.0.rc.2) activesupport (>= 4.0.2, < 6) fuzzy_match (~> 2.0.4) nap (~> 1.0) cocoapods-deintegrate (1.0.2) - cocoapods-downloader (1.2.0) + cocoapods-downloader (1.2.2) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) - cocoapods-stats (1.0.0) - cocoapods-trunk (1.3.0) + cocoapods-stats (1.1.0) + cocoapods-trunk (1.3.1) nap (>= 0.8, < 2.0) netrc (~> 0.11) cocoapods-try (1.1.0) colored2 (3.1.2) - concurrent-ruby (1.0.5) + concurrent-ruby (1.1.4) escape (0.0.4) - fourflusher (2.0.1) + fourflusher (2.2.0) fuzzy_match (2.0.4) gh_inspector (1.1.3) i18n (0.9.5) concurrent-ruby (~> 1.0) minitest (5.11.3) - molinillo (0.6.5) - nanaimo (0.2.5) + molinillo (0.6.6) + nanaimo (0.2.6) nap (1.1.0) netrc (0.11.0) - ruby-macho (1.1.0) + ruby-macho (1.3.1) thread_safe (0.3.6) tzinfo (1.2.5) thread_safe (~> 0.1) - xcodeproj (1.5.7) + xcodeproj (1.8.0) CFPropertyList (>= 2.3.3, < 4.0) - atomos (~> 0.1.2) + atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) - nanaimo (~> 0.2.4) + nanaimo (~> 0.2.6) PLATFORMS ruby DEPENDENCIES - cocoapods (= 1.5.0) + cocoapods (~> 1.6.0.rc.2) BUNDLED WITH - 1.16.1 + 1.17.2 diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.podspec b/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.podspec index 93cbdda..d66190b 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.podspec +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Nimble" - s.version = "7.1.3" + s.version = "8.0.0" s.summary = "A Matcher Framework for Swift and Objective-C" s.description = <<-DESC Use Nimble to express the expected outcomes of Swift or Objective-C expressions. Inspired by Cedar. @@ -49,4 +49,7 @@ Pod::Spec.new do |s| 'OTHER_SWIFT_FLAGS' => '$(inherited) -suppress-warnings', 'FRAMEWORK_SEARCH_PATHS' => '$(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks"', } + + s.cocoapods_version = '>= 1.4.0' + s.swift_version = '4.2' end diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/project.pbxproj b/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/project.pbxproj index 0a2224e..2bf9a6a 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/project.pbxproj +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/project.pbxproj @@ -23,8 +23,8 @@ /* Begin PBXBuildFile section */ 1F0648CC19639F5A001F9C46 /* ObjectWithLazyProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */; }; 1F0648CD19639F5A001F9C46 /* ObjectWithLazyProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */; }; - 1F0648D41963AAB2001F9C46 /* SynchronousTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTests.swift */; }; - 1F0648D51963AAB2001F9C46 /* SynchronousTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTests.swift */; }; + 1F0648D41963AAB2001F9C46 /* SynchronousTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */; }; + 1F0648D51963AAB2001F9C46 /* SynchronousTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */; }; 1F14FB64194180C5009F2A08 /* utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F14FB63194180C5009F2A08 /* utils.swift */; }; 1F1871C51CA89EDB00A34BF2 /* DSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1871BC1CA89EDB00A34BF2 /* DSL.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1F1871C61CA89EDB00A34BF2 /* DSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871BD1CA89EDB00A34BF2 /* DSL.m */; }; @@ -50,10 +50,10 @@ 1F1871E01CA89EF600A34BF2 /* DSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1871BC1CA89EDB00A34BF2 /* DSL.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1F1871E11CA89EF600A34BF2 /* NMBExceptionCapture.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1871BE1CA89EDB00A34BF2 /* NMBExceptionCapture.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1F1871E21CA89EF600A34BF2 /* NMBStringify.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1871C01CA89EDB00A34BF2 /* NMBStringify.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 1F1871E41CA89FB600A34BF2 /* AsyncMatcherWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* AsyncMatcherWrapper.swift */; }; + 1F1871E41CA89FB600A34BF2 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* Async.swift */; }; 1F1871E61CA89FCD00A34BF2 /* MatcherFunc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */; }; - 1F1871E71CA8A18400A34BF2 /* AsyncMatcherWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* AsyncMatcherWrapper.swift */; }; - 1F1871E81CA8A18400A34BF2 /* AsyncMatcherWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* AsyncMatcherWrapper.swift */; }; + 1F1871E71CA8A18400A34BF2 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* Async.swift */; }; + 1F1871E81CA8A18400A34BF2 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* Async.swift */; }; 1F1871E91CA8A18700A34BF2 /* MatcherFunc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */; }; 1F1871EB1CA8A18800A34BF2 /* MatcherFunc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */; }; 1F1A742F1940169200FFFC47 /* Nimble.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1A742E1940169200FFFC47 /* Nimble.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -143,11 +143,11 @@ 1F5DF1891BDCA0F500C3A531 /* RaisesException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1E1968AB07008ED995 /* RaisesException.swift */; }; 1F5DF18A1BDCA0F500C3A531 /* ThrowError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29EA59651B551EE6002D767E /* ThrowError.swift */; }; 1F5DF18B1BDCA0F500C3A531 /* Functional.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD251968AB07008ED995 /* Functional.swift */; }; - 1F5DF18C1BDCA0F500C3A531 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Async.swift */; }; + 1F5DF18C1BDCA0F500C3A531 /* Await.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Await.swift */; }; 1F5DF18D1BDCA0F500C3A531 /* SourceLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD271968AB07008ED995 /* SourceLocation.swift */; }; 1F5DF18E1BDCA0F500C3A531 /* Stringers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD281968AB07008ED995 /* Stringers.swift */; }; 1F5DF1921BDCA10200C3A531 /* AsynchronousTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F925EE5195C121200ED456B /* AsynchronousTest.swift */; }; - 1F5DF1931BDCA10200C3A531 /* SynchronousTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTests.swift */; }; + 1F5DF1931BDCA10200C3A531 /* SynchronousTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */; }; 1F5DF1941BDCA10200C3A531 /* UserDescriptionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965B0D0B1B62C06D0005AE66 /* UserDescriptionTest.swift */; }; 1F5DF1951BDCA10200C3A531 /* utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F14FB63194180C5009F2A08 /* utils.swift */; }; 1F5DF1961BDCA10200C3A531 /* ObjectWithLazyProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */; }; @@ -273,8 +273,8 @@ 1FD8CD5B1968AB07008ED995 /* Equal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1C1968AB07008ED995 /* Equal.swift */; }; 1FD8CD5E1968AB07008ED995 /* RaisesException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1E1968AB07008ED995 /* RaisesException.swift */; }; 1FD8CD5F1968AB07008ED995 /* RaisesException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1E1968AB07008ED995 /* RaisesException.swift */; }; - 1FD8CD6A1968AB07008ED995 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Async.swift */; }; - 1FD8CD6B1968AB07008ED995 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Async.swift */; }; + 1FD8CD6A1968AB07008ED995 /* Await.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Await.swift */; }; + 1FD8CD6B1968AB07008ED995 /* Await.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Await.swift */; }; 1FDBD8671AF8A4FF0089F27B /* AssertionDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FDBD8661AF8A4FF0089F27B /* AssertionDispatcher.swift */; }; 1FDBD8681AF8A4FF0089F27B /* AssertionDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FDBD8661AF8A4FF0089F27B /* AssertionDispatcher.swift */; }; 1FE661571E6574E30035F243 /* ExpectationMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FE661561E6574E20035F243 /* ExpectationMessage.swift */; }; @@ -347,6 +347,13 @@ AE7ADE491C80C00D00B94CD3 /* MatchErrorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */; }; AE7ADE4A1C80C00D00B94CD3 /* MatchErrorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */; }; AE7ADE4B1C80C00D00B94CD3 /* MatchErrorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */; }; + B20058C120E92C7500C1264D /* ElementsEqual.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C020E92C7500C1264D /* ElementsEqual.swift */; }; + B20058C220E92CA900C1264D /* ElementsEqual.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C020E92C7500C1264D /* ElementsEqual.swift */; }; + B20058C320E92CA900C1264D /* ElementsEqual.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C020E92C7500C1264D /* ElementsEqual.swift */; }; + B20058C520E92CE400C1264D /* ElementsEqualTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C420E92CE400C1264D /* ElementsEqualTest.swift */; }; + B20058C620E92CE400C1264D /* ElementsEqualTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C420E92CE400C1264D /* ElementsEqualTest.swift */; }; + B20058C720E92CE400C1264D /* ElementsEqualTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C420E92CE400C1264D /* ElementsEqualTest.swift */; }; + CD037213207DCC580047AF28 /* XCTestManifests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD037212207DCC580047AF28 /* XCTestManifests.swift */; }; CD79C99E1D2CC832004B6F9A /* ObjCAsyncTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F4A56651A3B305F009E1637 /* ObjCAsyncTest.m */; }; CD79C99F1D2CC835004B6F9A /* ObjCSyncTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F8A37AF1B7C5042001C8357 /* ObjCSyncTest.m */; }; CD79C9A01D2CC839004B6F9A /* ObjCBeAnInstanceOfTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F4A56691A3B3108009E1637 /* ObjCBeAnInstanceOfTest.m */; }; @@ -487,7 +494,7 @@ /* Begin PBXFileReference section */ 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectWithLazyProperty.swift; sourceTree = ""; }; - 1F0648D31963AAB2001F9C46 /* SynchronousTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SynchronousTests.swift; sourceTree = ""; }; + 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SynchronousTest.swift; sourceTree = ""; }; 1F14FB63194180C5009F2A08 /* utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = utils.swift; sourceTree = ""; }; 1F1871BC1CA89EDB00A34BF2 /* DSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DSL.h; sourceTree = ""; }; 1F1871BD1CA89EDB00A34BF2 /* DSL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DSL.m; sourceTree = ""; }; @@ -498,7 +505,7 @@ 1F1871C21CA89EDB00A34BF2 /* NMBExpectation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NMBExpectation.swift; sourceTree = ""; }; 1F1871C31CA89EDB00A34BF2 /* NMBObjCMatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NMBObjCMatcher.swift; sourceTree = ""; }; 1F1871CD1CA89EE000A34BF2 /* ExceptionCapture.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExceptionCapture.swift; sourceTree = ""; }; - 1F1871E31CA89FB600A34BF2 /* AsyncMatcherWrapper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AsyncMatcherWrapper.swift; sourceTree = ""; }; + 1F1871E31CA89FB600A34BF2 /* Async.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Async.swift; sourceTree = ""; }; 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatcherFunc.swift; sourceTree = ""; }; 1F1A74291940169200FFFC47 /* Nimble.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 1F1A742D1940169200FFFC47 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -582,7 +589,7 @@ 1FD8CD1D1968AB07008ED995 /* MatcherProtocols.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatcherProtocols.swift; sourceTree = ""; }; 1FD8CD1E1968AB07008ED995 /* RaisesException.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = RaisesException.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 1FD8CD251968AB07008ED995 /* Functional.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Functional.swift; sourceTree = ""; }; - 1FD8CD261968AB07008ED995 /* Async.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Async.swift; sourceTree = ""; }; + 1FD8CD261968AB07008ED995 /* Await.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Await.swift; sourceTree = ""; }; 1FD8CD271968AB07008ED995 /* SourceLocation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SourceLocation.swift; sourceTree = ""; }; 1FD8CD281968AB07008ED995 /* Stringers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Stringers.swift; sourceTree = ""; }; 1FDBD8661AF8A4FF0089F27B /* AssertionDispatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssertionDispatcher.swift; sourceTree = ""; }; @@ -612,6 +619,9 @@ AE4BA9AC1C88DDB500B73906 /* Errors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Errors.swift; sourceTree = ""; }; AE7ADE441C80BF8000B94CD3 /* MatchError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatchError.swift; sourceTree = ""; }; AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatchErrorTest.swift; sourceTree = ""; }; + B20058C020E92C7500C1264D /* ElementsEqual.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementsEqual.swift; sourceTree = ""; }; + B20058C420E92CE400C1264D /* ElementsEqualTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementsEqualTest.swift; sourceTree = ""; }; + CD037212207DCC580047AF28 /* XCTestManifests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTestManifests.swift; sourceTree = ""; }; CDFB6A1E1F7E07C600AD8CC7 /* CwlCatchException.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlCatchException.swift; sourceTree = ""; }; CDFB6A201F7E07C600AD8CC7 /* CwlCatchException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CwlCatchException.m; sourceTree = ""; }; CDFB6A221F7E07C600AD8CC7 /* CwlCatchException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlCatchException.h; sourceTree = ""; }; @@ -768,9 +778,10 @@ isa = PBXGroup; children = ( 1F925EE5195C121200ED456B /* AsynchronousTest.swift */, - 1F0648D31963AAB2001F9C46 /* SynchronousTests.swift */, + 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */, 965B0D0B1B62C06D0005AE66 /* UserDescriptionTest.swift */, 6CAEDD091CAEA86F003F1584 /* LinuxSupport.swift */, + CD037212207DCC580047AF28 /* XCTestManifests.swift */, 1FFD729A1963FC8200CD29A2 /* objc */, 1F14FB61194180A7009F2A08 /* Helpers */, 1F925EE3195C11B000ED456B /* Matchers */, @@ -810,6 +821,7 @@ 1F925F01195C189500ED456B /* ContainTest.swift */, 1F925EFE195C187600ED456B /* EndWithTest.swift */, 1F925F04195C18B700ED456B /* EqualTest.swift */, + B20058C420E92CE400C1264D /* ElementsEqualTest.swift */, 472FD1361B9E094B00C7B8DA /* HaveCountTest.swift */, DDB4D5EF19FE442800E9D9FE /* MatchTest.swift */, 1F925EEB195C12C800ED456B /* RaisesExceptionTest.swift */, @@ -843,7 +855,7 @@ isa = PBXGroup; children = ( DDB1BC781A92235600F743C3 /* AllPass.swift */, - 1F1871E31CA89FB600A34BF2 /* AsyncMatcherWrapper.swift */, + 1F1871E31CA89FB600A34BF2 /* Async.swift */, 1FD8CD0E1968AB07008ED995 /* BeAKindOf.swift */, 1FD8CD0D1968AB07008ED995 /* BeAnInstanceOf.swift */, 1FD8CD0F1968AB07008ED995 /* BeCloseTo.swift */, @@ -861,6 +873,7 @@ 7B13BA051DD360AA00C9098C /* ContainElementSatisfying.swift */, 1FD8CD1B1968AB07008ED995 /* EndWith.swift */, 1FD8CD1C1968AB07008ED995 /* Equal.swift */, + B20058C020E92C7500C1264D /* ElementsEqual.swift */, 472FD1341B9E085700C7B8DA /* HaveCount.swift */, DDB4D5EC19FE43C200E9D9FE /* Match.swift */, 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */, @@ -882,7 +895,7 @@ isa = PBXGroup; children = ( 1FD8CD251968AB07008ED995 /* Functional.swift */, - 1FD8CD261968AB07008ED995 /* Async.swift */, + 1FD8CD261968AB07008ED995 /* Await.swift */, 1FD8CD271968AB07008ED995 /* SourceLocation.swift */, 1FD8CD281968AB07008ED995 /* Stringers.swift */, AE4BA9AC1C88DDB500B73906 /* Errors.swift */, @@ -1081,9 +1094,9 @@ isa = PBXNativeTarget; buildConfigurationList = 1F1A743F1940169200FFFC47 /* Build configuration list for PBXNativeTarget "Nimble-iOS" */; buildPhases = ( + 1F1A74261940169200FFFC47 /* Headers */, 1F1A74241940169200FFFC47 /* Sources */, 1F1A74251940169200FFFC47 /* Frameworks */, - 1F1A74261940169200FFFC47 /* Headers */, 1F1A74271940169200FFFC47 /* Resources */, ); buildRules = ( @@ -1120,9 +1133,9 @@ isa = PBXNativeTarget; buildConfigurationList = 1F5DF16A1BDCA0CE00C3A531 /* Build configuration list for PBXNativeTarget "Nimble-tvOS" */; buildPhases = ( + 1F5DF1521BDCA0CE00C3A531 /* Headers */, 1F5DF1501BDCA0CE00C3A531 /* Sources */, 1F5DF1511BDCA0CE00C3A531 /* Frameworks */, - 1F5DF1521BDCA0CE00C3A531 /* Headers */, 1F5DF1531BDCA0CE00C3A531 /* Resources */, ); buildRules = ( @@ -1156,9 +1169,9 @@ isa = PBXNativeTarget; buildConfigurationList = 1F925EC0195C0D6300ED456B /* Build configuration list for PBXNativeTarget "Nimble-macOS" */; buildPhases = ( + 1F925EAA195C0D6300ED456B /* Headers */, 1F925EA8195C0D6300ED456B /* Sources */, 1F925EA9195C0D6300ED456B /* Frameworks */, - 1F925EAA195C0D6300ED456B /* Headers */, 1F925EAB195C0D6300ED456B /* Resources */, ); buildRules = ( @@ -1343,6 +1356,7 @@ DDB4D5ED19FE43C200E9D9FE /* Match.swift in Sources */, 1F91DD311C74BF61002C309F /* BeVoid.swift in Sources */, 7B13BA0B1DD361D200C9098C /* ContainElementSatisfying.swift in Sources */, + B20058C220E92CA900C1264D /* ElementsEqual.swift in Sources */, 1FCF91531C61C8A400B15DCB /* PostNotification.swift in Sources */, 1FD8CD2E1968AB07008ED995 /* AssertionRecorder.swift in Sources */, 29EA59661B551EE6002D767E /* ThrowError.swift in Sources */, @@ -1366,11 +1380,11 @@ 1FE661581E6574E30035F243 /* ExpectationMessage.swift in Sources */, 1F1871E61CA89FCD00A34BF2 /* MatcherFunc.swift in Sources */, 1FD8CD421968AB07008ED995 /* BeEmpty.swift in Sources */, - 1F1871E41CA89FB600A34BF2 /* AsyncMatcherWrapper.swift in Sources */, + 1F1871E41CA89FB600A34BF2 /* Async.swift in Sources */, 1F1871CA1CA89EDB00A34BF2 /* NMBStringify.m in Sources */, A8A3B6EB2071487E00E25A08 /* SatisfyAllOf.swift in Sources */, 1FD8CD521968AB07008ED995 /* BeNil.swift in Sources */, - 1FD8CD6A1968AB07008ED995 /* Async.swift in Sources */, + 1FD8CD6A1968AB07008ED995 /* Await.swift in Sources */, CDFB6A241F7E07C700AD8CC7 /* CwlCatchException.swift in Sources */, 1FD8CD581968AB07008ED995 /* EndWith.swift in Sources */, 1FD8CD341968AB07008ED995 /* DSL.swift in Sources */, @@ -1427,6 +1441,7 @@ 1F4A56911A3B344A009E1637 /* ObjCBeNilTest.m in Sources */, 1F8A37B01B7C5042001C8357 /* ObjCSyncTest.m in Sources */, 1F4A56941A3B346F009E1637 /* ObjCContainTest.m in Sources */, + B20058C620E92CE400C1264D /* ElementsEqualTest.swift in Sources */, 1F299EAB19627B2D002641AF /* BeEmptyTest.swift in Sources */, 7B13BA111DD361EB00C9098C /* ObjCContainElementSatisfyingTest.m in Sources */, 1F925EF6195C147800ED456B /* BeCloseToTest.swift in Sources */, @@ -1441,7 +1456,7 @@ 1F4A56851A3B33A0009E1637 /* ObjCBeTruthyTest.m in Sources */, DD9A9A8F19CF439B00706F49 /* BeIdenticalToObjectTest.swift in Sources */, 1F4BB8B71DACA0E40048464B /* ThrowAssertionTest.swift in Sources */, - 1F0648D41963AAB2001F9C46 /* SynchronousTests.swift in Sources */, + 1F0648D41963AAB2001F9C46 /* SynchronousTest.swift in Sources */, 347155CA1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */, 4793854D1BA0BB2500296F85 /* ObjCHaveCountTest.m in Sources */, 1F925F08195C18CF00ED456B /* BeGreaterThanTest.swift in Sources */, @@ -1470,7 +1485,7 @@ 1F5DF1751BDCA0F500C3A531 /* FailureMessage.swift in Sources */, A8A3B6EC2071487F00E25A08 /* SatisfyAllOf.swift in Sources */, 1F5DF1801BDCA0F500C3A531 /* BeLessThanOrEqual.swift in Sources */, - 1F1871E81CA8A18400A34BF2 /* AsyncMatcherWrapper.swift in Sources */, + 1F1871E81CA8A18400A34BF2 /* Async.swift in Sources */, 1F5DF18A1BDCA0F500C3A531 /* ThrowError.swift in Sources */, 1F5DF1891BDCA0F500C3A531 /* RaisesException.swift in Sources */, 1F5DF1761BDCA0F500C3A531 /* AllPass.swift in Sources */, @@ -1504,12 +1519,13 @@ 1F1871E91CA8A18700A34BF2 /* MatcherFunc.swift in Sources */, 1F5DF17A1BDCA0F500C3A531 /* BeEmpty.swift in Sources */, CDFB6A511F7E087500AD8CC7 /* CwlCatchBadInstructionPosix.swift in Sources */, - 1F5DF18C1BDCA0F500C3A531 /* Async.swift in Sources */, + 1F5DF18C1BDCA0F500C3A531 /* Await.swift in Sources */, 1F1871D81CA89EEF00A34BF2 /* NMBStringify.m in Sources */, 1F5DF1821BDCA0F500C3A531 /* BeNil.swift in Sources */, 1F5DF16F1BDCA0F500C3A531 /* AssertionDispatcher.swift in Sources */, 964CFEFF1C4FF48900513336 /* ThrowAssertion.swift in Sources */, 1F5DF1841BDCA0F500C3A531 /* EndWith.swift in Sources */, + B20058C320E92CA900C1264D /* ElementsEqual.swift in Sources */, 1F5DF18D1BDCA0F500C3A531 /* SourceLocation.swift in Sources */, 1F5DF1701BDCA0F500C3A531 /* DSL.swift in Sources */, CDD80B851F20307B0002CD65 /* MatcherProtocols.swift in Sources */, @@ -1562,11 +1578,12 @@ 1F5DF19C1BDCA10200C3A531 /* BeginWithTest.swift in Sources */, 1F5DF1A01BDCA10200C3A531 /* BeIdenticalToTest.swift in Sources */, 1F5DF19A1BDCA10200C3A531 /* BeCloseToTest.swift in Sources */, + B20058C720E92CE400C1264D /* ElementsEqualTest.swift in Sources */, 1F5DF1A61BDCA10200C3A531 /* EndWithTest.swift in Sources */, CD79C9A31D2CC841004B6F9A /* ObjCBeFalseTest.m in Sources */, 1F5DF1A71BDCA10200C3A531 /* EqualTest.swift in Sources */, CD79C9AA1D2CC848004B6F9A /* ObjCBeLessThanOrEqualToTest.m in Sources */, - 1F5DF1931BDCA10200C3A531 /* SynchronousTests.swift in Sources */, + 1F5DF1931BDCA10200C3A531 /* SynchronousTest.swift in Sources */, CD79C9A11D2CC83B004B6F9A /* ObjCBeCloseToTest.m in Sources */, 1F5DF19D1BDCA10200C3A531 /* BeGreaterThanOrEqualToTest.swift in Sources */, A8A3B6F7207329DE00E25A08 /* SatisfyAllOfTest.swift in Sources */, @@ -1605,7 +1622,7 @@ 1F43728E1A1B343F00EB80F8 /* Stringers.swift in Sources */, 1F43728C1A1B343C00EB80F8 /* SourceLocation.swift in Sources */, 1FD8CD4F1968AB07008ED995 /* BeLessThanOrEqual.swift in Sources */, - 1F1871E71CA8A18400A34BF2 /* AsyncMatcherWrapper.swift in Sources */, + 1F1871E71CA8A18400A34BF2 /* Async.swift in Sources */, 1FDBD8681AF8A4FF0089F27B /* AssertionDispatcher.swift in Sources */, 1F43728B1A1B343900EB80F8 /* Functional.swift in Sources */, AE4BA9AE1C88DDB500B73906 /* Errors.swift in Sources */, @@ -1618,6 +1635,7 @@ 1FD8CD2F1968AB07008ED995 /* AssertionRecorder.swift in Sources */, 7B13BA061DD360AA00C9098C /* ContainElementSatisfying.swift in Sources */, 1F91DD321C74BF61002C309F /* BeVoid.swift in Sources */, + B20058C120E92C7500C1264D /* ElementsEqual.swift in Sources */, 1FCF91541C61C8A400B15DCB /* PostNotification.swift in Sources */, DDB4D5EE19FE43C200E9D9FE /* Match.swift in Sources */, 29EA59671B551EE6002D767E /* ThrowError.swift in Sources */, @@ -1645,7 +1663,7 @@ 1F1871D41CA89EEE00A34BF2 /* NMBStringify.m in Sources */, A8F6B5BD2070186D00FCB5ED /* SatisfyAllOf.swift in Sources */, 1FD8CD531968AB07008ED995 /* BeNil.swift in Sources */, - 1FD8CD6B1968AB07008ED995 /* Async.swift in Sources */, + 1FD8CD6B1968AB07008ED995 /* Await.swift in Sources */, CDFB6A231F7E07C700AD8CC7 /* CwlCatchException.swift in Sources */, 964CFEFE1C4FF48900513336 /* ThrowAssertion.swift in Sources */, 1FD8CD591968AB07008ED995 /* EndWith.swift in Sources */, @@ -1676,10 +1694,12 @@ DDB4D5F119FE442800E9D9FE /* MatchTest.swift in Sources */, 1F4A56741A3B3210009E1637 /* ObjCBeginWithTest.m in Sources */, 1F4A56831A3B336F009E1637 /* ObjCBeLessThanOrEqualToTest.m in Sources */, + CD037213207DCC580047AF28 /* XCTestManifests.swift in Sources */, 7B13BA0D1DD361DE00C9098C /* ContainElementSatisfyingTest.swift in Sources */, 1F925F03195C189500ED456B /* ContainTest.swift in Sources */, A8A3B6FD2073644700E25A08 /* ObjcStringersTest.m in Sources */, 1F4A56891A3B33CB009E1637 /* ObjCBeFalsyTest.m in Sources */, + B20058C520E92CE400C1264D /* ElementsEqualTest.swift in Sources */, 1F4A568F1A3B342B009E1637 /* ObjCBeFalseTest.m in Sources */, 1F925F12195C190B00ED456B /* BeGreaterThanOrEqualToTest.swift in Sources */, 1F925EF0195C136500ED456B /* BeLogicalTest.swift in Sources */, @@ -1716,7 +1736,7 @@ 1F4A56861A3B33A0009E1637 /* ObjCBeTruthyTest.m in Sources */, DD9A9A9019CF43AD00706F49 /* BeIdenticalToObjectTest.swift in Sources */, 1F4BB8B61DACA0E30048464B /* ThrowAssertionTest.swift in Sources */, - 1F0648D51963AAB2001F9C46 /* SynchronousTests.swift in Sources */, + 1F0648D51963AAB2001F9C46 /* SynchronousTest.swift in Sources */, 347155CB1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */, 4793854E1BA0BB2500296F85 /* ObjCHaveCountTest.m in Sources */, 1F925F09195C18CF00ED456B /* BeGreaterThanTest.swift in Sources */, @@ -1836,13 +1856,13 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; TVOS_DEPLOYMENT_TARGET = 9.0; VERSIONING_SYSTEM = "apple-generic"; @@ -1895,12 +1915,12 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..3ddf867 --- /dev/null +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + BuildSystemType + Latest + + diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Package.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Package.swift index 8d0b745..dfa6226 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Package.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Package.swift @@ -1,11 +1,21 @@ -// swift-tools-version:3.0 - +// swift-tools-version:4.2 import PackageDescription let package = Package( name: "Nimble", - exclude: [ - "Sources/NimbleObjectiveC", - "Tests/NimbleTests/objc", - ] + products: [ + .library(name: "Nimble", targets: ["Nimble"]), + ], + targets: [ + .target( + name: "Nimble", + dependencies: [] + ), + .testTarget( + name: "NimbleTests", + dependencies: ["Nimble"], + exclude: ["objc"] + ), + ], + swiftLanguageVersions: [.v4_2] ) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Package@swift-4.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Package@swift-4.swift deleted file mode 100644 index 740b842..0000000 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Package@swift-4.swift +++ /dev/null @@ -1,22 +0,0 @@ -// swift-tools-version:4.0 - -import PackageDescription - -let package = Package( - name: "Nimble", - products: [ - .library(name: "Nimble", targets: ["Nimble"]), - ], - targets: [ - .target( - name: "Nimble", - dependencies: [] - ), - .testTarget( - name: "NimbleTests", - dependencies: ["Nimble"], - exclude: ["objc"] - ), - ], - swiftLanguageVersions: [4] -) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/README.md b/Carthage/Checkouts/Quick/Externals/Nimble/README.md index 19c562f..dde7fc4 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/README.md +++ b/Carthage/Checkouts/Quick/Externals/Nimble/README.md @@ -4,6 +4,7 @@ [![CocoaPods](https://img.shields.io/cocoapods/v/Nimble.svg)](https://cocoapods.org/pods/Nimble) [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Platforms](https://img.shields.io/cocoapods/p/Nimble.svg)](https://cocoapods.org/pods/Nimble) +[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com) Use Nimble to express the expected outcomes of Swift or Objective-C expressions. Inspired by @@ -306,8 +307,7 @@ In Nimble, it's easy to make expectations on values that are updated asynchronously. Just use `toEventually` or `toEventuallyNot`: ```swift -// Swift 3.0 and later - +// Swift DispatchQueue.main.async { ocean.add("dolphins") ocean.add("whales") @@ -316,17 +316,6 @@ expect(ocean).toEventually(contain("dolphins", "whales")) ``` -```swift -// Swift 2.3 and earlier - -dispatch_async(dispatch_get_main_queue()) { - ocean.add("dolphins") - ocean.add("whales") -} -expect(ocean).toEventually(contain("dolphins", "whales")) -``` - - ```objc // Objective-C @@ -857,11 +846,7 @@ Notes: ## Swift Error Handling -If you're using Swift 2.0 or newer, you can use the `throwError` matcher to check if an error is thrown. - -Note: -The following code sample references the `Swift.Error` protocol. -This is `Swift.ErrorProtocol` in versions of Swift prior to version 3.0. +You can use the `throwError` matcher to check if an error is thrown. ```swift // Swift @@ -1277,7 +1262,7 @@ public func equal(expectedValue: T?) -> Predicate { // Predicate { actual in ... } // // But shown with types here for clarity. - return Predicate { (actual: Expression) throws -> PredicateResult in + return Predicate { (actualExpression: Expression) throws -> PredicateResult in let msg = ExpectationMessage.expectedActualValueTo("equal <\(expectedValue)>") if let actualValue = try actualExpression.evaluate() { return PredicateResult( @@ -1673,11 +1658,11 @@ backported. The deprecating plan is a 3 major versions removal. Which is as follows: 1. Introduce new `Predicate` API, deprecation warning for old matcher APIs. - (Nimble `v7.x.x`) + (Nimble `v7.x.x` and `v8.x.x`) 2. Introduce warnings on migration-path features (`.predicate`, `Predicate`-constructors with similar arguments to old API). (Nimble - `v8.x.x`) - 3. Remove old API. (Nimble `v9.x.x`) + `v9.x.x`) + 3. Remove old API. (Nimble `v10.x.x`) # Installing Nimble diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift index 2e58fdf..abaf532 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift @@ -13,5 +13,6 @@ public protocol AssertionHandler { /// /// @see AssertionHandler public var NimbleAssertionHandler: AssertionHandler = { () -> AssertionHandler in + // swiftlint:disable:previous identifier_name return isXCTestAvailable() ? NimbleXCTestHandler() : NimbleXCTestUnavailableHandler() }() diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift index 740c392..0f5df59 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift @@ -37,21 +37,48 @@ public class AssertionRecorder: AssertionHandler { } } +extension NMBExceptionCapture { + internal func tryBlockThrows(_ unsafeBlock: () throws -> Void) throws { + var catchedError: Error? + tryBlock { + do { + try unsafeBlock() + } catch { + catchedError = error + } + } + if let error = catchedError { + throw error + } + } +} + /// Allows you to temporarily replace the current Nimble assertion handler with /// the one provided for the scope of the closure. /// /// Once the closure finishes, then the original Nimble assertion handler is restored. /// /// @see AssertionHandler -public func withAssertionHandler(_ tempAssertionHandler: AssertionHandler, closure: () throws -> Void) { +public func withAssertionHandler(_ tempAssertionHandler: AssertionHandler, + file: FileString = #file, + line: UInt = #line, + closure: () throws -> Void) { let environment = NimbleEnvironment.activeInstance let oldRecorder = environment.assertionHandler let capturer = NMBExceptionCapture(handler: nil, finally: ({ environment.assertionHandler = oldRecorder })) environment.assertionHandler = tempAssertionHandler - capturer.tryBlock { - try! closure() + + do { + try capturer.tryBlockThrows { + try closure() + } + } catch { + let failureMessage = FailureMessage() + failureMessage.stringValue = "unexpected error thrown: <\(error)>" + let location = SourceLocation(file: file, line: line) + tempAssertionHandler.assert(false, message: failureMessage, location: location) } } @@ -65,7 +92,7 @@ public func withAssertionHandler(_ tempAssertionHandler: AssertionHandler, closu /// assertion handler when this is true. Defaults to false. /// /// @see gatherFailingExpectations -public func gatherExpectations(silently: Bool = false, closure: @escaping () -> Void) -> [AssertionRecord] { +public func gatherExpectations(silently: Bool = false, closure: () -> Void) -> [AssertionRecord] { let previousRecorder = NimbleEnvironment.activeInstance.assertionHandler let recorder = AssertionRecorder() let handlers: [AssertionHandler] @@ -92,7 +119,7 @@ public func gatherExpectations(silently: Bool = false, closure: @escaping () -> /// /// @see gatherExpectations /// @see raiseException source for an example use case. -public func gatherFailingExpectations(silently: Bool = false, closure: @escaping () -> Void) -> [AssertionRecord] { +public func gatherFailingExpectations(silently: Bool = false, closure: () -> Void) -> [AssertionRecord] { let assertions = gatherExpectations(silently: silently, closure: closure) return assertions.filter { assertion in !assertion.success diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift index 5e1afd5..b3eb09a 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift @@ -1,10 +1,10 @@ import Foundation -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE private func from(objcPredicate: NMBPredicate) -> Predicate { return Predicate { actualExpression in - let result = objcPredicate.satisfies(({ try! actualExpression.evaluate() }), + let result = objcPredicate.satisfies(({ try actualExpression.evaluate() }), location: actualExpression.location) return result.toSwift() } @@ -15,6 +15,7 @@ internal struct ObjCMatcherWrapper: Matcher { func matches(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { return matcher.matches( + // swiftlint:disable:next force_try ({ try! actualExpression.evaluate() }), failureMessage: failureMessage, location: actualExpression.location) @@ -22,6 +23,7 @@ internal struct ObjCMatcherWrapper: Matcher { func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { return matcher.doesNotMatch( + // swiftlint:disable:next force_try ({ try! actualExpression.evaluate() }), failureMessage: failureMessage, location: actualExpression.location) @@ -30,11 +32,13 @@ internal struct ObjCMatcherWrapper: Matcher { // Equivalent to Expectation, but for Nimble's Objective-C interface public class NMBExpectation: NSObject { + // swiftlint:disable identifier_name internal let _actualBlock: () -> NSObject? internal var _negative: Bool internal let _file: FileString internal let _line: UInt internal var _timeout: TimeInterval = 1.0 + // swiftlint:enable identifier_name @objc public init(actualBlock: @escaping () -> NSObject?, negative: Bool, file: FileString, line: UInt) { self._actualBlock = actualBlock diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift index 0288b75..a91efe3 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift @@ -1,15 +1,17 @@ import Foundation -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) // swiftlint:disable line_length -public typealias MatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage) -> Bool -public typealias FullMatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage, _ shouldNotMatch: Bool) -> Bool +public typealias MatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage) throws -> Bool +public typealias FullMatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage, _ shouldNotMatch: Bool) throws -> Bool // swiftlint:enable line_length public class NMBObjCMatcher: NSObject, NMBMatcher { + // swiftlint:disable identifier_name let _match: MatcherBlock let _doesNotMatch: MatcherBlock + // swiftlint:enable identifier_name let canMatchNil: Bool public init(canMatchNil: Bool, matcher: @escaping MatcherBlock, notMatcher: @escaping MatcherBlock) { @@ -24,7 +26,7 @@ public class NMBObjCMatcher: NSObject, NMBMatcher { public convenience init(canMatchNil: Bool, matcher: @escaping MatcherBlock) { self.init(canMatchNil: canMatchNil, matcher: matcher, notMatcher: ({ actualExpression, failureMessage in - return !matcher(actualExpression, failureMessage) + return try !matcher(actualExpression, failureMessage) })) } @@ -34,9 +36,9 @@ public class NMBObjCMatcher: NSObject, NMBMatcher { public convenience init(canMatchNil: Bool, matcher: @escaping FullMatcherBlock) { self.init(canMatchNil: canMatchNil, matcher: ({ actualExpression, failureMessage in - return matcher(actualExpression, failureMessage, false) + return try matcher(actualExpression, failureMessage, false) }), notMatcher: ({ actualExpression, failureMessage in - return matcher(actualExpression, failureMessage, true) + return try matcher(actualExpression, failureMessage, true) })) } @@ -57,9 +59,14 @@ public class NMBObjCMatcher: NSObject, NMBMatcher { public func matches(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool { let expr = Expression(expression: actualBlock, location: location) - let result = _match( - expr, - failureMessage) + let result: Bool + do { + result = try _match(expr, failureMessage) + } catch let error { + failureMessage.stringValue = "unexpected error thrown: <\(error)>" + return false + } + if self.canMatch(Expression(expression: actualBlock, location: location), failureMessage: failureMessage) { return result } else { @@ -69,9 +76,14 @@ public class NMBObjCMatcher: NSObject, NMBMatcher { public func doesNotMatch(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool { let expr = Expression(expression: actualBlock, location: location) - let result = _doesNotMatch( - expr, - failureMessage) + let result: Bool + do { + result = try _doesNotMatch(expr, failureMessage) + } catch let error { + failureMessage.stringValue = "unexpected error thrown: <\(error)>" + return false + } + if self.canMatch(Expression(expression: actualBlock, location: location), failureMessage: failureMessage) { return result } else { diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift index e1b5432..1b2e8c0 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift @@ -3,7 +3,7 @@ import Foundation /// "Global" state of Nimble is stored here. Only DSL functions should access / be aware of this /// class' existence -internal class NimbleEnvironment { +internal class NimbleEnvironment: NSObject { static var activeInstance: NimbleEnvironment { get { let env = Thread.current.threadDictionary["NimbleEnvironment"] @@ -20,6 +20,7 @@ internal class NimbleEnvironment { } } + // swiftlint:disable:next todo // TODO: eventually migrate the global to this environment value var assertionHandler: AssertionHandler { get { return NimbleAssertionHandler } @@ -29,17 +30,14 @@ internal class NimbleEnvironment { var suppressTVOSAssertionWarning: Bool = false var awaiter: Awaiter - init() { - let timeoutQueue: DispatchQueue - if #available(OSX 10.10, *) { - timeoutQueue = DispatchQueue.global(qos: .userInitiated) - } else { - timeoutQueue = DispatchQueue.global(priority: .high) - } - + override init() { + let timeoutQueue = DispatchQueue.global(qos: .userInitiated) awaiter = Awaiter( waitLock: AssertionWaitLock(), asyncQueue: .main, - timeoutQueue: timeoutQueue) + timeoutQueue: timeoutQueue + ) + + super.init() } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift index c8d32ad..719bf44 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift @@ -64,7 +64,7 @@ class NimbleXCTestUnavailableHandler: AssertionHandler { #endif func isXCTestAvailable() -> Bool { -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) // XCTest is weakly linked and so may not be present return NSClassFromString("XCTestCase") != nil #else @@ -72,20 +72,19 @@ func isXCTestAvailable() -> Bool { #endif } -private func recordFailure(_ message: String, location: SourceLocation) { +public func recordFailure(_ message: String, location: SourceLocation) { #if SWIFT_PACKAGE XCTFail("\(message)", file: location.file, line: location.line) #else if let testCase = CurrentTestCaseTracker.sharedInstance.currentTestCase { - #if swift(>=4) let line = Int(location.line) - #else - let line = location.line - #endif testCase.recordFailure(withDescription: message, inFile: location.file, atLine: line, expected: true) } else { - let msg = "Attempted to report a test failure to XCTest while no test case was running. " + - "The failure was:\n\"\(message)\"\nIt occurred at: \(location.file):\(location.line)" + let msg = """ + Attempted to report a test failure to XCTest while no test case was running. The failure was: + \"\(message)\" + It occurred at: \(location.file):\(location.line) + """ NSException(name: .internalInconsistencyException, reason: msg, userInfo: nil).raise() } #endif diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NonObjectiveC/ExceptionCapture.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NonObjectiveC/ExceptionCapture.swift index 8f8d360..d0871fc 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NonObjectiveC/ExceptionCapture.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NonObjectiveC/ExceptionCapture.swift @@ -1,6 +1,6 @@ import Foundation -#if !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) +#if !canImport(Darwin) // swift-corelibs-foundation doesn't provide NSException at all, so provide a dummy class NSException {} #endif diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/DSL+Wait.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/DSL+Wait.swift index e874136..c049417 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/DSL+Wait.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/DSL+Wait.swift @@ -14,7 +14,7 @@ internal class NMBWait: NSObject { // About these kind of lines, `@objc` attributes are only required for Objective-C // support, so that should be conditional on Darwin platforms and normal Xcode builds // (non-SwiftPM builds). -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE @objc internal class func until( timeout: TimeInterval, @@ -87,13 +87,19 @@ internal class NMBWait: NSObject { } } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE @objc(untilFile:line:action:) - internal class func until(_ file: FileString = #file, line: UInt = #line, action: @escaping (() -> Void) -> Void) { + internal class func until( + _ file: FileString = #file, + line: UInt = #line, + action: @escaping (@escaping () -> Void) -> Void) { until(timeout: 1, file: file, line: line, action: action) } #else - internal class func until(_ file: FileString = #file, line: UInt = #line, action: @escaping (() -> Void) -> Void) { + internal class func until( + _ file: FileString = #file, + line: UInt = #line, + action: @escaping (@escaping () -> Void) -> Void) { until(timeout: 1, file: file, line: line, action: action) } #endif diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/DSL.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/DSL.swift index e49bb0c..d6dc9cc 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/DSL.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/DSL.swift @@ -43,12 +43,13 @@ internal func nimblePrecondition( line: UInt = #line) { let result = expr() if !result { -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - let e = NSException( +#if canImport(Darwin) + let exception = NSException( name: NSExceptionName(name()), reason: message(), - userInfo: nil) - e.raise() + userInfo: nil + ) + exception.raise() #else preconditionFailure("\(name()) - \(message())", file: file, line: line) #endif @@ -56,9 +57,12 @@ internal func nimblePrecondition( } internal func internalError(_ msg: String, file: FileString = #file, line: UInt = #line) -> Never { + // swiftlint:disable line_length fatalError( - "Nimble Bug Found: \(msg) at \(file):\(line).\n" + - "Please file a bug to Nimble: https://github.com/Quick/Nimble/issues with the " + - "code snippet that caused this error." + """ + Nimble Bug Found: \(msg) at \(file):\(line). + Please file a bug to Nimble: https://github.com/Quick/Nimble/issues with the code snippet that caused this error. + """ ) + // swiftlint:enable line_length } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Expectation.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Expectation.swift index e3f616a..41625a1 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Expectation.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Expectation.swift @@ -1,23 +1,5 @@ import Foundation -// Deprecated -internal func expressionMatches(_ expression: Expression, matcher: U, to: String, description: String?) -> (Bool, FailureMessage) - where U: Matcher, U.ValueType == T { - let msg = FailureMessage() - msg.userDescription = description - msg.to = to - do { - let pass = try matcher.matches(expression, failureMessage: msg) - if msg.actualValue == "" { - msg.actualValue = "<\(stringify(try expression.evaluate()))>" - } - return (pass, msg) - } catch let error { - msg.stringValue = "unexpected error thrown: <\(error)>" - return (false, msg) - } -} - // Deprecated internal func expressionDoesNotMatch(_ expression: Expression, matcher: U, toNot: String, description: String?) -> (Bool, FailureMessage) where U: Matcher, U.ValueType == T { @@ -75,6 +57,10 @@ public struct Expectation { public let expression: Expression + public init(expression: Expression) { + self.expression = expression + } + public func verify(_ pass: Bool, _ message: FailureMessage) { let handler = NimbleEnvironment.activeInstance.assertionHandler handler.assert(pass, message: message, location: expression.location) @@ -85,8 +71,15 @@ public struct Expectation { /// DEPRECATED: Tests the actual value using a matcher to match. public func to(_ matcher: U, description: String? = nil) where U: Matcher, U.ValueType == T { - let (pass, msg) = expressionMatches(expression, matcher: matcher, to: "to", description: description) - verify(pass, msg) + let (pass, msg) = execute( + expression, + .toMatch, + matcher.predicate, + to: "to", + description: description, + captureExceptions: false + ) + verify(pass, msg) } /// DEPRECATED: Tests the actual value using a matcher to not match. @@ -127,6 +120,6 @@ public struct Expectation { } // see: - // - AsyncMatcherWrapper for extension + // - `async` for extension // - NMBExpectation for Objective-C interface } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/ExpectationMessage.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/ExpectationMessage.swift index 992ee0e..b0cbcc3 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/ExpectationMessage.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/ExpectationMessage.swift @@ -75,6 +75,7 @@ public indirect enum ExpectationMessage { } internal func visitLeafs(_ f: (ExpectationMessage) -> ExpectationMessage) -> ExpectationMessage { + // swiftlint:disable:previous identifier_name switch self { case .fail, .expectedTo, .expectedActualValueTo, .expectedCustomValueTo: return f(self) @@ -90,6 +91,7 @@ public indirect enum ExpectationMessage { /// Replaces a primary expectation with one returned by f. Preserves all composite expectations /// that were built upon it (aka - all appended(message:) and appended(details:). public func replacedExpectation(_ f: @escaping (ExpectationMessage) -> ExpectationMessage) -> ExpectationMessage { + // swiftlint:disable:previous identifier_name func walk(_ msg: ExpectationMessage) -> ExpectationMessage { switch msg { case .fail, .expectedTo, .expectedActualValueTo, .expectedCustomValueTo: @@ -124,6 +126,7 @@ public indirect enum ExpectationMessage { return visitLeafs(walk) } + // swiftlint:disable:next todo // TODO: test & verify correct behavior internal func prepended(message: String) -> ExpectationMessage { return .prepends(message, self) @@ -152,8 +155,10 @@ public indirect enum ExpectationMessage { // Backwards compatibility: converts ExpectationMessage tree to FailureMessage internal func update(failureMessage: FailureMessage) { switch self { - case let .fail(msg): + case let .fail(msg) where !msg.isEmpty: failureMessage.stringValue = msg + case .fail: + break case let .expectedTo(msg): failureMessage.actualValue = nil failureMessage.postfixMessage = msg @@ -181,32 +186,32 @@ public indirect enum ExpectationMessage { extension FailureMessage { internal func toExpectationMessage() -> ExpectationMessage { - let defaultMsg = FailureMessage() - if expected != defaultMsg.expected || _stringValueOverride != nil { + let defaultMessage = FailureMessage() + if expected != defaultMessage.expected || _stringValueOverride != nil { return .fail(stringValue) } - var msg: ExpectationMessage = .fail(userDescription ?? "") + var message: ExpectationMessage = .fail(userDescription ?? "") if actualValue != "" && actualValue != nil { - msg = .expectedCustomValueTo(postfixMessage, actualValue ?? "") - } else if postfixMessage != defaultMsg.postfixMessage { + message = .expectedCustomValueTo(postfixMessage, actualValue ?? "") + } else if postfixMessage != defaultMessage.postfixMessage { if actualValue == nil { - msg = .expectedTo(postfixMessage) + message = .expectedTo(postfixMessage) } else { - msg = .expectedActualValueTo(postfixMessage) + message = .expectedActualValueTo(postfixMessage) } } - if postfixActual != defaultMsg.postfixActual { - msg = .appends(msg, postfixActual) + if postfixActual != defaultMessage.postfixActual { + message = .appends(message, postfixActual) } - if let m = extendedMessage { - msg = .details(msg, m) + if let extended = extendedMessage { + message = .details(message, extended) } - return msg + return message } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) public class NMBExpectationMessage: NSObject { private let msg: ExpectationMessage diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Expression.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Expression.swift index 5a233fd..b6b2ee3 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Expression.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Expression.swift @@ -24,8 +24,10 @@ internal func memoizedClosure(_ closure: @escaping () throws -> T) -> (Bool) /// This provides a common consumable API for matchers to utilize to allow /// Nimble to change internals to how the captured closure is managed. public struct Expression { + // swiftlint:disable identifier_name internal let _expression: (Bool) throws -> T? internal let _withoutCaching: Bool + // swiftlint:enable identifier_name public let location: SourceLocation public let isClosure: Bool diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/FailureMessage.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/FailureMessage.swift index 2bc57eb..503b540 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/FailureMessage.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/FailureMessage.swift @@ -28,6 +28,7 @@ public class FailureMessage: NSObject { } } + // swiftlint:disable:next identifier_name internal var _stringValueOverride: String? internal var hasOverriddenStringValue: Bool { return _stringValueOverride != nil diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/AllPass.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/AllPass.swift index 8affa62..dbbccb9 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/AllPass.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/AllPass.swift @@ -63,12 +63,12 @@ private func createPredicate(_ elementMatcher: Predicate) } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func allPassMatcher(_ matcher: NMBMatcher) -> NMBPredicate { return NMBPredicate { actualExpression in let location = actualExpression.location - let actualValue = try! actualExpression.evaluate() + let actualValue = try actualExpression.evaluate() var nsObjects = [NSObject]() var collectionIsUsable = true @@ -99,10 +99,11 @@ extension NMBObjCMatcher { let expr = Expression(expression: ({ nsObjects }), location: location) let pred: Predicate<[NSObject]> = createPredicate(Predicate { expr in if let predicate = matcher as? NMBPredicate { - return predicate.satisfies(({ try! expr.evaluate() }), location: expr.location).toSwift() + return predicate.satisfies(({ try expr.evaluate() }), location: expr.location).toSwift() } else { let failureMessage = FailureMessage() let result = matcher.matches( + // swiftlint:disable:next force_try ({ try! expr.evaluate() }), failureMessage: failureMessage, location: expr.location @@ -114,7 +115,7 @@ extension NMBObjCMatcher { ) } }) - return try! pred.satisfies(expr).toObjectiveC() + return try pred.satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Async.swift similarity index 63% rename from Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift rename to Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Async.swift index 3cba8b0..5022fe2 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Async.swift @@ -23,92 +23,29 @@ private func async(style: ExpectationStyle, predicate: Predicate, timeout: } switch result { case .completed: return lastPredicateResult! - case .timedOut: return PredicateResult(status: .fail, message: lastPredicateResult!.message) + case .timedOut: + let message = lastPredicateResult?.message ?? .fail("timed out before returning a value") + return PredicateResult(status: .fail, message: message) case let .errorThrown(error): return PredicateResult(status: .fail, message: .fail("unexpected error thrown: <\(error)>")) case let .raisedException(exception): return PredicateResult(status: .fail, message: .fail("unexpected exception raised: \(exception)")) case .blockedRunLoop: // swiftlint:disable:next line_length - return PredicateResult(status: .fail, message: lastPredicateResult!.message.appended(message: " (timed out, but main thread was unresponsive).")) + let message = lastPredicateResult?.message.appended(message: " (timed out, but main run loop was unresponsive).") ?? + .fail("main run loop was unresponsive") + return PredicateResult(status: .fail, message: message) case .incomplete: - internalError("Reached .incomplete state for toEventually(...).") - } - } -} - -// Deprecated -internal struct AsyncMatcherWrapper: Matcher - where U: Matcher, U.ValueType == T { - let fullMatcher: U - let timeoutInterval: TimeInterval - let pollInterval: TimeInterval - - init(fullMatcher: U, timeoutInterval: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval) { - self.fullMatcher = fullMatcher - self.timeoutInterval = timeoutInterval - self.pollInterval = pollInterval - } - - func matches(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { - let uncachedExpression = actualExpression.withoutCaching() - let fnName = "expect(...).toEventually(...)" - let result = pollBlock( - pollInterval: pollInterval, - timeoutInterval: timeoutInterval, - file: actualExpression.location.file, - line: actualExpression.location.line, - fnName: fnName) { - try self.fullMatcher.matches(uncachedExpression, failureMessage: failureMessage) - } - switch result { - case let .completed(isSuccessful): return isSuccessful - case .timedOut: return false - case let .errorThrown(error): - failureMessage.stringValue = "an unexpected error thrown: <\(error)>" - return false - case let .raisedException(exception): - failureMessage.stringValue = "an unexpected exception thrown: <\(exception)>" - return false - case .blockedRunLoop: - failureMessage.postfixMessage += " (timed out, but main thread was unresponsive)." - return false - case .incomplete: - internalError("Reached .incomplete state for toEventually(...).") - } - } - - func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { - let uncachedExpression = actualExpression.withoutCaching() - let result = pollBlock( - pollInterval: pollInterval, - timeoutInterval: timeoutInterval, - file: actualExpression.location.file, - line: actualExpression.location.line, - fnName: "expect(...).toEventuallyNot(...)") { - try self.fullMatcher.doesNotMatch(uncachedExpression, failureMessage: failureMessage) - } - switch result { - case let .completed(isSuccessful): return isSuccessful - case .timedOut: return false - case let .errorThrown(error): - failureMessage.stringValue = "an unexpected error thrown: <\(error)>" - return false - case let .raisedException(exception): - failureMessage.stringValue = "an unexpected exception thrown: <\(exception)>" - return false - case .blockedRunLoop: - failureMessage.postfixMessage += " (timed out, but main thread was unresponsive)." - return false - case .incomplete: - internalError("Reached .incomplete state for toEventuallyNot(...).") + internalError("Reached .incomplete state for \(fnName)(...).") } } } private let toEventuallyRequiresClosureError = FailureMessage( - // swiftlint:disable:next line_length - stringValue: "expect(...).toEventually(...) requires an explicit closure (eg - expect { ... }.toEventually(...) )\nSwift 1.2 @autoclosure behavior has changed in an incompatible way for Nimble to function" + stringValue: """ + expect(...).toEventually(...) requires an explicit closure (eg - expect { ... }.toEventually(...) ) + Swift 1.2 @autoclosure behavior has changed in an incompatible way for Nimble to function + """ ) extension Expectation { @@ -182,14 +119,19 @@ extension Expectation { public func toEventually(_ matcher: U, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) where U: Matcher, U.ValueType == T { if expression.isClosure { - let (pass, msg) = expressionMatches( + let (pass, msg) = execute( expression, - matcher: AsyncMatcherWrapper( - fullMatcher: matcher, - timeoutInterval: timeout, - pollInterval: pollInterval), + .toMatch, + async( + style: .toMatch, + predicate: matcher.predicate, + timeout: timeout, + poll: pollInterval, + fnName: "toEventually" + ), to: "to eventually", - description: description + description: description, + captureExceptions: false ) verify(pass, msg) } else { @@ -208,10 +150,13 @@ extension Expectation { if expression.isClosure { let (pass, msg) = expressionDoesNotMatch( expression, - matcher: AsyncMatcherWrapper( - fullMatcher: matcher, - timeoutInterval: timeout, - pollInterval: pollInterval), + matcher: async( + style: .toNotMatch, + predicate: matcher.predicate, + timeout: timeout, + poll: pollInterval, + fnName: "toEventuallyNot" + ), toNot: "to eventually not", description: description ) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift index ac9d723..3a68b09 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift @@ -29,7 +29,7 @@ public func beAKindOf(_ expectedType: T.Type) -> Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) /// A Nimble matcher that succeeds when the actual value is an instance of the given class. /// @see beAnInstanceOf if you want to match against the exact class @@ -60,7 +60,7 @@ public func beAKindOf(_ expectedClass: AnyClass) -> Predicate { extension NMBObjCMatcher { @objc public class func beAKindOfMatcher(_ expected: AnyClass) -> NMBMatcher { return NMBPredicate { actualExpression in - return try! beAKindOf(expected).satisfies(actualExpression).toObjectiveC() + return try beAKindOf(expected).satisfies(actualExpression).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift index 5e2c850..3cef3a7 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift @@ -33,7 +33,7 @@ public func beAnInstanceOf(_ expectedClass: AnyClass) -> Predicate { } else { actualString = "" } - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) let matches = instance != nil && instance!.isMember(of: expectedClass) #else let matches = instance != nil && type(of: instance!) == expectedClass @@ -45,11 +45,11 @@ public func beAnInstanceOf(_ expectedClass: AnyClass) -> Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func beAnInstanceOfMatcher(_ expected: AnyClass) -> NMBMatcher { return NMBPredicate { actualExpression in - return try! beAnInstanceOf(expected).satisfies(actualExpression).toObjectiveC() + return try beAnInstanceOf(expected).satisfies(actualExpression).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift index 34fa1b8..d6fd1ee 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift @@ -1,5 +1,6 @@ import Foundation +// swiftlint:disable:next identifier_name public let DefaultDelta = 0.0001 internal func isCloseTo(_ actualValue: NMBDoubleConvertible?, @@ -34,10 +35,12 @@ public func beCloseTo(_ expectedValue: NMBDoubleConvertible, within delta: Doubl } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) public class NMBObjCBeCloseToMatcher: NSObject, NMBMatcher { + // swiftlint:disable identifier_name var _expected: NSNumber var _delta: CDouble + // swiftlint:enable identifier_name init(expected: NSNumber, within: CDouble) { _expected = expected _delta = within @@ -49,7 +52,13 @@ public class NMBObjCBeCloseToMatcher: NSObject, NMBMatcher { }) let expr = Expression(expression: actualBlock, location: location) let matcher = beCloseTo(self._expected, within: self._delta) - return try! matcher.matches(expr, failureMessage: failureMessage) + + do { + return try matcher.matches(expr, failureMessage: failureMessage) + } catch let error { + failureMessage.stringValue = "unexpected error thrown: <\(error)>" + return false + } } @objc public func doesNotMatch(_ actualExpression: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool { @@ -58,7 +67,13 @@ public class NMBObjCBeCloseToMatcher: NSObject, NMBMatcher { }) let expr = Expression(expression: actualBlock, location: location) let matcher = beCloseTo(self._expected, within: self._delta) - return try! matcher.doesNotMatch(expr, failureMessage: failureMessage) + + do { + return try matcher.doesNotMatch(expr, failureMessage: failureMessage) + } catch let error { + failureMessage.stringValue = "unexpected error thrown: <\(error)>" + return false + } } @objc public var within: (CDouble) -> NMBObjCBeCloseToMatcher { @@ -98,14 +113,17 @@ public func beCloseTo(_ expectedValues: [Double], within delta: Double = Default infix operator ≈ : ComparisonPrecedence +// swiftlint:disable:next identifier_name public func ≈(lhs: Expectation<[Double]>, rhs: [Double]) { lhs.to(beCloseTo(rhs)) } +// swiftlint:disable:next identifier_name public func ≈(lhs: Expectation, rhs: NMBDoubleConvertible) { lhs.to(beCloseTo(rhs)) } +// swiftlint:disable:next identifier_name public func ≈(lhs: Expectation, rhs: (expected: NMBDoubleConvertible, delta: Double)) { lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) } @@ -121,6 +139,7 @@ precedencegroup PlusMinusOperatorPrecedence { } infix operator ± : PlusMinusOperatorPrecedence +// swiftlint:disable:next identifier_name public func ±(lhs: NMBDoubleConvertible, rhs: Double) -> (expected: NMBDoubleConvertible, delta: Double) { return (expected: lhs, delta: rhs) } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeEmpty.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeEmpty.swift index 3cbc15d..79bf923 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeEmpty.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeEmpty.swift @@ -13,6 +13,17 @@ public func beEmpty() -> Predicate { } } +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For strings, it is an empty string. +public func beEmpty() -> Predicate { + return Predicate.simple("be empty") { actualExpression in + guard let actual = try actualExpression.evaluate() else { + return .fail + } + return PredicateStatus(bool: actual.isEmpty) + } +} + /// A Nimble matcher that succeeds when a value is "empty". For collections, this /// means the are no items in that collection. For strings, it is an empty string. public func beEmpty() -> Predicate { @@ -61,19 +72,19 @@ public func beEmpty() -> Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func beEmptyMatcher() -> NMBPredicate { return NMBPredicate { actualExpression in let location = actualExpression.location - let actualValue = try! actualExpression.evaluate() + let actualValue = try actualExpression.evaluate() if let value = actualValue as? NMBCollection { let expr = Expression(expression: ({ value as NMBCollection }), location: location) - return try! beEmpty().satisfies(expr).toObjectiveC() + return try beEmpty().satisfies(expr).toObjectiveC() } else if let value = actualValue as? NSString { let expr = Expression(expression: ({ value as String }), location: location) - return try! beEmpty().satisfies(expr).toObjectiveC() + return try beEmpty().satisfies(expr).toObjectiveC() } else if let actualValue = actualValue { // swiftlint:disable:next line_length let badTypeErrorMsg = "be empty (only works for NSArrays, NSSets, NSIndexSets, NSDictionaries, NSHashTables, and NSStrings)" diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift index 4370f19..4a4cdd2 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift @@ -30,12 +30,12 @@ public func > (lhs: Expectation, rhs: NMBComparable?) { lhs.to(beGreaterThan(rhs)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } - return try! beGreaterThan(expected).matches(expr, failureMessage: failureMessage) + return try beGreaterThan(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift index 55d8e7b..39d9e63 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift @@ -3,25 +3,25 @@ import Foundation /// A Nimble matcher that succeeds when the actual value is greater than /// or equal to the expected value. public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be greater than or equal to <\(stringify(expectedValue))>" + let message = "be greater than or equal to <\(stringify(expectedValue))>" + return Predicate.simple(message) { actualExpression in let actualValue = try actualExpression.evaluate() if let actual = actualValue, let expected = expectedValue { - return actual >= expected + return PredicateStatus(bool: actual >= expected) } - return false - }.requireNonNil + return .fail + } } /// A Nimble matcher that succeeds when the actual value is greater than /// or equal to the expected value. public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be greater than or equal to <\(stringify(expectedValue))>" + let message = "be greater than or equal to <\(stringify(expectedValue))>" + return Predicate.simple(message) { actualExpression in let actualValue = try actualExpression.evaluate() let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) != ComparisonResult.orderedAscending - return matches - }.requireNonNil + return PredicateStatus(bool: matches) + } } public func >=(lhs: Expectation, rhs: T) { @@ -32,12 +32,12 @@ public func >=(lhs: Expectation, rhs: T) { lhs.to(beGreaterThanOrEqualTo(rhs)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beGreaterThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func beGreaterThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } - return try! beGreaterThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage) + return try beGreaterThanOrEqualTo(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift index 5732922..49e503e 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift @@ -4,14 +4,14 @@ import Foundation /// as the expected instance. public func beIdenticalTo(_ expected: Any?) -> Predicate { return Predicate.define { actualExpression in - #if os(Linux) + #if os(Linux) && !swift(>=4.1.50) let actual = try actualExpression.evaluate() as? AnyObject #else let actual = try actualExpression.evaluate() as AnyObject? #endif let bool: Bool - #if os(Linux) + #if os(Linux) && !swift(>=4.1.50) bool = actual === (expected as? AnyObject) && actual !== nil #else bool = actual === (expected as AnyObject?) && actual !== nil @@ -41,12 +41,12 @@ public func be(_ expected: Any?) -> Predicate { return beIdenticalTo(expected) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beIdenticalToMatcher(_ expected: NSObject?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func beIdenticalToMatcher(_ expected: NSObject?) -> NMBMatcher { + return NMBPredicate { actualExpression in let aExpr = actualExpression.cast { $0 as Any? } - return try! beIdenticalTo(expected).matches(aExpr, failureMessage: failureMessage) + return try beIdenticalTo(expected).satisfies(aExpr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThan.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThan.swift index 8047efd..ef0a7d4 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThan.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThan.swift @@ -2,23 +2,23 @@ import Foundation /// A Nimble matcher that succeeds when the actual value is less than the expected value. public func beLessThan(_ expectedValue: T?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be less than <\(stringify(expectedValue))>" + let message = "be less than <\(stringify(expectedValue))>" + return Predicate.simple(message) { actualExpression in if let actual = try actualExpression.evaluate(), let expected = expectedValue { - return actual < expected + return PredicateStatus(bool: actual < expected) } - return false - }.requireNonNil + return .fail + } } /// A Nimble matcher that succeeds when the actual value is less than the expected value. public func beLessThan(_ expectedValue: NMBComparable?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be less than <\(stringify(expectedValue))>" + let message = "be less than <\(stringify(expectedValue))>" + return Predicate.simple(message) { actualExpression in let actualValue = try actualExpression.evaluate() let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) == ComparisonResult.orderedAscending - return matches - }.requireNonNil + return PredicateStatus(bool: matches) + } } public func <(lhs: Expectation, rhs: T) { @@ -29,12 +29,12 @@ public func < (lhs: Expectation, rhs: NMBComparable?) { lhs.to(beLessThan(rhs)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beLessThanMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func beLessThanMatcher(_ expected: NMBComparable?) -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } - return try! beLessThan(expected).matches(expr, failureMessage: failureMessage) + return try beLessThan(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift index f9e9f4e..30ce043 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift @@ -3,23 +3,22 @@ import Foundation /// A Nimble matcher that succeeds when the actual value is less than /// or equal to the expected value. public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be less than or equal to <\(stringify(expectedValue))>" + return Predicate.simple("be less than or equal to <\(stringify(expectedValue))>") { actualExpression in if let actual = try actualExpression.evaluate(), let expected = expectedValue { - return actual <= expected + return PredicateStatus(bool: actual <= expected) } - return false - }.requireNonNil + return .fail + } } /// A Nimble matcher that succeeds when the actual value is less than /// or equal to the expected value. public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be less than or equal to <\(stringify(expectedValue))>" + return Predicate.simple("be less than or equal to <\(stringify(expectedValue))>") { actualExpression in let actualValue = try actualExpression.evaluate() - return actualValue != nil && actualValue!.NMB_compare(expectedValue) != ComparisonResult.orderedDescending - }.requireNonNil + let matches = actualValue.map { $0.NMB_compare(expectedValue) != .orderedDescending } ?? false + return PredicateStatus(bool: matches) + } } public func <=(lhs: Expectation, rhs: T) { @@ -30,12 +29,12 @@ public func <=(lhs: Expectation, rhs: T) { lhs.to(beLessThanOrEqualTo(rhs)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beLessThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func beLessThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } - return try! beLessThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage) + return try beLessThanOrEqualTo(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLogical.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLogical.swift index 2b18b4c..788234b 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLogical.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLogical.swift @@ -100,14 +100,6 @@ public func beTruthy() -> Predicate< return Predicate.simpleNilable("be truthy") { actualExpression in let actualValue = try actualExpression.evaluate() if let actualValue = actualValue { - // FIXME: This is a workaround to SR-2290. - // See: - // - https://bugs.swift.org/browse/SR-2290 - // - https://github.com/norio-nomura/Nimble/pull/5#issuecomment-237835873 - if let number = actualValue as? NSNumber { - return PredicateStatus(bool: number.boolValue == true) - } - return PredicateStatus(bool: actualValue == (true as T)) } return PredicateStatus(bool: actualValue != nil) @@ -120,47 +112,42 @@ public func beFalsy() -> Predicate NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in + @objc public class func beTruthyMatcher() -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } - return try! beTruthy().matches(expr, failureMessage: failureMessage) + return try beTruthy().satisfies(expr).toObjectiveC() } } - @objc public class func beFalsyMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in + @objc public class func beFalsyMatcher() -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } - return try! beFalsy().matches(expr, failureMessage: failureMessage) + return try beFalsy().satisfies(expr).toObjectiveC() } } - @objc public class func beTrueMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in + @objc public class func beTrueMatcher() -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } - return try! beTrue().matches(expr, failureMessage: failureMessage) + return try beTrue().satisfies(expr).toObjectiveC() } } - @objc public class func beFalseMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } - return try! beFalse().matches(expr, failureMessage: failureMessage) + @objc public class func beFalseMatcher() -> NMBMatcher { + return NMBPredicate { actualExpression in + let expr = actualExpression.cast { value -> Bool? in + guard let value = value else { return nil } + return (value as? NSNumber)?.boolValue ?? false + } + return try beFalse().satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeNil.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeNil.swift index a22e0f4..0f21d41 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeNil.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeNil.swift @@ -8,11 +8,11 @@ public func beNil() -> Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beNilMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in - return try! beNil().matches(actualExpression, failureMessage: failureMessage) + @objc public class func beNilMatcher() -> NMBMatcher { + return NMBPredicate { actualExpression in + return try beNil().satisfies(actualExpression).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeVoid.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeVoid.swift index a9dbc28..9a7eafd 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeVoid.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeVoid.swift @@ -8,10 +8,12 @@ public func beVoid() -> Predicate<()> { } } -public func == (lhs: Expectation<()>, rhs: ()) { - lhs.to(beVoid()) -} +extension Expectation where T == () { + public static func == (lhs: Expectation<()>, rhs: ()) { + lhs.to(beVoid()) + } -public func != (lhs: Expectation<()>, rhs: ()) { - lhs.toNot(beVoid()) + public static func != (lhs: Expectation<()>, rhs: ()) { + lhs.toNot(beVoid()) + } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeginWith.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeginWith.swift index c2ab568..3183eb9 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeginWith.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeginWith.swift @@ -35,24 +35,24 @@ public func beginWith(_ startingElement: Any) -> Predicate public func beginWith(_ startingSubstring: String) -> Predicate { return Predicate.simple("begin with <\(startingSubstring)>") { actualExpression in if let actual = try actualExpression.evaluate() { - let range = actual.range(of: startingSubstring) - return PredicateStatus(bool: range != nil && range!.lowerBound == actual.startIndex) + return PredicateStatus(bool: actual.hasPrefix(startingSubstring)) } return .fail } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beginWithMatcher(_ expected: Any) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let actual = try! actualExpression.evaluate() - if (actual as? String) != nil { + @objc public class func beginWithMatcher(_ expected: Any) -> NMBMatcher { + return NMBPredicate { actualExpression in + let actual = try actualExpression.evaluate() + if actual is String { let expr = actualExpression.cast { $0 as? String } - return try! beginWith(expected as! String).matches(expr, failureMessage: failureMessage) + // swiftlint:disable:next force_cast + return try beginWith(expected as! String).satisfies(expr).toObjectiveC() } else { let expr = actualExpression.cast { $0 as? NMBOrderedCollection } - return try! beginWith(expected).matches(expr, failureMessage: failureMessage) + return try beginWith(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Contain.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Contain.swift index f1afb72..1d16fb1 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Contain.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Contain.swift @@ -1,22 +1,43 @@ import Foundation -/// A Nimble matcher that succeeds when the actual sequence contains the expected value. +/// A Nimble matcher that succeeds when the actual sequence contains the expected values. public func contain(_ items: T...) -> Predicate - where S.Iterator.Element == T { + where S.Element == T { return contain(items) } +/// A Nimble matcher that succeeds when the actual sequence contains the expected values. public func contain(_ items: [T]) -> Predicate - where S.Iterator.Element == T { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "contain <\(arrayAsString(items))>" + where S.Element == T { + return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in if let actual = try actualExpression.evaluate() { - return items.all { + let matches = items.allSatisfy { return actual.contains($0) } + return PredicateStatus(bool: matches) + } + return .fail + } +} + +/// A Nimble matcher that succeeds when the actual set contains the expected values. +public func contain(_ items: T...) -> Predicate + where S.Element == T { + return contain(items) +} + +/// A Nimble matcher that succeeds when the actual set contains the expected values. +public func contain(_ items: [T]) -> Predicate + where S.Element == T { + return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in + if let actual = try actualExpression.evaluate() { + let matches = items.allSatisfy { + return actual.contains($0) + } + return PredicateStatus(bool: matches) + } + return .fail } - return false - }.requireNonNil } /// A Nimble matcher that succeeds when the actual string contains the expected substring. @@ -25,16 +46,16 @@ public func contain(_ substrings: String...) -> Predicate { } public func contain(_ substrings: [String]) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "contain <\(arrayAsString(substrings))>" + return Predicate.simple("contain <\(arrayAsString(substrings))>") { actualExpression in if let actual = try actualExpression.evaluate() { - return substrings.all { + let matches = substrings.allSatisfy { let range = actual.range(of: $0) return range != nil && !range!.isEmpty } + return PredicateStatus(bool: matches) } - return false - }.requireNonNil + return .fail + } } /// A Nimble matcher that succeeds when the actual string contains the expected substring. @@ -43,13 +64,13 @@ public func contain(_ substrings: NSString...) -> Predicate { } public func contain(_ substrings: [NSString]) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "contain <\(arrayAsString(substrings))>" + return Predicate.simple("contain <\(arrayAsString(substrings))>") { actualExpression in if let actual = try actualExpression.evaluate() { - return substrings.all { actual.range(of: $0.description).length != 0 } + let matches = substrings.allSatisfy { actual.range(of: $0.description).length != 0 } + return PredicateStatus(bool: matches) } - return false - }.requireNonNil + return .fail + } } /// A Nimble matcher that succeeds when the actual collection contains the expected object. @@ -58,37 +79,45 @@ public func contain(_ items: Any?...) -> Predicate { } public func contain(_ items: [Any?]) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "contain <\(arrayAsString(items))>" - guard let actual = try actualExpression.evaluate() else { return false } - return items.all { item in - return item != nil && actual.contains(item!) + return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + let matches = items.allSatisfy { item in + return item.map { actual.contains($0) } ?? false } - }.requireNonNil + return PredicateStatus(bool: matches) + } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func containMatcher(_ expected: [NSObject]) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func containMatcher(_ expected: [NSObject]) -> NMBMatcher { + return NMBPredicate { actualExpression in let location = actualExpression.location - let actualValue = try! actualExpression.evaluate() + let actualValue = try actualExpression.evaluate() if let value = actualValue as? NMBContainer { let expr = Expression(expression: ({ value as NMBContainer }), location: location) // A straightforward cast on the array causes this to crash, so we have to cast the individual items let expectedOptionals: [Any?] = expected.map({ $0 as Any? }) - return try! contain(expectedOptionals).matches(expr, failureMessage: failureMessage) + return try contain(expectedOptionals).satisfies(expr).toObjectiveC() } else if let value = actualValue as? NSString { let expr = Expression(expression: ({ value as String }), location: location) - return try! contain(expected as! [String]).matches(expr, failureMessage: failureMessage) - } else if actualValue != nil { - // swiftlint:disable:next line_length - failureMessage.postfixMessage = "contain <\(arrayAsString(expected))> (only works for NSArrays, NSSets, NSHashTables, and NSStrings)" - } else { - failureMessage.postfixMessage = "contain <\(arrayAsString(expected))>" + // swiftlint:disable:next force_cast + return try contain(expected as! [String]).satisfies(expr).toObjectiveC() } - return false + + let message: ExpectationMessage + if actualValue != nil { + message = ExpectationMessage.expectedActualValueTo( + // swiftlint:disable:next line_length + "contain <\(arrayAsString(expected))> (only works for NSArrays, NSSets, NSHashTables, and NSStrings)" + ) + } else { + message = ExpectationMessage + .expectedActualValueTo("contain <\(arrayAsString(expected))>") + .appendedBeNilHint() + } + return NMBPredicateResult(status: .fail, message: message.toObjectiveC()) } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift index ae0d854..331f3bc 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift @@ -2,43 +2,44 @@ import Foundation public func containElementSatisfying(_ predicate: @escaping ((T) -> Bool), _ predicateDescription: String = "") -> Predicate where S.Iterator.Element == T { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.actualValue = nil - + return Predicate.define { actualExpression in + let message: ExpectationMessage if predicateDescription == "" { - failureMessage.postfixMessage = "find object in collection that satisfies predicate" + message = .expectedTo("find object in collection that satisfies predicate") } else { - failureMessage.postfixMessage = "find object in collection \(predicateDescription)" + message = .expectedTo("find object in collection \(predicateDescription)") } if let sequence = try actualExpression.evaluate() { for object in sequence { if predicate(object) { - return true + return PredicateResult(bool: true, message: message) } } - return false + return PredicateResult(bool: false, message: message) } - return false - }.requireNonNil + return PredicateResult(status: .fail, message: message) + } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func containElementSatisfyingMatcher(_ predicate: @escaping ((NSObject) -> Bool)) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let value = try! actualExpression.evaluate() + @objc public class func containElementSatisfyingMatcher(_ predicate: @escaping ((NSObject) -> Bool)) -> NMBMatcher { + return NMBPredicate { actualExpression in + let value = try actualExpression.evaluate() guard let enumeration = value as? NSFastEnumeration else { - // swiftlint:disable:next line_length - failureMessage.postfixMessage = "containElementSatisfying must be provided an NSFastEnumeration object" - failureMessage.actualValue = nil - failureMessage.expected = "" - failureMessage.to = "" - return false + let message = ExpectationMessage.fail( + "containElementSatisfying must be provided an NSFastEnumeration object" + ) + return NMBPredicateResult(status: .fail, message: message.toObjectiveC()) } + let message = ExpectationMessage + .expectedTo("find object in collection that satisfies predicate") + .toObjectiveC() + var iterator = NSFastEnumerationIterator(enumeration) while let item = iterator.next() { guard let object = item as? NSObject else { @@ -46,14 +47,11 @@ public func containElementSatisfying(_ predicate: @escaping ((T) } if predicate(object) { - return true + return NMBPredicateResult(status: .matches, message: message) } } - failureMessage.actualValue = nil - failureMessage.postfixMessage = "" - failureMessage.to = "to find object in collection that satisfies predicate" - return false + return NMBPredicateResult(status: .doesNotMatch, message: message) } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ElementsEqual.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ElementsEqual.swift new file mode 100644 index 0000000..1704e94 --- /dev/null +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ElementsEqual.swift @@ -0,0 +1,16 @@ +/// A Nimble matcher that succeeds when the actual sequence contain the same elements in the same order to the exepected sequence. +public func elementsEqual(_ expectedValue: S?) -> Predicate where S.Element: Equatable { + // A matcher abstraction for https://developer.apple.com/documentation/swift/sequence/2949668-elementsequal + return Predicate.define("elementsEqual <\(stringify(expectedValue))>") { (actualExpression, msg) in + let actualValue = try actualExpression.evaluate() + switch (expectedValue, actualValue) { + case (nil, _?): + return PredicateResult(status: .fail, message: msg.appendedBeNilHint()) + case (nil, nil), (_, nil): + return PredicateResult(status: .fail, message: msg) + case (let expected?, let actual?): + let matches = expected.elementsEqual(actual) + return PredicateResult(bool: matches, message: msg) + } + } +} diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/EndWith.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/EndWith.swift index a6f9f91..13bdb31 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/EndWith.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/EndWith.swift @@ -4,9 +4,7 @@ import Foundation /// is equal to the expected value. public func endWith(_ endingElement: T) -> Predicate where S.Iterator.Element == T { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "end with <\(endingElement)>" - + return Predicate.simple("end with <\(endingElement)>") { actualExpression in if let actualValue = try actualExpression.evaluate() { var actualGenerator = actualValue.makeIterator() var lastItem: T? @@ -16,55 +14,54 @@ public func endWith(_ endingElement: T) -> Predicate< item = actualGenerator.next() } while(item != nil) - return lastItem == endingElement + return PredicateStatus(bool: lastItem == endingElement) } - return false - }.requireNonNil + return .fail + } } /// A Nimble matcher that succeeds when the actual collection's last element /// is equal to the expected object. public func endWith(_ endingElement: Any) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "end with <\(endingElement)>" - guard let collection = try actualExpression.evaluate() else { return false } - guard collection.count > 0 else { return false } + return Predicate.simple("end with <\(endingElement)>") { actualExpression in + guard let collection = try actualExpression.evaluate() else { return .fail } + guard collection.count > 0 else { return PredicateStatus(bool: false) } #if os(Linux) guard let collectionValue = collection.object(at: collection.count - 1) as? NSObject else { - return false + return .fail } #else let collectionValue = collection.object(at: collection.count - 1) as AnyObject #endif - return collectionValue.isEqual(endingElement) - }.requireNonNil + return PredicateStatus(bool: collectionValue.isEqual(endingElement)) + } } /// A Nimble matcher that succeeds when the actual string contains the expected substring /// where the expected substring's location is the actual string's length minus the /// expected substring's length. public func endWith(_ endingSubstring: String) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "end with <\(endingSubstring)>" + return Predicate.simple("end with <\(endingSubstring)>") { actualExpression in if let collection = try actualExpression.evaluate() { - return collection.hasSuffix(endingSubstring) + return PredicateStatus(bool: collection.hasSuffix(endingSubstring)) } - return false - }.requireNonNil + return .fail + } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func endWithMatcher(_ expected: Any) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let actual = try! actualExpression.evaluate() - if (actual as? String) != nil { + @objc public class func endWithMatcher(_ expected: Any) -> NMBMatcher { + return NMBPredicate { actualExpression in + let actual = try actualExpression.evaluate() + if actual is String { let expr = actualExpression.cast { $0 as? String } - return try! endWith(expected as! String).matches(expr, failureMessage: failureMessage) + // swiftlint:disable:next force_cast + return try endWith(expected as! String).satisfies(expr).toObjectiveC() } else { let expr = actualExpression.cast { $0 as? NMBOrderedCollection } - return try! endWith(expected).matches(expr, failureMessage: failureMessage) + return try endWith(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Equal.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Equal.swift index ab457ca..b08d5f6 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Equal.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Equal.swift @@ -7,103 +7,30 @@ import Foundation public func equal(_ expectedValue: T?) -> Predicate { return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in let actualValue = try actualExpression.evaluate() - let matches = actualValue == expectedValue && expectedValue != nil - if expectedValue == nil || actualValue == nil { - if expectedValue == nil && actualValue != nil { - return PredicateResult( - status: .fail, - message: msg.appendedBeNilHint() - ) - } + switch (expectedValue, actualValue) { + case (nil, _?): + return PredicateResult(status: .fail, message: msg.appendedBeNilHint()) + case (nil, nil), (_, nil): return PredicateResult(status: .fail, message: msg) + case (let expected?, let actual?): + let matches = expected == actual + return PredicateResult(bool: matches, message: msg) } - return PredicateResult(status: PredicateStatus(bool: matches), message: msg) - } -} - -/// A Nimble matcher that succeeds when the actual value is equal to the expected value. -/// 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]?) -> Predicate<[T: C]> { - return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in - let actualValue = try actualExpression.evaluate() - if expectedValue == nil || actualValue == nil { - if expectedValue == nil && actualValue != nil { - return PredicateResult( - status: .fail, - message: msg.appendedBeNilHint() - ) - } - return PredicateResult(status: .fail, message: msg) - } - return PredicateResult( - status: PredicateStatus(bool: expectedValue! == actualValue!), - message: msg - ) - } -} - -/// A Nimble matcher that succeeds when the actual collection is equal to the expected collection. -/// Items must implement the Equatable protocol. -public func equal(_ expectedValue: [T]?) -> Predicate<[T]> { - return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in - let actualValue = try actualExpression.evaluate() - if expectedValue == nil || actualValue == nil { - if expectedValue == nil && actualValue != nil { - return PredicateResult( - status: .fail, - message: msg.appendedBeNilHint() - ) - } - return PredicateResult( - status: .fail, - message: msg - ) - } - return PredicateResult( - bool: expectedValue! == actualValue!, - message: msg - ) } } /// A Nimble matcher allowing comparison of collection with optional type public func equal(_ expectedValue: [T?]) -> Predicate<[T?]> { return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in - if let actualValue = try actualExpression.evaluate() { - let doesNotMatch = PredicateResult( - status: .doesNotMatch, - message: msg - ) - - if expectedValue.count != actualValue.count { - return doesNotMatch - } - - for (index, item) in actualValue.enumerated() { - let otherItem = expectedValue[index] - if item == nil && otherItem == nil { - continue - } else if item == nil && otherItem != nil { - return doesNotMatch - } else if item != nil && otherItem == nil { - return doesNotMatch - } else if item! != otherItem! { - return doesNotMatch - } - } - - return PredicateResult( - status: .matches, - message: msg - ) - } else { + guard let actualValue = try actualExpression.evaluate() else { return PredicateResult( status: .fail, message: msg.appendedBeNilHint() ) } + + let matches = expectedValue == actualValue + return PredicateResult(bool: matches, message: msg) } } @@ -128,44 +55,45 @@ private func equal(_ expectedValue: Set?, stringify: @escaping (Set?) - var errorMessage: ExpectationMessage = .expectedActualValueTo("equal <\(stringify(expectedValue))>") - if let expectedValue = expectedValue { - if let actualValue = try actualExpression.evaluate() { - errorMessage = .expectedCustomValueTo( - "equal <\(stringify(expectedValue))>", - "<\(stringify(actualValue))>" - ) - - if expectedValue == actualValue { - return PredicateResult( - status: .matches, - message: errorMessage - ) - } - - let missing = expectedValue.subtracting(actualValue) - if missing.count > 0 { - errorMessage = errorMessage.appended(message: ", missing <\(stringify(missing))>") - } - - let extra = actualValue.subtracting(expectedValue) - if extra.count > 0 { - errorMessage = errorMessage.appended(message: ", extra <\(stringify(extra))>") - } - return PredicateResult( - status: .doesNotMatch, - message: errorMessage - ) - } - return PredicateResult( - status: .fail, - message: errorMessage.appendedBeNilHint() - ) - } else { + guard let expectedValue = expectedValue else { return PredicateResult( status: .fail, message: errorMessage.appendedBeNilHint() ) } + + guard let actualValue = try actualExpression.evaluate() else { + return PredicateResult( + status: .fail, + message: errorMessage.appendedBeNilHint() + ) + } + + errorMessage = .expectedCustomValueTo( + "equal <\(stringify(expectedValue))>", + "<\(stringify(actualValue))>" + ) + + if expectedValue == actualValue { + return PredicateResult( + status: .matches, + message: errorMessage + ) + } + + let missing = expectedValue.subtracting(actualValue) + if missing.count > 0 { + errorMessage = errorMessage.appended(message: ", missing <\(stringify(missing))>") + } + + let extra = actualValue.subtracting(expectedValue) + if extra.count > 0 { + errorMessage = errorMessage.appended(message: ", extra <\(stringify(extra))>") + } + return PredicateResult( + status: .doesNotMatch, + message: errorMessage + ) } } @@ -209,11 +137,11 @@ public func !=(lhs: Expectation<[T: C]>, rhs: [T: C]?) { lhs.toNot(equal(rhs)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func equalMatcher(_ expected: NSObject) -> NMBMatcher { return NMBPredicate { actualExpression in - return try! equal(expected).satisfies(actualExpression).toObjectiveC() + return try equal(expected).satisfies(actualExpression).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/HaveCount.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/HaveCount.swift index 93335a8..984e2d4 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/HaveCount.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/HaveCount.swift @@ -7,52 +7,67 @@ import Foundation /// A Nimble matcher that succeeds when the actual Collection's count equals /// the expected value -public func haveCount(_ expectedValue: T.IndexDistance) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in +public func haveCount(_ expectedValue: Int) -> Predicate { + return Predicate.define { actualExpression in if let actualValue = try actualExpression.evaluate() { - // swiftlint:disable:next line_length - failureMessage.postfixMessage = "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))" + let message = ExpectationMessage + .expectedCustomValueTo( + "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))", + "\(actualValue.count)" + ) + .appended(details: "Actual Value: \(stringify(actualValue))") + let result = expectedValue == actualValue.count - failureMessage.actualValue = "\(actualValue.count)" - failureMessage.extendedMessage = "Actual Value: \(stringify(actualValue))" - return result + return PredicateResult(bool: result, message: message) } else { - return false + return PredicateResult(status: .fail, message: .fail("")) } - }.requireNonNil + } } /// A Nimble matcher that succeeds when the actual collection's count equals /// the expected value public func haveCount(_ expectedValue: Int) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in + return Predicate { actualExpression in if let actualValue = try actualExpression.evaluate() { - // swiftlint:disable:next line_length - failureMessage.postfixMessage = "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))" + let message = ExpectationMessage + .expectedCustomValueTo( + "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))", + "\(actualValue.count)" + ) + .appended(details: "Actual Value: \(stringify(actualValue))") + let result = expectedValue == actualValue.count - failureMessage.actualValue = "\(actualValue.count)" - failureMessage.extendedMessage = "Actual Value: \(stringify(actualValue))" - return result + return PredicateResult(bool: result, message: message) } else { - return false + return PredicateResult(status: .fail, message: .fail("")) } } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func haveCountMatcher(_ expected: NSNumber) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func haveCountMatcher(_ expected: NSNumber) -> NMBMatcher { + return NMBPredicate { actualExpression in let location = actualExpression.location - let actualValue = try! actualExpression.evaluate() + let actualValue = try actualExpression.evaluate() if let value = actualValue as? NMBCollection { let expr = Expression(expression: ({ value as NMBCollection}), location: location) - return try! haveCount(expected.intValue).matches(expr, failureMessage: failureMessage) - } else if let actualValue = actualValue { - failureMessage.postfixMessage = "get type of NSArray, NSSet, NSDictionary, or NSHashTable" - failureMessage.actualValue = "\(String(describing: type(of: actualValue)))" + return try haveCount(expected.intValue).satisfies(expr).toObjectiveC() } - return false + + let message: ExpectationMessage + if let actualValue = actualValue { + message = ExpectationMessage.expectedCustomValueTo( + "get type of NSArray, NSSet, NSDictionary, or NSHashTable", + "\(String(describing: type(of: actualValue)))" + ) + } else { + message = ExpectationMessage + .expectedActualValueTo("have a collection with count \(stringify(expected.intValue))") + .appendedBeNilHint() + } + return NMBPredicateResult(status: .fail, message: message.toObjectiveC()) } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Match.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Match.swift index 96e7a82..dbcff09 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Match.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Match.swift @@ -15,13 +15,13 @@ public func match(_ expectedValue: String?) -> Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func matchMatcher(_ expected: NSString) -> NMBMatcher { return NMBPredicate { actualExpression in let actual = actualExpression.cast { $0 as? String } - return try! match(expected.description).satisfies(actual).toObjectiveC() + return try match(expected.description).satisfies(actual).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatchError.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatchError.swift index 9c86fb7..4ad71d4 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatchError.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatchError.swift @@ -6,16 +6,24 @@ import Foundation /// Errors are tried to be compared by their implementation of Equatable, /// otherwise they fallback to comparison by _domain and _code. public func matchError(_ error: T) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - let actualError: Error? = try actualExpression.evaluate() + return Predicate.define { actualExpression in + let actualError = try actualExpression.evaluate() + + let failureMessage = FailureMessage() + setFailureMessageForError( + failureMessage, + postfixMessageVerb: "match", + actualError: actualError, + error: error + ) - setFailureMessageForError(failureMessage, postfixMessageVerb: "match", actualError: actualError, error: error) var matches = false if let actualError = actualError, errorMatchesExpectedError(actualError, expectedError: error) { matches = true } - return matches - }.requireNonNil + + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + } } /// A Nimble matcher that succeeds when the actual expression evaluates to an @@ -24,35 +32,45 @@ public func matchError(_ error: T) -> Predicate { /// Errors are tried to be compared by their implementation of Equatable, /// otherwise they fallback to comparision by _domain and _code. public func matchError(_ error: T) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - let actualError: Error? = try actualExpression.evaluate() + return Predicate.define { actualExpression in + let actualError = try actualExpression.evaluate() - setFailureMessageForError(failureMessage, postfixMessageVerb: "match", actualError: actualError, error: error) + let failureMessage = FailureMessage() + setFailureMessageForError( + failureMessage, + postfixMessageVerb: "match", + actualError: actualError, + error: error + ) var matches = false if let actualError = actualError as? T, error == actualError { matches = true } - return matches - }.requireNonNil + + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + } } /// A Nimble matcher that succeeds when the actual expression evaluates to an /// error of the specified type public func matchError(_ errorType: T.Type) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - let actualError: Error? = try actualExpression.evaluate() + return Predicate.define { actualExpression in + let actualError = try actualExpression.evaluate() + let failureMessage = FailureMessage() setFailureMessageForError( failureMessage, postfixMessageVerb: "match", actualError: actualError, errorType: errorType ) + var matches = false if actualError as? T != nil { matches = true } - return matches - }.requireNonNil + + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift index 6f8f103..38bb297 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift @@ -1,6 +1,6 @@ import Foundation // `CGFloat` is in Foundation (swift-corelibs-foundation) on Linux. -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) import CoreGraphics #endif @@ -28,7 +28,7 @@ extension Matcher { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) /// Objective-C interface to the Swift variant of Matcher. @objc public protocol NMBMatcher { func matches(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool @@ -41,7 +41,8 @@ public protocol NMBContainer { func contains(_ anObject: Any) -> Bool } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) +// swiftlint:disable:next todo // FIXME: NSHashTable can not conform to NMBContainer since swift-DEVELOPMENT-SNAPSHOT-2016-04-25-a //extension NSHashTable : NMBContainer {} // Corelibs Foundation does not include this class yet #endif @@ -54,7 +55,7 @@ public protocol NMBCollection { var count: Int { get } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NSHashTable: NMBCollection {} // Corelibs Foundation does not include these classes yet extension NSMapTable: NMBCollection {} #endif @@ -131,7 +132,7 @@ extension NSDate: TestOutputStringConvertible { /// beGreaterThan(), beGreaterThanOrEqualTo(), and equal() matchers. /// /// Types that conform to Swift's Comparable protocol will work implicitly too -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) @objc public protocol NMBComparable { func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult } @@ -144,11 +145,13 @@ public protocol NMBComparable { extension NSNumber: NMBComparable { public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult { + // swiftlint:disable:next force_cast return compare(otherObject as! NSNumber) } } extension NSString: NMBComparable { public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult { + // swiftlint:disable:next force_cast return compare(otherObject as! String) } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/PostNotification.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/PostNotification.swift index ee886f1..7d3e44c 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/PostNotification.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/PostNotification.swift @@ -1,36 +1,9 @@ import Foundation -// A workaround to SR-6419. -extension NotificationCenter { -#if !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) - #if swift(>=4.0) - #if swift(>=4.0.2) - #else - func addObserver(forName name: Notification.Name?, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Void) -> NSObjectProtocol { - return addObserver(forName: name, object: obj, queue: queue, usingBlock: block) - } - #endif - #elseif swift(>=3.2) - #if swift(>=3.2.2) - #else - // swiftlint:disable:next line_length - func addObserver(forName name: Notification.Name?, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Void) -> NSObjectProtocol { - return addObserver(forName: name, object: obj, queue: queue, usingBlock: block) - } - #endif - #else - // swiftlint:disable:next line_length - func addObserver(forName name: Notification.Name?, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Void) -> NSObjectProtocol { - return addObserver(forName: name, object: obj, queue: queue, usingBlock: block) - } - #endif -#endif -} - internal class NotificationCollector { private(set) var observedNotifications: [Notification] private let notificationCenter: NotificationCenter - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) private var token: AnyObject? #else private var token: NSObjectProtocol? @@ -43,14 +16,14 @@ internal class NotificationCollector { func startObserving() { // swiftlint:disable:next line_length - self.token = self.notificationCenter.addObserver(forName: nil, object: nil, queue: nil, using: { [weak self] n in + self.token = self.notificationCenter.addObserver(forName: nil, object: nil, queue: nil) { [weak self] notification in // linux-swift gets confused by .append(n) - self?.observedNotifications.append(n) - }) + self?.observedNotifications.append(notification) + } } deinit { - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) if let token = self.token { self.notificationCenter.removeObserver(token) } @@ -74,7 +47,8 @@ public func postNotifications( let collector = NotificationCollector(notificationCenter: center) collector.startObserving() var once: Bool = false - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in + + return Predicate { actualExpression in let collectorNotificationsExpression = Expression(memoizedExpression: { _ in return collector.observedNotifications }, location: actualExpression.location, withoutCaching: true) @@ -85,12 +59,13 @@ public func postNotifications( _ = try actualExpression.evaluate() } + let failureMessage = FailureMessage() let match = try notificationsMatcher.matches(collectorNotificationsExpression, failureMessage: failureMessage) if collector.observedNotifications.isEmpty { failureMessage.actualValue = "no notifications" } else { failureMessage.actualValue = "<\(stringify(collector.observedNotifications))>" } - return match + return PredicateResult(bool: match, message: failureMessage.toExpectationMessage()) } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Predicate.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Predicate.swift index f812344..2604411 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Predicate.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Predicate.swift @@ -218,6 +218,7 @@ extension Predicate: Matcher { extension Predicate { // Someday, make this public? Needs documentation internal func after(f: @escaping (Expression, PredicateResult) throws -> PredicateResult) -> Predicate { + // swiftlint:disable:previous identifier_name return Predicate { actual -> PredicateResult in let result = try self.satisfies(actual) return try f(actual, result) @@ -241,8 +242,8 @@ extension Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) -public typealias PredicateBlock = (_ actualExpression: Expression) -> NMBPredicateResult +#if canImport(Darwin) +public typealias PredicateBlock = (_ actualExpression: Expression) throws -> NMBPredicateResult public class NMBPredicate: NSObject { private let predicate: PredicateBlock @@ -251,9 +252,13 @@ public class NMBPredicate: NSObject { self.predicate = predicate } - func satisfies(_ expression: @escaping () -> NSObject?, location: SourceLocation) -> NMBPredicateResult { + func satisfies(_ expression: @escaping () throws -> NSObject?, location: SourceLocation) -> NMBPredicateResult { let expr = Expression(expression: expression, location: location) - return self.predicate(expr) + do { + return try self.predicate(expr) + } catch let error { + return PredicateResult(status: .fail, message: .fail("unexpected error thrown: <\(error)>")).toObjectiveC() + } } } @@ -307,7 +312,7 @@ final public class NMBPredicateStatus: NSObject { public static let doesNotMatch: NMBPredicateStatus = NMBPredicateStatus(status: 1) public static let fail: NMBPredicateStatus = NMBPredicateStatus(status: 2) - public override var hashValue: Int { return self.status.hashValue } + public override var hash: Int { return self.status.hashValue } public override func isEqual(_ object: Any?) -> Bool { guard let otherPredicate = object as? NMBPredicateStatus else { diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/RaisesException.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/RaisesException.swift index 3e7f2df..f44c810 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/RaisesException.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/RaisesException.swift @@ -1,7 +1,7 @@ import Foundation // This matcher requires the Objective-C, and being built by Xcode rather than the Swift Package Manager -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE /// A Nimble matcher that succeeds when the actual expression raises an /// exception with the specified name, reason, and/or userInfo. @@ -17,18 +17,21 @@ public func raiseException( reason: String? = nil, userInfo: NSDictionary? = nil, closure: ((NSException) -> Void)? = nil) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - + return Predicate { actualExpression in var exception: NSException? let capture = NMBExceptionCapture(handler: ({ e in exception = e }), finally: nil) - capture.tryBlock { - _ = try! actualExpression.evaluate() - return + do { + try capture.tryBlockThrows { + _ = try actualExpression.evaluate() + } + } catch { + return PredicateResult(status: .fail, message: .fail("unexpected error thrown: <\(error)>")) } + let failureMessage = FailureMessage() setFailureMessageForException( failureMessage, exception: exception, @@ -37,13 +40,15 @@ public func raiseException( userInfo: userInfo, closure: closure ) - return exceptionMatchesNonNilFieldsOrClosure( + + let matches = exceptionMatchesNonNilFieldsOrClosure( exception, named: named, reason: reason, userInfo: userInfo, closure: closure ) + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) } } @@ -117,10 +122,12 @@ internal func exceptionMatchesNonNilFieldsOrClosure( } public class NMBObjCRaiseExceptionMatcher: NSObject, NMBMatcher { + // swiftlint:disable identifier_name internal var _name: String? internal var _reason: String? internal var _userInfo: NSDictionary? internal var _block: ((NSException) -> Void)? + // swiftlint:enable identifier_name internal init(name: String?, reason: String?, userInfo: NSDictionary?, block: ((NSException) -> Void)?) { _name = name @@ -133,12 +140,17 @@ public class NMBObjCRaiseExceptionMatcher: NSObject, NMBMatcher { let block: () -> Any? = ({ _ = actualBlock(); return nil }) let expr = Expression(expression: block, location: location) - return try! raiseException( - named: _name, - reason: _reason, - userInfo: _userInfo, - closure: _block - ).matches(expr, failureMessage: failureMessage) + do { + return try raiseException( + named: _name, + reason: _reason, + userInfo: _userInfo, + closure: _block + ).matches(expr, failureMessage: failureMessage) + } catch let error { + failureMessage.stringValue = "unexpected error thrown: <\(error)>" + return false + } } @objc public func doesNotMatch(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool { diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift index 6c63a15..da3ea9a 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift @@ -4,33 +4,11 @@ import Foundation /// provided in the variable list of matchers. public func satisfyAllOf(_ matchers: U...) -> Predicate where U: Matcher, U.ValueType == T { - return satisfyAllOf(matchers) -} - -/// Deprecated. Please use `satisfyAnyOf(_) -> Predicate` instead. -internal func satisfyAllOf(_ matchers: [U]) -> Predicate - where U: Matcher, U.ValueType == T { - return NonNilMatcherFunc { actualExpression, failureMessage in - let postfixMessages = NSMutableArray() - var matches = true - for matcher in matchers { - if try matcher.doesNotMatch(actualExpression, failureMessage: failureMessage) { - matches = false - } - postfixMessages.add(NSString(string: "{\(failureMessage.postfixMessage)}")) - } - - failureMessage.postfixMessage = "match all of: " + postfixMessages.componentsJoined(by: ", and ") - if let actualValue = try actualExpression.evaluate() { - failureMessage.actualValue = "\(actualValue)" - } - - return matches - }.predicate + return satisfyAllOf(matchers.map { $0.predicate }) } internal func satisfyAllOf(_ predicates: [Predicate]) -> Predicate { - return Predicate { actualExpression in + return Predicate.define { actualExpression in var postfixMessages = [String]() var matches = true for predicate in predicates { @@ -53,18 +31,15 @@ internal func satisfyAllOf(_ predicates: [Predicate]) -> Predicate { ) } - return PredicateResult( - bool: matches, - message: msg - ) - }.requireNonNil + return PredicateResult(bool: matches, message: msg) + } } public func && (left: Predicate, right: Predicate) -> Predicate { return satisfyAllOf(left, right) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func satisfyAllOfMatcher(_ matchers: [NMBMatcher]) -> NMBPredicate { return NMBPredicate { actualExpression in @@ -82,11 +57,15 @@ extension NMBObjCMatcher { let elementEvaluator = Predicate { expression in if let predicate = matcher as? NMBPredicate { // swiftlint:disable:next line_length - return predicate.satisfies({ try! expression.evaluate() }, location: actualExpression.location).toSwift() + return predicate.satisfies({ try expression.evaluate() }, location: actualExpression.location).toSwift() } else { let failureMessage = FailureMessage() - // swiftlint:disable:next line_length - let success = matcher.matches({ try! expression.evaluate() }, failureMessage: failureMessage, location: actualExpression.location) + let success = matcher.matches( + // swiftlint:disable:next force_try + { try! expression.evaluate() }, + failureMessage: failureMessage, + location: actualExpression.location + ) return PredicateResult(bool: success, message: failureMessage.toExpectationMessage()) } } @@ -94,7 +73,7 @@ extension NMBObjCMatcher { elementEvaluators.append(elementEvaluator) } - return try! satisfyAllOf(elementEvaluators).satisfies(actualExpression).toObjectiveC() + return try satisfyAllOf(elementEvaluators).satisfies(actualExpression).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift index d02a0ff..6724956 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift @@ -4,33 +4,11 @@ import Foundation /// provided in the variable list of matchers. public func satisfyAnyOf(_ matchers: U...) -> Predicate where U: Matcher, U.ValueType == T { - return satisfyAnyOf(matchers) -} - -/// Deprecated. Please use `satisfyAnyOf(_) -> Predicate` instead. -internal func satisfyAnyOf(_ matchers: [U]) -> Predicate - where U: Matcher, U.ValueType == T { - return NonNilMatcherFunc { actualExpression, failureMessage in - let postfixMessages = NSMutableArray() - var matches = false - for matcher in matchers { - if try matcher.matches(actualExpression, failureMessage: failureMessage) { - matches = true - } - postfixMessages.add(NSString(string: "{\(failureMessage.postfixMessage)}")) - } - - failureMessage.postfixMessage = "match one of: " + postfixMessages.componentsJoined(by: ", or ") - if let actualValue = try actualExpression.evaluate() { - failureMessage.actualValue = "\(actualValue)" - } - - return matches - }.predicate + return satisfyAnyOf(matchers.map { $0.predicate }) } internal func satisfyAnyOf(_ predicates: [Predicate]) -> Predicate { - return Predicate { actualExpression in + return Predicate.define { actualExpression in var postfixMessages = [String]() var matches = false for predicate in predicates { @@ -53,11 +31,8 @@ internal func satisfyAnyOf(_ predicates: [Predicate]) -> Predicate { ) } - return PredicateResult( - status: PredicateStatus(bool: matches), - message: msg - ) - }.requireNonNil + return PredicateResult(bool: matches, message: msg) + } } public func || (left: Predicate, right: Predicate) -> Predicate { @@ -72,7 +47,7 @@ public func || (left: MatcherFunc, right: MatcherFunc) -> Predicate return satisfyAnyOf(left, right) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func satisfyAnyOfMatcher(_ matchers: [NMBMatcher]) -> NMBPredicate { return NMBPredicate { actualExpression in @@ -90,11 +65,15 @@ extension NMBObjCMatcher { let elementEvaluator = Predicate { expression in if let predicate = matcher as? NMBPredicate { // swiftlint:disable:next line_length - return predicate.satisfies({ try! expression.evaluate() }, location: actualExpression.location).toSwift() + return predicate.satisfies({ try expression.evaluate() }, location: actualExpression.location).toSwift() } else { let failureMessage = FailureMessage() - // swiftlint:disable:next line_length - let success = matcher.matches({ try! expression.evaluate() }, failureMessage: failureMessage, location: actualExpression.location) + let success = matcher.matches( + // swiftlint:disable:next force_try + { try! expression.evaluate() }, + failureMessage: failureMessage, + location: actualExpression.location + ) return PredicateResult(bool: success, message: failureMessage.toExpectationMessage()) } } @@ -102,7 +81,7 @@ extension NMBObjCMatcher { elementEvaluators.append(elementEvaluator) } - return try! satisfyAnyOf(elementEvaluators).satisfies(actualExpression).toObjectiveC() + return try satisfyAnyOf(elementEvaluators).satisfies(actualExpression).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift index a530c60..53d9191 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift @@ -1,13 +1,11 @@ import Foundation public func throwAssertion() -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - #if arch(x86_64) && (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE - failureMessage.postfixMessage = "throw an assertion" - failureMessage.actualValue = nil - - var succeeded = true + return Predicate { actualExpression in + #if arch(x86_64) && canImport(Darwin) && !SWIFT_PACKAGE + let message = ExpectationMessage.expectedTo("throw an assertion") + var actualError: Error? let caughtException: BadInstructionException? = catchBadInstruction { #if os(tvOS) if !NimbleEnvironment.activeInstance.suppressTVOSAssertionWarning { @@ -27,30 +25,27 @@ public func throwAssertion() -> Predicate { #endif do { try actualExpression.evaluate() - } catch let error { - succeeded = false - failureMessage.postfixMessage += "; threw error instead <\(error)>" + } catch { + actualError = error } } - if !succeeded { - return false + if let actualError = actualError { + return PredicateResult( + bool: false, + message: message.appended(message: "; threw error instead <\(actualError)>") + ) + } else { + return PredicateResult(bool: caughtException != nil, message: message) } - - if caughtException == nil { - return false - } - - return true #elseif SWIFT_PACKAGE fatalError("The throwAssertion Nimble matcher does not currently support Swift CLI." + " You can silence this error by placing the test case inside an #if !SWIFT_PACKAGE" + " conditional statement") #else fatalError("The throwAssertion Nimble matcher can only run on x86_64 platforms with " + - "Objective-C (e.g. Mac, iPhone 5s or later simulators). You can silence this error " + - "by placing the test case inside an #if arch(x86_64) or (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) conditional statement") - // swiftlint:disable:previous line_length + "Objective-C (e.g. macOS, iPhone 5s or later simulators). You can silence this error " + + "by placing the test case inside an #if arch(x86_64) or canImport(Darwin) conditional statement") #endif } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ThrowError.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ThrowError.swift index 872ca5c..d294ba3 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ThrowError.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ThrowError.swift @@ -12,22 +12,19 @@ import Foundation /// nil arguments indicates that the matcher should not attempt to match against /// that parameter. public func throwError() -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - + return Predicate { actualExpression in var actualError: Error? do { _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError + } catch { + actualError = error } - failureMessage.postfixMessage = "throw any error" if let actualError = actualError { - failureMessage.actualValue = "<\(actualError)>" + return PredicateResult(bool: true, message: .expectedCustomValueTo("throw any error", "<\(actualError)>")) } else { - failureMessage.actualValue = "no error" + return PredicateResult(bool: false, message: .expectedCustomValueTo("throw any error", "no error")) } - return actualError != nil } } @@ -43,15 +40,15 @@ public func throwError() -> Predicate { /// nil arguments indicates that the matcher should not attempt to match against /// that parameter. public func throwError(_ error: T, closure: ((Error) -> Void)? = nil) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - + return Predicate { actualExpression in var actualError: Error? do { _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError + } catch { + actualError = error } + let failureMessage = FailureMessage() setFailureMessageForError( failureMessage, actualError: actualError, @@ -59,20 +56,23 @@ public func throwError(_ error: T, closure: ((Error) -> Void)? = nil) errorType: nil, closure: closure ) + var matches = false if let actualError = actualError, errorMatchesExpectedError(actualError, expectedError: error) { matches = true + if let closure = closure { let assertions = gatherFailingExpectations { closure(actualError) } let messages = assertions.map { $0.message } - if messages.count > 0 { + if !messages.isEmpty { matches = false } } } - return matches + + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) } } @@ -88,15 +88,15 @@ public func throwError(_ error: T, closure: ((Error) -> Void)? = nil) /// nil arguments indicates that the matcher should not attempt to match against /// that parameter. public func throwError(_ error: T, closure: ((T) -> Void)? = nil) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - + return Predicate { actualExpression in var actualError: Error? do { _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError + } catch { + actualError = error } + let failureMessage = FailureMessage() setFailureMessageForError( failureMessage, actualError: actualError, @@ -104,6 +104,7 @@ public func throwError(_ error: T, closure: ((T) -> Void)? errorType: nil, closure: closure ) + var matches = false if let actualError = actualError as? T, error == actualError { matches = true @@ -113,12 +114,13 @@ public func throwError(_ error: T, closure: ((T) -> Void)? closure(actualError) } let messages = assertions.map { $0.message } - if messages.count > 0 { + if !messages.isEmpty { matches = false } } } - return matches + + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) } } @@ -136,15 +138,15 @@ public func throwError(_ error: T, closure: ((T) -> Void)? public func throwError( errorType: T.Type, closure: ((T) -> Void)? = nil) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - + return Predicate { actualExpression in var actualError: Error? do { _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError + } catch { + actualError = error } + let failureMessage = FailureMessage() setFailureMessageForError( failureMessage, actualError: actualError, @@ -152,16 +154,18 @@ public func throwError( errorType: errorType, closure: closure ) + var matches = false if let actualError = actualError { matches = true + if let actualError = actualError as? T { if let closure = closure { let assertions = gatherFailingExpectations { closure(actualError) } let messages = assertions.map { $0.message } - if messages.count > 0 { + if !messages.isEmpty { matches = false } } @@ -176,14 +180,14 @@ public func throwError( } } let messages = assertions.map { $0.message } - if messages.count > 0 { + if !messages.isEmpty { matches = false } } } } - return matches + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) } } @@ -195,15 +199,15 @@ public func throwError( /// /// The closure only gets called when an error was thrown. public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - + return Predicate { actualExpression in var actualError: Error? do { _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError + } catch { + actualError = error } + let failureMessage = FailureMessage() setFailureMessageForError(failureMessage, actualError: actualError, closure: closure) var matches = false @@ -214,11 +218,12 @@ public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate { closure(actualError) } let messages = assertions.map { $0.message } - if messages.count > 0 { + if !messages.isEmpty { matches = false } } - return matches + + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) } } @@ -230,15 +235,15 @@ public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate { /// /// The closure only gets called when an error was thrown. public func throwError(closure: @escaping ((T) -> Void)) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - + return Predicate { actualExpression in var actualError: Error? do { _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError + } catch { + actualError = error } + let failureMessage = FailureMessage() setFailureMessageForError(failureMessage, actualError: actualError, closure: closure) var matches = false @@ -249,10 +254,11 @@ public func throwError(closure: @escaping ((T) -> Void)) -> Predicate< closure(actualError) } let messages = assertions.map { $0.message } - if messages.count > 0 { + if !messages.isEmpty { matches = false } } - return matches + + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Async.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Await.swift similarity index 93% rename from Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Async.swift rename to Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Await.swift index cb672ad..276f618 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Async.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Await.swift @@ -2,7 +2,7 @@ import CoreFoundation import Dispatch import Foundation -#if !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) +#if canImport(CDispatch) import CDispatch #endif @@ -32,7 +32,7 @@ internal class AssertionWaitLock: WaitLock { func acquireWaitingLock(_ fnName: String, file: FileString, line: UInt) { let info = WaitingInfo(name: fnName, file: file, lineNumber: line) - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) let isMainThread = Thread.isMainThread #else let isMainThread = _CFIsMainThread() @@ -45,10 +45,15 @@ internal class AssertionWaitLock: WaitLock { nimblePrecondition( currentWaiter == nil, "InvalidNimbleAPIUsage", - "Nested async expectations are not allowed to avoid creating flaky tests.\n\n" + - "The call to\n\t\(info)\n" + - "triggered this exception because\n\t\(currentWaiter!)\n" + - "is currently managing the main run loop." + """ + Nested async expectations are not allowed to avoid creating flaky tests. + + The call to + \t\(info) + triggered this exception because + \t\(currentWaiter!) + is currently managing the main run loop. + """ ) currentWaiter = info } @@ -180,25 +185,18 @@ internal class AwaitPromiseBuilder { // checked. // // In addition, stopping the run loop is used to halt code executed on the main run loop. - #if swift(>=4.0) trigger.timeoutSource.schedule( deadline: DispatchTime.now() + timeoutInterval, repeating: .never, leeway: timeoutLeeway ) - #else - trigger.timeoutSource.scheduleOneshot( - deadline: DispatchTime.now() + timeoutInterval, - leeway: timeoutLeeway - ) - #endif trigger.timeoutSource.setEventHandler { guard self.promise.asyncResult.isIncomplete() else { return } let timedOutSem = DispatchSemaphore(value: 0) let semTimedOutOrBlocked = DispatchSemaphore(value: 0) semTimedOutOrBlocked.signal() let runLoop = CFRunLoopGetMain() - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) let runLoopMode = CFRunLoopMode.defaultMode.rawValue #else let runLoopMode = kCFRunLoopDefaultMode @@ -263,7 +261,7 @@ internal class AwaitPromiseBuilder { self.trigger.timeoutSource.resume() while self.promise.asyncResult.isIncomplete() { // Stopping the run loop does not work unless we run only 1 mode - #if swift(>=4.2) + #if (swift(>=4.2) && canImport(Darwin)) || compiler(>=5.0) _ = RunLoop.current.run(mode: .default, before: .distantFuture) #else _ = RunLoop.current.run(mode: .defaultRunLoopMode, before: .distantFuture) @@ -333,11 +331,7 @@ internal class Awaiter { let asyncSource = createTimerSource(asyncQueue) let trigger = AwaitTrigger(timeoutSource: timeoutSource, actionSource: asyncSource) { let interval = DispatchTimeInterval.nanoseconds(Int(pollInterval * TimeInterval(NSEC_PER_SEC))) - #if swift(>=4.0) asyncSource.schedule(deadline: .now(), repeating: interval, leeway: pollLeeway) - #else - asyncSource.scheduleRepeating(deadline: .now(), interval: interval, leeway: pollLeeway) - #endif asyncSource.setEventHandler { do { if let result = try closure() { diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Functional.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Functional.swift index 6c5126a..c87af76 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Functional.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Functional.swift @@ -1,12 +1,14 @@ import Foundation +#if !swift(>=4.2) extension Sequence { - internal func all(_ fn: (Iterator.Element) -> Bool) -> Bool { + internal func allSatisfy(_ predicate: (Element) throws -> Bool) rethrows -> Bool { for item in self { - if !fn(item) { + if try !predicate(item) { return false } } return true } } +#endif diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Stringers.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Stringers.swift index 7c4d273..4ab18d2 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Stringers.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Stringers.swift @@ -2,7 +2,7 @@ import Foundation internal func identityAsString(_ value: Any?) -> String { let anyObject: AnyObject? -#if os(Linux) +#if os(Linux) && !swift(>=4.1.50) anyObject = value as? AnyObject #else anyObject = value as AnyObject? @@ -122,6 +122,7 @@ extension String: TestOutputStringConvertible { extension Data: TestOutputStringConvertible { public var testDescription: String { #if os(Linux) + // swiftlint:disable:next todo // FIXME: Swift on Linux triggers a segfault when calling NSData's hash() (last checked on 03-11-16) return "Data" #else @@ -158,7 +159,7 @@ public func stringify(_ value: T?) -> String { return String(describing: value) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) @objc public class NMBStringer: NSObject { @objc public class func stringify(_ obj: Any?) -> String { return Nimble.stringify(obj) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/LinuxMain.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/LinuxMain.swift index 16c6953..ee03ebd 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/LinuxMain.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/LinuxMain.swift @@ -1,37 +1,8 @@ import XCTest -@testable import NimbleTests -// This is the entry point for NimbleTests on Linux +import NimbleTests -XCTMain([ - testCase(AsyncTest.allTests), - testCase(SynchronousTest.allTests), - testCase(UserDescriptionTest.allTests), +var tests = [XCTestCaseEntry]() +tests += NimbleTests.__allTests() - // Matchers - testCase(AllPassTest.allTests), - testCase(BeAKindOfSwiftTest.allTests), - testCase(BeAnInstanceOfTest.allTests), - testCase(BeCloseToTest.allTests), - testCase(BeginWithTest.allTests), - testCase(BeGreaterThanOrEqualToTest.allTests), - testCase(BeGreaterThanTest.allTests), - testCase(BeIdenticalToObjectTest.allTests), - testCase(BeIdenticalToTest.allTests), - testCase(BeLessThanOrEqualToTest.allTests), - testCase(BeLessThanTest.allTests), - testCase(BeTruthyTest.allTests), - testCase(BeTrueTest.allTests), - testCase(BeFalsyTest.allTests), - testCase(BeFalseTest.allTests), - testCase(BeNilTest.allTests), - testCase(ContainTest.allTests), - testCase(EndWithTest.allTests), - testCase(EqualTest.allTests), - testCase(HaveCountTest.allTests), - testCase(MatchTest.allTests), - // testCase(RaisesExceptionTest.allTests), - testCase(ThrowErrorTest.allTests), - testCase(SatisfyAnyOfTest.allTests), - testCase(PostNotificationTest.allTests), -]) +XCTMain(tests) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/AsynchronousTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/AsynchronousTest.swift index c44b9e6..bfa34c2 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/AsynchronousTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/AsynchronousTest.swift @@ -4,25 +4,6 @@ import XCTest import Nimble final class AsyncTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (AsyncTest) -> () throws -> Void)] { - return [ - ("testToEventuallyPositiveMatches", testToEventuallyPositiveMatches), - ("testToEventuallyNegativeMatches", testToEventuallyNegativeMatches), - ("testWaitUntilWithCustomDefaultsTimeout", testWaitUntilWithCustomDefaultsTimeout), - ("testWaitUntilPositiveMatches", testWaitUntilPositiveMatches), - ("testToEventuallyWithCustomDefaultTimeout", testToEventuallyWithCustomDefaultTimeout), - ("testWaitUntilTimesOutIfNotCalled", testWaitUntilTimesOutIfNotCalled), - ("testWaitUntilTimesOutWhenExceedingItsTime", testWaitUntilTimesOutWhenExceedingItsTime), - ("testWaitUntilNegativeMatches", testWaitUntilNegativeMatches), - ("testWaitUntilDetectsStalledMainThreadActivity", testWaitUntilDetectsStalledMainThreadActivity), - ("testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed", testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed), - ("testWaitUntilErrorsIfDoneIsCalledMultipleTimes", testWaitUntilErrorsIfDoneIsCalledMultipleTimes), - ("testWaitUntilMustBeInMainThread", testWaitUntilMustBeInMainThread), - ("testToEventuallyMustBeInMainThread", testToEventuallyMustBeInMainThread), - ("testSubjectUnderTestIsReleasedFromMemory", testSubjectUnderTestIsReleasedFromMemory), - ] - } - class Error: Swift.Error {} let errorToThrow = Error() @@ -70,20 +51,12 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { var asyncOperation: () -> Void = { sleepThenSetValueTo(1) } - if #available(OSX 10.10, *) { - DispatchQueue.global().async(execute: asyncOperation) - } else { - DispatchQueue.global(priority: .default).async(execute: asyncOperation) - } + DispatchQueue.global().async(execute: asyncOperation) expect { value }.toEventually(equal(1)) asyncOperation = { sleepThenSetValueTo(0) } - if #available(OSX 10.10, *) { - DispatchQueue.global().async(execute: asyncOperation) - } else { - DispatchQueue.global(priority: .default).async(execute: asyncOperation) - } + DispatchQueue.global().async(execute: asyncOperation) expect { value }.toEventuallyNot(equal(1)) } @@ -124,11 +97,7 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { done() waiting = false } - if #available(OSX 10.10, *) { - DispatchQueue.global().async(execute: asyncOperation) - } else { - DispatchQueue.global(priority: .default).async(execute: asyncOperation) - } + DispatchQueue.global().async(execute: asyncOperation) } } @@ -161,15 +130,16 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { func testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed() { // Currently we are unable to catch Objective-C exceptions when built by the Swift Package Manager #if !SWIFT_PACKAGE - let referenceLine = #line + 9 - var msg = "Unexpected exception raised: Nested async expectations are not allowed " - msg += "to avoid creating flaky tests." - msg += "\n\n" - msg += "The call to\n\t" - msg += "expect(...).toEventually(...) at \(#file):\(referenceLine + 7)\n" - msg += "triggered this exception because\n\t" - msg += "waitUntil(...) at \(#file):\(referenceLine + 1)\n" - msg += "is currently managing the main run loop." + let referenceLine = #line + 10 + let msg = """ + Unexpected exception raised: Nested async expectations are not allowed to avoid creating flaky tests. + + The call to + \texpect(...).toEventually(...) at \(#file):\(referenceLine + 7) + triggered this exception because + \twaitUntil(...) at \(#file):\(referenceLine + 1) + is currently managing the main run loop. + """ failsWithErrorMessage(msg) { // reference line waitUntil(timeout: 2.0) { done in var protected: Int = 0 @@ -204,11 +174,7 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { }.to(raiseException(named: "InvalidNimbleAPIUsage")) executedAsyncBlock = true } - if #available(OSX 10.10, *) { - DispatchQueue.global().async(execute: asyncOperation) - } else { - DispatchQueue.global(priority: .default).async(execute: asyncOperation) - } + DispatchQueue.global().async(execute: asyncOperation) expect(executedAsyncBlock).toEventually(beTruthy()) #endif } @@ -222,11 +188,7 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { }.to(raiseException(named: "InvalidNimbleAPIUsage")) executedAsyncBlock = true } - if #available(OSX 10.10, *) { - DispatchQueue.global().async(execute: asyncOperation) - } else { - DispatchQueue.global(priority: .default).async(execute: asyncOperation) - } + DispatchQueue.global().async(execute: asyncOperation) expect(executedAsyncBlock).toEventually(beTruthy()) #endif } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Helpers/XCTestCaseProvider.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Helpers/XCTestCaseProvider.swift index 08a67c6..08567fd 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Helpers/XCTestCaseProvider.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Helpers/XCTestCaseProvider.swift @@ -4,7 +4,7 @@ import XCTest // XCTestCaseProvider should be adopted by all XCTestCase subclasses. It provides a // mechanism for us to fail tests in Xcode which haven't been included in the `allTests` // list for swift-corelibs-xctest which is unable to dynamically discover tests. Note -// that only `static var allTests` needs to be explicitly implemented, as `allTestNames` +// that only `static var __allTests` needs to be explicitly implemented, as `allTestNames` // has a default implementation provided by a protocol extension. // Implementation note: This is broken down into two separate protocols because we need a @@ -12,7 +12,7 @@ import XCTest public protocol XCTestCaseProviderStatic { // This should be explicitly implemented by XCTestCase subclasses - static var allTests: [(String, (Self) -> () throws -> Void)] { get } + static var __allTests: [(String, (Self) -> () -> ())] { get } } public protocol XCTestCaseNameProvider { @@ -20,17 +20,21 @@ public protocol XCTestCaseNameProvider { var allTestNames: [String] { get } } +#if os(macOS) public protocol XCTestCaseProvider: XCTestCaseProviderStatic, XCTestCaseNameProvider {} extension XCTestCaseProvider { var allTestNames: [String] { - return type(of: self).allTests.map({ name, _ in + return type(of: self).__allTests.map({ name, _ in return name }) } } +#else +public protocol XCTestCaseProvider {} +#endif -#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS) +#if os(macOS) extension XCTestCase { override open func tearDown() { @@ -45,7 +49,13 @@ extension XCTestCase { extension XCTestCaseNameProvider { fileprivate func assertContainsTest(_ name: String) { let contains = self.allTestNames.contains(name) - XCTAssert(contains, "Test '\(name)' is missing from the allTests array") + XCTAssert( + contains, + """ + Test '\(name)' is missing from the __allTests array. + Please run `$ swift test --generate-linuxmain` to update the manifests. + """ + ) } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Helpers/utils.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Helpers/utils.swift index a1bbc68..c90b72a 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Helpers/utils.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Helpers/utils.swift @@ -3,12 +3,12 @@ import Foundation @testable import Nimble import XCTest -func failsWithErrorMessage(_ messages: [String], file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: @escaping () throws -> Void) { +func failsWithErrorMessage(_ messages: [String], file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: () throws -> Void) { var filePath = file var lineNumber = line let recorder = AssertionRecorder() - withAssertionHandler(recorder, closure: closure) + withAssertionHandler(recorder, file: file, line: line, closure: closure) for msg in messages { var lastFailure: AssertionRecord? @@ -37,7 +37,12 @@ func failsWithErrorMessage(_ messages: [String], file: FileString = #file, line: } else { let knownFailures = recorder.assertions.filter { !$0.success }.map { $0.message.stringValue } let knownFailuresJoined = knownFailures.joined(separator: ", ") - message = "Expected error message (\(msg)), got (\(knownFailuresJoined))\n\nAssertions Received:\n\(recorder.assertions)" + message = """ + Expected error message (\(msg)), got (\(knownFailuresJoined)) + + Assertions Received: + \(recorder.assertions) + """ } NimbleAssertionHandler.assert(false, message: FailureMessage(stringValue: message), @@ -45,7 +50,7 @@ func failsWithErrorMessage(_ messages: [String], file: FileString = #file, line: } } -func failsWithErrorMessage(_ message: String, file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: @escaping () -> Void) { +func failsWithErrorMessage(_ message: String, file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: () -> Void) { return failsWithErrorMessage( [message], file: file, @@ -55,7 +60,7 @@ func failsWithErrorMessage(_ message: String, file: FileString = #file, line: UI ) } -func failsWithErrorMessageForNil(_ message: String, file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: @escaping () -> Void) { +func failsWithErrorMessageForNil(_ message: String, file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: () -> Void) { failsWithErrorMessage("\(message) (use beNil() to match nils)", file: file, line: line, preferOriginalSourceLocation: preferOriginalSourceLocation, closure: closure) } @@ -68,15 +73,15 @@ func deferToMainQueue(action: @escaping () -> Void) { #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE public class NimbleHelper: NSObject { - @objc public class func expectFailureMessage(_ message: NSString, block: @escaping () -> Void, file: FileString, line: UInt) { + @objc public class func expectFailureMessage(_ message: NSString, block: () -> Void, file: FileString, line: UInt) { failsWithErrorMessage(String(describing: message), file: file, line: line, preferOriginalSourceLocation: true, closure: block) } - @objc public class func expectFailureMessages(_ messages: [NSString], block: @escaping () -> Void, file: FileString, line: UInt) { + @objc public class func expectFailureMessages(_ messages: [NSString], block: () -> Void, file: FileString, line: UInt) { failsWithErrorMessage(messages.map({String(describing: $0)}), file: file, line: line, preferOriginalSourceLocation: true, closure: block) } - @objc public class func expectFailureMessageForNil(_ message: NSString, block: @escaping () -> Void, file: FileString, line: UInt) { + @objc public class func expectFailureMessageForNil(_ message: NSString, block: () -> Void, file: FileString, line: UInt) { failsWithErrorMessageForNil(String(describing: message), file: file, line: line, preferOriginalSourceLocation: true, closure: block) } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/AllPassTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/AllPassTest.swift index 2050881..683121c 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/AllPassTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/AllPassTest.swift @@ -43,17 +43,6 @@ extension Optional where Wrapped: Comparable { } final class AllPassTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (AllPassTest) -> () throws -> Void)] { - return [ - ("testAllPassArray", testAllPassArray), - ("testAllPassMatcher", testAllPassMatcher), - ("testAllPassCollectionsWithOptionalsDontWork", testAllPassCollectionsWithOptionalsDontWork), - ("testAllPassCollectionsWithOptionalsUnwrappingOneOptionalLayer", testAllPassCollectionsWithOptionalsUnwrappingOneOptionalLayer), - ("testAllPassSet", testAllPassSet), - ("testAllPassWithNilAsExpectedValue", testAllPassWithNilAsExpectedValue), - ] - } - func testAllPassArray() { expect([1, 2, 3, 4]).to(allPass({$0 < 5})) expect([1, 2, 3, 4]).toNot(allPass({$0 > 5})) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift index bb9041b..64a439b 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift @@ -8,13 +8,6 @@ private class TestClassConformingToProtocol: TestProtocol {} private struct TestStructConformingToProtocol: TestProtocol {} final class BeAKindOfSwiftTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeAKindOfSwiftTest) -> () throws -> Void)] { - return [ - ("testPositiveMatch", testPositiveMatch), - ("testFailureMessages", testFailureMessages), - ] - } - enum TestEnum { case one, two } @@ -54,23 +47,17 @@ final class BeAKindOfSwiftTest: XCTestCase, XCTestCaseProvider { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - final class BeAKindOfObjCTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeAKindOfObjCTest) -> () throws -> Void)] { - return [ - ("testPositiveMatch", testPositiveMatch), - ("testFailureMessages", testFailureMessages), - ] - } - func testPositiveMatch() { +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) expect(TestNull()).to(beAKindOf(NSNull.self)) expect(NSObject()).to(beAKindOf(NSObject.self)) expect(NSNumber(value: 1)).toNot(beAKindOf(NSDate.self)) +#endif } func testFailureMessages() { +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) failsWithErrorMessageForNil("expected to not be a kind of NSNull, got ") { expect(nil as NSNull?).toNot(beAKindOf(NSNull.self)) } @@ -83,7 +70,6 @@ final class BeAKindOfObjCTest: XCTestCase, XCTestCaseProvider { failsWithErrorMessage("expected to not be a kind of NSNumber, got <__NSCFNumber instance>") { expect(NSNumber(value: 1)).toNot(beAKindOf(NSNumber.self)) } +#endif } } - -#endif diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift index aeea28a..df431e6 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift @@ -7,15 +7,6 @@ private class TestClassConformingToProtocol: TestProtocol {} private struct TestStructConformingToProtocol: TestProtocol {} final class BeAnInstanceOfTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeAnInstanceOfTest) -> () throws -> Void)] { - return [ - ("testPositiveMatch", testPositiveMatch), - ("testPositiveMatchSwiftTypes", testPositiveMatchSwiftTypes), - ("testFailureMessages", testFailureMessages), - ("testFailureMessagesSwiftTypes", testFailureMessagesSwiftTypes), - ] - } - func testPositiveMatch() { expect(NSNull()).to(beAnInstanceOf(NSNull.self)) expect(NSNumber(value: 1)).toNot(beAnInstanceOf(NSDate.self)) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeCloseToTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeCloseToTest.swift index cb7a3ec..f724be6 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeCloseToTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeCloseToTest.swift @@ -3,24 +3,6 @@ import XCTest import Nimble final class BeCloseToTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeCloseToTest) -> () throws -> Void)] { - return [ - ("testBeCloseTo", testBeCloseTo), - ("testBeCloseToWithin", testBeCloseToWithin), - ("testBeCloseToWithNSNumber", testBeCloseToWithNSNumber), - ("testBeCloseToWithDate", testBeCloseToWithDate), - ("testBeCloseToWithNSDate", testBeCloseToWithNSDate), - ("testBeCloseToOperator", testBeCloseToOperator), - ("testBeCloseToWithinOperator", testBeCloseToWithinOperator), - ("testPlusMinusOperator", testPlusMinusOperator), - ("testBeCloseToOperatorWithDate", testBeCloseToOperatorWithDate), - ("testBeCloseToWithinOperatorWithDate", testBeCloseToWithinOperatorWithDate), - ("testPlusMinusOperatorWithDate", testPlusMinusOperatorWithDate), - ("testBeCloseToArray", testBeCloseToArray), - ("testBeCloseToWithCGFloat", testBeCloseToWithCGFloat), - ] - } - func testBeCloseTo() { expect(1.2).to(beCloseTo(1.2001)) expect(1.2 as CDouble).to(beCloseTo(1.2001)) @@ -34,8 +16,8 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { func testBeCloseToWithin() { expect(1.2).to(beCloseTo(9.300, within: 10)) - failsWithErrorMessage("expected to not be close to <1.2001> (within 1), got <1.2>") { - expect(1.2).toNot(beCloseTo(1.2001, within: 1.0)) + failsWithErrorMessage("expected to not be close to <1.2001> (within 1.1), got <1.2>") { + expect(1.2).toNot(beCloseTo(1.2001, within: 1.1)) } } @@ -44,8 +26,8 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect(NSNumber(value: 1.2)).to(beCloseTo(NSNumber(value: 9.300), within: 10)) expect(1.2).to(beCloseTo(NSNumber(value: 9.300), within: 10)) - failsWithErrorMessage("expected to not be close to <1.2001> (within 1), got <1.2>") { - expect(NSNumber(value: 1.2)).toNot(beCloseTo(1.2001, within: 1.0)) + failsWithErrorMessage("expected to not be close to <1.2001> (within 1.1), got <1.2>") { + expect(NSNumber(value: 1.2)).toNot(beCloseTo(1.2001, within: 1.1)) } } @@ -53,8 +35,8 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect(CGFloat(1.2)).to(beCloseTo(1.2001)) expect(CGFloat(1.2)).to(beCloseTo(CGFloat(1.2001))) - failsWithErrorMessage("expected to not be close to <1.2001> (within 1), got <1.2>") { - expect(CGFloat(1.2)).toNot(beCloseTo(1.2001, within: 1.0)) + failsWithErrorMessage("expected to not be close to <1.2001> (within 1.1), got <1.2>") { + expect(CGFloat(1.2)).toNot(beCloseTo(1.2001, within: 1.1)) } } @@ -89,11 +71,11 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect(1.2) ≈ (9.300, 10) expect(1.2) == (9.300, 10) - failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") { - expect(1.2) ≈ (1.0, 0.1) + failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") { + expect(1.3) ≈ (1.1, 0.1) } - failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") { - expect(1.2) == (1.0, 0.1) + failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") { + expect(1.3) == (1.1, 0.1) } } @@ -101,11 +83,11 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect(1.2) ≈ 9.300 ± 10 expect(1.2) == 9.300 ± 10 - failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") { - expect(1.2) ≈ 1.0 ± 0.1 + failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") { + expect(1.3) ≈ 1.1 ± 0.1 } - failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") { - expect(1.2) == 1.0 ± 0.1 + failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") { + expect(1.3) == 1.1 ± 0.1 } } @@ -150,11 +132,11 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect([0.0, 1.1, 2.2]) ≈ [0.0001, 1.1001, 2.2001] expect([0.0, 1.1, 2.2]).to(beCloseTo([0.1, 1.2, 2.3], within: 0.1)) - failsWithErrorMessage("expected to be close to <[0, 1]> (each within 0.0001), got <[0, 1.1]>") { - expect([0.0, 1.1]) ≈ [0.0, 1.0] + failsWithErrorMessage("expected to be close to <[0.1, 1.1]> (each within 0.0001), got <[0.1, 1.2]>") { + expect([0.1, 1.2]) ≈ [0.1, 1.1] } - failsWithErrorMessage("expected to be close to <[0.2, 1.2]> (each within 0.1), got <[0, 1.1]>") { - expect([0.0, 1.1]).to(beCloseTo([0.2, 1.2], within: 0.1)) + failsWithErrorMessage("expected to be close to <[0.3, 1.3]> (each within 0.1), got <[0.1, 1.2]>") { + expect([0.1, 1.2]).to(beCloseTo([0.3, 1.3], within: 0.1)) } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift index 067ddeb..637bc7a 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeEmptyTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeEmptyTest) -> () throws -> Void)] { - return [ - ("testBeEmptyPositive", testBeEmptyPositive), - ("testBeEmptyNegative", testBeEmptyNegative), - ] - } - func testBeEmptyPositive() { expect([] as [Int]).to(beEmpty()) expect([1]).toNot(beEmpty()) @@ -41,16 +34,12 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect("").to(beEmpty()) expect("foo").toNot(beEmpty()) + + expect([] as TestOptionSet).to(beEmpty()) + expect(TestOptionSet.one).toNot(beEmpty()) } func testBeEmptyNegative() { - failsWithErrorMessageForNil("expected to be empty, got ") { - expect(nil as NSString?).to(beEmpty()) - } - failsWithErrorMessageForNil("expected to not be empty, got ") { - expect(nil as [CInt]?).toNot(beEmpty()) - } - failsWithErrorMessage("expected to not be empty, got <()>") { expect(NSArray()).toNot(beEmpty()) } @@ -58,12 +47,14 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect([1]).to(beEmpty()) } +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) failsWithErrorMessage("expected to not be empty, got <{()}>") { expect(NSSet()).toNot(beEmpty()) } failsWithErrorMessage("expected to be empty, got <{(1)}>") { expect(NSSet(object: NSNumber(value: 1))).to(beEmpty()) } +#endif failsWithErrorMessage("expected to not be empty, got <()>") { expect(NSIndexSet()).toNot(beEmpty()) @@ -78,5 +69,49 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { failsWithErrorMessage("expected to be empty, got ") { expect("foo").to(beEmpty()) } + + failsWithErrorMessage("expected to not be empty, got ") { + expect([] as TestOptionSet).toNot(beEmpty()) + } + failsWithErrorMessage("expected to be empty, got ") { + expect(TestOptionSet.one).to(beEmpty()) + } + } + + func testNilMatches() { + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as NSString?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as NSString?).toNot(beEmpty()) + } + + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as [CInt]?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as [CInt]?).toNot(beEmpty()) + } + + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as TestOptionSet?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as TestOptionSet?).toNot(beEmpty()) + } + } +} + +private struct TestOptionSet: OptionSet, CustomStringConvertible { + let rawValue: Int + + static let one = TestOptionSet(rawValue: 1 << 0) + + init(rawValue: Int) { + self.rawValue = rawValue + } + + var description: String { + return "TestOptionSet(rawValue: \(rawValue))" } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift index bd73361..4c91fec 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeGreaterThanOrEqualToTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeGreaterThanOrEqualToTest) -> () throws -> Void)] { - return [ - ("testGreaterThanOrEqualTo", testGreaterThanOrEqualTo), - ("testGreaterThanOrEqualToOperator", testGreaterThanOrEqualToOperator), - ] - } - func testGreaterThanOrEqualTo() { expect(10).to(beGreaterThanOrEqualTo(10)) expect(10).to(beGreaterThanOrEqualTo(2)) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanTest.swift index 9c33e4b..3d742f4 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeGreaterThanTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeGreaterThanTest) -> () throws -> Void)] { - return [ - ("testGreaterThan", testGreaterThan), - ("testGreaterThanOperator", testGreaterThanOperator), - ] - } - func testGreaterThan() { expect(10).to(beGreaterThan(2)) expect(1).toNot(beGreaterThan(2)) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToObjectTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToObjectTest.swift index 923fa76..b1155fb 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToObjectTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToObjectTest.swift @@ -3,17 +3,6 @@ import XCTest import Nimble final class BeIdenticalToObjectTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeIdenticalToObjectTest) -> () throws -> Void)] { - return [ - ("testBeIdenticalToPositive", testBeIdenticalToPositive), - ("testBeIdenticalToNegative", testBeIdenticalToNegative), - ("testBeIdenticalToPositiveMessage", testBeIdenticalToPositiveMessage), - ("testBeIdenticalToNegativeMessage", testBeIdenticalToNegativeMessage), - ("testFailsOnNils", testFailsOnNils), - ("testOperators", testOperators), - ] - } - private class BeIdenticalToObjectTester {} private let testObjectA = BeIdenticalToObjectTester() private let testObjectB = BeIdenticalToObjectTester() diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift index 6b629b0..8830647 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift @@ -3,17 +3,6 @@ import XCTest @testable import Nimble final class BeIdenticalToTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeIdenticalToTest) -> () throws -> Void)] { - return [ - ("testBeIdenticalToPositive", testBeIdenticalToPositive), - ("testBeIdenticalToNegative", testBeIdenticalToNegative), - ("testBeIdenticalToPositiveMessage", testBeIdenticalToPositiveMessage), - ("testBeIdenticalToNegativeMessage", testBeIdenticalToNegativeMessage), - ("testOperators", testOperators), - ("testBeAlias", testBeAlias), - ] - } - func testBeIdenticalToPositive() { let value = NSDate() expect(value).to(beIdenticalTo(value)) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift index 428ace4..f389469 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeLessThanOrEqualToTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeLessThanOrEqualToTest) -> () throws -> Void)] { - return [ - ("testLessThanOrEqualTo", testLessThanOrEqualTo), - ("testLessThanOrEqualToOperator", testLessThanOrEqualToOperator), - ] - } - func testLessThanOrEqualTo() { expect(10).to(beLessThanOrEqualTo(10)) expect(2).to(beLessThanOrEqualTo(10)) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLessThanTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLessThanTest.swift index 90ba1b9..d560232 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLessThanTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLessThanTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeLessThanTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeLessThanTest) -> () throws -> Void)] { - return [ - ("testLessThan", testLessThan), - ("testLessThanOperator", testLessThanOperator), - ] - } - func testLessThan() { expect(2).to(beLessThan(10)) expect(2).toNot(beLessThan(1)) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLogicalTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLogicalTest.swift index 947a1b4..d9ef8ea 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLogicalTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLogicalTest.swift @@ -30,18 +30,6 @@ enum ConvertsToBool: ExpressibleByBooleanLiteral, CustomStringConvertible { } final class BeTruthyTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeTruthyTest) -> () throws -> Void)] { - return [ - ("testShouldMatchNonNilTypes", testShouldMatchNonNilTypes), - ("testShouldMatchTrue", testShouldMatchTrue), - ("testShouldNotMatchNilTypes", testShouldNotMatchNilTypes), - ("testShouldNotMatchFalse", testShouldNotMatchFalse), - ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), - ("testShouldMatchBoolConvertibleTypesThatConvertToTrue", testShouldMatchBoolConvertibleTypesThatConvertToTrue), - ("testShouldNotMatchBoolConvertibleTypesThatConvertToFalse", testShouldNotMatchBoolConvertibleTypesThatConvertToFalse), - ] - } - func testShouldMatchNonNilTypes() { expect(true as Bool?).to(beTruthy()) @@ -123,14 +111,6 @@ final class BeTruthyTest: XCTestCase, XCTestCaseProvider { } final class BeTrueTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeTrueTest) -> () throws -> Void)] { - return [ - ("testShouldMatchTrue", testShouldMatchTrue), - ("testShouldNotMatchFalse", testShouldNotMatchFalse), - ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), - ] - } - func testShouldMatchTrue() { expect(true).to(beTrue()) @@ -159,16 +139,6 @@ final class BeTrueTest: XCTestCase, XCTestCaseProvider { } final class BeFalsyTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeFalsyTest) -> () throws -> Void)] { - return [ - ("testShouldMatchNilTypes", testShouldMatchNilTypes), - ("testShouldNotMatchTrue", testShouldNotMatchTrue), - ("testShouldNotMatchNonNilTypes", testShouldNotMatchNonNilTypes), - ("testShouldMatchFalse", testShouldMatchFalse), - ("testShouldMatchNilBools", testShouldMatchNilBools), - ] - } - func testShouldMatchNilTypes() { expect(false as Bool?).to(beFalsy()) @@ -234,14 +204,6 @@ final class BeFalsyTest: XCTestCase, XCTestCaseProvider { } final class BeFalseTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeFalseTest) -> () throws -> Void)] { - return [ - ("testShouldNotMatchTrue", testShouldNotMatchTrue), - ("testShouldMatchFalse", testShouldMatchFalse), - ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), - ] - } - func testShouldNotMatchTrue() { expect(true).toNot(beFalse()) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeNilTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeNilTest.swift index 69f4185..9e37116 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeNilTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeNilTest.swift @@ -2,12 +2,6 @@ import XCTest import Nimble final class BeNilTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeNilTest) -> () throws -> Void)] { - return [ - ("testBeNil", testBeNil), - ] - } - func producesNil() -> [Int]? { return nil } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeVoidTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeVoidTest.swift index a8eefc1..bb5d324 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeVoidTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeVoidTest.swift @@ -2,12 +2,6 @@ import XCTest import Nimble final class BeVoidTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeVoidTest) -> () throws -> Void)] { - return [ - ("testBeVoid", testBeVoid), - ] - } - func testBeVoid() { expect(()).to(beVoid()) expect(() as ()?).to(beVoid()) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift index 276c7d0..3a5162e 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeginWithTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeginWithTest) -> () throws -> Void)] { - return [ - ("testPositiveMatches", testPositiveMatches), - ("testNegativeMatches", testNegativeMatches), - ] - } - func testPositiveMatches() { expect([1, 2, 3]).to(beginWith(1)) expect([1, 2, 3]).toNot(beginWith(2)) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ContainElementSatisfyingTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ContainElementSatisfyingTest.swift index a9fe80e..6944375 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ContainElementSatisfyingTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ContainElementSatisfyingTest.swift @@ -3,20 +3,6 @@ import XCTest import Nimble final class ContainElementSatisfyingTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (ContainElementSatisfyingTest) -> () throws -> Void)] { - return [ - ("testContainElementSatisfying", testContainElementSatisfying), - ("testContainElementSatisfyingDefaultErrorMessage", testContainElementSatisfyingDefaultErrorMessage), - ("testContainElementSatisfyingSpecificErrorMessage", testContainElementSatisfyingSpecificErrorMessage), - ("testContainElementSatisfyingNegativeCase", - testContainElementSatisfyingNegativeCase), - ("testContainElementSatisfyingNegativeCaseDefaultErrorMessage", - testContainElementSatisfyingNegativeCaseDefaultErrorMessage), - ("testContainElementSatisfyingNegativeCaseSpecificErrorMessage", - testContainElementSatisfyingNegativeCaseSpecificErrorMessage), - ] - } - func testContainElementSatisfying() { var orderIndifferentArray = [1, 2, 3] expect(orderIndifferentArray).to(containElementSatisfying({ number in diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift index 1d8a1eb..f69f351 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift @@ -3,22 +3,12 @@ import XCTest import Nimble final class ContainTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (ContainTest) -> () throws -> Void)] { - return [ - ("testContain", testContain), - ("testContainSubstring", testContainSubstring), - ("testContainObjCSubstring", testContainObjCSubstring), - ("testVariadicArguments", testVariadicArguments), - ("testCollectionArguments", testCollectionArguments), - ] - } - - func testContain() { + func testContainSequence() { expect([1, 2, 3]).to(contain(1)) + expect([1, 2, 3]).toNot(contain(4)) expect([1, 2, 3] as [CInt]).to(contain(1 as CInt)) expect([1, 2, 3] as [CInt]).toNot(contain(4 as CInt)) expect(["foo", "bar", "baz"]).to(contain("baz")) - expect([1, 2, 3]).toNot(contain(4)) expect(["foo", "bar", "baz"]).toNot(contain("ba")) #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) expect(NSArray(array: ["a"])).to(contain(NSString(string: "a"))) @@ -41,6 +31,25 @@ final class ContainTest: XCTestCase, XCTestCaseProvider { } } + func testContainSetAlgebra() { + expect([.a, .b, .c] as TestOptionSet).to(contain(.a)) + expect([.a, .b, .c] as TestOptionSet).toNot(contain(.d)) + + failsWithErrorMessage("expected to contain <8>, got <7>") { + expect([.a, .b, .c] as TestOptionSet).to(contain(.d)) + } + failsWithErrorMessage("expected to not contain <2>, got <7>") { + expect([.a, .b, .c] as TestOptionSet).toNot(contain(.b)) + } + + failsWithErrorMessageForNil("expected to contain <1>, got ") { + expect(nil as TestOptionSet?).to(contain(.a)) + } + failsWithErrorMessageForNil("expected to not contain <1>, got ") { + expect(nil as TestOptionSet?).toNot(contain(.a)) + } + } + func testContainSubstring() { expect("foo").to(contain("o")) expect("foo").to(contain("oo")) @@ -93,3 +102,23 @@ final class ContainTest: XCTestCase, XCTestCaseProvider { } } } + +private struct TestOptionSet: OptionSet, CustomStringConvertible { + let rawValue: Int + + // swiftlint:disable identifier_name + static let a = TestOptionSet(rawValue: 1 << 0) + static let b = TestOptionSet(rawValue: 1 << 1) + static let c = TestOptionSet(rawValue: 1 << 2) + static let d = TestOptionSet(rawValue: 1 << 3) + static let e = TestOptionSet(rawValue: 1 << 4) + // swiftlint:enable identifier_name + + init(rawValue: Int) { + self.rawValue = rawValue + } + + var description: String { + return "\(rawValue)" + } +} diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ElementsEqualTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ElementsEqualTest.swift new file mode 100644 index 0000000..ec7a0dd --- /dev/null +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ElementsEqualTest.swift @@ -0,0 +1,27 @@ +import Foundation +import XCTest +import Nimble + +final class ElementsEqualTest: XCTestCase, XCTestCaseProvider { + + func testSequenceElementsEquality() { + failsWithErrorMessageForNil("expected to elementsEqual , got ") { + expect(nil as [Int]?).to(elementsEqual(nil as [Int]?)) + } + let sequence = [1, 2] + failsWithErrorMessageForNil("expected to elementsEqual <[1, 2]>, got ") { + expect(nil as [Int]?).to(elementsEqual(sequence)) + } + + failsWithErrorMessageForNil("expected to elementsEqual , got <[1, 2]>") { + expect(sequence).to(elementsEqual(nil as [Int]?)) + } + + let sequence1 = [1, 2, 3] + let sequence2 = [1, 2, 3, 4, 5] + expect(sequence1).toNot(elementsEqual(sequence2)) + expect(sequence1).toNot(elementsEqual([3, 2, 1])) + expect(sequence1).to(elementsEqual([1, 2, 3])) + + } +} diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift index 30e3b26..88005e8 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class EndWithTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (EndWithTest) -> () throws -> Void)] { - return [ - ("testEndWithPositives", testEndWithPositives), - ("testEndWithNegatives", testEndWithNegatives), - ] - } - func testEndWithPositives() { expect([1, 2, 3]).to(endWith(3)) expect([1, 2, 3]).toNot(endWith(2)) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift index 85be751..18b0647 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift @@ -3,24 +3,6 @@ import XCTest import Nimble final class EqualTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (EqualTest) -> () throws -> Void)] { - return [ - ("testEquality", testEquality), - ("testArrayEquality", testArrayEquality), - ("testSetEquality", testSetEquality), - ("testDoesNotMatchNils", testDoesNotMatchNils), - ("testDictionaryEquality", testDictionaryEquality), - ("testDataEquality", testDataEquality), - ("testNSObjectEquality", testNSObjectEquality), - ("testOperatorEquality", testOperatorEquality), - ("testOperatorEqualityWithArrays", testOperatorEqualityWithArrays), - ("testOperatorEqualityWithDictionaries", testOperatorEqualityWithDictionaries), - ("testOptionalEquality", testOptionalEquality), - ("testArrayOfOptionalsEquality", testArrayOfOptionalsEquality), - ("testDictionariesWithDifferentSequences", testDictionariesWithDifferentSequences), - ] - } - func testEquality() { expect(1 as CInt).to(equal(1 as CInt)) expect(1 as CInt).to(equal(1)) @@ -152,6 +134,7 @@ final class EqualTest: XCTestCase, XCTestCaseProvider { expect(actual).toNot(equal(unexpected)) #if os(Linux) + // swiftlint:disable:next todo // FIXME: Swift on Linux triggers a segfault when calling NSData's hash() (last checked on 03-11) let expectedErrorMessage = "expected to equal >, got >" #else diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/HaveCountTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/HaveCountTest.swift index a0294c3..4ef610e 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/HaveCountTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/HaveCountTest.swift @@ -2,23 +2,25 @@ import XCTest import Nimble final class HaveCountTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (HaveCountTest) -> () throws -> Void)] { - return [ - ("testHaveCountForArray", testHaveCountForArray), - ("testHaveCountForDictionary", testHaveCountForDictionary), - ("testHaveCountForSet", testHaveCountForSet), - ] - } - func testHaveCountForArray() { expect([1, 2, 3]).to(haveCount(3)) expect([1, 2, 3]).notTo(haveCount(1)) - failsWithErrorMessage("expected to have Array with count 1, got 3\nActual Value: [1, 2, 3]") { + failsWithErrorMessage( + """ + expected to have Array with count 1, got 3 + Actual Value: [1, 2, 3] + """ + ) { expect([1, 2, 3]).to(haveCount(1)) } - failsWithErrorMessage("expected to not have Array with count 3, got 3\nActual Value: [1, 2, 3]") { + failsWithErrorMessage( + """ + expected to not have Array with count 3, got 3 + Actual Value: [1, 2, 3] + """ + ) { expect([1, 2, 3]).notTo(haveCount(3)) } } @@ -28,13 +30,22 @@ final class HaveCountTest: XCTestCase, XCTestCaseProvider { expect(dictionary).to(haveCount(3)) expect(dictionary).notTo(haveCount(1)) - failsWithErrorMessage("expected to have Dictionary with count 1, got 3\nActual Value: \(stringify(dictionary))") { + failsWithErrorMessage( + """ + expected to have Dictionary with count 1, got 3 + Actual Value: \(stringify(dictionary)) + """ + ) { expect(dictionary).to(haveCount(1)) } - failsWithErrorMessage("expected to not have Dictionary with count 3, got 3" + - "\nActual Value: \(stringify(dictionary))") { - expect(dictionary).notTo(haveCount(3)) + failsWithErrorMessage( + """ + expected to not have Dictionary with count 3, got 3 + Actual Value: \(stringify(dictionary)) + """ + ) { + expect(dictionary).notTo(haveCount(3)) } } @@ -43,14 +54,22 @@ final class HaveCountTest: XCTestCase, XCTestCaseProvider { expect(set).to(haveCount(3)) expect(set).notTo(haveCount(1)) - failsWithErrorMessage("expected to have Set with count 1, got 3" + - "\nActual Value: \(stringify(set))") { - expect(set).to(haveCount(1)) + failsWithErrorMessage( + """ + expected to have Set with count 1, got 3 + Actual Value: \(stringify(set)) + """ + ) { + expect(set).to(haveCount(1)) } - failsWithErrorMessage("expected to not have Set with count 3, got 3" + - "\nActual Value: \(stringify(set))") { - expect(set).notTo(haveCount(3)) + failsWithErrorMessage( + """ + expected to not have Set with count 3, got 3 + Actual Value: \(stringify(set)) + """ + ) { + expect(set).notTo(haveCount(3)) } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift index 946e4cd..41e5159 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift @@ -3,18 +3,6 @@ import XCTest import Nimble final class MatchErrorTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (MatchErrorTest) -> () throws -> Void)] { - return [ - ("testMatchErrorPositive", testMatchErrorPositive), - ("testMatchErrorNegative", testMatchErrorNegative), - ("testMatchNSErrorPositive", testMatchNSErrorPositive), - ("testMatchNSErrorNegative", testMatchNSErrorNegative), - ("testMatchPositiveMessage", testMatchPositiveMessage), - ("testMatchNegativeMessage", testMatchNegativeMessage), - ("testDoesNotMatchNils", testDoesNotMatchNils), - ] - } - func testMatchErrorPositive() { expect(NimbleError.laugh).to(matchError(NimbleError.laugh)) expect(NimbleError.laugh).to(matchError(NimbleError.self)) @@ -31,10 +19,12 @@ final class MatchErrorTest: XCTestCase, XCTestCaseProvider { } func testMatchNSErrorPositive() { +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) let error1 = NSError(domain: "err", code: 0, userInfo: nil) let error2 = NSError(domain: "err", code: 0, userInfo: nil) expect(error1).to(matchError(error2)) +#endif } func testMatchNSErrorNegative() { @@ -55,11 +45,13 @@ final class MatchErrorTest: XCTestCase, XCTestCaseProvider { expect(CustomDebugStringConvertibleError.a).to(matchError(CustomDebugStringConvertibleError.b)) } +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) failsWithErrorMessage("expected to match error , got ") { let error1 = NSError(domain: "err", code: 0, userInfo: nil) let error2 = NSError(domain: "err", code: 1, userInfo: nil) expect(error1).to(matchError(error2)) } +#endif } func testMatchNegativeMessage() { diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/MatchTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/MatchTest.swift index a95ba56..1285ecc 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/MatchTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/MatchTest.swift @@ -2,16 +2,6 @@ import XCTest import Nimble final class MatchTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (MatchTest) -> () throws -> Void)] { - return [ - ("testMatchPositive", testMatchPositive), - ("testMatchNegative", testMatchNegative), - ("testMatchPositiveMessage", testMatchPositiveMessage), - ("testMatchNegativeMessage", testMatchNegativeMessage), - ("testMatchNils", testMatchNils), - ] - } - func testMatchPositive() { expect("11:14").to(match("\\d{2}:\\d{2}")) } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift index ac7f9ec..32f5100 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift @@ -3,18 +3,6 @@ import Nimble import Foundation final class PostNotificationTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (PostNotificationTest) -> () throws -> Void)] { - return [ - ("testPassesWhenNoNotificationsArePosted", testPassesWhenNoNotificationsArePosted), - ("testPassesWhenExpectedNotificationIsPosted", testPassesWhenExpectedNotificationIsPosted), - ("testPassesWhenAllExpectedNotificationsArePosted", testPassesWhenAllExpectedNotificationsArePosted), - ("testFailsWhenNoNotificationsArePosted", testFailsWhenNoNotificationsArePosted), - ("testFailsWhenNotificationWithWrongNameIsPosted", testFailsWhenNotificationWithWrongNameIsPosted), - ("testFailsWhenNotificationWithWrongObjectIsPosted", testFailsWhenNotificationWithWrongObjectIsPosted), - ("testPassesWhenExpectedNotificationEventuallyIsPosted", testPassesWhenExpectedNotificationEventuallyIsPosted), - ] - } - let notificationCenter = NotificationCenter() func testPassesWhenNoNotificationsArePosted() { diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift index f62f633..beca75b 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift @@ -3,17 +3,7 @@ import Nimble #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE -final class RaisesExceptionTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (RaisesExceptionTest) -> () throws -> Void)] { - return [ - ("testPositiveMatches", testPositiveMatches), - ("testPositiveMatchesWithClosures", testPositiveMatchesWithClosures), - ("testNegativeMatches", testNegativeMatches), - ("testNegativeMatchesDoNotCallClosureWithoutException", testNegativeMatchesDoNotCallClosureWithoutException), - ("testNegativeMatchesWithClosure", testNegativeMatchesWithClosure), - ] - } - +final class RaisesExceptionTest: XCTestCase { var anException = NSException(name: NSExceptionName("laugh"), reason: "Lulz", userInfo: ["key": "value"]) func testPositiveMatches() { diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/SatisfyAllOfTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/SatisfyAllOfTest.swift index 42ed892..be60a41 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/SatisfyAllOfTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/SatisfyAllOfTest.swift @@ -3,13 +3,6 @@ import Nimble import Foundation final class SatisfyAllOfTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (SatisfyAllOfTest) -> () throws -> Void)] { - return [ - ("testSatisfyAllOf", testSatisfyAllOf), - ("testOperatorAnd", testOperatorAnd), - ] - } - func testSatisfyAllOf() { expect(2).to(satisfyAllOf(equal(2), beLessThan(3))) #if SUPPORT_IMPLICIT_BRIDGING_CONVERSION diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/SatisfyAnyOfTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/SatisfyAnyOfTest.swift index 0bd9495..0cba8d5 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/SatisfyAnyOfTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/SatisfyAnyOfTest.swift @@ -3,13 +3,6 @@ import Nimble import Foundation final class SatisfyAnyOfTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (SatisfyAnyOfTest) -> () throws -> Void)] { - return [ - ("testSatisfyAnyOf", testSatisfyAnyOf), - ("testOperatorOr", testOperatorOr), - ] - } - func testSatisfyAnyOf() { expect(2).to(satisfyAnyOf(equal(2), equal(3))) #if SUPPORT_IMPLICIT_BRIDGING_CONVERSION diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift index 68086e0..edd9e0e 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift @@ -4,24 +4,15 @@ import Nimble #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE -final class ThrowAssertionTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (ThrowAssertionTest) -> () throws -> Void)] { - return [ - ("testPositiveMatch", testPositiveMatch), - ("testErrorThrown", testErrorThrown), - ("testPostAssertionCodeNotRun", testPostAssertionCodeNotRun), - ("testNegativeMatch", testNegativeMatch), - ("testPositiveMessage", testPositiveMessage), - ("testNegativeMessage", testNegativeMessage), - ] - } +private let error: Error = NSError(domain: "test", code: 0, userInfo: nil) +final class ThrowAssertionTest: XCTestCase { func testPositiveMatch() { expect { () -> Void in fatalError() }.to(throwAssertion()) } func testErrorThrown() { - expect { throw NSError(domain: "test", code: 0, userInfo: nil) }.toNot(throwAssertion()) + expect { throw error }.toNot(throwAssertion()) } func testPostAssertionCodeNotRun() { @@ -50,6 +41,10 @@ final class ThrowAssertionTest: XCTestCase, XCTestCaseProvider { failsWithErrorMessage("expected to throw an assertion") { expect { () -> Void? in return }.to(throwAssertion()) } + + failsWithErrorMessage("expected to throw an assertion; threw error instead <\(error)>") { + expect { throw error }.to(throwAssertion()) + } } func testNegativeMessage() { diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ThrowErrorTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ThrowErrorTest.swift index f862992..7a7253f 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ThrowErrorTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ThrowErrorTest.swift @@ -30,8 +30,10 @@ func == (lhs: EquatableError, rhs: EquatableError) -> Bool { } enum CustomDebugStringConvertibleError: Error { + // swiftlint:disable identifier_name case a case b + // swiftlint:enable identifier_name } extension CustomDebugStringConvertibleError: CustomDebugStringConvertible { @@ -41,18 +43,6 @@ extension CustomDebugStringConvertibleError: CustomDebugStringConvertible { } final class ThrowErrorTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (ThrowErrorTest) -> () throws -> Void)] { - return [ - ("testPositiveMatches", testPositiveMatches), - ("testPositiveMatchesWithClosures", testPositiveMatchesWithClosures), - ("testNegativeMatches", testNegativeMatches), - ("testPositiveNegatedMatches", testPositiveNegatedMatches), - ("testNegativeNegatedMatches", testNegativeNegatedMatches), - ("testNegativeMatchesDoNotCallClosureWithoutError", testNegativeMatchesDoNotCallClosureWithoutError), - ("testNegativeMatchesWithClosure", testNegativeMatchesWithClosure), - ] - } - func testPositiveMatches() { expect { throw NimbleError.laugh }.to(throwError()) expect { throw NimbleError.laugh }.to(throwError(NimbleError.laugh)) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ToSucceedTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ToSucceedTest.swift index dde999a..0079f23 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ToSucceedTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ToSucceedTest.swift @@ -2,12 +2,6 @@ import XCTest import Nimble final class ToSucceedTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (ToSucceedTest) -> () throws -> Void)] { - return [ - ("testToSucceed", testToSucceed), - ] - } - func testToSucceed() { expect({ return .succeeded diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/SynchronousTests.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/SynchronousTest.swift similarity index 71% rename from Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/SynchronousTests.swift rename to Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/SynchronousTest.swift index ce8181b..1f412dd 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/SynchronousTests.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/SynchronousTest.swift @@ -3,24 +3,6 @@ import XCTest import Nimble final class SynchronousTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (SynchronousTest) -> () throws -> Void)] { - return [ - ("testFailAlwaysFails", testFailAlwaysFails), - ("testUnexpectedErrorsThrownFails", testUnexpectedErrorsThrownFails), - ("testToMatchesIfMatcherReturnsTrue", testToMatchesIfMatcherReturnsTrue), - ("testToProvidesActualValueExpression", testToProvidesActualValueExpression), - ("testToProvidesAMemoizedActualValueExpression", testToProvidesActualValueExpression), - ("testToProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl", testToProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl), - ("testToMatchAgainstLazyProperties", testToMatchAgainstLazyProperties), - ("testToNotMatchesIfMatcherReturnsTrue", testToNotMatchesIfMatcherReturnsTrue), - ("testToNotProvidesActualValueExpression", testToNotProvidesActualValueExpression), - ("testToNotProvidesAMemoizedActualValueExpression", testToNotProvidesAMemoizedActualValueExpression), - ("testToNotProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl", testToNotProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl), - ("testToNotNegativeMatches", testToNotNegativeMatches), - ("testNotToMatchesLikeToNot", testNotToMatchesLikeToNot), - ] - } - class Error: Swift.Error {} let errorToThrow = Error() @@ -49,6 +31,12 @@ final class SynchronousTest: XCTestCase, XCTestCaseProvider { func testToMatchesIfMatcherReturnsTrue() { expect(1).to(MatcherFunc { _, _ in true }) expect {1}.to(MatcherFunc { _, _ in true }) + + expect(1).to(MatcherFunc { _, _ in true }.predicate) + expect {1}.to(MatcherFunc { _, _ in true }.predicate) + + expect(1).to(Predicate.simple("match") { _ in .matches }) + expect {1}.to(Predicate.simple("match") { _ in .matches }) } func testToProvidesActualValueExpression() { @@ -88,6 +76,12 @@ final class SynchronousTest: XCTestCase, XCTestCaseProvider { func testToNotMatchesIfMatcherReturnsTrue() { expect(1).toNot(MatcherFunc { _, _ in false }) expect {1}.toNot(MatcherFunc { _, _ in false }) + + expect(1).toNot(MatcherFunc { _, _ in false }.predicate) + expect {1}.toNot(MatcherFunc { _, _ in false }.predicate) + + expect(1).toNot(Predicate.simple("match") { _ in .doesNotMatch }) + expect {1}.toNot(Predicate.simple("match") { _ in .doesNotMatch }) } func testToNotProvidesActualValueExpression() { @@ -116,13 +110,33 @@ final class SynchronousTest: XCTestCase, XCTestCaseProvider { expect(callCount).to(equal(1)) } + func testToNegativeMatches() { + failsWithErrorMessage("expected to match, got <1>") { + expect(1).to(MatcherFunc { _, _ in false }) + } + failsWithErrorMessage("expected to match, got <1>") { + expect(1).to(MatcherFunc { _, _ in false }.predicate) + } + failsWithErrorMessage("expected to match, got <1>") { + expect(1).to(Predicate.simple("match") { _ in .doesNotMatch }) + } + } + func testToNotNegativeMatches() { failsWithErrorMessage("expected to not match, got <1>") { expect(1).toNot(MatcherFunc { _, _ in true }) } + failsWithErrorMessage("expected to not match, got <1>") { + expect(1).toNot(MatcherFunc { _, _ in true }.predicate) + } + failsWithErrorMessage("expected to not match, got <1>") { + expect(1).toNot(Predicate.simple("match") { _ in .matches }) + } } func testNotToMatchesLikeToNot() { expect(1).notTo(MatcherFunc { _, _ in false }) + expect(1).notTo(MatcherFunc { _, _ in false }.predicate) + expect(1).notTo(Predicate.simple("match") { _ in .doesNotMatch }) } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/UserDescriptionTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/UserDescriptionTest.swift index 9bb64b6..0c451c8 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/UserDescriptionTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/UserDescriptionTest.swift @@ -2,62 +2,69 @@ import XCTest import Nimble final class UserDescriptionTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (UserDescriptionTest) -> () throws -> Void)] { - return [ - ("testToMatcher_CustomFailureMessage", testToMatcher_CustomFailureMessage), - ("testNotToMatcher_CustomFailureMessage", testNotToMatcher_CustomFailureMessage), - ("testToNotMatcher_CustomFailureMessage", testToNotMatcher_CustomFailureMessage), - ("testToEventuallyMatch_CustomFailureMessage", testToEventuallyMatch_CustomFailureMessage), - ("testToEventuallyNotMatch_CustomFailureMessage", testToEventuallyNotMatch_CustomFailureMessage), - ("testToNotEventuallyMatch_CustomFailureMessage", testToNotEventuallyMatch_CustomFailureMessage), - ] - } - func testToMatcher_CustomFailureMessage() { failsWithErrorMessage( - "These aren't equal!\n" + - "expected to match, got <1>") { - expect(1).to(MatcherFunc { _, _ in false }, description: "These aren't equal!") + """ + These aren't equal! + expected to match, got <1> + """ + ) { + expect(1).to(MatcherFunc { _, _ in false }, description: "These aren't equal!") } } func testNotToMatcher_CustomFailureMessage() { failsWithErrorMessage( - "These aren't equal!\n" + - "expected to not match, got <1>") { - expect(1).notTo(MatcherFunc { _, _ in true }, description: "These aren't equal!") + """ + These aren't equal! + expected to not match, got <1> + """ + ) { + expect(1).notTo(MatcherFunc { _, _ in true }, description: "These aren't equal!") } } func testToNotMatcher_CustomFailureMessage() { failsWithErrorMessage( - "These aren't equal!\n" + - "expected to not match, got <1>") { - expect(1).toNot(MatcherFunc { _, _ in true }, description: "These aren't equal!") + """ + These aren't equal! + expected to not match, got <1> + """ + ) { + expect(1).toNot(MatcherFunc { _, _ in true }, description: "These aren't equal!") } } func testToEventuallyMatch_CustomFailureMessage() { failsWithErrorMessage( - "These aren't eventually equal!\n" + - "expected to eventually equal <1>, got <0>") { - expect { 0 }.toEventually(equal(1), description: "These aren't eventually equal!") + """ + These aren't eventually equal! + expected to eventually equal <1>, got <0> + """ + ) { + expect { 0 }.toEventually(equal(1), description: "These aren't eventually equal!") } } func testToEventuallyNotMatch_CustomFailureMessage() { failsWithErrorMessage( - "These are eventually equal!\n" + - "expected to eventually not equal <1>, got <1>") { - expect { 1 }.toEventuallyNot(equal(1), description: "These are eventually equal!") + """ + These are eventually equal! + expected to eventually not equal <1>, got <1> + """ + ) { + expect { 1 }.toEventuallyNot(equal(1), description: "These are eventually equal!") } } func testToNotEventuallyMatch_CustomFailureMessage() { failsWithErrorMessage( - "These are eventually equal!\n" + - "expected to eventually not equal <1>, got <1>") { - expect { 1 }.toEventuallyNot(equal(1), description: "These are eventually equal!") + """ + These are eventually equal! + expected to eventually not equal <1>, got <1> + """ + ) { + expect { 1 }.toEventuallyNot(equal(1), description: "These are eventually equal!") } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/XCTestManifests.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/XCTestManifests.swift new file mode 100644 index 0000000..e0fcd0a --- /dev/null +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/XCTestManifests.swift @@ -0,0 +1,386 @@ +import XCTest + +extension AllPassTest { + static let __allTests = [ + ("testAllPassArray", testAllPassArray), + ("testAllPassCollectionsWithOptionalsDontWork", testAllPassCollectionsWithOptionalsDontWork), + ("testAllPassCollectionsWithOptionalsUnwrappingOneOptionalLayer", testAllPassCollectionsWithOptionalsUnwrappingOneOptionalLayer), + ("testAllPassMatcher", testAllPassMatcher), + ("testAllPassSet", testAllPassSet), + ("testAllPassWithNilAsExpectedValue", testAllPassWithNilAsExpectedValue), + ] +} + +extension AsyncTest { + static let __allTests = [ + ("testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed", testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed), + ("testSubjectUnderTestIsReleasedFromMemory", testSubjectUnderTestIsReleasedFromMemory), + ("testToEventuallyMustBeInMainThread", testToEventuallyMustBeInMainThread), + ("testToEventuallyNegativeMatches", testToEventuallyNegativeMatches), + ("testToEventuallyPositiveMatches", testToEventuallyPositiveMatches), + ("testToEventuallyWithCustomDefaultTimeout", testToEventuallyWithCustomDefaultTimeout), + ("testWaitUntilDetectsStalledMainThreadActivity", testWaitUntilDetectsStalledMainThreadActivity), + ("testWaitUntilErrorsIfDoneIsCalledMultipleTimes", testWaitUntilErrorsIfDoneIsCalledMultipleTimes), + ("testWaitUntilMustBeInMainThread", testWaitUntilMustBeInMainThread), + ("testWaitUntilNegativeMatches", testWaitUntilNegativeMatches), + ("testWaitUntilPositiveMatches", testWaitUntilPositiveMatches), + ("testWaitUntilTimesOutIfNotCalled", testWaitUntilTimesOutIfNotCalled), + ("testWaitUntilTimesOutWhenExceedingItsTime", testWaitUntilTimesOutWhenExceedingItsTime), + ("testWaitUntilWithCustomDefaultsTimeout", testWaitUntilWithCustomDefaultsTimeout), + ] +} + +extension BeAKindOfObjCTest { + static let __allTests = [ + ("testFailureMessages", testFailureMessages), + ("testPositiveMatch", testPositiveMatch), + ] +} + +extension BeAKindOfSwiftTest { + static let __allTests = [ + ("testFailureMessages", testFailureMessages), + ("testPositiveMatch", testPositiveMatch), + ] +} + +extension BeAnInstanceOfTest { + static let __allTests = [ + ("testFailureMessages", testFailureMessages), + ("testFailureMessagesSwiftTypes", testFailureMessagesSwiftTypes), + ("testPositiveMatch", testPositiveMatch), + ("testPositiveMatchSwiftTypes", testPositiveMatchSwiftTypes), + ] +} + +extension BeCloseToTest { + static let __allTests = [ + ("testBeCloseTo", testBeCloseTo), + ("testBeCloseToArray", testBeCloseToArray), + ("testBeCloseToOperator", testBeCloseToOperator), + ("testBeCloseToOperatorWithDate", testBeCloseToOperatorWithDate), + ("testBeCloseToWithCGFloat", testBeCloseToWithCGFloat), + ("testBeCloseToWithDate", testBeCloseToWithDate), + ("testBeCloseToWithin", testBeCloseToWithin), + ("testBeCloseToWithinOperator", testBeCloseToWithinOperator), + ("testBeCloseToWithinOperatorWithDate", testBeCloseToWithinOperatorWithDate), + ("testBeCloseToWithNSDate", testBeCloseToWithNSDate), + ("testBeCloseToWithNSNumber", testBeCloseToWithNSNumber), + ("testPlusMinusOperator", testPlusMinusOperator), + ("testPlusMinusOperatorWithDate", testPlusMinusOperatorWithDate), + ] +} + +extension BeEmptyTest { + static let __allTests = [ + ("testBeEmptyNegative", testBeEmptyNegative), + ("testBeEmptyPositive", testBeEmptyPositive), + ("testNilMatches", testNilMatches), + ] +} + +extension BeFalseTest { + static let __allTests = [ + ("testShouldMatchFalse", testShouldMatchFalse), + ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), + ("testShouldNotMatchTrue", testShouldNotMatchTrue), + ] +} + +extension BeFalsyTest { + static let __allTests = [ + ("testShouldMatchFalse", testShouldMatchFalse), + ("testShouldMatchNilBools", testShouldMatchNilBools), + ("testShouldMatchNilTypes", testShouldMatchNilTypes), + ("testShouldNotMatchNonNilTypes", testShouldNotMatchNonNilTypes), + ("testShouldNotMatchTrue", testShouldNotMatchTrue), + ] +} + +extension BeGreaterThanOrEqualToTest { + static let __allTests = [ + ("testGreaterThanOrEqualTo", testGreaterThanOrEqualTo), + ("testGreaterThanOrEqualToOperator", testGreaterThanOrEqualToOperator), + ] +} + +extension BeGreaterThanTest { + static let __allTests = [ + ("testGreaterThan", testGreaterThan), + ("testGreaterThanOperator", testGreaterThanOperator), + ] +} + +extension BeIdenticalToObjectTest { + static let __allTests = [ + ("testBeIdenticalToNegative", testBeIdenticalToNegative), + ("testBeIdenticalToNegativeMessage", testBeIdenticalToNegativeMessage), + ("testBeIdenticalToPositive", testBeIdenticalToPositive), + ("testBeIdenticalToPositiveMessage", testBeIdenticalToPositiveMessage), + ("testFailsOnNils", testFailsOnNils), + ("testOperators", testOperators), + ] +} + +extension BeIdenticalToTest { + static let __allTests = [ + ("testBeAlias", testBeAlias), + ("testBeIdenticalToNegative", testBeIdenticalToNegative), + ("testBeIdenticalToNegativeMessage", testBeIdenticalToNegativeMessage), + ("testBeIdenticalToPositive", testBeIdenticalToPositive), + ("testBeIdenticalToPositiveMessage", testBeIdenticalToPositiveMessage), + ("testOperators", testOperators), + ] +} + +extension BeLessThanOrEqualToTest { + static let __allTests = [ + ("testLessThanOrEqualTo", testLessThanOrEqualTo), + ("testLessThanOrEqualToOperator", testLessThanOrEqualToOperator), + ] +} + +extension BeLessThanTest { + static let __allTests = [ + ("testLessThan", testLessThan), + ("testLessThanOperator", testLessThanOperator), + ] +} + +extension BeNilTest { + static let __allTests = [ + ("testBeNil", testBeNil), + ] +} + +extension BeTrueTest { + static let __allTests = [ + ("testShouldMatchTrue", testShouldMatchTrue), + ("testShouldNotMatchFalse", testShouldNotMatchFalse), + ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), + ] +} + +extension BeTruthyTest { + static let __allTests = [ + ("testShouldMatchBoolConvertibleTypesThatConvertToTrue", testShouldMatchBoolConvertibleTypesThatConvertToTrue), + ("testShouldMatchNonNilTypes", testShouldMatchNonNilTypes), + ("testShouldMatchTrue", testShouldMatchTrue), + ("testShouldNotMatchBoolConvertibleTypesThatConvertToFalse", testShouldNotMatchBoolConvertibleTypesThatConvertToFalse), + ("testShouldNotMatchFalse", testShouldNotMatchFalse), + ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), + ("testShouldNotMatchNilTypes", testShouldNotMatchNilTypes), + ] +} + +extension BeVoidTest { + static let __allTests = [ + ("testBeVoid", testBeVoid), + ] +} + +extension BeginWithTest { + static let __allTests = [ + ("testNegativeMatches", testNegativeMatches), + ("testPositiveMatches", testPositiveMatches), + ] +} + +extension ContainElementSatisfyingTest { + static let __allTests = [ + ("testContainElementSatisfying", testContainElementSatisfying), + ("testContainElementSatisfyingDefaultErrorMessage", testContainElementSatisfyingDefaultErrorMessage), + ("testContainElementSatisfyingNegativeCase", testContainElementSatisfyingNegativeCase), + ("testContainElementSatisfyingNegativeCaseDefaultErrorMessage", testContainElementSatisfyingNegativeCaseDefaultErrorMessage), + ("testContainElementSatisfyingNegativeCaseSpecificErrorMessage", testContainElementSatisfyingNegativeCaseSpecificErrorMessage), + ("testContainElementSatisfyingSpecificErrorMessage", testContainElementSatisfyingSpecificErrorMessage), + ] +} + +extension ContainTest { + static let __allTests = [ + ("testCollectionArguments", testCollectionArguments), + ("testContainObjCSubstring", testContainObjCSubstring), + ("testContainSequence", testContainSequence), + ("testContainSetAlgebra", testContainSetAlgebra), + ("testContainSubstring", testContainSubstring), + ("testVariadicArguments", testVariadicArguments), + ] +} + +extension ElementsEqualTest { + static let __allTests = [ + ("testSequenceElementsEquality", testSequenceElementsEquality), + ] +} + +extension EndWithTest { + static let __allTests = [ + ("testEndWithNegatives", testEndWithNegatives), + ("testEndWithPositives", testEndWithPositives), + ] +} + +extension EqualTest { + static let __allTests = [ + ("testArrayEquality", testArrayEquality), + ("testArrayOfOptionalsEquality", testArrayOfOptionalsEquality), + ("testDataEquality", testDataEquality), + ("testDictionariesWithDifferentSequences", testDictionariesWithDifferentSequences), + ("testDictionaryEquality", testDictionaryEquality), + ("testDoesNotMatchNils", testDoesNotMatchNils), + ("testEquality", testEquality), + ("testNSObjectEquality", testNSObjectEquality), + ("testOperatorEquality", testOperatorEquality), + ("testOperatorEqualityWithArrays", testOperatorEqualityWithArrays), + ("testOperatorEqualityWithDictionaries", testOperatorEqualityWithDictionaries), + ("testOptionalEquality", testOptionalEquality), + ("testSetEquality", testSetEquality), + ] +} + +extension HaveCountTest { + static let __allTests = [ + ("testHaveCountForArray", testHaveCountForArray), + ("testHaveCountForDictionary", testHaveCountForDictionary), + ("testHaveCountForSet", testHaveCountForSet), + ] +} + +extension MatchErrorTest { + static let __allTests = [ + ("testDoesNotMatchNils", testDoesNotMatchNils), + ("testMatchErrorNegative", testMatchErrorNegative), + ("testMatchErrorPositive", testMatchErrorPositive), + ("testMatchNegativeMessage", testMatchNegativeMessage), + ("testMatchNSErrorNegative", testMatchNSErrorNegative), + ("testMatchNSErrorPositive", testMatchNSErrorPositive), + ("testMatchPositiveMessage", testMatchPositiveMessage), + ] +} + +extension MatchTest { + static let __allTests = [ + ("testMatchNegative", testMatchNegative), + ("testMatchNegativeMessage", testMatchNegativeMessage), + ("testMatchNils", testMatchNils), + ("testMatchPositive", testMatchPositive), + ("testMatchPositiveMessage", testMatchPositiveMessage), + ] +} + +extension PostNotificationTest { + static let __allTests = [ + ("testFailsWhenNoNotificationsArePosted", testFailsWhenNoNotificationsArePosted), + ("testFailsWhenNotificationWithWrongNameIsPosted", testFailsWhenNotificationWithWrongNameIsPosted), + ("testFailsWhenNotificationWithWrongObjectIsPosted", testFailsWhenNotificationWithWrongObjectIsPosted), + ("testPassesWhenAllExpectedNotificationsArePosted", testPassesWhenAllExpectedNotificationsArePosted), + ("testPassesWhenExpectedNotificationEventuallyIsPosted", testPassesWhenExpectedNotificationEventuallyIsPosted), + ("testPassesWhenExpectedNotificationIsPosted", testPassesWhenExpectedNotificationIsPosted), + ("testPassesWhenNoNotificationsArePosted", testPassesWhenNoNotificationsArePosted), + ] +} + +extension SatisfyAllOfTest { + static let __allTests = [ + ("testOperatorAnd", testOperatorAnd), + ("testSatisfyAllOf", testSatisfyAllOf), + ] +} + +extension SatisfyAnyOfTest { + static let __allTests = [ + ("testOperatorOr", testOperatorOr), + ("testSatisfyAnyOf", testSatisfyAnyOf), + ] +} + +extension SynchronousTest { + static let __allTests = [ + ("testFailAlwaysFails", testFailAlwaysFails), + ("testNotToMatchesLikeToNot", testNotToMatchesLikeToNot), + ("testToMatchAgainstLazyProperties", testToMatchAgainstLazyProperties), + ("testToMatchesIfMatcherReturnsTrue", testToMatchesIfMatcherReturnsTrue), + ("testToNegativeMatches", testToNegativeMatches), + ("testToNotMatchesIfMatcherReturnsTrue", testToNotMatchesIfMatcherReturnsTrue), + ("testToNotNegativeMatches", testToNotNegativeMatches), + ("testToNotProvidesActualValueExpression", testToNotProvidesActualValueExpression), + ("testToNotProvidesAMemoizedActualValueExpression", testToNotProvidesAMemoizedActualValueExpression), + ("testToNotProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl", testToNotProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl), + ("testToProvidesActualValueExpression", testToProvidesActualValueExpression), + ("testToProvidesAMemoizedActualValueExpression", testToProvidesAMemoizedActualValueExpression), + ("testToProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl", testToProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl), + ("testUnexpectedErrorsThrownFails", testUnexpectedErrorsThrownFails), + ] +} + +extension ThrowErrorTest { + static let __allTests = [ + ("testNegativeMatches", testNegativeMatches), + ("testNegativeMatchesDoNotCallClosureWithoutError", testNegativeMatchesDoNotCallClosureWithoutError), + ("testNegativeMatchesWithClosure", testNegativeMatchesWithClosure), + ("testNegativeNegatedMatches", testNegativeNegatedMatches), + ("testPositiveMatches", testPositiveMatches), + ("testPositiveMatchesWithClosures", testPositiveMatchesWithClosures), + ("testPositiveNegatedMatches", testPositiveNegatedMatches), + ] +} + +extension ToSucceedTest { + static let __allTests = [ + ("testToSucceed", testToSucceed), + ] +} + +extension UserDescriptionTest { + static let __allTests = [ + ("testNotToMatcher_CustomFailureMessage", testNotToMatcher_CustomFailureMessage), + ("testToEventuallyMatch_CustomFailureMessage", testToEventuallyMatch_CustomFailureMessage), + ("testToEventuallyNotMatch_CustomFailureMessage", testToEventuallyNotMatch_CustomFailureMessage), + ("testToMatcher_CustomFailureMessage", testToMatcher_CustomFailureMessage), + ("testToNotEventuallyMatch_CustomFailureMessage", testToNotEventuallyMatch_CustomFailureMessage), + ("testToNotMatcher_CustomFailureMessage", testToNotMatcher_CustomFailureMessage), + ] +} + +#if !os(macOS) +public func __allTests() -> [XCTestCaseEntry] { + return [ + testCase(AllPassTest.__allTests), + testCase(AsyncTest.__allTests), + testCase(BeAKindOfObjCTest.__allTests), + testCase(BeAKindOfSwiftTest.__allTests), + testCase(BeAnInstanceOfTest.__allTests), + testCase(BeCloseToTest.__allTests), + testCase(BeEmptyTest.__allTests), + testCase(BeFalseTest.__allTests), + testCase(BeFalsyTest.__allTests), + testCase(BeGreaterThanOrEqualToTest.__allTests), + testCase(BeGreaterThanTest.__allTests), + testCase(BeIdenticalToObjectTest.__allTests), + testCase(BeIdenticalToTest.__allTests), + testCase(BeLessThanOrEqualToTest.__allTests), + testCase(BeLessThanTest.__allTests), + testCase(BeNilTest.__allTests), + testCase(BeTrueTest.__allTests), + testCase(BeTruthyTest.__allTests), + testCase(BeVoidTest.__allTests), + testCase(BeginWithTest.__allTests), + testCase(ContainElementSatisfyingTest.__allTests), + testCase(ContainTest.__allTests), + testCase(ElementsEqualTest.__allTests), + testCase(EndWithTest.__allTests), + testCase(EqualTest.__allTests), + testCase(HaveCountTest.__allTests), + testCase(MatchErrorTest.__allTests), + testCase(MatchTest.__allTests), + testCase(PostNotificationTest.__allTests), + testCase(SatisfyAllOfTest.__allTests), + testCase(SatisfyAnyOfTest.__allTests), + testCase(SynchronousTest.__allTests), + testCase(ThrowErrorTest.__allTests), + testCase(ToSucceedTest.__allTests), + testCase(UserDescriptionTest.__allTests), + ] +} +#endif diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCAsyncTest.m b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCAsyncTest.m index f052e74..06f5b32 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCAsyncTest.m +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCAsyncTest.m @@ -29,6 +29,11 @@ waitUntil(^(void (^done)(void)){ done(); }); + waitUntil(^(void (^done)(void)){ + dispatch_async(dispatch_get_main_queue(), ^{ + done(); + }); + }); expectFailureMessage(@"Waited more than 1.0 second", ^{ waitUntil(^(void (^done)(void)){ /* ... */ }); diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCContainTest.m b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCContainTest.m index 8b954fe..62d6e45 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCContainTest.m +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCContainTest.m @@ -64,4 +64,13 @@ }); } +- (void)testUnsupportedTypes { + expectFailureMessage(@"expected to contain (only works for NSArrays, NSSets, NSHashTables, and NSStrings), got <1>", ^{ + expect(@1).to(contain(@"foo")); + }); + expectFailureMessage(@"expected to not contain (only works for NSArrays, NSSets, NSHashTables, and NSStrings), got <1>", ^{ + expect(@1).toNot(contain(@"foo")); + }); +} + @end diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCEndWithTest.m b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCEndWithTest.m index b960f01..b48b3fc 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCEndWithTest.m +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCEndWithTest.m @@ -13,7 +13,6 @@ expect(@"hello world!").toNot(endWith(@"hello")); expect(array).to(endWith(@2)); expect(array).toNot(endWith(@1)); - expect(@1).toNot(contain(@"foo")); } - (void)testNegativeMatches { diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCHaveCountTest.m b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCHaveCountTest.m index 31053c8..ea0e31f 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCHaveCountTest.m +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCHaveCountTest.m @@ -171,4 +171,13 @@ }); } +- (void)testNilMatches { + expectNilFailureMessage(@"expected to have a collection with count 3, got ", ^{ + expect(nil).to(haveCount(3)); + }); + expectNilFailureMessage(@"expected to not have a collection with count 3, got ", ^{ + expect(nil).toNot(haveCount(3)); + }); +} + @end diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/test b/Carthage/Checkouts/Quick/Externals/Nimble/test index 0766351..c213afe 100755 --- a/Carthage/Checkouts/Quick/Externals/Nimble/test +++ b/Carthage/Checkouts/Quick/Externals/Nimble/test @@ -63,7 +63,7 @@ function test_ios { function test_tvos { run osascript -e 'tell app "Simulator" to quit' - run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-tvOS" -configuration "Debug" -sdk "appletvsimulator$BUILD_TVOS_SDK_VERSION" -destination "name=Apple TV 1080p,OS=$RUNTIME_TVOS_SDK_VERSION" build-for-testing test-without-building + run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-tvOS" -configuration "Debug" -sdk "appletvsimulator$BUILD_TVOS_SDK_VERSION" -destination "name=Apple TV,OS=$RUNTIME_TVOS_SDK_VERSION" build-for-testing test-without-building } function test_macos { @@ -74,13 +74,17 @@ function test_podspec { echo "Gathering CocoaPods installation information..." run bundle exec pod --version echo "Linting podspec..." + # To work around the lint error: "ERROR | swift: Specification `Nimble` specifies an inconsistent `swift_version` (`4.0`) compared to the one present in your `.swift-version` file (`4.1`). Please remove the `.swift-version` file which is now deprecated and only use the `swift_version` attribute within your podspec." + # `.swift-version` is for swiftenv, not for CocoaPods, so we can't remove the file as suggested. + run mv .swift-version .swift-version.backup # Note: remove `--allow-warnings` once old Matcher API has been removed - run bundle exec pod lib lint Nimble.podspec --allow-warnings + run bundle exec pod lib lint Nimble.podspec --allow-warnings --skip-import-validation + run mv .swift-version.backup .swift-version } function test_swiftpm { if [ -d .build ]; then - run swift build --clean + run swift package clean fi run swift build && swift test } diff --git a/Carthage/Checkouts/Quick/Gemfile b/Carthage/Checkouts/Quick/Gemfile index 716d667..45cf683 100644 --- a/Carthage/Checkouts/Quick/Gemfile +++ b/Carthage/Checkouts/Quick/Gemfile @@ -1,5 +1,5 @@ source "https://rubygems.org" -gem 'cocoapods', '~> 1.5.0' +gem 'cocoapods', '~> 1.7.0.beta' gem 'danger' gem 'danger-swiftlint' diff --git a/Carthage/Checkouts/Quick/Gemfile.lock b/Carthage/Checkouts/Quick/Gemfile.lock index 9a0bf21..ce57b59 100644 --- a/Carthage/Checkouts/Quick/Gemfile.lock +++ b/Carthage/Checkouts/Quick/Gemfile.lock @@ -2,55 +2,55 @@ GEM remote: https://rubygems.org/ specs: CFPropertyList (3.0.0) - activesupport (4.2.10) + activesupport (4.2.11) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) addressable (2.5.0) public_suffix (~> 2.0, >= 2.0.2) - atomos (0.1.2) + atomos (0.1.3) claide (1.0.2) claide-plugins (0.9.2) cork nap open4 (~> 1.3) - cocoapods (1.5.0) + cocoapods (1.7.0.beta.1) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.5.0) - cocoapods-deintegrate (>= 1.0.2, < 2.0) - cocoapods-downloader (>= 1.2.0, < 2.0) + cocoapods-core (= 1.7.0.beta.1) + cocoapods-deintegrate (>= 1.0.3, < 2.0) + cocoapods-downloader (>= 1.2.2, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) cocoapods-stats (>= 1.0.0, < 2.0) - cocoapods-trunk (>= 1.3.0, < 2.0) + cocoapods-trunk (>= 1.3.1, < 2.0) cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) - fourflusher (~> 2.0.1) + fourflusher (>= 2.2.0, < 3.0) gh_inspector (~> 1.0) - molinillo (~> 0.6.5) + molinillo (~> 0.6.6) nap (~> 1.0) - ruby-macho (~> 1.1) - xcodeproj (>= 1.5.7, < 2.0) - cocoapods-core (1.5.0) + ruby-macho (~> 1.4) + xcodeproj (>= 1.8.1, < 2.0) + cocoapods-core (1.7.0.beta.1) activesupport (>= 4.0.2, < 6) fuzzy_match (~> 2.0.4) nap (~> 1.0) - cocoapods-deintegrate (1.0.2) - cocoapods-downloader (1.2.0) + cocoapods-deintegrate (1.0.3) + cocoapods-downloader (1.2.2) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) - cocoapods-stats (1.0.0) - cocoapods-trunk (1.3.0) + cocoapods-stats (1.1.0) + cocoapods-trunk (1.3.1) nap (>= 0.8, < 2.0) netrc (~> 0.11) cocoapods-try (1.1.0) colored (1.2) colored2 (3.1.2) - concurrent-ruby (1.0.5) + concurrent-ruby (1.1.4) cork (0.2.0) colored (~> 1.2) danger (4.0.4) @@ -71,7 +71,7 @@ GEM multipart-post (>= 1.2, < 3) faraday-http-cache (1.3.1) faraday (~> 0.8) - fourflusher (2.0.1) + fourflusher (2.2.0) fuzzy_match (2.0.4) gh_inspector (1.1.3) git (1.3.0) @@ -79,16 +79,16 @@ GEM concurrent-ruby (~> 1.0) kramdown (1.13.2) minitest (5.11.3) - molinillo (0.6.5) + molinillo (0.6.6) multipart-post (2.0.0) - nanaimo (0.2.5) + nanaimo (0.2.6) nap (1.1.0) netrc (0.11.0) octokit (4.6.2) sawyer (~> 0.8.0, >= 0.5.3) open4 (1.3.4) public_suffix (2.0.5) - ruby-macho (1.1.0) + ruby-macho (1.4.0) sawyer (0.8.1) addressable (>= 2.3.5, < 2.6) faraday (~> 0.8, < 1.0) @@ -98,20 +98,20 @@ GEM tzinfo (1.2.5) thread_safe (~> 0.1) unicode-display_width (1.1.2) - xcodeproj (1.5.7) + xcodeproj (1.8.1) CFPropertyList (>= 2.3.3, < 4.0) - atomos (~> 0.1.2) + atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) - nanaimo (~> 0.2.4) + nanaimo (~> 0.2.6) PLATFORMS ruby DEPENDENCIES - cocoapods (~> 1.5.0) + cocoapods (~> 1.7.0.beta) danger danger-swiftlint BUNDLED WITH - 1.16.1 + 1.17.2 diff --git a/Carthage/Checkouts/Quick/Package.resolved b/Carthage/Checkouts/Quick/Package.resolved index 4651c1a..9d724da 100644 --- a/Carthage/Checkouts/Quick/Package.resolved +++ b/Carthage/Checkouts/Quick/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/Quick/Nimble.git", "state": { "branch": null, - "revision": "9c1379fdcd58c4f2278aea5e029394ba9a2b8f07", - "version": "7.1.3" + "revision": "a27c5186ce2d65f60d1237660b2509df3eb29023", + "version": "8.0.0" } } ] diff --git a/Carthage/Checkouts/Quick/Package.swift b/Carthage/Checkouts/Quick/Package.swift index 07b93b4..419d663 100644 --- a/Carthage/Checkouts/Quick/Package.swift +++ b/Carthage/Checkouts/Quick/Package.swift @@ -1,47 +1,40 @@ -// swift-tools-version:3.1 +// swift-tools-version:4.2 -import Foundation import PackageDescription -var isTesting: Bool { - guard let value = ProcessInfo.processInfo.environment["SWIFT_PACKAGE_TEST_Quick"] else { return false } - return NSString(string: value).boolValue -} - -var package = Package( +let package = Package( name: "Quick", + products: [ + .library(name: "Quick", targets: ["Quick"]), + ], + dependencies: [ + .package(url: "https://github.com/Quick/Nimble.git", from: "8.0.0"), + ], targets: { + var targets: [Target] = [ + .testTarget( + name: "QuickTests", + dependencies: [ "Quick", "Nimble" ], + exclude: [ + "QuickAfterSuiteTests/AfterSuiteTests+ObjC.m", + "QuickFocusedTests/FocusedTests+ObjC.m", + "QuickTests/FunctionalTests/ObjC", + "QuickTests/Helpers", + "QuickTests/QuickConfigurationTests.m", + ] + ), + ] #if os(macOS) - return [ - Target(name: "QuickSpecBase"), - Target(name: "Quick", dependencies: [ "QuickSpecBase" ]), - Target(name: "QuickTests", dependencies: [ "Quick" ]), - ] + targets.append(contentsOf: [ + .target(name: "QuickSpecBase", dependencies: []), + .target(name: "Quick", dependencies: [ "QuickSpecBase" ]), + ]) #else - return [ - Target(name: "Quick"), - Target(name: "QuickTests", dependencies: [ "Quick" ]), - ] + targets.append(contentsOf: [ + .target(name: "Quick", dependencies: []), + ]) #endif + return targets }(), - exclude: { - var excludes = [ - "Sources/QuickObjectiveC", - "Tests/QuickTests/QuickAfterSuiteTests/AfterSuiteTests+ObjC.m", - "Tests/QuickTests/QuickFocusedTests/FocusedTests+ObjC.m", - "Tests/QuickTests/QuickTests/FunctionalTests/ObjC", - "Tests/QuickTests/QuickTests/Helpers", - "Tests/QuickTests/QuickTests/QuickConfigurationTests.m", - ] -#if !os(macOS) - excludes.append("Sources/QuickSpecBase") -#endif - return excludes - }() + swiftLanguageVersions: [.v4_2] ) - -if isTesting { - package.dependencies.append(contentsOf: [ - .Package(url: "https://github.com/Quick/Nimble.git", majorVersion: 7), - ]) -} diff --git a/Carthage/Checkouts/Quick/Package@swift-4.swift b/Carthage/Checkouts/Quick/Package@swift-4.swift deleted file mode 100644 index 7f230fd..0000000 --- a/Carthage/Checkouts/Quick/Package@swift-4.swift +++ /dev/null @@ -1,40 +0,0 @@ -// swift-tools-version:4.0 - -import PackageDescription - -let package = Package( - name: "Quick", - products: [ - .library(name: "Quick", targets: ["Quick"]), - ], - dependencies: [ - .package(url: "https://github.com/Quick/Nimble.git", from: "7.0.1"), - ], - targets: { - var targets: [Target] = [ - .testTarget( - name: "QuickTests", - dependencies: [ "Quick", "Nimble" ], - exclude: [ - "QuickAfterSuiteTests/AfterSuiteTests+ObjC.m", - "QuickFocusedTests/FocusedTests+ObjC.m", - "QuickTests/FunctionalTests/ObjC", - "QuickTests/Helpers", - "QuickTests/QuickConfigurationTests.m", - ] - ), - ] -#if os(macOS) - targets.append(contentsOf: [ - .target(name: "QuickSpecBase", dependencies: []), - .target(name: "Quick", dependencies: [ "QuickSpecBase" ]), - ]) -#else - targets.append(contentsOf: [ - .target(name: "Quick", dependencies: []), - ]) -#endif - return targets - }(), - swiftLanguageVersions: [3] -) diff --git a/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Objective-C/___FILEBASENAME___.h b/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Objective-C/___FILEBASENAME___.h index b934bcb..7b63eb5 100644 --- a/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Objective-C/___FILEBASENAME___.h +++ b/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Objective-C/___FILEBASENAME___.h @@ -3,7 +3,7 @@ // ___PROJECTNAME___ // // Created by ___FULLUSERNAME___ on ___DATE___. -//___COPYRIGHT___ +// ___COPYRIGHT___ // @import Quick; diff --git a/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Objective-C/___FILEBASENAME___.m b/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Objective-C/___FILEBASENAME___.m index cd3f486..61e7d24 100644 --- a/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Objective-C/___FILEBASENAME___.m +++ b/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Objective-C/___FILEBASENAME___.m @@ -3,7 +3,7 @@ // ___PROJECTNAME___ // // Created by ___FULLUSERNAME___ on ___DATE___. -//___COPYRIGHT___ +// ___COPYRIGHT___ // #import "___FILEBASENAMEASIDENTIFIER___.h" diff --git a/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Swift/___FILEBASENAME___.swift b/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Swift/___FILEBASENAME___.swift index ae0acbb..67b9f64 100644 --- a/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Swift/___FILEBASENAME___.swift +++ b/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Swift/___FILEBASENAME___.swift @@ -3,7 +3,7 @@ // ___PROJECTNAME___ // // Created by ___FULLUSERNAME___ on ___DATE___. -//___COPYRIGHT___ +// ___COPYRIGHT___ // import Quick diff --git a/Carthage/Checkouts/Quick/Quick Templates/Quick Spec Class.xctemplate/Objective-C/___FILEBASENAME___.m b/Carthage/Checkouts/Quick/Quick Templates/Quick Spec Class.xctemplate/Objective-C/___FILEBASENAME___.m index 3e8da5b..31443f2 100644 --- a/Carthage/Checkouts/Quick/Quick Templates/Quick Spec Class.xctemplate/Objective-C/___FILEBASENAME___.m +++ b/Carthage/Checkouts/Quick/Quick Templates/Quick Spec Class.xctemplate/Objective-C/___FILEBASENAME___.m @@ -3,7 +3,7 @@ // ___PROJECTNAME___ // // Created by ___FULLUSERNAME___ on ___DATE___. -//___COPYRIGHT___ +// ___COPYRIGHT___ // #import diff --git a/Carthage/Checkouts/Quick/Quick Templates/Quick Spec Class.xctemplate/Swift/___FILEBASENAME___.swift b/Carthage/Checkouts/Quick/Quick Templates/Quick Spec Class.xctemplate/Swift/___FILEBASENAME___.swift index a8371cf..63c1cfc 100644 --- a/Carthage/Checkouts/Quick/Quick Templates/Quick Spec Class.xctemplate/Swift/___FILEBASENAME___.swift +++ b/Carthage/Checkouts/Quick/Quick Templates/Quick Spec Class.xctemplate/Swift/___FILEBASENAME___.swift @@ -3,7 +3,7 @@ // ___PROJECTNAME___ // // Created by ___FULLUSERNAME___ on ___DATE___. -//___COPYRIGHT___ +// ___COPYRIGHT___ // import Quick diff --git a/Carthage/Checkouts/Quick/Quick.podspec b/Carthage/Checkouts/Quick/Quick.podspec index 8db9764..4565831 100644 --- a/Carthage/Checkouts/Quick/Quick.podspec +++ b/Carthage/Checkouts/Quick/Quick.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Quick" - s.version = "1.3.2" + s.version = "2.0.0" s.summary = "The Swift (and Objective-C) testing framework." s.description = <<-DESC @@ -12,7 +12,7 @@ Pod::Spec.new do |s| s.author = "Quick Contributors" s.ios.deployment_target = "7.0" - s.osx.deployment_target = "10.9" + s.osx.deployment_target = "10.10" s.tvos.deployment_target = '9.0' s.source = { :git => "https://github.com/Quick/Quick.git", :tag => "v#{s.version}" } @@ -39,4 +39,7 @@ Pod::Spec.new do |s| 'ENABLE_BITCODE' => 'NO', 'OTHER_LDFLAGS' => '$(inherited) -Xlinker -no_application_extension', } + + s.cocoapods_version = '>= 1.4.0' + s.swift_version = '4.2' end diff --git a/Carthage/Checkouts/Quick/Quick.xcodeproj/project.pbxproj b/Carthage/Checkouts/Quick/Quick.xcodeproj/project.pbxproj index d0f1425..931b615 100644 --- a/Carthage/Checkouts/Quick/Quick.xcodeproj/project.pbxproj +++ b/Carthage/Checkouts/Quick/Quick.xcodeproj/project.pbxproj @@ -2413,13 +2413,13 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -2468,12 +2468,12 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -2496,7 +2496,7 @@ INFOPLIST_FILE = Sources/Quick/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; OTHER_LDFLAGS = ( "$(inherited)", "-Xlinker", @@ -2528,7 +2528,7 @@ INFOPLIST_FILE = Sources/Quick/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; OTHER_LDFLAGS = ( "$(inherited)", "-Xlinker", diff --git a/Carthage/Checkouts/Quick/Quick.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/Carthage/Checkouts/Quick/Quick.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..3ddf867 --- /dev/null +++ b/Carthage/Checkouts/Quick/Quick.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + BuildSystemType + Latest + + diff --git a/Carthage/Checkouts/Quick/README.md b/Carthage/Checkouts/Quick/README.md index e6dc0ad..2cb397f 100644 --- a/Carthage/Checkouts/Quick/README.md +++ b/Carthage/Checkouts/Quick/README.md @@ -4,6 +4,7 @@ [![CocoaPods](https://img.shields.io/cocoapods/v/Quick.svg)](https://cocoapods.org/pods/Quick) [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Platforms](https://img.shields.io/cocoapods/p/Quick.svg)](https://cocoapods.org/pods/Quick) +[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com) Quick is a behavior-driven development framework for Swift and Objective-C. Inspired by [RSpec](https://github.com/rspec/rspec), [Specta](https://github.com/specta/specta), and [Ginkgo](https://github.com/onsi/ginkgo). @@ -44,7 +45,8 @@ Certain versions of Quick and Nimble only support certain versions of Swift. Dep |Swift version |Quick version |Nimble version | |:--------------------|:---------------|:--------------| -|Swift 3 |v1.0.0 or later |v5.0.0 or later| +|Swift 4.2 |v1.3.2 or later |v7.3.2 or later| +|Swift 3 / Swift 4 |v1.0.0 or later |v5.0.0 or later| |Swift 2.2 / Swift 2.3|v0.9.3 |v4.1.0 | ## Documentation diff --git a/Carthage/Checkouts/Quick/Rakefile b/Carthage/Checkouts/Quick/Rakefile index 051803e..d98ed39 100644 --- a/Carthage/Checkouts/Quick/Rakefile +++ b/Carthage/Checkouts/Quick/Rakefile @@ -13,35 +13,38 @@ end namespace "podspec" do desc "Run lint for podspec" task :lint do + # To work around the lint error: "ERROR | swift: Specification `Nimble` specifies an inconsistent `swift_version` (`4.0`) compared to the one present in your `.swift-version` file (`4.1`). Please remove the `.swift-version` file which is now deprecated and only use the `swift_version` attribute within your podspec." + # `.swift-version` is for swiftenv, not for CocoaPods, so we can't remove the file as suggested. + run "mv .swift-version .swift-version.backup" run "bundle exec pod lib lint" + run "mv .swift-version.backup .swift-version" end end namespace "test" do desc "Run unit tests for all iOS targets" task :ios do |t| - run "xcodebuild -workspace Quick.xcworkspace -scheme Quick-iOS -destination 'platform=iOS Simulator,name=iPhone 6' clean #{xcode_action}" + run "xcodebuild -workspace Quick.xcworkspace -scheme Quick-iOS -destination 'platform=iOS Simulator,name=iPhone 6' OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' clean #{xcode_action} | xcpretty" end desc "Run unit tests for all tvOS targets" task :tvos do |t| - run "xcodebuild -workspace Quick.xcworkspace -scheme Quick-tvOS -destination 'platform=tvOS Simulator,name=Apple TV 1080p' clean #{xcode_action}" + run "xcodebuild -workspace Quick.xcworkspace -scheme Quick-tvOS -destination 'platform=tvOS Simulator,name=Apple TV' OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' clean #{xcode_action} | xcpretty" end desc "Run unit tests for all macOS targets" task :macos do |t| - run "xcodebuild -workspace Quick.xcworkspace -scheme Quick-macOS clean #{xcode_action}" + run "xcodebuild -workspace Quick.xcworkspace -scheme Quick-macOS OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' clean #{xcode_action} | xcpretty" end desc "Run unit tests for all macOS targets using static linking" task :macos_static do |t| - run " MACH_O_TYPE=staticlib xcodebuild -workspace Quick.xcworkspace -scheme Quick-macOS clean #{xcode_action}" + run "MACH_O_TYPE=staticlib xcodebuild -workspace Quick.xcworkspace -scheme Quick-macOS OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' clean #{xcode_action} | xcpretty" end desc "Run unit tests for the current platform built by the Swift Package Manager" task :swiftpm do |t| - env = { "SWIFT_PACKAGE_TEST_Quick" => "true" } - run env, "swift package clean && swift test" + run "swift package clean && swift test" end end diff --git a/Carthage/Checkouts/Quick/Sources/Quick/Behavior.swift b/Carthage/Checkouts/Quick/Sources/Quick/Behavior.swift index 1d98702..7dfefac 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/Behavior.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/Behavior.swift @@ -4,7 +4,7 @@ open class Behavior { - open static var name: String { return String(describing: self) } + public static var name: String { return String(describing: self) } /** override this method in your behavior to define a set of reusable examples. diff --git a/Carthage/Checkouts/Quick/Sources/Quick/Callsite.swift b/Carthage/Checkouts/Quick/Sources/Quick/Callsite.swift index f5e3711..951cf93 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/Callsite.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/Callsite.swift @@ -1,14 +1,8 @@ import Foundation -// `#if swift(>=3.2) && (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE` -// does not work as expected. -#if swift(>=3.2) - #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE - @objcMembers - public class _CallsiteBase: NSObject {} - #else - public class _CallsiteBase: NSObject {} - #endif +#if canImport(Darwin) && !SWIFT_PACKAGE +@objcMembers +public class _CallsiteBase: NSObject {} #else public class _CallsiteBase: NSObject {} #endif diff --git a/Carthage/Checkouts/Quick/Sources/Quick/Configuration/Configuration.swift b/Carthage/Checkouts/Quick/Sources/Quick/Configuration/Configuration.swift index dbb95f1..fe33997 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/Configuration/Configuration.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/Configuration/Configuration.swift @@ -72,7 +72,7 @@ final public class Configuration: NSObject { provided with metadata on the example that the closure is being run prior to. */ -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) @objc(beforeEachWithMetadata:) public func beforeEach(_ closure: @escaping BeforeExampleWithMetadataClosure) { exampleHooks.appendBefore(closure) @@ -109,7 +109,7 @@ final public class Configuration: NSObject { is provided with metadata on the example that the closure is being run after. */ -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) @objc(afterEachWithMetadata:) public func afterEach(_ closure: @escaping AfterExampleWithMetadataClosure) { exampleHooks.appendAfter(closure) diff --git a/Carthage/Checkouts/Quick/Sources/Quick/Configuration/QuickConfiguration.swift b/Carthage/Checkouts/Quick/Sources/Quick/Configuration/QuickConfiguration.swift index 3da6be2..0874f64 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/Configuration/QuickConfiguration.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/Configuration/QuickConfiguration.swift @@ -10,7 +10,7 @@ open class QuickConfiguration: NSObject { open class func configure(_ configuration: Configuration) {} } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) internal func qck_enumerateSubclasses(_ klass: T.Type, block: (T.Type) -> Void) { var classesCount = objc_getClassList(nil, 0) diff --git a/Carthage/Checkouts/Quick/Sources/Quick/DSL/World+DSL.swift b/Carthage/Checkouts/Quick/Sources/Quick/DSL/World+DSL.swift index 942c2e6..14a46d6 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/DSL/World+DSL.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/DSL/World+DSL.swift @@ -56,7 +56,7 @@ extension World { currentExampleGroup.hooks.appendBefore(closure) } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE @objc(beforeEachWithMetadata:) internal func beforeEach(closure: @escaping BeforeExampleWithMetadataClosure) { currentExampleGroup.hooks.appendBefore(closure) @@ -74,7 +74,7 @@ extension World { currentExampleGroup.hooks.appendAfter(closure) } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE @objc(afterEachWithMetadata:) internal func afterEach(closure: @escaping AfterExampleWithMetadataClosure) { currentExampleGroup.hooks.appendAfter(closure) @@ -172,7 +172,7 @@ extension World { self.itBehavesLike(behavior, context: context, flags: pendingFlags, file: file, line: line) } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE @objc(itWithDescription:flags:file:line:closure:) internal func objc_it(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { it(description, flags: flags, file: file, line: line, closure: closure) diff --git a/Carthage/Checkouts/Quick/Sources/Quick/ErrorUtility.swift b/Carthage/Checkouts/Quick/Sources/Quick/ErrorUtility.swift index 155fefd..f13f43a 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/ErrorUtility.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/ErrorUtility.swift @@ -1,7 +1,7 @@ import Foundation internal func raiseError(_ message: String) -> Never { -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) NSException(name: .internalInconsistencyException, reason: message, userInfo: nil).raise() #endif diff --git a/Carthage/Checkouts/Quick/Sources/Quick/Example.swift b/Carthage/Checkouts/Quick/Sources/Quick/Example.swift index cf7b4a3..594efa0 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/Example.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/Example.swift @@ -3,15 +3,9 @@ import Foundation private var numberOfExamplesRun = 0 private var numberOfIncludedExamples = 0 -// `#if swift(>=3.2) && (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE` -// does not work as expected. -#if swift(>=3.2) - #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE - @objcMembers - public class _ExampleBase: NSObject {} - #else - public class _ExampleBase: NSObject {} - #endif +#if canImport(Darwin) && !SWIFT_PACKAGE +@objcMembers +public class _ExampleBase: NSObject {} #else public class _ExampleBase: NSObject {} #endif diff --git a/Carthage/Checkouts/Quick/Sources/Quick/ExampleMetadata.swift b/Carthage/Checkouts/Quick/Sources/Quick/ExampleMetadata.swift index 3dd28ab..b07b3bd 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/ExampleMetadata.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/ExampleMetadata.swift @@ -1,14 +1,8 @@ import Foundation -// `#if swift(>=3.2) && (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE` -// does not work as expected. -#if swift(>=3.2) - #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE - @objcMembers - public class _ExampleMetadataBase: NSObject {} - #else - public class _ExampleMetadataBase: NSObject {} - #endif +#if canImport(Darwin) && !SWIFT_PACKAGE +@objcMembers +public class _ExampleMetadataBase: NSObject {} #else public class _ExampleMetadataBase: NSObject {} #endif diff --git a/Carthage/Checkouts/Quick/Sources/Quick/Filter.swift b/Carthage/Checkouts/Quick/Sources/Quick/Filter.swift index da137f8..304f6ec 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/Filter.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/Filter.swift @@ -1,14 +1,8 @@ import Foundation -// `#if swift(>=3.2) && (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE` -// does not work as expected. -#if swift(>=3.2) - #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE - @objcMembers - public class _FilterBase: NSObject {} - #else - public class _FilterBase: NSObject {} - #endif +#if canImport(Darwin) && !SWIFT_PACKAGE +@objcMembers +public class _FilterBase: NSObject {} #else public class _FilterBase: NSObject {} #endif diff --git a/Carthage/Checkouts/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift b/Carthage/Checkouts/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift index d7a1442..ed0cf8e 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift @@ -1,4 +1,4 @@ -#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) +#if canImport(Darwin) import Foundation diff --git a/Carthage/Checkouts/Quick/Sources/Quick/NSString+C99ExtendedIdentifier.swift b/Carthage/Checkouts/Quick/Sources/Quick/NSString+C99ExtendedIdentifier.swift index 8d67d8d..acb650b 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/NSString+C99ExtendedIdentifier.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/NSString+C99ExtendedIdentifier.swift @@ -1,4 +1,4 @@ -#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) +#if canImport(Darwin) import Foundation extension NSString { @@ -21,7 +21,7 @@ extension NSString { return invalidCharacters }() - /// This API is not meant to be used outside Quick, so will be unavaialbe in + /// This API is not meant to be used outside Quick, so will be unavailable in /// a next major version. @objc(qck_c99ExtendedIdentifier) public var c99ExtendedIdentifier: String { diff --git a/Carthage/Checkouts/Quick/Sources/Quick/QuickMain.swift b/Carthage/Checkouts/Quick/Sources/Quick/QuickMain.swift index eb9aba5..63e099f 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/QuickMain.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/QuickMain.swift @@ -3,7 +3,7 @@ import XCTest // NOTE: This file is not intended to be included in the Xcode project or CocoaPods. // It is picked up by the Swift Package Manager during its build process. -#if SWIFT_PACKAGE && os(Linux) +#if SWIFT_PACKAGE && !canImport(Darwin) /// When using Quick with swift-corelibs-xctest, automatic discovery of specs and /// configurations is not available. Instead, you should create a standalone @@ -32,7 +32,7 @@ public func QCKMain(_ specs: [QuickSpec.Type], } world.finalizeConfiguration() - XCTMain(specs.flatMap { testCase($0.allTests) } + testCases) + XCTMain(specs.compactMap { testCase($0.allTests) } + testCases) } #endif diff --git a/Carthage/Checkouts/Quick/Sources/Quick/QuickSelectedTestSuiteBuilder.swift b/Carthage/Checkouts/Quick/Sources/Quick/QuickSelectedTestSuiteBuilder.swift index 415b680..865c3ae 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/QuickSelectedTestSuiteBuilder.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/QuickSelectedTestSuiteBuilder.swift @@ -1,4 +1,4 @@ -#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) +#if canImport(Darwin) import Foundation /** diff --git a/Carthage/Checkouts/Quick/Sources/Quick/QuickSpec.swift b/Carthage/Checkouts/Quick/Sources/Quick/QuickSpec.swift index 12845d8..62e50d4 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/QuickSpec.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/QuickSpec.swift @@ -5,7 +5,7 @@ import XCTest #if SWIFT_PACKAGE -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) import QuickSpecBase public typealias QuickSpecBase = _QuickSpecBase @@ -16,7 +16,7 @@ public typealias QuickSpecBase = XCTestCase open class QuickSpec: QuickSpecBase { open func spec() {} -#if !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) +#if !canImport(Darwin) public required init() { super.init(name: "", testClosure: { _ in }) } @@ -37,19 +37,11 @@ open class QuickSpec: QuickSpecBase { /// SwiftPM on macOS does not have the mechanism (test cases are automatically /// discovered powered by Objective-C runtime), so we needed the alternative /// way. - #if swift(>=4) override open class var defaultTestSuite: XCTestSuite { configureDefaultTestSuite() return super.defaultTestSuite } - #else - override open class func defaultTestSuite() -> XCTestSuite { - configureDefaultTestSuite() - - return super.defaultTestSuite() - } - #endif private static func configureDefaultTestSuite() { let world = World.sharedWorld diff --git a/Carthage/Checkouts/Quick/Sources/Quick/QuickTestSuite.swift b/Carthage/Checkouts/Quick/Sources/Quick/QuickTestSuite.swift index 0fe76a7..5cdc6d8 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/QuickTestSuite.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/QuickTestSuite.swift @@ -1,4 +1,4 @@ -#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) +#if canImport(Darwin) import XCTest diff --git a/Carthage/Checkouts/Quick/Sources/Quick/World.swift b/Carthage/Checkouts/Quick/Sources/Quick/World.swift index 59ea7e6..e652871 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/World.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/World.swift @@ -12,15 +12,9 @@ public typealias SharedExampleContext = () -> [String: Any] */ public typealias SharedExampleClosure = (@escaping SharedExampleContext) -> Void -// `#if swift(>=3.2) && (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE` -// does not work as expected. -#if swift(>=3.2) - #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE - @objcMembers - internal class _WorldBase: NSObject {} - #else - internal class _WorldBase: NSObject {} - #endif +#if canImport(Darwin) && !SWIFT_PACKAGE +@objcMembers +internal class _WorldBase: NSObject {} #else internal class _WorldBase: NSObject {} #endif @@ -57,7 +51,7 @@ final internal class World: _WorldBase { within this test suite. This is only true within the context of Quick functional tests. */ -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) // Convention of generating Objective-C selector has been changed on Swift 3 @objc(isRunningAdditionalSuites) internal var isRunningAdditionalSuites = false @@ -158,7 +152,7 @@ final internal class World: _WorldBase { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) @objc(examplesForSpecClass:) internal func objc_examples(_ specClass: AnyClass) -> [Example] { return examples(specClass) diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/XCTestCaseProvider.swift b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/XCTestCaseProvider.swift index 304eb30..05b0196 100644 --- a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/XCTestCaseProvider.swift +++ b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/XCTestCaseProvider.swift @@ -30,7 +30,7 @@ public extension XCTestCaseProvider where Self: XCTestCaseProviderStatic { } } -#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) +#if canImport(Darwin) extension XCTestCase { override open func tearDown() { diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/AfterEachTests.swift b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/AfterEachTests.swift index 45f6203..f6b6777 100644 --- a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/AfterEachTests.swift +++ b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/AfterEachTests.swift @@ -50,7 +50,7 @@ class FunctionalTests_AfterEachSpec: QuickSpec { afterEach { afterEachOrder.append(.noExamples) } } } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE describe("error handling when misusing ordering") { it("should throw an exception when including afterEach in it block") { expect { diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/BeforeEachTests.swift b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/BeforeEachTests.swift index 6709051..17b222e 100644 --- a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/BeforeEachTests.swift +++ b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/BeforeEachTests.swift @@ -35,7 +35,7 @@ class FunctionalTests_BeforeEachSpec: QuickSpec { beforeEach { beforeEachOrder.append(.noExamples) } } } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE describe("error handling when misusing ordering") { it("should throw an exception when including beforeEach in it block") { expect { diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/BehaviorTests.swift b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/BehaviorTests.swift index 21dadfe..54bcb42 100644 --- a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/BehaviorTests.swift +++ b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/BehaviorTests.swift @@ -17,7 +17,7 @@ class FunctionalTests_BehaviorTests_ContextSpec: QuickSpec { } } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE class FunctionalTests_BehaviorTests_ErrorSpec: QuickSpec { override func spec() { describe("error handling when misusing ordering") { diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ContextTests.swift b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ContextTests.swift index ab619be..eb6c03a 100644 --- a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ContextTests.swift +++ b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ContextTests.swift @@ -2,7 +2,7 @@ import XCTest import Quick import Nimble -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE class QuickContextTests: QuickSpec { override func spec() { describe("Context") { diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/DescribeTests.swift b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/DescribeTests.swift index 6c4ac07..a923f4d 100644 --- a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/DescribeTests.swift +++ b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/DescribeTests.swift @@ -2,7 +2,7 @@ import XCTest import Nimble import Quick -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE final class DescribeTests: XCTestCase, XCTestCaseProvider { static var allTests: [(String, (DescribeTests) -> () throws -> Void)] { diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ItTests.swift b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ItTests.swift index 106cf30..3016401 100644 --- a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ItTests.swift +++ b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ItTests.swift @@ -16,7 +16,7 @@ class FunctionalTests_ItSpec: QuickSpec { expect(exampleMetadata!.example.name).to(equal(name)) } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE describe("when an example has a unique name") { it("has a unique name") {} @@ -113,7 +113,7 @@ final class ItTests: XCTestCase, XCTestCaseProvider { ] } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE func testAllExamplesAreExecuted() { let result = qck_runSpec(FunctionalTests_ItSpec.self) XCTAssertEqual(result?.executionCount, 10) diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/SharedExamplesTests.swift b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/SharedExamplesTests.swift index 8a50cc1..f75f524 100644 --- a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/SharedExamplesTests.swift +++ b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/SharedExamplesTests.swift @@ -15,7 +15,7 @@ class FunctionalTests_SharedExamples_ContextSpec: QuickSpec { } } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE class FunctionalTests_SharedExamples_ErrorSpec: QuickSpec { override func spec() { describe("error handling when misusing ordering") { diff --git a/Carthage/Checkouts/Quick/script/release b/Carthage/Checkouts/Quick/script/release index 26409c4..77ff6c8 100755 --- a/Carthage/Checkouts/Quick/script/release +++ b/Carthage/Checkouts/Quick/script/release @@ -3,7 +3,7 @@ REMOTE_BRANCH=master POD_NAME=Quick PODSPEC=Quick.podspec -POD=${COCOAPODS:-pod} +POD=${COCOAPODS:-"bundle exec pod"} function help { echo "Usage: release VERSION RELEASE_NOTES [-f]" diff --git a/Carthage/Checkouts/Quick/script/travis-install-macos b/Carthage/Checkouts/Quick/script/travis-install-macos deleted file mode 100755 index 64edf92..0000000 --- a/Carthage/Checkouts/Quick/script/travis-install-macos +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh -set -e - -git submodule update --init --recursive From 2937238c78cf793b3a87729d1bedf58fbaa48bb6 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Sun, 17 Mar 2019 11:30:48 -0600 Subject: [PATCH 02/25] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Commandant=20(0.15.0?= =?UTF-8?q?+)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cartfile | 4 +- Cartfile.resolved | 2 +- Carthage/Checkouts/Commandant/.swift-version | 2 +- Carthage/Checkouts/Commandant/.travis.yml | 33 +- .../Checkouts/Commandant/Cartfile.private | 4 +- .../Checkouts/Commandant/Cartfile.resolved | 6 +- .../Carthage/Checkouts/Nimble/.swift-version | 2 +- .../Carthage/Checkouts/Nimble/.swiftlint.yml | 20 +- .../Carthage/Checkouts/Nimble/.travis.yml | 47 ++- .../Checkouts/Nimble/Cartfile.private | 2 +- .../Checkouts/Nimble/Cartfile.resolved | 2 +- .../Mach/CwlPreconditionTesting.h | 2 + .../Posix/CwlPreconditionTesting_POSIX.h | 2 + .../Carthage/Checkouts/Nimble/Gemfile | 2 +- .../Carthage/Checkouts/Nimble/Gemfile.lock | 48 +-- .../Carthage/Checkouts/Nimble/Nimble.podspec | 7 +- .../Nimble/Nimble.xcodeproj/project.pbxproj | 100 +++-- .../xcshareddata/WorkspaceSettings.xcsettings | 8 + .../Carthage/Checkouts/Nimble/Package.swift | 22 +- .../Checkouts/Nimble/Package@swift-4.swift | 22 - .../Carthage/Checkouts/Nimble/README.md | 29 +- .../Nimble/Adapters/AdapterProtocols.swift | 1 + .../Nimble/Adapters/AssertionRecorder.swift | 37 +- .../Nimble/Adapters/NMBExpectation.swift | 8 +- .../Nimble/Adapters/NMBObjCMatcher.swift | 36 +- .../Nimble/Adapters/NimbleEnvironment.swift | 18 +- .../Nimble/Adapters/NimbleXCTestHandler.swift | 26 +- .../NonObjectiveC/ExceptionCapture.swift | 2 +- .../Nimble/Sources/Nimble/DSL+Wait.swift | 14 +- .../Checkouts/Nimble/Sources/Nimble/DSL.swift | 18 +- .../Nimble/Sources/Nimble/Expectation.swift | 35 +- .../Sources/Nimble/ExpectationMessage.swift | 33 +- .../Nimble/Sources/Nimble/Expression.swift | 2 + .../Sources/Nimble/FailureMessage.swift | 1 + .../Sources/Nimble/Matchers/AllPass.swift | 9 +- .../Sources/Nimble/Matchers/Async.swift} | 113 ++--- .../Sources/Nimble/Matchers/BeAKindOf.swift | 6 +- .../Nimble/Matchers/BeAnInstanceOf.swift | 8 +- .../Sources/Nimble/Matchers/BeCloseTo.swift | 25 +- .../Sources/Nimble/Matchers/BeEmpty.swift | 19 +- .../Nimble/Matchers/BeGreaterThan.swift | 16 +- .../Matchers/BeGreaterThanOrEqualTo.swift | 26 +- .../Nimble/Matchers/BeIdenticalTo.swift | 31 +- .../Sources/Nimble/Matchers/BeLessThan.swift | 26 +- .../Nimble/Matchers/BeLessThanOrEqual.swift | 25 +- .../Sources/Nimble/Matchers/BeLogical.swift | 47 +-- .../Sources/Nimble/Matchers/BeNil.swift | 8 +- .../Sources/Nimble/Matchers/BeVoid.swift | 17 +- .../Sources/Nimble/Matchers/BeginWith.swift | 18 +- .../Sources/Nimble/Matchers/Contain.swift | 101 +++-- .../Matchers/ContainElementSatisfying.swift | 46 +-- .../Nimble/Matchers/ElementsEqual.swift | 16 + .../Sources/Nimble/Matchers/EndWith.swift | 47 +-- .../Sources/Nimble/Matchers/Equal.swift | 168 +++----- .../Sources/Nimble/Matchers/HaveCount.swift | 65 +-- .../Sources/Nimble/Matchers/Match.swift | 17 +- .../Sources/Nimble/Matchers/MatchError.swift | 46 ++- .../Nimble/Matchers/MatcherProtocols.swift | 13 +- .../Nimble/Matchers/PostNotification.swift | 43 +- .../Sources/Nimble/Matchers/Predicate.swift | 15 +- .../Nimble/Matchers/RaisesException.swift | 38 +- .../Nimble/Matchers/SatisfyAllOf.swift | 47 +-- .../Nimble/Matchers/SatisfyAnyOf.swift | 47 +-- .../Nimble/Matchers/ThrowAssertion.swift | 35 +- .../Sources/Nimble/Matchers/ThrowError.swift | 84 ++-- .../Nimble/Utils/{Async.swift => Await.swift} | 34 +- .../Sources/Nimble/Utils/Functional.swift | 6 +- .../Sources/Nimble/Utils/Stringers.swift | 5 +- .../Checkouts/Nimble/Tests/LinuxMain.swift | 37 +- .../Tests/NimbleTests/AsynchronousTest.swift | 68 +-- .../Helpers/XCTestCaseProvider.swift | 20 +- .../Tests/NimbleTests/Helpers/utils.swift | 21 +- .../NimbleTests/Matchers/AllPassTest.swift | 11 - .../NimbleTests/Matchers/BeAKindOfTest.swift | 22 +- .../Matchers/BeAnInstanceOfTest.swift | 9 - .../NimbleTests/Matchers/BeCloseToTest.swift | 54 +-- .../NimbleTests/Matchers/BeEmptyTest.swift | 63 ++- .../Matchers/BeGreaterThanOrEqualToTest.swift | 7 - .../Matchers/BeGreaterThanTest.swift | 7 - .../Matchers/BeIdenticalToObjectTest.swift | 11 - .../Matchers/BeIdenticalToTest.swift | 11 - .../Matchers/BeLessThanOrEqualToTest.swift | 7 - .../NimbleTests/Matchers/BeLessThanTest.swift | 7 - .../NimbleTests/Matchers/BeLogicalTest.swift | 38 -- .../NimbleTests/Matchers/BeNilTest.swift | 6 - .../NimbleTests/Matchers/BeVoidTest.swift | 6 - .../NimbleTests/Matchers/BeginWithTest.swift | 7 - .../ContainElementSatisfyingTest.swift | 14 - .../NimbleTests/Matchers/ContainTest.swift | 53 ++- .../Matchers/ElementsEqualTest.swift | 27 ++ .../NimbleTests/Matchers/EndWithTest.swift | 7 - .../NimbleTests/Matchers/EqualTest.swift | 19 +- .../NimbleTests/Matchers/HaveCountTest.swift | 59 ++- .../NimbleTests/Matchers/MatchErrorTest.swift | 18 +- .../NimbleTests/Matchers/MatchTest.swift | 10 - .../Matchers/PostNotificationTest.swift | 12 - .../Matchers/RaisesExceptionTest.swift | 12 +- .../Matchers/SatisfyAllOfTest.swift | 7 - .../Matchers/SatisfyAnyOfTest.swift | 7 - .../Matchers/ThrowAssertionTest.swift | 19 +- .../NimbleTests/Matchers/ThrowErrorTest.swift | 27 +- .../NimbleTests/Matchers/ToSucceedTest.swift | 6 - .../Tests/NimbleTests/SynchronousTest.swift} | 50 ++- .../NimbleTests/UserDescriptionTest.swift | 65 +-- .../Tests/NimbleTests/XCTestManifests.swift | 386 ++++++++++++++++++ .../Tests/NimbleTests/objc/ObjCAsyncTest.m | 5 + .../Tests/NimbleTests/objc/ObjCContainTest.m | 9 + .../Tests/NimbleTests/objc/ObjCEndWithTest.m | 1 - .../NimbleTests/objc/ObjCHaveCountTest.m | 9 + .../Commandant/Carthage/Checkouts/Nimble/test | 10 +- .../Carthage/Checkouts/Quick/.hound.yml | 4 +- .../Carthage/Checkouts/Quick/.swift-version | 2 +- .../Carthage/Checkouts/Quick/.travis.yml | 79 ++-- .../Carthage/Checkouts/Quick/Dangerfile | 4 +- .../Documentation/en-us/SharedExamples.md | 2 +- .../Documentation/ko-kr/BehavioralTesting.md | 2 +- .../Documentation/ko-kr/InstallingQuick.md | 2 +- .../Quick/Externals/Nimble/.swift-version | 2 +- .../Quick/Externals/Nimble/.swiftlint.yml | 20 +- .../Quick/Externals/Nimble/.travis.yml | 47 ++- .../Quick/Externals/Nimble/Cartfile.private | 2 +- .../Quick/Externals/Nimble/Cartfile.resolved | 2 +- .../Mach/CwlPreconditionTesting.h | 2 + .../Posix/CwlPreconditionTesting_POSIX.h | 2 + .../Checkouts/Quick/Externals/Nimble/Gemfile | 2 +- .../Quick/Externals/Nimble/Gemfile.lock | 48 +-- .../Quick/Externals/Nimble/Nimble.podspec | 10 +- .../Nimble/Nimble.xcodeproj/project.pbxproj | 104 +++-- .../xcshareddata/WorkspaceSettings.xcsettings | 8 + .../Quick/Externals/Nimble/Package.swift | 22 +- .../Externals/Nimble/Package@swift-4.swift | 22 - .../Quick/Externals/Nimble/README.md | 29 +- .../Nimble/Adapters/AdapterProtocols.swift | 1 + .../Nimble/Adapters/AssertionRecorder.swift | 37 +- .../Nimble/Adapters/NMBExpectation.swift | 12 +- .../Nimble/Adapters/NMBObjCMatcher.swift | 40 +- .../Nimble/Adapters/NimbleEnvironment.swift | 18 +- .../Nimble/Adapters/NimbleXCTestHandler.swift | 26 +- .../NonObjectiveC/ExceptionCapture.swift | 2 +- .../Nimble/Sources/Nimble/DSL+Wait.swift | 14 +- .../Externals/Nimble/Sources/Nimble/DSL.swift | 18 +- .../Nimble/Sources/Nimble/Expectation.swift | 35 +- .../Sources/Nimble/ExpectationMessage.swift | 33 +- .../Nimble/Sources/Nimble/Expression.swift | 2 + .../Sources/Nimble/FailureMessage.swift | 1 + .../Sources/Nimble/Matchers/AllPass.swift | 9 +- .../Sources/Nimble/Matchers/Async.swift} | 113 ++--- .../Sources/Nimble/Matchers/BeAKindOf.swift | 6 +- .../Nimble/Matchers/BeAnInstanceOf.swift | 8 +- .../Sources/Nimble/Matchers/BeCloseTo.swift | 29 +- .../Sources/Nimble/Matchers/BeEmpty.swift | 19 +- .../Nimble/Matchers/BeGreaterThan.swift | 16 +- .../Matchers/BeGreaterThanOrEqualTo.swift | 26 +- .../Nimble/Matchers/BeIdenticalTo.swift | 31 +- .../Sources/Nimble/Matchers/BeLessThan.swift | 26 +- .../Nimble/Matchers/BeLessThanOrEqual.swift | 25 +- .../Sources/Nimble/Matchers/BeLogical.swift | 47 +-- .../Sources/Nimble/Matchers/BeNil.swift | 8 +- .../Sources/Nimble/Matchers/BeVoid.swift | 17 +- .../Sources/Nimble/Matchers/BeginWith.swift | 18 +- .../Sources/Nimble/Matchers/Contain.swift | 101 +++-- .../Matchers/ContainElementSatisfying.swift | 46 +-- .../Nimble/Matchers/ElementsEqual.swift | 16 + .../Sources/Nimble/Matchers/EndWith.swift | 47 +-- .../Sources/Nimble/Matchers/Equal.swift | 168 +++----- .../Sources/Nimble/Matchers/HaveCount.swift | 65 +-- .../Sources/Nimble/Matchers/Match.swift | 17 +- .../Sources/Nimble/Matchers/MatchError.swift | 46 ++- .../Nimble/Matchers/MatcherProtocols.swift | 17 +- .../Nimble/Matchers/PostNotification.swift | 43 +- .../Sources/Nimble/Matchers/Predicate.swift | 19 +- .../Nimble/Matchers/RaisesException.swift | 42 +- .../Nimble/Matchers/SatisfyAllOf.swift | 47 +-- .../Nimble/Matchers/SatisfyAnyOf.swift | 47 +-- .../Nimble/Matchers/ThrowAssertion.swift | 35 +- .../Sources/Nimble/Matchers/ThrowError.swift | 84 ++-- .../Nimble/Utils/{Async.swift => Await.swift} | 34 +- .../Sources/Nimble/Utils/Functional.swift | 6 +- .../Sources/Nimble/Utils/Stringers.swift | 17 +- .../NimbleObjectiveC/CurrentTestCaseTracker.h | 14 - .../Nimble/Sources/NimbleObjectiveC/DSL.m | 8 - .../NimbleObjectiveC/NMBExceptionCapture.m | 2 +- .../XCTestObservationCenter+Register.m | 7 +- .../Externals/Nimble/Tests/LinuxMain.swift | 37 +- .../Tests/NimbleTests/AsynchronousTest.swift | 68 +-- .../Helpers/XCTestCaseProvider.swift | 20 +- .../Tests/NimbleTests/Helpers/utils.swift | 21 +- .../NimbleTests/Matchers/AllPassTest.swift | 11 - .../NimbleTests/Matchers/BeAKindOfTest.swift | 22 +- .../Matchers/BeAnInstanceOfTest.swift | 9 - .../NimbleTests/Matchers/BeCloseToTest.swift | 54 +-- .../NimbleTests/Matchers/BeEmptyTest.swift | 63 ++- .../Matchers/BeGreaterThanOrEqualToTest.swift | 7 - .../Matchers/BeGreaterThanTest.swift | 7 - .../Matchers/BeIdenticalToObjectTest.swift | 11 - .../Matchers/BeIdenticalToTest.swift | 11 - .../Matchers/BeLessThanOrEqualToTest.swift | 7 - .../NimbleTests/Matchers/BeLessThanTest.swift | 7 - .../NimbleTests/Matchers/BeLogicalTest.swift | 38 -- .../NimbleTests/Matchers/BeNilTest.swift | 6 - .../NimbleTests/Matchers/BeVoidTest.swift | 6 - .../NimbleTests/Matchers/BeginWithTest.swift | 7 - .../ContainElementSatisfyingTest.swift | 14 - .../NimbleTests/Matchers/ContainTest.swift | 53 ++- .../Matchers/ElementsEqualTest.swift | 27 ++ .../NimbleTests/Matchers/EndWithTest.swift | 7 - .../NimbleTests/Matchers/EqualTest.swift | 19 +- .../NimbleTests/Matchers/HaveCountTest.swift | 59 ++- .../NimbleTests/Matchers/MatchErrorTest.swift | 18 +- .../NimbleTests/Matchers/MatchTest.swift | 10 - .../Matchers/PostNotificationTest.swift | 12 - .../Matchers/RaisesExceptionTest.swift | 12 +- .../Matchers/SatisfyAllOfTest.swift | 7 - .../Matchers/SatisfyAnyOfTest.swift | 7 - .../Matchers/ThrowAssertionTest.swift | 19 +- .../NimbleTests/Matchers/ThrowErrorTest.swift | 27 +- .../NimbleTests/Matchers/ToSucceedTest.swift | 6 - .../Tests/NimbleTests/SynchronousTest.swift} | 50 ++- .../NimbleTests/UserDescriptionTest.swift | 65 +-- .../Tests/NimbleTests/XCTestManifests.swift | 386 ++++++++++++++++++ .../Tests/NimbleTests/objc/ObjCAsyncTest.m | 5 + .../Tests/NimbleTests/objc/ObjCContainTest.m | 9 + .../Tests/NimbleTests/objc/ObjCEndWithTest.m | 1 - .../NimbleTests/objc/ObjCHaveCountTest.m | 9 + .../Checkouts/Quick/Externals/Nimble/test | 10 +- .../Carthage/Checkouts/Quick/Gemfile | 2 +- .../Carthage/Checkouts/Quick/Gemfile.lock | 52 +-- .../Carthage/Checkouts/Quick/Package.resolved | 4 +- .../Carthage/Checkouts/Quick/Package.swift | 67 ++- .../Checkouts/Quick/Package@swift-4.swift | 40 -- .../Objective-C/___FILEBASENAME___.h | 2 +- .../Objective-C/___FILEBASENAME___.m | 2 +- .../Swift/___FILEBASENAME___.swift | 2 +- .../Objective-C/___FILEBASENAME___.m | 2 +- .../Swift/___FILEBASENAME___.swift | 2 +- .../Carthage/Checkouts/Quick/Quick.podspec | 13 +- .../Quick/Quick.xcodeproj/project.pbxproj | 92 +++-- .../xcshareddata/WorkspaceSettings.xcsettings | 8 + .../Carthage/Checkouts/Quick/README.md | 4 +- .../Carthage/Checkouts/Quick/Rakefile | 18 +- .../Quick/Sources/Quick/Behavior.swift | 2 +- .../Quick/Sources/Quick/Callsite.swift | 12 +- .../Quick/Configuration/Configuration.swift | 4 +- .../Configuration/QuickConfiguration.swift | 2 +- .../Quick/Sources/Quick/DSL/World+DSL.swift | 19 +- .../Quick/Sources/Quick/ErrorUtility.swift | 2 +- .../Quick/Sources/Quick/Example.swift | 15 +- .../Quick/Sources/Quick/ExampleMetadata.swift | 12 +- .../Quick/Sources/Quick/Filter.swift | 12 +- .../Quick/NSBundle+CurrentTestBundle.swift | 2 +- .../NSString+C99ExtendedIdentifier.swift | 24 +- .../Quick/Sources/Quick/QuickMain.swift | 4 +- .../Quick/QuickSelectedTestSuiteBuilder.swift | 2 +- .../Quick/Sources/Quick/QuickSpec.swift | 12 +- .../Quick/Sources/Quick/QuickTestSuite.swift | 2 +- .../Checkouts/Quick/Sources/Quick/World.swift | 18 +- .../Configuration/QuickConfiguration.m | 7 +- .../Sources/QuickObjectiveC/DSL/QCKDSL.m | 8 +- .../Sources/QuickObjectiveC/DSL/World+DSL.h | 24 -- .../Quick/Sources/QuickObjectiveC/QuickSpec.m | 6 +- .../Quick/Sources/QuickObjectiveC/World.h | 22 - .../XCTestSuite+QuickTestSuiteBuilder.m | 1 + .../QuickTestHelpers/XCTestCaseProvider.swift | 2 +- .../FunctionalTests/AfterEachTests.swift | 2 +- .../FunctionalTests/BeforeEachTests.swift | 2 +- .../FunctionalTests/BehaviorTests.swift | 2 +- .../FunctionalTests/ContextTests.swift | 2 +- .../FunctionalTests/DescribeTests.swift | 2 +- .../QuickTests/FunctionalTests/ItTests.swift | 4 +- .../FunctionalTests/SharedExamplesTests.swift | 2 +- .../QuickTests/Helpers/QCKSpecRunner.m | 1 - .../Helpers/QuickSpec+QuickSpec_MethodList.h | 8 +- .../Helpers/QuickSpec+QuickSpec_MethodList.m | 18 +- .../Carthage/Checkouts/Quick/script/release | 2 +- .../Quick/script/travis-install-macos | 4 - .../Carthage/Checkouts/Result/.swift-version | 2 +- .../Carthage/Checkouts/Result/.travis.yml | 32 ++ .../Checkouts/Result/Package@swift-5.swift | 14 + .../Carthage/Checkouts/Result/README.md | 11 +- .../Carthage/Checkouts/Result/Result.podspec | 4 +- .../Result/Result.xcodeproj/project.pbxproj | 16 +- .../Checkouts/Result/Result/Info.plist | 2 +- .../Checkouts/Result/Result/Result.swift | 41 +- .../Result/Result/ResultProtocol.swift | 12 +- .../Result/Tests/ResultTests/Info.plist | 2 +- .../Checkouts/Commandant/Commandant.podspec | 2 +- .../Commandant.xcodeproj/project.pbxproj | 22 +- .../xcschemes/Commandant.xcscheme | 2 +- .../Checkouts/Commandant/Package.resolved | 12 +- Carthage/Checkouts/Commandant/Package.swift | 10 +- Carthage/Checkouts/Commandant/README.md | 2 + .../Sources/Commandant/ArgumentParser.swift | 18 - .../Sources/Commandant/Command.swift | 29 +- .../Sources/Commandant/HelpCommand.swift | 7 +- .../Sources/Commandant/OrderedSet.swift | 10 +- 295 files changed, 3844 insertions(+), 3313 deletions(-) create mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Package@swift-4.swift rename Carthage/Checkouts/Commandant/Carthage/Checkouts/{Quick/Externals/Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift => Nimble/Sources/Nimble/Matchers/Async.swift} (63%) create mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ElementsEqual.swift rename Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/{Async.swift => Await.swift} (94%) create mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ElementsEqualTest.swift rename Carthage/Checkouts/Commandant/Carthage/Checkouts/{Quick/Externals/Nimble/Tests/NimbleTests/SynchronousTests.swift => Nimble/Tests/NimbleTests/SynchronousTest.swift} (71%) create mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/XCTestManifests.swift create mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Package@swift-4.swift rename Carthage/Checkouts/Commandant/Carthage/Checkouts/{Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift => Quick/Externals/Nimble/Sources/Nimble/Matchers/Async.swift} (63%) create mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ElementsEqual.swift rename Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/{Async.swift => Await.swift} (94%) delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/NimbleObjectiveC/CurrentTestCaseTracker.h create mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ElementsEqualTest.swift rename Carthage/Checkouts/Commandant/Carthage/Checkouts/{Nimble/Tests/NimbleTests/SynchronousTests.swift => Quick/Externals/Nimble/Tests/NimbleTests/SynchronousTest.swift} (71%) create mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/XCTestManifests.swift delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package@swift-4.swift create mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/DSL/World+DSL.h delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/World.h delete mode 100755 Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/script/travis-install-macos create mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Package@swift-5.swift diff --git a/Cartfile b/Cartfile index 193783a..66b8d0f 100644 --- a/Cartfile +++ b/Cartfile @@ -1,2 +1,2 @@ -github "Carthage/Commandant" -github "antitypical/Result" \ No newline at end of file +github "Carthage/Commandant" "master" +github "antitypical/Result" diff --git a/Cartfile.resolved b/Cartfile.resolved index 994d4bc..7d9265e 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ -github "Carthage/Commandant" "0.15.0" +github "Carthage/Commandant" "191b3f7ba9c3c1ab148287af14345d0262748b1a" github "Quick/Nimble" "v8.0.1" github "Quick/Quick" "v2.0.0" github "antitypical/Result" "4.1.0" diff --git a/Carthage/Checkouts/Commandant/.swift-version b/Carthage/Checkouts/Commandant/.swift-version index 4d0dcda..bf77d54 100644 --- a/Carthage/Checkouts/Commandant/.swift-version +++ b/Carthage/Checkouts/Commandant/.swift-version @@ -1 +1 @@ -4.1.2 +4.2 diff --git a/Carthage/Checkouts/Commandant/.travis.yml b/Carthage/Checkouts/Commandant/.travis.yml index 60bc687..3ac9587 100644 --- a/Carthage/Checkouts/Commandant/.travis.yml +++ b/Carthage/Checkouts/Commandant/.travis.yml @@ -8,6 +8,7 @@ aliases: - &cocoapods script: - rm .swift-version + - gem update cocoapods - pod repo update master - pod lib lint --verbose os: osx @@ -31,7 +32,7 @@ aliases: dist: trusty language: generic install: - - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/02090c7ede5a637b76e6df1710e83cd0bbe7dcdf/swiftenv-install.sh)" + - eval "$(curl -sL https://swiftenv.fuller.li/install.sh)" branches: only: @@ -40,28 +41,32 @@ branches: matrix: include: - <<: *xcode - osx_image: xcode9.2 - env: JOB=Xcode9.2 + name: Xcode 10.1 / Swift 4.2.1 + osx_image: xcode10.1 + env: JOB=Xcode10.1 - <<: *xcode - osx_image: xcode9.4 - env: JOB=Xcode9.4 + name: Xcode 10.2 / Swift 5.0 + osx_image: xcode10.2 + env: JOB=Xcode10.2 - <<: *cocoapods - osx_image: xcode9.4 + name: CocoaPods Lint + osx_image: xcode10.1 - <<: *swiftpm_darwin - osx_image: xcode9.2 + name: SwiftPM / Swift 4.2.1 + osx_image: xcode10.1 - <<: *swiftpm_darwin - osx_image: xcode9.4 + name: SwiftPM / Swift 5.0 + osx_image: xcode10.2 - <<: *swiftpm_linux + name: Linux / Swift 4.2.3 env: - JOB=Linux - - SWIFT_VERSION=4.0.3 + - SWIFT_VESION=4.2.3 - <<: *swiftpm_linux + name: Linux / Swift 5.0 Development env: - JOB=Linux - - <<: *swiftpm_linux - env: - - JOB=Linux - - SWIFT_VERSION=4.2-DEVELOPMENT-SNAPSHOT-2018-07-05-a + - SWIFT_VERSION=5.0-DEVELOPMENT-SNAPSHOT-2019-02-28-a notifications: email: false @@ -83,4 +88,4 @@ deploy: on: repo: Carthage/Commandant tags: true - condition: $JOB = Xcode9.4 + condition: $JOB = Xcode10.1 diff --git a/Carthage/Checkouts/Commandant/Cartfile.private b/Carthage/Checkouts/Commandant/Cartfile.private index bf6802d..6da26fd 100644 --- a/Carthage/Checkouts/Commandant/Cartfile.private +++ b/Carthage/Checkouts/Commandant/Cartfile.private @@ -1,3 +1,3 @@ github "jspahrsummers/xcconfigs" ~> 0.9 -github "Quick/Quick" ~> 1.3 -github "Quick/Nimble" ~> 7.1.2 +github "Quick/Quick" ~> 2.0 +github "Quick/Nimble" ~> 8.0 diff --git a/Carthage/Checkouts/Commandant/Cartfile.resolved b/Carthage/Checkouts/Commandant/Cartfile.resolved index 26edfb2..4ce3b13 100644 --- a/Carthage/Checkouts/Commandant/Cartfile.resolved +++ b/Carthage/Checkouts/Commandant/Cartfile.resolved @@ -1,4 +1,4 @@ -github "Quick/Nimble" "v7.1.2" -github "Quick/Quick" "v1.3.0" -github "antitypical/Result" "4.0.0" +github "Quick/Nimble" "v8.0.0" +github "Quick/Quick" "v2.0.0" +github "antitypical/Result" "4.1.0" github "jspahrsummers/xcconfigs" "0.9" diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.swift-version b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.swift-version index 9f55b2c..bf77d54 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.swift-version +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.swift-version @@ -1 +1 @@ -3.0 +4.2 diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.swiftlint.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.swiftlint.yml index cb105e7..146ea6a 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.swiftlint.yml +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.swiftlint.yml @@ -1,8 +1,5 @@ disabled_rules: - - todo - - variable_name - - force_try - - force_cast + - included: - Sources @@ -10,6 +7,8 @@ included: excluded: - Carthage/Checkouts + - Tests/NimbleTests/XCTestManifests.swift + - Tests/NimbleTests/Helpers/XCTestCaseProvider.swift trailing_comma: mandatory_comma: true @@ -17,3 +16,16 @@ trailing_comma: line_length: ignores_comments: true ignores_function_declarations: true + +identifier_name: + max_length: 50 + excluded: + - x + - l + - r + - e + - n1 + - n2 + - to + allowed_symbols: + - _ diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.travis.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.travis.yml index 20d7f7d..fb72977 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.travis.yml +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.travis.yml @@ -1,39 +1,52 @@ -osx_image: xcode8.3 +osx_image: xcode10.1 language: generic matrix: include: - os: osx sudo: required env: TYPE=podspec + install: bundle install + name: CocoaPods Lint - os: osx - env: TYPE=ios NIMBLE_RUNTIME_IOS_SDK_VERSION=10.0 + env: TYPE=ios + name: iOS / Swift 4.2.1 - os: osx - env: TYPE=tvos NIMBLE_RUNTIME_TVOS_SDK_VERSION=10.0 + env: TYPE=tvos + name: tvOS / Swift 4.2.1 - os: osx env: TYPE=macos + name: macOS / Swift 4.2.1 - os: osx env: TYPE=macos - osx_image: xcode9 + osx_image: xcode10.2 + name: macOS / Swift 5.0 - os: osx - env: TYPE=swiftpm + env: + - TYPE=swiftpm - os: osx - env: TYPE=swiftpm - osx_image: xcode9 - - os: linux - dist: trusty - sudo: required - env: TYPE=swiftpm - install: - - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" - - os: linux + env: + - TYPE=swiftpm + osx_image: xcode10.2 + - &linux + name: Linux / Swift 4.2.1 + os: linux dist: trusty sudo: required env: - TYPE=swiftpm - - SWIFT_VERSION=4.0.2 + - SWIFT_VERSION=4.2.1 install: - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" -install: - - if [[ "$TYPE" == "podspec" ]]; then sudo gem install bundler; bundle install; fi + - <<: *linux + name: Linux / Swift 5.0 Development + env: + - TYPE=swiftpm + - SWIFT_VERSION=5.0-DEVELOPMENT-SNAPSHOT-2019-02-28-a + install: + - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" +install: true script: - ./test $TYPE + +notifications: + email: false diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Cartfile.private b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Cartfile.private index 8e95dd6..23d7e11 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Cartfile.private +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Cartfile.private @@ -1 +1 @@ -github "mattgallagher/CwlPreconditionTesting" "cb7ab89273cfd0725a7a2f865cc6fc560a9b9083" +github "mattgallagher/CwlPreconditionTesting" "1e62a726d54c743f4585233f08fcaac7307319b5" diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Cartfile.resolved b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Cartfile.resolved index 3984e09..32a1c25 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Cartfile.resolved +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Cartfile.resolved @@ -1,2 +1,2 @@ github "mattgallagher/CwlCatchException" "b14c111e9b33cd142bd4bc75c482cfd5c3490923" -github "mattgallagher/CwlPreconditionTesting" "cb7ab89273cfd0725a7a2f865cc6fc560a9b9083" +github "mattgallagher/CwlPreconditionTesting" "1e62a726d54c743f4585233f08fcaac7307319b5" diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h index f9dbedd..7c50da1 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h @@ -20,6 +20,8 @@ #import +extern bool _swift_reportFatalErrorsToDebugger; + //! Project version number for CwlUtils. FOUNDATION_EXPORT double CwlPreconditionTestingVersionNumber; diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h index 3434a71..4e28f95 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h @@ -20,6 +20,8 @@ #import +extern bool _swift_reportFatalErrorsToDebugger; + //! Project version number for CwlUtils. FOUNDATION_EXPORT double CwlPreconditionTesting_POSIXVersionNumber; diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Gemfile b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Gemfile index eca9219..206f109 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Gemfile +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Gemfile @@ -1,4 +1,4 @@ # A sample Gemfile source "https://rubygems.org" -gem 'cocoapods', '1.5.0' +gem 'cocoapods', '~> 1.6.0.rc.2' diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Gemfile.lock b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Gemfile.lock index 36a0839..cc03cbf 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Gemfile.lock +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Gemfile.lock @@ -2,75 +2,75 @@ GEM remote: https://rubygems.org/ specs: CFPropertyList (3.0.0) - activesupport (4.2.10) + activesupport (4.2.11) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - atomos (0.1.2) + atomos (0.1.3) claide (1.0.2) - cocoapods (1.5.0) + cocoapods (1.6.0.rc.2) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.5.0) + cocoapods-core (= 1.6.0.rc.2) cocoapods-deintegrate (>= 1.0.2, < 2.0) - cocoapods-downloader (>= 1.2.0, < 2.0) + cocoapods-downloader (>= 1.2.2, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) cocoapods-stats (>= 1.0.0, < 2.0) - cocoapods-trunk (>= 1.3.0, < 2.0) + cocoapods-trunk (>= 1.3.1, < 2.0) cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) - fourflusher (~> 2.0.1) + fourflusher (>= 2.2.0, < 3.0) gh_inspector (~> 1.0) - molinillo (~> 0.6.5) + molinillo (~> 0.6.6) nap (~> 1.0) - ruby-macho (~> 1.1) - xcodeproj (>= 1.5.7, < 2.0) - cocoapods-core (1.5.0) + ruby-macho (~> 1.3, >= 1.3.1) + xcodeproj (>= 1.8.0, < 2.0) + cocoapods-core (1.6.0.rc.2) activesupport (>= 4.0.2, < 6) fuzzy_match (~> 2.0.4) nap (~> 1.0) cocoapods-deintegrate (1.0.2) - cocoapods-downloader (1.2.0) + cocoapods-downloader (1.2.2) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) - cocoapods-stats (1.0.0) - cocoapods-trunk (1.3.0) + cocoapods-stats (1.1.0) + cocoapods-trunk (1.3.1) nap (>= 0.8, < 2.0) netrc (~> 0.11) cocoapods-try (1.1.0) colored2 (3.1.2) - concurrent-ruby (1.0.5) + concurrent-ruby (1.1.4) escape (0.0.4) - fourflusher (2.0.1) + fourflusher (2.2.0) fuzzy_match (2.0.4) gh_inspector (1.1.3) i18n (0.9.5) concurrent-ruby (~> 1.0) minitest (5.11.3) - molinillo (0.6.5) - nanaimo (0.2.5) + molinillo (0.6.6) + nanaimo (0.2.6) nap (1.1.0) netrc (0.11.0) - ruby-macho (1.1.0) + ruby-macho (1.3.1) thread_safe (0.3.6) tzinfo (1.2.5) thread_safe (~> 0.1) - xcodeproj (1.5.7) + xcodeproj (1.8.0) CFPropertyList (>= 2.3.3, < 4.0) - atomos (~> 0.1.2) + atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) - nanaimo (~> 0.2.4) + nanaimo (~> 0.2.6) PLATFORMS ruby DEPENDENCIES - cocoapods (= 1.5.0) + cocoapods (~> 1.6.0.rc.2) BUNDLED WITH - 1.16.1 + 1.17.2 diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Nimble.podspec b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Nimble.podspec index 6aaf25e..d66190b 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Nimble.podspec +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Nimble.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Nimble" - s.version = "7.1.2" + s.version = "8.0.0" s.summary = "A Matcher Framework for Swift and Objective-C" s.description = <<-DESC Use Nimble to express the expected outcomes of Swift or Objective-C expressions. Inspired by Cedar. @@ -45,8 +45,11 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = { 'APPLICATION_EXTENSION_API_ONLY' => 'YES', 'ENABLE_BITCODE' => 'NO', - 'OTHER_LDFLAGS' => '-weak-lswiftXCTest', + 'OTHER_LDFLAGS' => '$(inherited) -weak-lswiftXCTest -Xlinker -no_application_extension', 'OTHER_SWIFT_FLAGS' => '$(inherited) -suppress-warnings', 'FRAMEWORK_SEARCH_PATHS' => '$(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks"', } + + s.cocoapods_version = '>= 1.4.0' + s.swift_version = '4.2' end diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.pbxproj b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.pbxproj index eba6712..2bf9a6a 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.pbxproj +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.pbxproj @@ -23,8 +23,8 @@ /* Begin PBXBuildFile section */ 1F0648CC19639F5A001F9C46 /* ObjectWithLazyProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */; }; 1F0648CD19639F5A001F9C46 /* ObjectWithLazyProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */; }; - 1F0648D41963AAB2001F9C46 /* SynchronousTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTests.swift */; }; - 1F0648D51963AAB2001F9C46 /* SynchronousTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTests.swift */; }; + 1F0648D41963AAB2001F9C46 /* SynchronousTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */; }; + 1F0648D51963AAB2001F9C46 /* SynchronousTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */; }; 1F14FB64194180C5009F2A08 /* utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F14FB63194180C5009F2A08 /* utils.swift */; }; 1F1871C51CA89EDB00A34BF2 /* DSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1871BC1CA89EDB00A34BF2 /* DSL.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1F1871C61CA89EDB00A34BF2 /* DSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871BD1CA89EDB00A34BF2 /* DSL.m */; }; @@ -50,10 +50,10 @@ 1F1871E01CA89EF600A34BF2 /* DSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1871BC1CA89EDB00A34BF2 /* DSL.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1F1871E11CA89EF600A34BF2 /* NMBExceptionCapture.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1871BE1CA89EDB00A34BF2 /* NMBExceptionCapture.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1F1871E21CA89EF600A34BF2 /* NMBStringify.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1871C01CA89EDB00A34BF2 /* NMBStringify.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 1F1871E41CA89FB600A34BF2 /* AsyncMatcherWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* AsyncMatcherWrapper.swift */; }; + 1F1871E41CA89FB600A34BF2 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* Async.swift */; }; 1F1871E61CA89FCD00A34BF2 /* MatcherFunc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */; }; - 1F1871E71CA8A18400A34BF2 /* AsyncMatcherWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* AsyncMatcherWrapper.swift */; }; - 1F1871E81CA8A18400A34BF2 /* AsyncMatcherWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* AsyncMatcherWrapper.swift */; }; + 1F1871E71CA8A18400A34BF2 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* Async.swift */; }; + 1F1871E81CA8A18400A34BF2 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* Async.swift */; }; 1F1871E91CA8A18700A34BF2 /* MatcherFunc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */; }; 1F1871EB1CA8A18800A34BF2 /* MatcherFunc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */; }; 1F1A742F1940169200FFFC47 /* Nimble.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1A742E1940169200FFFC47 /* Nimble.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -143,11 +143,11 @@ 1F5DF1891BDCA0F500C3A531 /* RaisesException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1E1968AB07008ED995 /* RaisesException.swift */; }; 1F5DF18A1BDCA0F500C3A531 /* ThrowError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29EA59651B551EE6002D767E /* ThrowError.swift */; }; 1F5DF18B1BDCA0F500C3A531 /* Functional.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD251968AB07008ED995 /* Functional.swift */; }; - 1F5DF18C1BDCA0F500C3A531 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Async.swift */; }; + 1F5DF18C1BDCA0F500C3A531 /* Await.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Await.swift */; }; 1F5DF18D1BDCA0F500C3A531 /* SourceLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD271968AB07008ED995 /* SourceLocation.swift */; }; 1F5DF18E1BDCA0F500C3A531 /* Stringers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD281968AB07008ED995 /* Stringers.swift */; }; 1F5DF1921BDCA10200C3A531 /* AsynchronousTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F925EE5195C121200ED456B /* AsynchronousTest.swift */; }; - 1F5DF1931BDCA10200C3A531 /* SynchronousTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTests.swift */; }; + 1F5DF1931BDCA10200C3A531 /* SynchronousTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */; }; 1F5DF1941BDCA10200C3A531 /* UserDescriptionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965B0D0B1B62C06D0005AE66 /* UserDescriptionTest.swift */; }; 1F5DF1951BDCA10200C3A531 /* utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F14FB63194180C5009F2A08 /* utils.swift */; }; 1F5DF1961BDCA10200C3A531 /* ObjectWithLazyProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */; }; @@ -273,8 +273,8 @@ 1FD8CD5B1968AB07008ED995 /* Equal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1C1968AB07008ED995 /* Equal.swift */; }; 1FD8CD5E1968AB07008ED995 /* RaisesException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1E1968AB07008ED995 /* RaisesException.swift */; }; 1FD8CD5F1968AB07008ED995 /* RaisesException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1E1968AB07008ED995 /* RaisesException.swift */; }; - 1FD8CD6A1968AB07008ED995 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Async.swift */; }; - 1FD8CD6B1968AB07008ED995 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Async.swift */; }; + 1FD8CD6A1968AB07008ED995 /* Await.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Await.swift */; }; + 1FD8CD6B1968AB07008ED995 /* Await.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Await.swift */; }; 1FDBD8671AF8A4FF0089F27B /* AssertionDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FDBD8661AF8A4FF0089F27B /* AssertionDispatcher.swift */; }; 1FDBD8681AF8A4FF0089F27B /* AssertionDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FDBD8661AF8A4FF0089F27B /* AssertionDispatcher.swift */; }; 1FE661571E6574E30035F243 /* ExpectationMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FE661561E6574E20035F243 /* ExpectationMessage.swift */; }; @@ -347,6 +347,13 @@ AE7ADE491C80C00D00B94CD3 /* MatchErrorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */; }; AE7ADE4A1C80C00D00B94CD3 /* MatchErrorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */; }; AE7ADE4B1C80C00D00B94CD3 /* MatchErrorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */; }; + B20058C120E92C7500C1264D /* ElementsEqual.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C020E92C7500C1264D /* ElementsEqual.swift */; }; + B20058C220E92CA900C1264D /* ElementsEqual.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C020E92C7500C1264D /* ElementsEqual.swift */; }; + B20058C320E92CA900C1264D /* ElementsEqual.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C020E92C7500C1264D /* ElementsEqual.swift */; }; + B20058C520E92CE400C1264D /* ElementsEqualTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C420E92CE400C1264D /* ElementsEqualTest.swift */; }; + B20058C620E92CE400C1264D /* ElementsEqualTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C420E92CE400C1264D /* ElementsEqualTest.swift */; }; + B20058C720E92CE400C1264D /* ElementsEqualTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C420E92CE400C1264D /* ElementsEqualTest.swift */; }; + CD037213207DCC580047AF28 /* XCTestManifests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD037212207DCC580047AF28 /* XCTestManifests.swift */; }; CD79C99E1D2CC832004B6F9A /* ObjCAsyncTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F4A56651A3B305F009E1637 /* ObjCAsyncTest.m */; }; CD79C99F1D2CC835004B6F9A /* ObjCSyncTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F8A37AF1B7C5042001C8357 /* ObjCSyncTest.m */; }; CD79C9A01D2CC839004B6F9A /* ObjCBeAnInstanceOfTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F4A56691A3B3108009E1637 /* ObjCBeAnInstanceOfTest.m */; }; @@ -487,7 +494,7 @@ /* Begin PBXFileReference section */ 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectWithLazyProperty.swift; sourceTree = ""; }; - 1F0648D31963AAB2001F9C46 /* SynchronousTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SynchronousTests.swift; sourceTree = ""; }; + 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SynchronousTest.swift; sourceTree = ""; }; 1F14FB63194180C5009F2A08 /* utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = utils.swift; sourceTree = ""; }; 1F1871BC1CA89EDB00A34BF2 /* DSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DSL.h; sourceTree = ""; }; 1F1871BD1CA89EDB00A34BF2 /* DSL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DSL.m; sourceTree = ""; }; @@ -498,7 +505,7 @@ 1F1871C21CA89EDB00A34BF2 /* NMBExpectation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NMBExpectation.swift; sourceTree = ""; }; 1F1871C31CA89EDB00A34BF2 /* NMBObjCMatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NMBObjCMatcher.swift; sourceTree = ""; }; 1F1871CD1CA89EE000A34BF2 /* ExceptionCapture.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExceptionCapture.swift; sourceTree = ""; }; - 1F1871E31CA89FB600A34BF2 /* AsyncMatcherWrapper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AsyncMatcherWrapper.swift; sourceTree = ""; }; + 1F1871E31CA89FB600A34BF2 /* Async.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Async.swift; sourceTree = ""; }; 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatcherFunc.swift; sourceTree = ""; }; 1F1A74291940169200FFFC47 /* Nimble.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 1F1A742D1940169200FFFC47 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -582,7 +589,7 @@ 1FD8CD1D1968AB07008ED995 /* MatcherProtocols.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatcherProtocols.swift; sourceTree = ""; }; 1FD8CD1E1968AB07008ED995 /* RaisesException.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = RaisesException.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 1FD8CD251968AB07008ED995 /* Functional.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Functional.swift; sourceTree = ""; }; - 1FD8CD261968AB07008ED995 /* Async.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Async.swift; sourceTree = ""; }; + 1FD8CD261968AB07008ED995 /* Await.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Await.swift; sourceTree = ""; }; 1FD8CD271968AB07008ED995 /* SourceLocation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SourceLocation.swift; sourceTree = ""; }; 1FD8CD281968AB07008ED995 /* Stringers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Stringers.swift; sourceTree = ""; }; 1FDBD8661AF8A4FF0089F27B /* AssertionDispatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssertionDispatcher.swift; sourceTree = ""; }; @@ -612,6 +619,9 @@ AE4BA9AC1C88DDB500B73906 /* Errors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Errors.swift; sourceTree = ""; }; AE7ADE441C80BF8000B94CD3 /* MatchError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatchError.swift; sourceTree = ""; }; AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatchErrorTest.swift; sourceTree = ""; }; + B20058C020E92C7500C1264D /* ElementsEqual.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementsEqual.swift; sourceTree = ""; }; + B20058C420E92CE400C1264D /* ElementsEqualTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementsEqualTest.swift; sourceTree = ""; }; + CD037212207DCC580047AF28 /* XCTestManifests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTestManifests.swift; sourceTree = ""; }; CDFB6A1E1F7E07C600AD8CC7 /* CwlCatchException.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlCatchException.swift; sourceTree = ""; }; CDFB6A201F7E07C600AD8CC7 /* CwlCatchException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CwlCatchException.m; sourceTree = ""; }; CDFB6A221F7E07C600AD8CC7 /* CwlCatchException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlCatchException.h; sourceTree = ""; }; @@ -768,9 +778,10 @@ isa = PBXGroup; children = ( 1F925EE5195C121200ED456B /* AsynchronousTest.swift */, - 1F0648D31963AAB2001F9C46 /* SynchronousTests.swift */, + 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */, 965B0D0B1B62C06D0005AE66 /* UserDescriptionTest.swift */, 6CAEDD091CAEA86F003F1584 /* LinuxSupport.swift */, + CD037212207DCC580047AF28 /* XCTestManifests.swift */, 1FFD729A1963FC8200CD29A2 /* objc */, 1F14FB61194180A7009F2A08 /* Helpers */, 1F925EE3195C11B000ED456B /* Matchers */, @@ -810,6 +821,7 @@ 1F925F01195C189500ED456B /* ContainTest.swift */, 1F925EFE195C187600ED456B /* EndWithTest.swift */, 1F925F04195C18B700ED456B /* EqualTest.swift */, + B20058C420E92CE400C1264D /* ElementsEqualTest.swift */, 472FD1361B9E094B00C7B8DA /* HaveCountTest.swift */, DDB4D5EF19FE442800E9D9FE /* MatchTest.swift */, 1F925EEB195C12C800ED456B /* RaisesExceptionTest.swift */, @@ -843,7 +855,7 @@ isa = PBXGroup; children = ( DDB1BC781A92235600F743C3 /* AllPass.swift */, - 1F1871E31CA89FB600A34BF2 /* AsyncMatcherWrapper.swift */, + 1F1871E31CA89FB600A34BF2 /* Async.swift */, 1FD8CD0E1968AB07008ED995 /* BeAKindOf.swift */, 1FD8CD0D1968AB07008ED995 /* BeAnInstanceOf.swift */, 1FD8CD0F1968AB07008ED995 /* BeCloseTo.swift */, @@ -861,6 +873,7 @@ 7B13BA051DD360AA00C9098C /* ContainElementSatisfying.swift */, 1FD8CD1B1968AB07008ED995 /* EndWith.swift */, 1FD8CD1C1968AB07008ED995 /* Equal.swift */, + B20058C020E92C7500C1264D /* ElementsEqual.swift */, 472FD1341B9E085700C7B8DA /* HaveCount.swift */, DDB4D5EC19FE43C200E9D9FE /* Match.swift */, 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */, @@ -882,7 +895,7 @@ isa = PBXGroup; children = ( 1FD8CD251968AB07008ED995 /* Functional.swift */, - 1FD8CD261968AB07008ED995 /* Async.swift */, + 1FD8CD261968AB07008ED995 /* Await.swift */, 1FD8CD271968AB07008ED995 /* SourceLocation.swift */, 1FD8CD281968AB07008ED995 /* Stringers.swift */, AE4BA9AC1C88DDB500B73906 /* Errors.swift */, @@ -1081,9 +1094,9 @@ isa = PBXNativeTarget; buildConfigurationList = 1F1A743F1940169200FFFC47 /* Build configuration list for PBXNativeTarget "Nimble-iOS" */; buildPhases = ( + 1F1A74261940169200FFFC47 /* Headers */, 1F1A74241940169200FFFC47 /* Sources */, 1F1A74251940169200FFFC47 /* Frameworks */, - 1F1A74261940169200FFFC47 /* Headers */, 1F1A74271940169200FFFC47 /* Resources */, ); buildRules = ( @@ -1120,9 +1133,9 @@ isa = PBXNativeTarget; buildConfigurationList = 1F5DF16A1BDCA0CE00C3A531 /* Build configuration list for PBXNativeTarget "Nimble-tvOS" */; buildPhases = ( + 1F5DF1521BDCA0CE00C3A531 /* Headers */, 1F5DF1501BDCA0CE00C3A531 /* Sources */, 1F5DF1511BDCA0CE00C3A531 /* Frameworks */, - 1F5DF1521BDCA0CE00C3A531 /* Headers */, 1F5DF1531BDCA0CE00C3A531 /* Resources */, ); buildRules = ( @@ -1156,9 +1169,9 @@ isa = PBXNativeTarget; buildConfigurationList = 1F925EC0195C0D6300ED456B /* Build configuration list for PBXNativeTarget "Nimble-macOS" */; buildPhases = ( + 1F925EAA195C0D6300ED456B /* Headers */, 1F925EA8195C0D6300ED456B /* Sources */, 1F925EA9195C0D6300ED456B /* Frameworks */, - 1F925EAA195C0D6300ED456B /* Headers */, 1F925EAB195C0D6300ED456B /* Resources */, ); buildRules = ( @@ -1343,6 +1356,7 @@ DDB4D5ED19FE43C200E9D9FE /* Match.swift in Sources */, 1F91DD311C74BF61002C309F /* BeVoid.swift in Sources */, 7B13BA0B1DD361D200C9098C /* ContainElementSatisfying.swift in Sources */, + B20058C220E92CA900C1264D /* ElementsEqual.swift in Sources */, 1FCF91531C61C8A400B15DCB /* PostNotification.swift in Sources */, 1FD8CD2E1968AB07008ED995 /* AssertionRecorder.swift in Sources */, 29EA59661B551EE6002D767E /* ThrowError.swift in Sources */, @@ -1366,11 +1380,11 @@ 1FE661581E6574E30035F243 /* ExpectationMessage.swift in Sources */, 1F1871E61CA89FCD00A34BF2 /* MatcherFunc.swift in Sources */, 1FD8CD421968AB07008ED995 /* BeEmpty.swift in Sources */, - 1F1871E41CA89FB600A34BF2 /* AsyncMatcherWrapper.swift in Sources */, + 1F1871E41CA89FB600A34BF2 /* Async.swift in Sources */, 1F1871CA1CA89EDB00A34BF2 /* NMBStringify.m in Sources */, A8A3B6EB2071487E00E25A08 /* SatisfyAllOf.swift in Sources */, 1FD8CD521968AB07008ED995 /* BeNil.swift in Sources */, - 1FD8CD6A1968AB07008ED995 /* Async.swift in Sources */, + 1FD8CD6A1968AB07008ED995 /* Await.swift in Sources */, CDFB6A241F7E07C700AD8CC7 /* CwlCatchException.swift in Sources */, 1FD8CD581968AB07008ED995 /* EndWith.swift in Sources */, 1FD8CD341968AB07008ED995 /* DSL.swift in Sources */, @@ -1427,6 +1441,7 @@ 1F4A56911A3B344A009E1637 /* ObjCBeNilTest.m in Sources */, 1F8A37B01B7C5042001C8357 /* ObjCSyncTest.m in Sources */, 1F4A56941A3B346F009E1637 /* ObjCContainTest.m in Sources */, + B20058C620E92CE400C1264D /* ElementsEqualTest.swift in Sources */, 1F299EAB19627B2D002641AF /* BeEmptyTest.swift in Sources */, 7B13BA111DD361EB00C9098C /* ObjCContainElementSatisfyingTest.m in Sources */, 1F925EF6195C147800ED456B /* BeCloseToTest.swift in Sources */, @@ -1441,7 +1456,7 @@ 1F4A56851A3B33A0009E1637 /* ObjCBeTruthyTest.m in Sources */, DD9A9A8F19CF439B00706F49 /* BeIdenticalToObjectTest.swift in Sources */, 1F4BB8B71DACA0E40048464B /* ThrowAssertionTest.swift in Sources */, - 1F0648D41963AAB2001F9C46 /* SynchronousTests.swift in Sources */, + 1F0648D41963AAB2001F9C46 /* SynchronousTest.swift in Sources */, 347155CA1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */, 4793854D1BA0BB2500296F85 /* ObjCHaveCountTest.m in Sources */, 1F925F08195C18CF00ED456B /* BeGreaterThanTest.swift in Sources */, @@ -1470,7 +1485,7 @@ 1F5DF1751BDCA0F500C3A531 /* FailureMessage.swift in Sources */, A8A3B6EC2071487F00E25A08 /* SatisfyAllOf.swift in Sources */, 1F5DF1801BDCA0F500C3A531 /* BeLessThanOrEqual.swift in Sources */, - 1F1871E81CA8A18400A34BF2 /* AsyncMatcherWrapper.swift in Sources */, + 1F1871E81CA8A18400A34BF2 /* Async.swift in Sources */, 1F5DF18A1BDCA0F500C3A531 /* ThrowError.swift in Sources */, 1F5DF1891BDCA0F500C3A531 /* RaisesException.swift in Sources */, 1F5DF1761BDCA0F500C3A531 /* AllPass.swift in Sources */, @@ -1504,12 +1519,13 @@ 1F1871E91CA8A18700A34BF2 /* MatcherFunc.swift in Sources */, 1F5DF17A1BDCA0F500C3A531 /* BeEmpty.swift in Sources */, CDFB6A511F7E087500AD8CC7 /* CwlCatchBadInstructionPosix.swift in Sources */, - 1F5DF18C1BDCA0F500C3A531 /* Async.swift in Sources */, + 1F5DF18C1BDCA0F500C3A531 /* Await.swift in Sources */, 1F1871D81CA89EEF00A34BF2 /* NMBStringify.m in Sources */, 1F5DF1821BDCA0F500C3A531 /* BeNil.swift in Sources */, 1F5DF16F1BDCA0F500C3A531 /* AssertionDispatcher.swift in Sources */, 964CFEFF1C4FF48900513336 /* ThrowAssertion.swift in Sources */, 1F5DF1841BDCA0F500C3A531 /* EndWith.swift in Sources */, + B20058C320E92CA900C1264D /* ElementsEqual.swift in Sources */, 1F5DF18D1BDCA0F500C3A531 /* SourceLocation.swift in Sources */, 1F5DF1701BDCA0F500C3A531 /* DSL.swift in Sources */, CDD80B851F20307B0002CD65 /* MatcherProtocols.swift in Sources */, @@ -1562,11 +1578,12 @@ 1F5DF19C1BDCA10200C3A531 /* BeginWithTest.swift in Sources */, 1F5DF1A01BDCA10200C3A531 /* BeIdenticalToTest.swift in Sources */, 1F5DF19A1BDCA10200C3A531 /* BeCloseToTest.swift in Sources */, + B20058C720E92CE400C1264D /* ElementsEqualTest.swift in Sources */, 1F5DF1A61BDCA10200C3A531 /* EndWithTest.swift in Sources */, CD79C9A31D2CC841004B6F9A /* ObjCBeFalseTest.m in Sources */, 1F5DF1A71BDCA10200C3A531 /* EqualTest.swift in Sources */, CD79C9AA1D2CC848004B6F9A /* ObjCBeLessThanOrEqualToTest.m in Sources */, - 1F5DF1931BDCA10200C3A531 /* SynchronousTests.swift in Sources */, + 1F5DF1931BDCA10200C3A531 /* SynchronousTest.swift in Sources */, CD79C9A11D2CC83B004B6F9A /* ObjCBeCloseToTest.m in Sources */, 1F5DF19D1BDCA10200C3A531 /* BeGreaterThanOrEqualToTest.swift in Sources */, A8A3B6F7207329DE00E25A08 /* SatisfyAllOfTest.swift in Sources */, @@ -1605,7 +1622,7 @@ 1F43728E1A1B343F00EB80F8 /* Stringers.swift in Sources */, 1F43728C1A1B343C00EB80F8 /* SourceLocation.swift in Sources */, 1FD8CD4F1968AB07008ED995 /* BeLessThanOrEqual.swift in Sources */, - 1F1871E71CA8A18400A34BF2 /* AsyncMatcherWrapper.swift in Sources */, + 1F1871E71CA8A18400A34BF2 /* Async.swift in Sources */, 1FDBD8681AF8A4FF0089F27B /* AssertionDispatcher.swift in Sources */, 1F43728B1A1B343900EB80F8 /* Functional.swift in Sources */, AE4BA9AE1C88DDB500B73906 /* Errors.swift in Sources */, @@ -1618,6 +1635,7 @@ 1FD8CD2F1968AB07008ED995 /* AssertionRecorder.swift in Sources */, 7B13BA061DD360AA00C9098C /* ContainElementSatisfying.swift in Sources */, 1F91DD321C74BF61002C309F /* BeVoid.swift in Sources */, + B20058C120E92C7500C1264D /* ElementsEqual.swift in Sources */, 1FCF91541C61C8A400B15DCB /* PostNotification.swift in Sources */, DDB4D5EE19FE43C200E9D9FE /* Match.swift in Sources */, 29EA59671B551EE6002D767E /* ThrowError.swift in Sources */, @@ -1645,7 +1663,7 @@ 1F1871D41CA89EEE00A34BF2 /* NMBStringify.m in Sources */, A8F6B5BD2070186D00FCB5ED /* SatisfyAllOf.swift in Sources */, 1FD8CD531968AB07008ED995 /* BeNil.swift in Sources */, - 1FD8CD6B1968AB07008ED995 /* Async.swift in Sources */, + 1FD8CD6B1968AB07008ED995 /* Await.swift in Sources */, CDFB6A231F7E07C700AD8CC7 /* CwlCatchException.swift in Sources */, 964CFEFE1C4FF48900513336 /* ThrowAssertion.swift in Sources */, 1FD8CD591968AB07008ED995 /* EndWith.swift in Sources */, @@ -1676,10 +1694,12 @@ DDB4D5F119FE442800E9D9FE /* MatchTest.swift in Sources */, 1F4A56741A3B3210009E1637 /* ObjCBeginWithTest.m in Sources */, 1F4A56831A3B336F009E1637 /* ObjCBeLessThanOrEqualToTest.m in Sources */, + CD037213207DCC580047AF28 /* XCTestManifests.swift in Sources */, 7B13BA0D1DD361DE00C9098C /* ContainElementSatisfyingTest.swift in Sources */, 1F925F03195C189500ED456B /* ContainTest.swift in Sources */, A8A3B6FD2073644700E25A08 /* ObjcStringersTest.m in Sources */, 1F4A56891A3B33CB009E1637 /* ObjCBeFalsyTest.m in Sources */, + B20058C520E92CE400C1264D /* ElementsEqualTest.swift in Sources */, 1F4A568F1A3B342B009E1637 /* ObjCBeFalseTest.m in Sources */, 1F925F12195C190B00ED456B /* BeGreaterThanOrEqualToTest.swift in Sources */, 1F925EF0195C136500ED456B /* BeLogicalTest.swift in Sources */, @@ -1716,7 +1736,7 @@ 1F4A56861A3B33A0009E1637 /* ObjCBeTruthyTest.m in Sources */, DD9A9A9019CF43AD00706F49 /* BeIdenticalToObjectTest.swift in Sources */, 1F4BB8B61DACA0E30048464B /* ThrowAssertionTest.swift in Sources */, - 1F0648D51963AAB2001F9C46 /* SynchronousTests.swift in Sources */, + 1F0648D51963AAB2001F9C46 /* SynchronousTest.swift in Sources */, 347155CB1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */, 4793854E1BA0BB2500296F85 /* ObjCHaveCountTest.m in Sources */, 1F925F09195C18CF00ED456B /* BeGreaterThanTest.swift in Sources */, @@ -1836,13 +1856,13 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; TVOS_DEPLOYMENT_TARGET = 9.0; VERSIONING_SYSTEM = "apple-generic"; @@ -1895,12 +1915,12 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; @@ -1933,9 +1953,12 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( + "$(inherited)", "-weak_framework", XCTest, "-weak-lswiftXCTest", + "-Xlinker", + "-no_application_extension", ); PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Nimble; @@ -1967,9 +1990,12 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; OTHER_LDFLAGS = ( + "$(inherited)", "-weak_framework", XCTest, "-weak-lswiftXCTest", + "-Xlinker", + "-no_application_extension", ); PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Nimble; @@ -2043,9 +2069,12 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = ( + "$(inherited)", "-weak_framework", XCTest, "-weak-lswiftXCTest", + "-Xlinker", + "-no_application_extension", ); PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Nimble; @@ -2080,9 +2109,12 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; OTHER_LDFLAGS = ( + "$(inherited)", "-weak_framework", XCTest, "-weak-lswiftXCTest", + "-Xlinker", + "-no_application_extension", ); PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Nimble; @@ -2160,9 +2192,12 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; METAL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = ( + "$(inherited)", "-weak_framework", XCTest, "-weak-lswiftXCTest", + "-Xlinker", + "-no_application_extension", ); PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Nimble; @@ -2197,9 +2232,12 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; METAL_ENABLE_DEBUG_INFO = NO; OTHER_LDFLAGS = ( + "$(inherited)", "-weak_framework", XCTest, "-weak-lswiftXCTest", + "-Xlinker", + "-no_application_extension", ); PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Nimble; diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..3ddf867 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + BuildSystemType + Latest + + diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Package.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Package.swift index 8d0b745..dfa6226 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Package.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Package.swift @@ -1,11 +1,21 @@ -// swift-tools-version:3.0 - +// swift-tools-version:4.2 import PackageDescription let package = Package( name: "Nimble", - exclude: [ - "Sources/NimbleObjectiveC", - "Tests/NimbleTests/objc", - ] + products: [ + .library(name: "Nimble", targets: ["Nimble"]), + ], + targets: [ + .target( + name: "Nimble", + dependencies: [] + ), + .testTarget( + name: "NimbleTests", + dependencies: ["Nimble"], + exclude: ["objc"] + ), + ], + swiftLanguageVersions: [.v4_2] ) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Package@swift-4.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Package@swift-4.swift deleted file mode 100644 index 740b842..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Package@swift-4.swift +++ /dev/null @@ -1,22 +0,0 @@ -// swift-tools-version:4.0 - -import PackageDescription - -let package = Package( - name: "Nimble", - products: [ - .library(name: "Nimble", targets: ["Nimble"]), - ], - targets: [ - .target( - name: "Nimble", - dependencies: [] - ), - .testTarget( - name: "NimbleTests", - dependencies: ["Nimble"], - exclude: ["objc"] - ), - ], - swiftLanguageVersions: [4] -) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/README.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/README.md index 19c562f..dde7fc4 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/README.md +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/README.md @@ -4,6 +4,7 @@ [![CocoaPods](https://img.shields.io/cocoapods/v/Nimble.svg)](https://cocoapods.org/pods/Nimble) [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Platforms](https://img.shields.io/cocoapods/p/Nimble.svg)](https://cocoapods.org/pods/Nimble) +[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com) Use Nimble to express the expected outcomes of Swift or Objective-C expressions. Inspired by @@ -306,8 +307,7 @@ In Nimble, it's easy to make expectations on values that are updated asynchronously. Just use `toEventually` or `toEventuallyNot`: ```swift -// Swift 3.0 and later - +// Swift DispatchQueue.main.async { ocean.add("dolphins") ocean.add("whales") @@ -316,17 +316,6 @@ expect(ocean).toEventually(contain("dolphins", "whales")) ``` -```swift -// Swift 2.3 and earlier - -dispatch_async(dispatch_get_main_queue()) { - ocean.add("dolphins") - ocean.add("whales") -} -expect(ocean).toEventually(contain("dolphins", "whales")) -``` - - ```objc // Objective-C @@ -857,11 +846,7 @@ Notes: ## Swift Error Handling -If you're using Swift 2.0 or newer, you can use the `throwError` matcher to check if an error is thrown. - -Note: -The following code sample references the `Swift.Error` protocol. -This is `Swift.ErrorProtocol` in versions of Swift prior to version 3.0. +You can use the `throwError` matcher to check if an error is thrown. ```swift // Swift @@ -1277,7 +1262,7 @@ public func equal(expectedValue: T?) -> Predicate { // Predicate { actual in ... } // // But shown with types here for clarity. - return Predicate { (actual: Expression) throws -> PredicateResult in + return Predicate { (actualExpression: Expression) throws -> PredicateResult in let msg = ExpectationMessage.expectedActualValueTo("equal <\(expectedValue)>") if let actualValue = try actualExpression.evaluate() { return PredicateResult( @@ -1673,11 +1658,11 @@ backported. The deprecating plan is a 3 major versions removal. Which is as follows: 1. Introduce new `Predicate` API, deprecation warning for old matcher APIs. - (Nimble `v7.x.x`) + (Nimble `v7.x.x` and `v8.x.x`) 2. Introduce warnings on migration-path features (`.predicate`, `Predicate`-constructors with similar arguments to old API). (Nimble - `v8.x.x`) - 3. Remove old API. (Nimble `v9.x.x`) + `v9.x.x`) + 3. Remove old API. (Nimble `v10.x.x`) # Installing Nimble diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift index 2e58fdf..abaf532 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift @@ -13,5 +13,6 @@ public protocol AssertionHandler { /// /// @see AssertionHandler public var NimbleAssertionHandler: AssertionHandler = { () -> AssertionHandler in + // swiftlint:disable:previous identifier_name return isXCTestAvailable() ? NimbleXCTestHandler() : NimbleXCTestUnavailableHandler() }() diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift index 740c392..0f5df59 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift @@ -37,21 +37,48 @@ public class AssertionRecorder: AssertionHandler { } } +extension NMBExceptionCapture { + internal func tryBlockThrows(_ unsafeBlock: () throws -> Void) throws { + var catchedError: Error? + tryBlock { + do { + try unsafeBlock() + } catch { + catchedError = error + } + } + if let error = catchedError { + throw error + } + } +} + /// Allows you to temporarily replace the current Nimble assertion handler with /// the one provided for the scope of the closure. /// /// Once the closure finishes, then the original Nimble assertion handler is restored. /// /// @see AssertionHandler -public func withAssertionHandler(_ tempAssertionHandler: AssertionHandler, closure: () throws -> Void) { +public func withAssertionHandler(_ tempAssertionHandler: AssertionHandler, + file: FileString = #file, + line: UInt = #line, + closure: () throws -> Void) { let environment = NimbleEnvironment.activeInstance let oldRecorder = environment.assertionHandler let capturer = NMBExceptionCapture(handler: nil, finally: ({ environment.assertionHandler = oldRecorder })) environment.assertionHandler = tempAssertionHandler - capturer.tryBlock { - try! closure() + + do { + try capturer.tryBlockThrows { + try closure() + } + } catch { + let failureMessage = FailureMessage() + failureMessage.stringValue = "unexpected error thrown: <\(error)>" + let location = SourceLocation(file: file, line: line) + tempAssertionHandler.assert(false, message: failureMessage, location: location) } } @@ -65,7 +92,7 @@ public func withAssertionHandler(_ tempAssertionHandler: AssertionHandler, closu /// assertion handler when this is true. Defaults to false. /// /// @see gatherFailingExpectations -public func gatherExpectations(silently: Bool = false, closure: @escaping () -> Void) -> [AssertionRecord] { +public func gatherExpectations(silently: Bool = false, closure: () -> Void) -> [AssertionRecord] { let previousRecorder = NimbleEnvironment.activeInstance.assertionHandler let recorder = AssertionRecorder() let handlers: [AssertionHandler] @@ -92,7 +119,7 @@ public func gatherExpectations(silently: Bool = false, closure: @escaping () -> /// /// @see gatherExpectations /// @see raiseException source for an example use case. -public func gatherFailingExpectations(silently: Bool = false, closure: @escaping () -> Void) -> [AssertionRecord] { +public func gatherFailingExpectations(silently: Bool = false, closure: () -> Void) -> [AssertionRecord] { let assertions = gatherExpectations(silently: silently, closure: closure) return assertions.filter { assertion in !assertion.success diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift index 5e1afd5..b3eb09a 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift @@ -1,10 +1,10 @@ import Foundation -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE private func from(objcPredicate: NMBPredicate) -> Predicate { return Predicate { actualExpression in - let result = objcPredicate.satisfies(({ try! actualExpression.evaluate() }), + let result = objcPredicate.satisfies(({ try actualExpression.evaluate() }), location: actualExpression.location) return result.toSwift() } @@ -15,6 +15,7 @@ internal struct ObjCMatcherWrapper: Matcher { func matches(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { return matcher.matches( + // swiftlint:disable:next force_try ({ try! actualExpression.evaluate() }), failureMessage: failureMessage, location: actualExpression.location) @@ -22,6 +23,7 @@ internal struct ObjCMatcherWrapper: Matcher { func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { return matcher.doesNotMatch( + // swiftlint:disable:next force_try ({ try! actualExpression.evaluate() }), failureMessage: failureMessage, location: actualExpression.location) @@ -30,11 +32,13 @@ internal struct ObjCMatcherWrapper: Matcher { // Equivalent to Expectation, but for Nimble's Objective-C interface public class NMBExpectation: NSObject { + // swiftlint:disable identifier_name internal let _actualBlock: () -> NSObject? internal var _negative: Bool internal let _file: FileString internal let _line: UInt internal var _timeout: TimeInterval = 1.0 + // swiftlint:enable identifier_name @objc public init(actualBlock: @escaping () -> NSObject?, negative: Bool, file: FileString, line: UInt) { self._actualBlock = actualBlock diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift index 0288b75..a91efe3 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift @@ -1,15 +1,17 @@ import Foundation -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) // swiftlint:disable line_length -public typealias MatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage) -> Bool -public typealias FullMatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage, _ shouldNotMatch: Bool) -> Bool +public typealias MatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage) throws -> Bool +public typealias FullMatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage, _ shouldNotMatch: Bool) throws -> Bool // swiftlint:enable line_length public class NMBObjCMatcher: NSObject, NMBMatcher { + // swiftlint:disable identifier_name let _match: MatcherBlock let _doesNotMatch: MatcherBlock + // swiftlint:enable identifier_name let canMatchNil: Bool public init(canMatchNil: Bool, matcher: @escaping MatcherBlock, notMatcher: @escaping MatcherBlock) { @@ -24,7 +26,7 @@ public class NMBObjCMatcher: NSObject, NMBMatcher { public convenience init(canMatchNil: Bool, matcher: @escaping MatcherBlock) { self.init(canMatchNil: canMatchNil, matcher: matcher, notMatcher: ({ actualExpression, failureMessage in - return !matcher(actualExpression, failureMessage) + return try !matcher(actualExpression, failureMessage) })) } @@ -34,9 +36,9 @@ public class NMBObjCMatcher: NSObject, NMBMatcher { public convenience init(canMatchNil: Bool, matcher: @escaping FullMatcherBlock) { self.init(canMatchNil: canMatchNil, matcher: ({ actualExpression, failureMessage in - return matcher(actualExpression, failureMessage, false) + return try matcher(actualExpression, failureMessage, false) }), notMatcher: ({ actualExpression, failureMessage in - return matcher(actualExpression, failureMessage, true) + return try matcher(actualExpression, failureMessage, true) })) } @@ -57,9 +59,14 @@ public class NMBObjCMatcher: NSObject, NMBMatcher { public func matches(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool { let expr = Expression(expression: actualBlock, location: location) - let result = _match( - expr, - failureMessage) + let result: Bool + do { + result = try _match(expr, failureMessage) + } catch let error { + failureMessage.stringValue = "unexpected error thrown: <\(error)>" + return false + } + if self.canMatch(Expression(expression: actualBlock, location: location), failureMessage: failureMessage) { return result } else { @@ -69,9 +76,14 @@ public class NMBObjCMatcher: NSObject, NMBMatcher { public func doesNotMatch(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool { let expr = Expression(expression: actualBlock, location: location) - let result = _doesNotMatch( - expr, - failureMessage) + let result: Bool + do { + result = try _doesNotMatch(expr, failureMessage) + } catch let error { + failureMessage.stringValue = "unexpected error thrown: <\(error)>" + return false + } + if self.canMatch(Expression(expression: actualBlock, location: location), failureMessage: failureMessage) { return result } else { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift index e1b5432..1b2e8c0 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift @@ -3,7 +3,7 @@ import Foundation /// "Global" state of Nimble is stored here. Only DSL functions should access / be aware of this /// class' existence -internal class NimbleEnvironment { +internal class NimbleEnvironment: NSObject { static var activeInstance: NimbleEnvironment { get { let env = Thread.current.threadDictionary["NimbleEnvironment"] @@ -20,6 +20,7 @@ internal class NimbleEnvironment { } } + // swiftlint:disable:next todo // TODO: eventually migrate the global to this environment value var assertionHandler: AssertionHandler { get { return NimbleAssertionHandler } @@ -29,17 +30,14 @@ internal class NimbleEnvironment { var suppressTVOSAssertionWarning: Bool = false var awaiter: Awaiter - init() { - let timeoutQueue: DispatchQueue - if #available(OSX 10.10, *) { - timeoutQueue = DispatchQueue.global(qos: .userInitiated) - } else { - timeoutQueue = DispatchQueue.global(priority: .high) - } - + override init() { + let timeoutQueue = DispatchQueue.global(qos: .userInitiated) awaiter = Awaiter( waitLock: AssertionWaitLock(), asyncQueue: .main, - timeoutQueue: timeoutQueue) + timeoutQueue: timeoutQueue + ) + + super.init() } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift index 0ad8590..719bf44 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift @@ -42,18 +42,29 @@ class NimbleXCTestUnavailableHandler: AssertionHandler { private(set) var currentTestCase: XCTestCase? + private var stashed_swift_reportFatalErrorsToDebugger: Bool = false + @objc func testCaseWillStart(_ testCase: XCTestCase) { + #if swift(>=3.2) + stashed_swift_reportFatalErrorsToDebugger = _swift_reportFatalErrorsToDebugger + _swift_reportFatalErrorsToDebugger = false + #endif + currentTestCase = testCase } @objc func testCaseDidFinish(_ testCase: XCTestCase) { currentTestCase = nil + + #if swift(>=3.2) + _swift_reportFatalErrorsToDebugger = stashed_swift_reportFatalErrorsToDebugger + #endif } } #endif func isXCTestAvailable() -> Bool { -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) // XCTest is weakly linked and so may not be present return NSClassFromString("XCTestCase") != nil #else @@ -61,20 +72,19 @@ func isXCTestAvailable() -> Bool { #endif } -private func recordFailure(_ message: String, location: SourceLocation) { +public func recordFailure(_ message: String, location: SourceLocation) { #if SWIFT_PACKAGE XCTFail("\(message)", file: location.file, line: location.line) #else if let testCase = CurrentTestCaseTracker.sharedInstance.currentTestCase { - #if swift(>=4) let line = Int(location.line) - #else - let line = location.line - #endif testCase.recordFailure(withDescription: message, inFile: location.file, atLine: line, expected: true) } else { - let msg = "Attempted to report a test failure to XCTest while no test case was running. " + - "The failure was:\n\"\(message)\"\nIt occurred at: \(location.file):\(location.line)" + let msg = """ + Attempted to report a test failure to XCTest while no test case was running. The failure was: + \"\(message)\" + It occurred at: \(location.file):\(location.line) + """ NSException(name: .internalInconsistencyException, reason: msg, userInfo: nil).raise() } #endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NonObjectiveC/ExceptionCapture.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NonObjectiveC/ExceptionCapture.swift index 8f8d360..d0871fc 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NonObjectiveC/ExceptionCapture.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NonObjectiveC/ExceptionCapture.swift @@ -1,6 +1,6 @@ import Foundation -#if !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) +#if !canImport(Darwin) // swift-corelibs-foundation doesn't provide NSException at all, so provide a dummy class NSException {} #endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/DSL+Wait.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/DSL+Wait.swift index e874136..c049417 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/DSL+Wait.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/DSL+Wait.swift @@ -14,7 +14,7 @@ internal class NMBWait: NSObject { // About these kind of lines, `@objc` attributes are only required for Objective-C // support, so that should be conditional on Darwin platforms and normal Xcode builds // (non-SwiftPM builds). -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE @objc internal class func until( timeout: TimeInterval, @@ -87,13 +87,19 @@ internal class NMBWait: NSObject { } } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE @objc(untilFile:line:action:) - internal class func until(_ file: FileString = #file, line: UInt = #line, action: @escaping (() -> Void) -> Void) { + internal class func until( + _ file: FileString = #file, + line: UInt = #line, + action: @escaping (@escaping () -> Void) -> Void) { until(timeout: 1, file: file, line: line, action: action) } #else - internal class func until(_ file: FileString = #file, line: UInt = #line, action: @escaping (() -> Void) -> Void) { + internal class func until( + _ file: FileString = #file, + line: UInt = #line, + action: @escaping (@escaping () -> Void) -> Void) { until(timeout: 1, file: file, line: line, action: action) } #endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/DSL.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/DSL.swift index e49bb0c..d6dc9cc 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/DSL.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/DSL.swift @@ -43,12 +43,13 @@ internal func nimblePrecondition( line: UInt = #line) { let result = expr() if !result { -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - let e = NSException( +#if canImport(Darwin) + let exception = NSException( name: NSExceptionName(name()), reason: message(), - userInfo: nil) - e.raise() + userInfo: nil + ) + exception.raise() #else preconditionFailure("\(name()) - \(message())", file: file, line: line) #endif @@ -56,9 +57,12 @@ internal func nimblePrecondition( } internal func internalError(_ msg: String, file: FileString = #file, line: UInt = #line) -> Never { + // swiftlint:disable line_length fatalError( - "Nimble Bug Found: \(msg) at \(file):\(line).\n" + - "Please file a bug to Nimble: https://github.com/Quick/Nimble/issues with the " + - "code snippet that caused this error." + """ + Nimble Bug Found: \(msg) at \(file):\(line). + Please file a bug to Nimble: https://github.com/Quick/Nimble/issues with the code snippet that caused this error. + """ ) + // swiftlint:enable line_length } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Expectation.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Expectation.swift index e3f616a..41625a1 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Expectation.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Expectation.swift @@ -1,23 +1,5 @@ import Foundation -// Deprecated -internal func expressionMatches(_ expression: Expression, matcher: U, to: String, description: String?) -> (Bool, FailureMessage) - where U: Matcher, U.ValueType == T { - let msg = FailureMessage() - msg.userDescription = description - msg.to = to - do { - let pass = try matcher.matches(expression, failureMessage: msg) - if msg.actualValue == "" { - msg.actualValue = "<\(stringify(try expression.evaluate()))>" - } - return (pass, msg) - } catch let error { - msg.stringValue = "unexpected error thrown: <\(error)>" - return (false, msg) - } -} - // Deprecated internal func expressionDoesNotMatch(_ expression: Expression, matcher: U, toNot: String, description: String?) -> (Bool, FailureMessage) where U: Matcher, U.ValueType == T { @@ -75,6 +57,10 @@ public struct Expectation { public let expression: Expression + public init(expression: Expression) { + self.expression = expression + } + public func verify(_ pass: Bool, _ message: FailureMessage) { let handler = NimbleEnvironment.activeInstance.assertionHandler handler.assert(pass, message: message, location: expression.location) @@ -85,8 +71,15 @@ public struct Expectation { /// DEPRECATED: Tests the actual value using a matcher to match. public func to(_ matcher: U, description: String? = nil) where U: Matcher, U.ValueType == T { - let (pass, msg) = expressionMatches(expression, matcher: matcher, to: "to", description: description) - verify(pass, msg) + let (pass, msg) = execute( + expression, + .toMatch, + matcher.predicate, + to: "to", + description: description, + captureExceptions: false + ) + verify(pass, msg) } /// DEPRECATED: Tests the actual value using a matcher to not match. @@ -127,6 +120,6 @@ public struct Expectation { } // see: - // - AsyncMatcherWrapper for extension + // - `async` for extension // - NMBExpectation for Objective-C interface } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/ExpectationMessage.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/ExpectationMessage.swift index 992ee0e..b0cbcc3 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/ExpectationMessage.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/ExpectationMessage.swift @@ -75,6 +75,7 @@ public indirect enum ExpectationMessage { } internal func visitLeafs(_ f: (ExpectationMessage) -> ExpectationMessage) -> ExpectationMessage { + // swiftlint:disable:previous identifier_name switch self { case .fail, .expectedTo, .expectedActualValueTo, .expectedCustomValueTo: return f(self) @@ -90,6 +91,7 @@ public indirect enum ExpectationMessage { /// Replaces a primary expectation with one returned by f. Preserves all composite expectations /// that were built upon it (aka - all appended(message:) and appended(details:). public func replacedExpectation(_ f: @escaping (ExpectationMessage) -> ExpectationMessage) -> ExpectationMessage { + // swiftlint:disable:previous identifier_name func walk(_ msg: ExpectationMessage) -> ExpectationMessage { switch msg { case .fail, .expectedTo, .expectedActualValueTo, .expectedCustomValueTo: @@ -124,6 +126,7 @@ public indirect enum ExpectationMessage { return visitLeafs(walk) } + // swiftlint:disable:next todo // TODO: test & verify correct behavior internal func prepended(message: String) -> ExpectationMessage { return .prepends(message, self) @@ -152,8 +155,10 @@ public indirect enum ExpectationMessage { // Backwards compatibility: converts ExpectationMessage tree to FailureMessage internal func update(failureMessage: FailureMessage) { switch self { - case let .fail(msg): + case let .fail(msg) where !msg.isEmpty: failureMessage.stringValue = msg + case .fail: + break case let .expectedTo(msg): failureMessage.actualValue = nil failureMessage.postfixMessage = msg @@ -181,32 +186,32 @@ public indirect enum ExpectationMessage { extension FailureMessage { internal func toExpectationMessage() -> ExpectationMessage { - let defaultMsg = FailureMessage() - if expected != defaultMsg.expected || _stringValueOverride != nil { + let defaultMessage = FailureMessage() + if expected != defaultMessage.expected || _stringValueOverride != nil { return .fail(stringValue) } - var msg: ExpectationMessage = .fail(userDescription ?? "") + var message: ExpectationMessage = .fail(userDescription ?? "") if actualValue != "" && actualValue != nil { - msg = .expectedCustomValueTo(postfixMessage, actualValue ?? "") - } else if postfixMessage != defaultMsg.postfixMessage { + message = .expectedCustomValueTo(postfixMessage, actualValue ?? "") + } else if postfixMessage != defaultMessage.postfixMessage { if actualValue == nil { - msg = .expectedTo(postfixMessage) + message = .expectedTo(postfixMessage) } else { - msg = .expectedActualValueTo(postfixMessage) + message = .expectedActualValueTo(postfixMessage) } } - if postfixActual != defaultMsg.postfixActual { - msg = .appends(msg, postfixActual) + if postfixActual != defaultMessage.postfixActual { + message = .appends(message, postfixActual) } - if let m = extendedMessage { - msg = .details(msg, m) + if let extended = extendedMessage { + message = .details(message, extended) } - return msg + return message } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) public class NMBExpectationMessage: NSObject { private let msg: ExpectationMessage diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Expression.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Expression.swift index 5a233fd..b6b2ee3 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Expression.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Expression.swift @@ -24,8 +24,10 @@ internal func memoizedClosure(_ closure: @escaping () throws -> T) -> (Bool) /// This provides a common consumable API for matchers to utilize to allow /// Nimble to change internals to how the captured closure is managed. public struct Expression { + // swiftlint:disable identifier_name internal let _expression: (Bool) throws -> T? internal let _withoutCaching: Bool + // swiftlint:enable identifier_name public let location: SourceLocation public let isClosure: Bool diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/FailureMessage.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/FailureMessage.swift index 2bc57eb..503b540 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/FailureMessage.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/FailureMessage.swift @@ -28,6 +28,7 @@ public class FailureMessage: NSObject { } } + // swiftlint:disable:next identifier_name internal var _stringValueOverride: String? internal var hasOverriddenStringValue: Bool { return _stringValueOverride != nil diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/AllPass.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/AllPass.swift index 8affa62..dbbccb9 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/AllPass.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/AllPass.swift @@ -63,12 +63,12 @@ private func createPredicate(_ elementMatcher: Predicate) } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func allPassMatcher(_ matcher: NMBMatcher) -> NMBPredicate { return NMBPredicate { actualExpression in let location = actualExpression.location - let actualValue = try! actualExpression.evaluate() + let actualValue = try actualExpression.evaluate() var nsObjects = [NSObject]() var collectionIsUsable = true @@ -99,10 +99,11 @@ extension NMBObjCMatcher { let expr = Expression(expression: ({ nsObjects }), location: location) let pred: Predicate<[NSObject]> = createPredicate(Predicate { expr in if let predicate = matcher as? NMBPredicate { - return predicate.satisfies(({ try! expr.evaluate() }), location: expr.location).toSwift() + return predicate.satisfies(({ try expr.evaluate() }), location: expr.location).toSwift() } else { let failureMessage = FailureMessage() let result = matcher.matches( + // swiftlint:disable:next force_try ({ try! expr.evaluate() }), failureMessage: failureMessage, location: expr.location @@ -114,7 +115,7 @@ extension NMBObjCMatcher { ) } }) - return try! pred.satisfies(expr).toObjectiveC() + return try pred.satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Async.swift similarity index 63% rename from Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift rename to Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Async.swift index 3cba8b0..5022fe2 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Async.swift @@ -23,92 +23,29 @@ private func async(style: ExpectationStyle, predicate: Predicate, timeout: } switch result { case .completed: return lastPredicateResult! - case .timedOut: return PredicateResult(status: .fail, message: lastPredicateResult!.message) + case .timedOut: + let message = lastPredicateResult?.message ?? .fail("timed out before returning a value") + return PredicateResult(status: .fail, message: message) case let .errorThrown(error): return PredicateResult(status: .fail, message: .fail("unexpected error thrown: <\(error)>")) case let .raisedException(exception): return PredicateResult(status: .fail, message: .fail("unexpected exception raised: \(exception)")) case .blockedRunLoop: // swiftlint:disable:next line_length - return PredicateResult(status: .fail, message: lastPredicateResult!.message.appended(message: " (timed out, but main thread was unresponsive).")) + let message = lastPredicateResult?.message.appended(message: " (timed out, but main run loop was unresponsive).") ?? + .fail("main run loop was unresponsive") + return PredicateResult(status: .fail, message: message) case .incomplete: - internalError("Reached .incomplete state for toEventually(...).") - } - } -} - -// Deprecated -internal struct AsyncMatcherWrapper: Matcher - where U: Matcher, U.ValueType == T { - let fullMatcher: U - let timeoutInterval: TimeInterval - let pollInterval: TimeInterval - - init(fullMatcher: U, timeoutInterval: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval) { - self.fullMatcher = fullMatcher - self.timeoutInterval = timeoutInterval - self.pollInterval = pollInterval - } - - func matches(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { - let uncachedExpression = actualExpression.withoutCaching() - let fnName = "expect(...).toEventually(...)" - let result = pollBlock( - pollInterval: pollInterval, - timeoutInterval: timeoutInterval, - file: actualExpression.location.file, - line: actualExpression.location.line, - fnName: fnName) { - try self.fullMatcher.matches(uncachedExpression, failureMessage: failureMessage) - } - switch result { - case let .completed(isSuccessful): return isSuccessful - case .timedOut: return false - case let .errorThrown(error): - failureMessage.stringValue = "an unexpected error thrown: <\(error)>" - return false - case let .raisedException(exception): - failureMessage.stringValue = "an unexpected exception thrown: <\(exception)>" - return false - case .blockedRunLoop: - failureMessage.postfixMessage += " (timed out, but main thread was unresponsive)." - return false - case .incomplete: - internalError("Reached .incomplete state for toEventually(...).") - } - } - - func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { - let uncachedExpression = actualExpression.withoutCaching() - let result = pollBlock( - pollInterval: pollInterval, - timeoutInterval: timeoutInterval, - file: actualExpression.location.file, - line: actualExpression.location.line, - fnName: "expect(...).toEventuallyNot(...)") { - try self.fullMatcher.doesNotMatch(uncachedExpression, failureMessage: failureMessage) - } - switch result { - case let .completed(isSuccessful): return isSuccessful - case .timedOut: return false - case let .errorThrown(error): - failureMessage.stringValue = "an unexpected error thrown: <\(error)>" - return false - case let .raisedException(exception): - failureMessage.stringValue = "an unexpected exception thrown: <\(exception)>" - return false - case .blockedRunLoop: - failureMessage.postfixMessage += " (timed out, but main thread was unresponsive)." - return false - case .incomplete: - internalError("Reached .incomplete state for toEventuallyNot(...).") + internalError("Reached .incomplete state for \(fnName)(...).") } } } private let toEventuallyRequiresClosureError = FailureMessage( - // swiftlint:disable:next line_length - stringValue: "expect(...).toEventually(...) requires an explicit closure (eg - expect { ... }.toEventually(...) )\nSwift 1.2 @autoclosure behavior has changed in an incompatible way for Nimble to function" + stringValue: """ + expect(...).toEventually(...) requires an explicit closure (eg - expect { ... }.toEventually(...) ) + Swift 1.2 @autoclosure behavior has changed in an incompatible way for Nimble to function + """ ) extension Expectation { @@ -182,14 +119,19 @@ extension Expectation { public func toEventually(_ matcher: U, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) where U: Matcher, U.ValueType == T { if expression.isClosure { - let (pass, msg) = expressionMatches( + let (pass, msg) = execute( expression, - matcher: AsyncMatcherWrapper( - fullMatcher: matcher, - timeoutInterval: timeout, - pollInterval: pollInterval), + .toMatch, + async( + style: .toMatch, + predicate: matcher.predicate, + timeout: timeout, + poll: pollInterval, + fnName: "toEventually" + ), to: "to eventually", - description: description + description: description, + captureExceptions: false ) verify(pass, msg) } else { @@ -208,10 +150,13 @@ extension Expectation { if expression.isClosure { let (pass, msg) = expressionDoesNotMatch( expression, - matcher: AsyncMatcherWrapper( - fullMatcher: matcher, - timeoutInterval: timeout, - pollInterval: pollInterval), + matcher: async( + style: .toNotMatch, + predicate: matcher.predicate, + timeout: timeout, + poll: pollInterval, + fnName: "toEventuallyNot" + ), toNot: "to eventually not", description: description ) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift index 5674525..3a68b09 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift @@ -29,7 +29,7 @@ public func beAKindOf(_ expectedType: T.Type) -> Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) /// A Nimble matcher that succeeds when the actual value is an instance of the given class. /// @see beAnInstanceOf if you want to match against the exact class @@ -59,8 +59,8 @@ public func beAKindOf(_ expectedClass: AnyClass) -> Predicate { extension NMBObjCMatcher { @objc public class func beAKindOfMatcher(_ expected: AnyClass) -> NMBMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - return try! beAKindOf(expected).matches(actualExpression, failureMessage: failureMessage) + return NMBPredicate { actualExpression in + return try beAKindOf(expected).satisfies(actualExpression).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift index 70c5661..3cef3a7 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift @@ -33,7 +33,7 @@ public func beAnInstanceOf(_ expectedClass: AnyClass) -> Predicate { } else { actualString = "" } - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) let matches = instance != nil && instance!.isMember(of: expectedClass) #else let matches = instance != nil && type(of: instance!) == expectedClass @@ -45,11 +45,11 @@ public func beAnInstanceOf(_ expectedClass: AnyClass) -> Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func beAnInstanceOfMatcher(_ expected: AnyClass) -> NMBMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - return try! beAnInstanceOf(expected).matches(actualExpression, failureMessage: failureMessage) + return NMBPredicate { actualExpression in + return try beAnInstanceOf(expected).satisfies(actualExpression).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift index 34fa1b8..d6fd1ee 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift @@ -1,5 +1,6 @@ import Foundation +// swiftlint:disable:next identifier_name public let DefaultDelta = 0.0001 internal func isCloseTo(_ actualValue: NMBDoubleConvertible?, @@ -34,10 +35,12 @@ public func beCloseTo(_ expectedValue: NMBDoubleConvertible, within delta: Doubl } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) public class NMBObjCBeCloseToMatcher: NSObject, NMBMatcher { + // swiftlint:disable identifier_name var _expected: NSNumber var _delta: CDouble + // swiftlint:enable identifier_name init(expected: NSNumber, within: CDouble) { _expected = expected _delta = within @@ -49,7 +52,13 @@ public class NMBObjCBeCloseToMatcher: NSObject, NMBMatcher { }) let expr = Expression(expression: actualBlock, location: location) let matcher = beCloseTo(self._expected, within: self._delta) - return try! matcher.matches(expr, failureMessage: failureMessage) + + do { + return try matcher.matches(expr, failureMessage: failureMessage) + } catch let error { + failureMessage.stringValue = "unexpected error thrown: <\(error)>" + return false + } } @objc public func doesNotMatch(_ actualExpression: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool { @@ -58,7 +67,13 @@ public class NMBObjCBeCloseToMatcher: NSObject, NMBMatcher { }) let expr = Expression(expression: actualBlock, location: location) let matcher = beCloseTo(self._expected, within: self._delta) - return try! matcher.doesNotMatch(expr, failureMessage: failureMessage) + + do { + return try matcher.doesNotMatch(expr, failureMessage: failureMessage) + } catch let error { + failureMessage.stringValue = "unexpected error thrown: <\(error)>" + return false + } } @objc public var within: (CDouble) -> NMBObjCBeCloseToMatcher { @@ -98,14 +113,17 @@ public func beCloseTo(_ expectedValues: [Double], within delta: Double = Default infix operator ≈ : ComparisonPrecedence +// swiftlint:disable:next identifier_name public func ≈(lhs: Expectation<[Double]>, rhs: [Double]) { lhs.to(beCloseTo(rhs)) } +// swiftlint:disable:next identifier_name public func ≈(lhs: Expectation, rhs: NMBDoubleConvertible) { lhs.to(beCloseTo(rhs)) } +// swiftlint:disable:next identifier_name public func ≈(lhs: Expectation, rhs: (expected: NMBDoubleConvertible, delta: Double)) { lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) } @@ -121,6 +139,7 @@ precedencegroup PlusMinusOperatorPrecedence { } infix operator ± : PlusMinusOperatorPrecedence +// swiftlint:disable:next identifier_name public func ±(lhs: NMBDoubleConvertible, rhs: Double) -> (expected: NMBDoubleConvertible, delta: Double) { return (expected: lhs, delta: rhs) } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeEmpty.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeEmpty.swift index 3cbc15d..79bf923 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeEmpty.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeEmpty.swift @@ -13,6 +13,17 @@ public func beEmpty() -> Predicate { } } +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For strings, it is an empty string. +public func beEmpty() -> Predicate { + return Predicate.simple("be empty") { actualExpression in + guard let actual = try actualExpression.evaluate() else { + return .fail + } + return PredicateStatus(bool: actual.isEmpty) + } +} + /// A Nimble matcher that succeeds when a value is "empty". For collections, this /// means the are no items in that collection. For strings, it is an empty string. public func beEmpty() -> Predicate { @@ -61,19 +72,19 @@ public func beEmpty() -> Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func beEmptyMatcher() -> NMBPredicate { return NMBPredicate { actualExpression in let location = actualExpression.location - let actualValue = try! actualExpression.evaluate() + let actualValue = try actualExpression.evaluate() if let value = actualValue as? NMBCollection { let expr = Expression(expression: ({ value as NMBCollection }), location: location) - return try! beEmpty().satisfies(expr).toObjectiveC() + return try beEmpty().satisfies(expr).toObjectiveC() } else if let value = actualValue as? NSString { let expr = Expression(expression: ({ value as String }), location: location) - return try! beEmpty().satisfies(expr).toObjectiveC() + return try beEmpty().satisfies(expr).toObjectiveC() } else if let actualValue = actualValue { // swiftlint:disable:next line_length let badTypeErrorMsg = "be empty (only works for NSArrays, NSSets, NSIndexSets, NSDictionaries, NSHashTables, and NSStrings)" diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift index 8717f97..4a4cdd2 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift @@ -13,13 +13,13 @@ public func beGreaterThan(_ expectedValue: T?) -> Predicate { /// A Nimble matcher that succeeds when the actual value is greater than the expected value. public func beGreaterThan(_ expectedValue: NMBComparable?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be greater than <\(stringify(expectedValue))>" + let errorMessage = "be greater than <\(stringify(expectedValue))>" + return Predicate.simple(errorMessage) { actualExpression in let actualValue = try actualExpression.evaluate() let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) == ComparisonResult.orderedDescending - return matches - }.requireNonNil + return PredicateStatus(bool: matches) + } } public func >(lhs: Expectation, rhs: T) { @@ -30,12 +30,12 @@ public func > (lhs: Expectation, rhs: NMBComparable?) { lhs.to(beGreaterThan(rhs)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } - return try! beGreaterThan(expected).matches(expr, failureMessage: failureMessage) + return try beGreaterThan(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift index 55d8e7b..39d9e63 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift @@ -3,25 +3,25 @@ import Foundation /// A Nimble matcher that succeeds when the actual value is greater than /// or equal to the expected value. public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be greater than or equal to <\(stringify(expectedValue))>" + let message = "be greater than or equal to <\(stringify(expectedValue))>" + return Predicate.simple(message) { actualExpression in let actualValue = try actualExpression.evaluate() if let actual = actualValue, let expected = expectedValue { - return actual >= expected + return PredicateStatus(bool: actual >= expected) } - return false - }.requireNonNil + return .fail + } } /// A Nimble matcher that succeeds when the actual value is greater than /// or equal to the expected value. public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be greater than or equal to <\(stringify(expectedValue))>" + let message = "be greater than or equal to <\(stringify(expectedValue))>" + return Predicate.simple(message) { actualExpression in let actualValue = try actualExpression.evaluate() let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) != ComparisonResult.orderedAscending - return matches - }.requireNonNil + return PredicateStatus(bool: matches) + } } public func >=(lhs: Expectation, rhs: T) { @@ -32,12 +32,12 @@ public func >=(lhs: Expectation, rhs: T) { lhs.to(beGreaterThanOrEqualTo(rhs)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beGreaterThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func beGreaterThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } - return try! beGreaterThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage) + return try beGreaterThanOrEqualTo(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift index ad19def..49e503e 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift @@ -3,20 +3,27 @@ import Foundation /// A Nimble matcher that succeeds when the actual value is the same instance /// as the expected instance. public func beIdenticalTo(_ expected: Any?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - #if os(Linux) + return Predicate.define { actualExpression in + #if os(Linux) && !swift(>=4.1.50) let actual = try actualExpression.evaluate() as? AnyObject #else let actual = try actualExpression.evaluate() as AnyObject? #endif - failureMessage.actualValue = "\(identityAsString(actual))" - failureMessage.postfixMessage = "be identical to \(identityAsString(expected))" - #if os(Linux) - return actual === (expected as? AnyObject) && actual !== nil + + let bool: Bool + #if os(Linux) && !swift(>=4.1.50) + bool = actual === (expected as? AnyObject) && actual !== nil #else - return actual === (expected as AnyObject?) && actual !== nil + bool = actual === (expected as AnyObject?) && actual !== nil #endif - }.requireNonNil + return PredicateResult( + bool: bool, + message: .expectedCustomValueTo( + "be identical to \(identityAsString(expected))", + "\(identityAsString(actual))" + ) + ) + } } public func === (lhs: Expectation, rhs: Any?) { @@ -34,12 +41,12 @@ public func be(_ expected: Any?) -> Predicate { return beIdenticalTo(expected) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beIdenticalToMatcher(_ expected: NSObject?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func beIdenticalToMatcher(_ expected: NSObject?) -> NMBMatcher { + return NMBPredicate { actualExpression in let aExpr = actualExpression.cast { $0 as Any? } - return try! beIdenticalTo(expected).matches(aExpr, failureMessage: failureMessage) + return try beIdenticalTo(expected).satisfies(aExpr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThan.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThan.swift index 8047efd..ef0a7d4 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThan.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThan.swift @@ -2,23 +2,23 @@ import Foundation /// A Nimble matcher that succeeds when the actual value is less than the expected value. public func beLessThan(_ expectedValue: T?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be less than <\(stringify(expectedValue))>" + let message = "be less than <\(stringify(expectedValue))>" + return Predicate.simple(message) { actualExpression in if let actual = try actualExpression.evaluate(), let expected = expectedValue { - return actual < expected + return PredicateStatus(bool: actual < expected) } - return false - }.requireNonNil + return .fail + } } /// A Nimble matcher that succeeds when the actual value is less than the expected value. public func beLessThan(_ expectedValue: NMBComparable?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be less than <\(stringify(expectedValue))>" + let message = "be less than <\(stringify(expectedValue))>" + return Predicate.simple(message) { actualExpression in let actualValue = try actualExpression.evaluate() let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) == ComparisonResult.orderedAscending - return matches - }.requireNonNil + return PredicateStatus(bool: matches) + } } public func <(lhs: Expectation, rhs: T) { @@ -29,12 +29,12 @@ public func < (lhs: Expectation, rhs: NMBComparable?) { lhs.to(beLessThan(rhs)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beLessThanMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func beLessThanMatcher(_ expected: NMBComparable?) -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } - return try! beLessThan(expected).matches(expr, failureMessage: failureMessage) + return try beLessThan(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift index f9e9f4e..30ce043 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift @@ -3,23 +3,22 @@ import Foundation /// A Nimble matcher that succeeds when the actual value is less than /// or equal to the expected value. public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be less than or equal to <\(stringify(expectedValue))>" + return Predicate.simple("be less than or equal to <\(stringify(expectedValue))>") { actualExpression in if let actual = try actualExpression.evaluate(), let expected = expectedValue { - return actual <= expected + return PredicateStatus(bool: actual <= expected) } - return false - }.requireNonNil + return .fail + } } /// A Nimble matcher that succeeds when the actual value is less than /// or equal to the expected value. public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be less than or equal to <\(stringify(expectedValue))>" + return Predicate.simple("be less than or equal to <\(stringify(expectedValue))>") { actualExpression in let actualValue = try actualExpression.evaluate() - return actualValue != nil && actualValue!.NMB_compare(expectedValue) != ComparisonResult.orderedDescending - }.requireNonNil + let matches = actualValue.map { $0.NMB_compare(expectedValue) != .orderedDescending } ?? false + return PredicateStatus(bool: matches) + } } public func <=(lhs: Expectation, rhs: T) { @@ -30,12 +29,12 @@ public func <=(lhs: Expectation, rhs: T) { lhs.to(beLessThanOrEqualTo(rhs)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beLessThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func beLessThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } - return try! beLessThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage) + return try beLessThanOrEqualTo(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLogical.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLogical.swift index 2b18b4c..788234b 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLogical.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLogical.swift @@ -100,14 +100,6 @@ public func beTruthy() -> Predicate< return Predicate.simpleNilable("be truthy") { actualExpression in let actualValue = try actualExpression.evaluate() if let actualValue = actualValue { - // FIXME: This is a workaround to SR-2290. - // See: - // - https://bugs.swift.org/browse/SR-2290 - // - https://github.com/norio-nomura/Nimble/pull/5#issuecomment-237835873 - if let number = actualValue as? NSNumber { - return PredicateStatus(bool: number.boolValue == true) - } - return PredicateStatus(bool: actualValue == (true as T)) } return PredicateStatus(bool: actualValue != nil) @@ -120,47 +112,42 @@ public func beFalsy() -> Predicate NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in + @objc public class func beTruthyMatcher() -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } - return try! beTruthy().matches(expr, failureMessage: failureMessage) + return try beTruthy().satisfies(expr).toObjectiveC() } } - @objc public class func beFalsyMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in + @objc public class func beFalsyMatcher() -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } - return try! beFalsy().matches(expr, failureMessage: failureMessage) + return try beFalsy().satisfies(expr).toObjectiveC() } } - @objc public class func beTrueMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in + @objc public class func beTrueMatcher() -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } - return try! beTrue().matches(expr, failureMessage: failureMessage) + return try beTrue().satisfies(expr).toObjectiveC() } } - @objc public class func beFalseMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } - return try! beFalse().matches(expr, failureMessage: failureMessage) + @objc public class func beFalseMatcher() -> NMBMatcher { + return NMBPredicate { actualExpression in + let expr = actualExpression.cast { value -> Bool? in + guard let value = value else { return nil } + return (value as? NSNumber)?.boolValue ?? false + } + return try beFalse().satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeNil.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeNil.swift index a22e0f4..0f21d41 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeNil.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeNil.swift @@ -8,11 +8,11 @@ public func beNil() -> Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beNilMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in - return try! beNil().matches(actualExpression, failureMessage: failureMessage) + @objc public class func beNilMatcher() -> NMBMatcher { + return NMBPredicate { actualExpression in + return try beNil().satisfies(actualExpression).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeVoid.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeVoid.swift index f5bf22a..9a7eafd 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeVoid.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeVoid.swift @@ -2,17 +2,18 @@ import Foundation /// A Nimble matcher that succeeds when the actual value is Void. public func beVoid() -> Predicate<()> { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be void" + return Predicate.simpleNilable("be void") { actualExpression in let actualValue: ()? = try actualExpression.evaluate() - return actualValue != nil + return PredicateStatus(bool: actualValue != nil) } } -public func == (lhs: Expectation<()>, rhs: ()) { - lhs.to(beVoid()) -} +extension Expectation where T == () { + public static func == (lhs: Expectation<()>, rhs: ()) { + lhs.to(beVoid()) + } -public func != (lhs: Expectation<()>, rhs: ()) { - lhs.toNot(beVoid()) + public static func != (lhs: Expectation<()>, rhs: ()) { + lhs.toNot(beVoid()) + } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeginWith.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeginWith.swift index c2ab568..3183eb9 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeginWith.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeginWith.swift @@ -35,24 +35,24 @@ public func beginWith(_ startingElement: Any) -> Predicate public func beginWith(_ startingSubstring: String) -> Predicate { return Predicate.simple("begin with <\(startingSubstring)>") { actualExpression in if let actual = try actualExpression.evaluate() { - let range = actual.range(of: startingSubstring) - return PredicateStatus(bool: range != nil && range!.lowerBound == actual.startIndex) + return PredicateStatus(bool: actual.hasPrefix(startingSubstring)) } return .fail } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beginWithMatcher(_ expected: Any) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let actual = try! actualExpression.evaluate() - if (actual as? String) != nil { + @objc public class func beginWithMatcher(_ expected: Any) -> NMBMatcher { + return NMBPredicate { actualExpression in + let actual = try actualExpression.evaluate() + if actual is String { let expr = actualExpression.cast { $0 as? String } - return try! beginWith(expected as! String).matches(expr, failureMessage: failureMessage) + // swiftlint:disable:next force_cast + return try beginWith(expected as! String).satisfies(expr).toObjectiveC() } else { let expr = actualExpression.cast { $0 as? NMBOrderedCollection } - return try! beginWith(expected).matches(expr, failureMessage: failureMessage) + return try beginWith(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Contain.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Contain.swift index f1afb72..1d16fb1 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Contain.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Contain.swift @@ -1,22 +1,43 @@ import Foundation -/// A Nimble matcher that succeeds when the actual sequence contains the expected value. +/// A Nimble matcher that succeeds when the actual sequence contains the expected values. public func contain(_ items: T...) -> Predicate - where S.Iterator.Element == T { + where S.Element == T { return contain(items) } +/// A Nimble matcher that succeeds when the actual sequence contains the expected values. public func contain(_ items: [T]) -> Predicate - where S.Iterator.Element == T { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "contain <\(arrayAsString(items))>" + where S.Element == T { + return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in if let actual = try actualExpression.evaluate() { - return items.all { + let matches = items.allSatisfy { return actual.contains($0) } + return PredicateStatus(bool: matches) + } + return .fail + } +} + +/// A Nimble matcher that succeeds when the actual set contains the expected values. +public func contain(_ items: T...) -> Predicate + where S.Element == T { + return contain(items) +} + +/// A Nimble matcher that succeeds when the actual set contains the expected values. +public func contain(_ items: [T]) -> Predicate + where S.Element == T { + return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in + if let actual = try actualExpression.evaluate() { + let matches = items.allSatisfy { + return actual.contains($0) + } + return PredicateStatus(bool: matches) + } + return .fail } - return false - }.requireNonNil } /// A Nimble matcher that succeeds when the actual string contains the expected substring. @@ -25,16 +46,16 @@ public func contain(_ substrings: String...) -> Predicate { } public func contain(_ substrings: [String]) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "contain <\(arrayAsString(substrings))>" + return Predicate.simple("contain <\(arrayAsString(substrings))>") { actualExpression in if let actual = try actualExpression.evaluate() { - return substrings.all { + let matches = substrings.allSatisfy { let range = actual.range(of: $0) return range != nil && !range!.isEmpty } + return PredicateStatus(bool: matches) } - return false - }.requireNonNil + return .fail + } } /// A Nimble matcher that succeeds when the actual string contains the expected substring. @@ -43,13 +64,13 @@ public func contain(_ substrings: NSString...) -> Predicate { } public func contain(_ substrings: [NSString]) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "contain <\(arrayAsString(substrings))>" + return Predicate.simple("contain <\(arrayAsString(substrings))>") { actualExpression in if let actual = try actualExpression.evaluate() { - return substrings.all { actual.range(of: $0.description).length != 0 } + let matches = substrings.allSatisfy { actual.range(of: $0.description).length != 0 } + return PredicateStatus(bool: matches) } - return false - }.requireNonNil + return .fail + } } /// A Nimble matcher that succeeds when the actual collection contains the expected object. @@ -58,37 +79,45 @@ public func contain(_ items: Any?...) -> Predicate { } public func contain(_ items: [Any?]) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "contain <\(arrayAsString(items))>" - guard let actual = try actualExpression.evaluate() else { return false } - return items.all { item in - return item != nil && actual.contains(item!) + return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + let matches = items.allSatisfy { item in + return item.map { actual.contains($0) } ?? false } - }.requireNonNil + return PredicateStatus(bool: matches) + } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func containMatcher(_ expected: [NSObject]) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func containMatcher(_ expected: [NSObject]) -> NMBMatcher { + return NMBPredicate { actualExpression in let location = actualExpression.location - let actualValue = try! actualExpression.evaluate() + let actualValue = try actualExpression.evaluate() if let value = actualValue as? NMBContainer { let expr = Expression(expression: ({ value as NMBContainer }), location: location) // A straightforward cast on the array causes this to crash, so we have to cast the individual items let expectedOptionals: [Any?] = expected.map({ $0 as Any? }) - return try! contain(expectedOptionals).matches(expr, failureMessage: failureMessage) + return try contain(expectedOptionals).satisfies(expr).toObjectiveC() } else if let value = actualValue as? NSString { let expr = Expression(expression: ({ value as String }), location: location) - return try! contain(expected as! [String]).matches(expr, failureMessage: failureMessage) - } else if actualValue != nil { - // swiftlint:disable:next line_length - failureMessage.postfixMessage = "contain <\(arrayAsString(expected))> (only works for NSArrays, NSSets, NSHashTables, and NSStrings)" - } else { - failureMessage.postfixMessage = "contain <\(arrayAsString(expected))>" + // swiftlint:disable:next force_cast + return try contain(expected as! [String]).satisfies(expr).toObjectiveC() } - return false + + let message: ExpectationMessage + if actualValue != nil { + message = ExpectationMessage.expectedActualValueTo( + // swiftlint:disable:next line_length + "contain <\(arrayAsString(expected))> (only works for NSArrays, NSSets, NSHashTables, and NSStrings)" + ) + } else { + message = ExpectationMessage + .expectedActualValueTo("contain <\(arrayAsString(expected))>") + .appendedBeNilHint() + } + return NMBPredicateResult(status: .fail, message: message.toObjectiveC()) } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift index ae0d854..331f3bc 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift @@ -2,43 +2,44 @@ import Foundation public func containElementSatisfying(_ predicate: @escaping ((T) -> Bool), _ predicateDescription: String = "") -> Predicate where S.Iterator.Element == T { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.actualValue = nil - + return Predicate.define { actualExpression in + let message: ExpectationMessage if predicateDescription == "" { - failureMessage.postfixMessage = "find object in collection that satisfies predicate" + message = .expectedTo("find object in collection that satisfies predicate") } else { - failureMessage.postfixMessage = "find object in collection \(predicateDescription)" + message = .expectedTo("find object in collection \(predicateDescription)") } if let sequence = try actualExpression.evaluate() { for object in sequence { if predicate(object) { - return true + return PredicateResult(bool: true, message: message) } } - return false + return PredicateResult(bool: false, message: message) } - return false - }.requireNonNil + return PredicateResult(status: .fail, message: message) + } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func containElementSatisfyingMatcher(_ predicate: @escaping ((NSObject) -> Bool)) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let value = try! actualExpression.evaluate() + @objc public class func containElementSatisfyingMatcher(_ predicate: @escaping ((NSObject) -> Bool)) -> NMBMatcher { + return NMBPredicate { actualExpression in + let value = try actualExpression.evaluate() guard let enumeration = value as? NSFastEnumeration else { - // swiftlint:disable:next line_length - failureMessage.postfixMessage = "containElementSatisfying must be provided an NSFastEnumeration object" - failureMessage.actualValue = nil - failureMessage.expected = "" - failureMessage.to = "" - return false + let message = ExpectationMessage.fail( + "containElementSatisfying must be provided an NSFastEnumeration object" + ) + return NMBPredicateResult(status: .fail, message: message.toObjectiveC()) } + let message = ExpectationMessage + .expectedTo("find object in collection that satisfies predicate") + .toObjectiveC() + var iterator = NSFastEnumerationIterator(enumeration) while let item = iterator.next() { guard let object = item as? NSObject else { @@ -46,14 +47,11 @@ public func containElementSatisfying(_ predicate: @escaping ((T) } if predicate(object) { - return true + return NMBPredicateResult(status: .matches, message: message) } } - failureMessage.actualValue = nil - failureMessage.postfixMessage = "" - failureMessage.to = "to find object in collection that satisfies predicate" - return false + return NMBPredicateResult(status: .doesNotMatch, message: message) } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ElementsEqual.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ElementsEqual.swift new file mode 100644 index 0000000..1704e94 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ElementsEqual.swift @@ -0,0 +1,16 @@ +/// A Nimble matcher that succeeds when the actual sequence contain the same elements in the same order to the exepected sequence. +public func elementsEqual(_ expectedValue: S?) -> Predicate where S.Element: Equatable { + // A matcher abstraction for https://developer.apple.com/documentation/swift/sequence/2949668-elementsequal + return Predicate.define("elementsEqual <\(stringify(expectedValue))>") { (actualExpression, msg) in + let actualValue = try actualExpression.evaluate() + switch (expectedValue, actualValue) { + case (nil, _?): + return PredicateResult(status: .fail, message: msg.appendedBeNilHint()) + case (nil, nil), (_, nil): + return PredicateResult(status: .fail, message: msg) + case (let expected?, let actual?): + let matches = expected.elementsEqual(actual) + return PredicateResult(bool: matches, message: msg) + } + } +} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/EndWith.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/EndWith.swift index a6f9f91..13bdb31 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/EndWith.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/EndWith.swift @@ -4,9 +4,7 @@ import Foundation /// is equal to the expected value. public func endWith(_ endingElement: T) -> Predicate where S.Iterator.Element == T { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "end with <\(endingElement)>" - + return Predicate.simple("end with <\(endingElement)>") { actualExpression in if let actualValue = try actualExpression.evaluate() { var actualGenerator = actualValue.makeIterator() var lastItem: T? @@ -16,55 +14,54 @@ public func endWith(_ endingElement: T) -> Predicate< item = actualGenerator.next() } while(item != nil) - return lastItem == endingElement + return PredicateStatus(bool: lastItem == endingElement) } - return false - }.requireNonNil + return .fail + } } /// A Nimble matcher that succeeds when the actual collection's last element /// is equal to the expected object. public func endWith(_ endingElement: Any) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "end with <\(endingElement)>" - guard let collection = try actualExpression.evaluate() else { return false } - guard collection.count > 0 else { return false } + return Predicate.simple("end with <\(endingElement)>") { actualExpression in + guard let collection = try actualExpression.evaluate() else { return .fail } + guard collection.count > 0 else { return PredicateStatus(bool: false) } #if os(Linux) guard let collectionValue = collection.object(at: collection.count - 1) as? NSObject else { - return false + return .fail } #else let collectionValue = collection.object(at: collection.count - 1) as AnyObject #endif - return collectionValue.isEqual(endingElement) - }.requireNonNil + return PredicateStatus(bool: collectionValue.isEqual(endingElement)) + } } /// A Nimble matcher that succeeds when the actual string contains the expected substring /// where the expected substring's location is the actual string's length minus the /// expected substring's length. public func endWith(_ endingSubstring: String) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "end with <\(endingSubstring)>" + return Predicate.simple("end with <\(endingSubstring)>") { actualExpression in if let collection = try actualExpression.evaluate() { - return collection.hasSuffix(endingSubstring) + return PredicateStatus(bool: collection.hasSuffix(endingSubstring)) } - return false - }.requireNonNil + return .fail + } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func endWithMatcher(_ expected: Any) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let actual = try! actualExpression.evaluate() - if (actual as? String) != nil { + @objc public class func endWithMatcher(_ expected: Any) -> NMBMatcher { + return NMBPredicate { actualExpression in + let actual = try actualExpression.evaluate() + if actual is String { let expr = actualExpression.cast { $0 as? String } - return try! endWith(expected as! String).matches(expr, failureMessage: failureMessage) + // swiftlint:disable:next force_cast + return try endWith(expected as! String).satisfies(expr).toObjectiveC() } else { let expr = actualExpression.cast { $0 as? NMBOrderedCollection } - return try! endWith(expected).matches(expr, failureMessage: failureMessage) + return try endWith(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Equal.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Equal.swift index 9467154..b08d5f6 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Equal.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Equal.swift @@ -7,103 +7,30 @@ import Foundation public func equal(_ expectedValue: T?) -> Predicate { return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in let actualValue = try actualExpression.evaluate() - let matches = actualValue == expectedValue && expectedValue != nil - if expectedValue == nil || actualValue == nil { - if expectedValue == nil && actualValue != nil { - return PredicateResult( - status: .fail, - message: msg.appendedBeNilHint() - ) - } + switch (expectedValue, actualValue) { + case (nil, _?): + return PredicateResult(status: .fail, message: msg.appendedBeNilHint()) + case (nil, nil), (_, nil): return PredicateResult(status: .fail, message: msg) + case (let expected?, let actual?): + let matches = expected == actual + return PredicateResult(bool: matches, message: msg) } - return PredicateResult(status: PredicateStatus(bool: matches), message: msg) - } -} - -/// A Nimble matcher that succeeds when the actual value is equal to the expected value. -/// 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]?) -> Predicate<[T: C]> { - return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in - let actualValue = try actualExpression.evaluate() - if expectedValue == nil || actualValue == nil { - if expectedValue == nil && actualValue != nil { - return PredicateResult( - status: .fail, - message: msg.appendedBeNilHint() - ) - } - return PredicateResult(status: .fail, message: msg) - } - return PredicateResult( - status: PredicateStatus(bool: expectedValue! == actualValue!), - message: msg - ) - } -} - -/// A Nimble matcher that succeeds when the actual collection is equal to the expected collection. -/// Items must implement the Equatable protocol. -public func equal(_ expectedValue: [T]?) -> Predicate<[T]> { - return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in - let actualValue = try actualExpression.evaluate() - if expectedValue == nil || actualValue == nil { - if expectedValue == nil && actualValue != nil { - return PredicateResult( - status: .fail, - message: msg.appendedBeNilHint() - ) - } - return PredicateResult( - status: .fail, - message: msg - ) - } - return PredicateResult( - bool: expectedValue! == actualValue!, - message: msg - ) } } /// A Nimble matcher allowing comparison of collection with optional type public func equal(_ expectedValue: [T?]) -> Predicate<[T?]> { return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in - if let actualValue = try actualExpression.evaluate() { - let doesNotMatch = PredicateResult( - status: .doesNotMatch, - message: msg - ) - - if expectedValue.count != actualValue.count { - return doesNotMatch - } - - for (index, item) in actualValue.enumerated() { - let otherItem = expectedValue[index] - if item == nil && otherItem == nil { - continue - } else if item == nil && otherItem != nil { - return doesNotMatch - } else if item != nil && otherItem == nil { - return doesNotMatch - } else if item! != otherItem! { - return doesNotMatch - } - } - - return PredicateResult( - status: .matches, - message: msg - ) - } else { + guard let actualValue = try actualExpression.evaluate() else { return PredicateResult( status: .fail, message: msg.appendedBeNilHint() ) } + + let matches = expectedValue == actualValue + return PredicateResult(bool: matches, message: msg) } } @@ -128,44 +55,45 @@ private func equal(_ expectedValue: Set?, stringify: @escaping (Set?) - var errorMessage: ExpectationMessage = .expectedActualValueTo("equal <\(stringify(expectedValue))>") - if let expectedValue = expectedValue { - if let actualValue = try actualExpression.evaluate() { - errorMessage = .expectedCustomValueTo( - "equal <\(stringify(expectedValue))>", - "<\(stringify(actualValue))>" - ) - - if expectedValue == actualValue { - return PredicateResult( - status: .matches, - message: errorMessage - ) - } - - let missing = expectedValue.subtracting(actualValue) - if missing.count > 0 { - errorMessage = errorMessage.appended(message: ", missing <\(stringify(missing))>") - } - - let extra = actualValue.subtracting(expectedValue) - if extra.count > 0 { - errorMessage = errorMessage.appended(message: ", extra <\(stringify(extra))>") - } - return PredicateResult( - status: .doesNotMatch, - message: errorMessage - ) - } - return PredicateResult( - status: .fail, - message: errorMessage.appendedBeNilHint() - ) - } else { + guard let expectedValue = expectedValue else { return PredicateResult( status: .fail, message: errorMessage.appendedBeNilHint() ) } + + guard let actualValue = try actualExpression.evaluate() else { + return PredicateResult( + status: .fail, + message: errorMessage.appendedBeNilHint() + ) + } + + errorMessage = .expectedCustomValueTo( + "equal <\(stringify(expectedValue))>", + "<\(stringify(actualValue))>" + ) + + if expectedValue == actualValue { + return PredicateResult( + status: .matches, + message: errorMessage + ) + } + + let missing = expectedValue.subtracting(actualValue) + if missing.count > 0 { + errorMessage = errorMessage.appended(message: ", missing <\(stringify(missing))>") + } + + let extra = actualValue.subtracting(expectedValue) + if extra.count > 0 { + errorMessage = errorMessage.appended(message: ", extra <\(stringify(extra))>") + } + return PredicateResult( + status: .doesNotMatch, + message: errorMessage + ) } } @@ -209,11 +137,11 @@ public func !=(lhs: Expectation<[T: C]>, rhs: [T: C]?) { lhs.toNot(equal(rhs)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func equalMatcher(_ expected: NSObject) -> NMBMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - return try! equal(expected).matches(actualExpression, failureMessage: failureMessage) + return NMBPredicate { actualExpression in + return try equal(expected).satisfies(actualExpression).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/HaveCount.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/HaveCount.swift index 93335a8..984e2d4 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/HaveCount.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/HaveCount.swift @@ -7,52 +7,67 @@ import Foundation /// A Nimble matcher that succeeds when the actual Collection's count equals /// the expected value -public func haveCount(_ expectedValue: T.IndexDistance) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in +public func haveCount(_ expectedValue: Int) -> Predicate { + return Predicate.define { actualExpression in if let actualValue = try actualExpression.evaluate() { - // swiftlint:disable:next line_length - failureMessage.postfixMessage = "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))" + let message = ExpectationMessage + .expectedCustomValueTo( + "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))", + "\(actualValue.count)" + ) + .appended(details: "Actual Value: \(stringify(actualValue))") + let result = expectedValue == actualValue.count - failureMessage.actualValue = "\(actualValue.count)" - failureMessage.extendedMessage = "Actual Value: \(stringify(actualValue))" - return result + return PredicateResult(bool: result, message: message) } else { - return false + return PredicateResult(status: .fail, message: .fail("")) } - }.requireNonNil + } } /// A Nimble matcher that succeeds when the actual collection's count equals /// the expected value public func haveCount(_ expectedValue: Int) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in + return Predicate { actualExpression in if let actualValue = try actualExpression.evaluate() { - // swiftlint:disable:next line_length - failureMessage.postfixMessage = "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))" + let message = ExpectationMessage + .expectedCustomValueTo( + "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))", + "\(actualValue.count)" + ) + .appended(details: "Actual Value: \(stringify(actualValue))") + let result = expectedValue == actualValue.count - failureMessage.actualValue = "\(actualValue.count)" - failureMessage.extendedMessage = "Actual Value: \(stringify(actualValue))" - return result + return PredicateResult(bool: result, message: message) } else { - return false + return PredicateResult(status: .fail, message: .fail("")) } } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func haveCountMatcher(_ expected: NSNumber) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func haveCountMatcher(_ expected: NSNumber) -> NMBMatcher { + return NMBPredicate { actualExpression in let location = actualExpression.location - let actualValue = try! actualExpression.evaluate() + let actualValue = try actualExpression.evaluate() if let value = actualValue as? NMBCollection { let expr = Expression(expression: ({ value as NMBCollection}), location: location) - return try! haveCount(expected.intValue).matches(expr, failureMessage: failureMessage) - } else if let actualValue = actualValue { - failureMessage.postfixMessage = "get type of NSArray, NSSet, NSDictionary, or NSHashTable" - failureMessage.actualValue = "\(String(describing: type(of: actualValue)))" + return try haveCount(expected.intValue).satisfies(expr).toObjectiveC() } - return false + + let message: ExpectationMessage + if let actualValue = actualValue { + message = ExpectationMessage.expectedCustomValueTo( + "get type of NSArray, NSSet, NSDictionary, or NSHashTable", + "\(String(describing: type(of: actualValue)))" + ) + } else { + message = ExpectationMessage + .expectedActualValueTo("have a collection with count \(stringify(expected.intValue))") + .appendedBeNilHint() + } + return NMBPredicateResult(status: .fail, message: message.toObjectiveC()) } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Match.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Match.swift index 1e5762f..dbcff09 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Match.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Match.swift @@ -3,26 +3,25 @@ import Foundation /// A Nimble matcher that succeeds when the actual string satisfies the regular expression /// described by the expected string. public func match(_ expectedValue: String?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "match <\(stringify(expectedValue))>" - + return Predicate.simple("match <\(stringify(expectedValue))>") { actualExpression in if let actual = try actualExpression.evaluate() { if let regexp = expectedValue { - return actual.range(of: regexp, options: .regularExpression) != nil + let bool = actual.range(of: regexp, options: .regularExpression) != nil + return PredicateStatus(bool: bool) } } - return false - }.requireNonNil + return .fail + } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func matchMatcher(_ expected: NSString) -> NMBMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + return NMBPredicate { actualExpression in let actual = actualExpression.cast { $0 as? String } - return try! match(expected.description).matches(actual, failureMessage: failureMessage) + return try match(expected.description).satisfies(actual).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/MatchError.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/MatchError.swift index 9c86fb7..4ad71d4 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/MatchError.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/MatchError.swift @@ -6,16 +6,24 @@ import Foundation /// Errors are tried to be compared by their implementation of Equatable, /// otherwise they fallback to comparison by _domain and _code. public func matchError(_ error: T) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - let actualError: Error? = try actualExpression.evaluate() + return Predicate.define { actualExpression in + let actualError = try actualExpression.evaluate() + + let failureMessage = FailureMessage() + setFailureMessageForError( + failureMessage, + postfixMessageVerb: "match", + actualError: actualError, + error: error + ) - setFailureMessageForError(failureMessage, postfixMessageVerb: "match", actualError: actualError, error: error) var matches = false if let actualError = actualError, errorMatchesExpectedError(actualError, expectedError: error) { matches = true } - return matches - }.requireNonNil + + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + } } /// A Nimble matcher that succeeds when the actual expression evaluates to an @@ -24,35 +32,45 @@ public func matchError(_ error: T) -> Predicate { /// Errors are tried to be compared by their implementation of Equatable, /// otherwise they fallback to comparision by _domain and _code. public func matchError(_ error: T) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - let actualError: Error? = try actualExpression.evaluate() + return Predicate.define { actualExpression in + let actualError = try actualExpression.evaluate() - setFailureMessageForError(failureMessage, postfixMessageVerb: "match", actualError: actualError, error: error) + let failureMessage = FailureMessage() + setFailureMessageForError( + failureMessage, + postfixMessageVerb: "match", + actualError: actualError, + error: error + ) var matches = false if let actualError = actualError as? T, error == actualError { matches = true } - return matches - }.requireNonNil + + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + } } /// A Nimble matcher that succeeds when the actual expression evaluates to an /// error of the specified type public func matchError(_ errorType: T.Type) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - let actualError: Error? = try actualExpression.evaluate() + return Predicate.define { actualExpression in + let actualError = try actualExpression.evaluate() + let failureMessage = FailureMessage() setFailureMessageForError( failureMessage, postfixMessageVerb: "match", actualError: actualError, errorType: errorType ) + var matches = false if actualError as? T != nil { matches = true } - return matches - }.requireNonNil + + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift index 6f8f103..38bb297 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift @@ -1,6 +1,6 @@ import Foundation // `CGFloat` is in Foundation (swift-corelibs-foundation) on Linux. -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) import CoreGraphics #endif @@ -28,7 +28,7 @@ extension Matcher { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) /// Objective-C interface to the Swift variant of Matcher. @objc public protocol NMBMatcher { func matches(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool @@ -41,7 +41,8 @@ public protocol NMBContainer { func contains(_ anObject: Any) -> Bool } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) +// swiftlint:disable:next todo // FIXME: NSHashTable can not conform to NMBContainer since swift-DEVELOPMENT-SNAPSHOT-2016-04-25-a //extension NSHashTable : NMBContainer {} // Corelibs Foundation does not include this class yet #endif @@ -54,7 +55,7 @@ public protocol NMBCollection { var count: Int { get } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NSHashTable: NMBCollection {} // Corelibs Foundation does not include these classes yet extension NSMapTable: NMBCollection {} #endif @@ -131,7 +132,7 @@ extension NSDate: TestOutputStringConvertible { /// beGreaterThan(), beGreaterThanOrEqualTo(), and equal() matchers. /// /// Types that conform to Swift's Comparable protocol will work implicitly too -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) @objc public protocol NMBComparable { func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult } @@ -144,11 +145,13 @@ public protocol NMBComparable { extension NSNumber: NMBComparable { public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult { + // swiftlint:disable:next force_cast return compare(otherObject as! NSNumber) } } extension NSString: NMBComparable { public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult { + // swiftlint:disable:next force_cast return compare(otherObject as! String) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/PostNotification.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/PostNotification.swift index ee886f1..7d3e44c 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/PostNotification.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/PostNotification.swift @@ -1,36 +1,9 @@ import Foundation -// A workaround to SR-6419. -extension NotificationCenter { -#if !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) - #if swift(>=4.0) - #if swift(>=4.0.2) - #else - func addObserver(forName name: Notification.Name?, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Void) -> NSObjectProtocol { - return addObserver(forName: name, object: obj, queue: queue, usingBlock: block) - } - #endif - #elseif swift(>=3.2) - #if swift(>=3.2.2) - #else - // swiftlint:disable:next line_length - func addObserver(forName name: Notification.Name?, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Void) -> NSObjectProtocol { - return addObserver(forName: name, object: obj, queue: queue, usingBlock: block) - } - #endif - #else - // swiftlint:disable:next line_length - func addObserver(forName name: Notification.Name?, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Void) -> NSObjectProtocol { - return addObserver(forName: name, object: obj, queue: queue, usingBlock: block) - } - #endif -#endif -} - internal class NotificationCollector { private(set) var observedNotifications: [Notification] private let notificationCenter: NotificationCenter - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) private var token: AnyObject? #else private var token: NSObjectProtocol? @@ -43,14 +16,14 @@ internal class NotificationCollector { func startObserving() { // swiftlint:disable:next line_length - self.token = self.notificationCenter.addObserver(forName: nil, object: nil, queue: nil, using: { [weak self] n in + self.token = self.notificationCenter.addObserver(forName: nil, object: nil, queue: nil) { [weak self] notification in // linux-swift gets confused by .append(n) - self?.observedNotifications.append(n) - }) + self?.observedNotifications.append(notification) + } } deinit { - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) if let token = self.token { self.notificationCenter.removeObserver(token) } @@ -74,7 +47,8 @@ public func postNotifications( let collector = NotificationCollector(notificationCenter: center) collector.startObserving() var once: Bool = false - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in + + return Predicate { actualExpression in let collectorNotificationsExpression = Expression(memoizedExpression: { _ in return collector.observedNotifications }, location: actualExpression.location, withoutCaching: true) @@ -85,12 +59,13 @@ public func postNotifications( _ = try actualExpression.evaluate() } + let failureMessage = FailureMessage() let match = try notificationsMatcher.matches(collectorNotificationsExpression, failureMessage: failureMessage) if collector.observedNotifications.isEmpty { failureMessage.actualValue = "no notifications" } else { failureMessage.actualValue = "<\(stringify(collector.observedNotifications))>" } - return match + return PredicateResult(bool: match, message: failureMessage.toExpectationMessage()) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Predicate.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Predicate.swift index f812344..2604411 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Predicate.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Predicate.swift @@ -218,6 +218,7 @@ extension Predicate: Matcher { extension Predicate { // Someday, make this public? Needs documentation internal func after(f: @escaping (Expression, PredicateResult) throws -> PredicateResult) -> Predicate { + // swiftlint:disable:previous identifier_name return Predicate { actual -> PredicateResult in let result = try self.satisfies(actual) return try f(actual, result) @@ -241,8 +242,8 @@ extension Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) -public typealias PredicateBlock = (_ actualExpression: Expression) -> NMBPredicateResult +#if canImport(Darwin) +public typealias PredicateBlock = (_ actualExpression: Expression) throws -> NMBPredicateResult public class NMBPredicate: NSObject { private let predicate: PredicateBlock @@ -251,9 +252,13 @@ public class NMBPredicate: NSObject { self.predicate = predicate } - func satisfies(_ expression: @escaping () -> NSObject?, location: SourceLocation) -> NMBPredicateResult { + func satisfies(_ expression: @escaping () throws -> NSObject?, location: SourceLocation) -> NMBPredicateResult { let expr = Expression(expression: expression, location: location) - return self.predicate(expr) + do { + return try self.predicate(expr) + } catch let error { + return PredicateResult(status: .fail, message: .fail("unexpected error thrown: <\(error)>")).toObjectiveC() + } } } @@ -307,7 +312,7 @@ final public class NMBPredicateStatus: NSObject { public static let doesNotMatch: NMBPredicateStatus = NMBPredicateStatus(status: 1) public static let fail: NMBPredicateStatus = NMBPredicateStatus(status: 2) - public override var hashValue: Int { return self.status.hashValue } + public override var hash: Int { return self.status.hashValue } public override func isEqual(_ object: Any?) -> Bool { guard let otherPredicate = object as? NMBPredicateStatus else { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/RaisesException.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/RaisesException.swift index 3e7f2df..f44c810 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/RaisesException.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/RaisesException.swift @@ -1,7 +1,7 @@ import Foundation // This matcher requires the Objective-C, and being built by Xcode rather than the Swift Package Manager -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE /// A Nimble matcher that succeeds when the actual expression raises an /// exception with the specified name, reason, and/or userInfo. @@ -17,18 +17,21 @@ public func raiseException( reason: String? = nil, userInfo: NSDictionary? = nil, closure: ((NSException) -> Void)? = nil) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - + return Predicate { actualExpression in var exception: NSException? let capture = NMBExceptionCapture(handler: ({ e in exception = e }), finally: nil) - capture.tryBlock { - _ = try! actualExpression.evaluate() - return + do { + try capture.tryBlockThrows { + _ = try actualExpression.evaluate() + } + } catch { + return PredicateResult(status: .fail, message: .fail("unexpected error thrown: <\(error)>")) } + let failureMessage = FailureMessage() setFailureMessageForException( failureMessage, exception: exception, @@ -37,13 +40,15 @@ public func raiseException( userInfo: userInfo, closure: closure ) - return exceptionMatchesNonNilFieldsOrClosure( + + let matches = exceptionMatchesNonNilFieldsOrClosure( exception, named: named, reason: reason, userInfo: userInfo, closure: closure ) + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) } } @@ -117,10 +122,12 @@ internal func exceptionMatchesNonNilFieldsOrClosure( } public class NMBObjCRaiseExceptionMatcher: NSObject, NMBMatcher { + // swiftlint:disable identifier_name internal var _name: String? internal var _reason: String? internal var _userInfo: NSDictionary? internal var _block: ((NSException) -> Void)? + // swiftlint:enable identifier_name internal init(name: String?, reason: String?, userInfo: NSDictionary?, block: ((NSException) -> Void)?) { _name = name @@ -133,12 +140,17 @@ public class NMBObjCRaiseExceptionMatcher: NSObject, NMBMatcher { let block: () -> Any? = ({ _ = actualBlock(); return nil }) let expr = Expression(expression: block, location: location) - return try! raiseException( - named: _name, - reason: _reason, - userInfo: _userInfo, - closure: _block - ).matches(expr, failureMessage: failureMessage) + do { + return try raiseException( + named: _name, + reason: _reason, + userInfo: _userInfo, + closure: _block + ).matches(expr, failureMessage: failureMessage) + } catch let error { + failureMessage.stringValue = "unexpected error thrown: <\(error)>" + return false + } } @objc public func doesNotMatch(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift index 6c63a15..da3ea9a 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift @@ -4,33 +4,11 @@ import Foundation /// provided in the variable list of matchers. public func satisfyAllOf(_ matchers: U...) -> Predicate where U: Matcher, U.ValueType == T { - return satisfyAllOf(matchers) -} - -/// Deprecated. Please use `satisfyAnyOf(_) -> Predicate` instead. -internal func satisfyAllOf(_ matchers: [U]) -> Predicate - where U: Matcher, U.ValueType == T { - return NonNilMatcherFunc { actualExpression, failureMessage in - let postfixMessages = NSMutableArray() - var matches = true - for matcher in matchers { - if try matcher.doesNotMatch(actualExpression, failureMessage: failureMessage) { - matches = false - } - postfixMessages.add(NSString(string: "{\(failureMessage.postfixMessage)}")) - } - - failureMessage.postfixMessage = "match all of: " + postfixMessages.componentsJoined(by: ", and ") - if let actualValue = try actualExpression.evaluate() { - failureMessage.actualValue = "\(actualValue)" - } - - return matches - }.predicate + return satisfyAllOf(matchers.map { $0.predicate }) } internal func satisfyAllOf(_ predicates: [Predicate]) -> Predicate { - return Predicate { actualExpression in + return Predicate.define { actualExpression in var postfixMessages = [String]() var matches = true for predicate in predicates { @@ -53,18 +31,15 @@ internal func satisfyAllOf(_ predicates: [Predicate]) -> Predicate { ) } - return PredicateResult( - bool: matches, - message: msg - ) - }.requireNonNil + return PredicateResult(bool: matches, message: msg) + } } public func && (left: Predicate, right: Predicate) -> Predicate { return satisfyAllOf(left, right) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func satisfyAllOfMatcher(_ matchers: [NMBMatcher]) -> NMBPredicate { return NMBPredicate { actualExpression in @@ -82,11 +57,15 @@ extension NMBObjCMatcher { let elementEvaluator = Predicate { expression in if let predicate = matcher as? NMBPredicate { // swiftlint:disable:next line_length - return predicate.satisfies({ try! expression.evaluate() }, location: actualExpression.location).toSwift() + return predicate.satisfies({ try expression.evaluate() }, location: actualExpression.location).toSwift() } else { let failureMessage = FailureMessage() - // swiftlint:disable:next line_length - let success = matcher.matches({ try! expression.evaluate() }, failureMessage: failureMessage, location: actualExpression.location) + let success = matcher.matches( + // swiftlint:disable:next force_try + { try! expression.evaluate() }, + failureMessage: failureMessage, + location: actualExpression.location + ) return PredicateResult(bool: success, message: failureMessage.toExpectationMessage()) } } @@ -94,7 +73,7 @@ extension NMBObjCMatcher { elementEvaluators.append(elementEvaluator) } - return try! satisfyAllOf(elementEvaluators).satisfies(actualExpression).toObjectiveC() + return try satisfyAllOf(elementEvaluators).satisfies(actualExpression).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift index d02a0ff..6724956 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift @@ -4,33 +4,11 @@ import Foundation /// provided in the variable list of matchers. public func satisfyAnyOf(_ matchers: U...) -> Predicate where U: Matcher, U.ValueType == T { - return satisfyAnyOf(matchers) -} - -/// Deprecated. Please use `satisfyAnyOf(_) -> Predicate` instead. -internal func satisfyAnyOf(_ matchers: [U]) -> Predicate - where U: Matcher, U.ValueType == T { - return NonNilMatcherFunc { actualExpression, failureMessage in - let postfixMessages = NSMutableArray() - var matches = false - for matcher in matchers { - if try matcher.matches(actualExpression, failureMessage: failureMessage) { - matches = true - } - postfixMessages.add(NSString(string: "{\(failureMessage.postfixMessage)}")) - } - - failureMessage.postfixMessage = "match one of: " + postfixMessages.componentsJoined(by: ", or ") - if let actualValue = try actualExpression.evaluate() { - failureMessage.actualValue = "\(actualValue)" - } - - return matches - }.predicate + return satisfyAnyOf(matchers.map { $0.predicate }) } internal func satisfyAnyOf(_ predicates: [Predicate]) -> Predicate { - return Predicate { actualExpression in + return Predicate.define { actualExpression in var postfixMessages = [String]() var matches = false for predicate in predicates { @@ -53,11 +31,8 @@ internal func satisfyAnyOf(_ predicates: [Predicate]) -> Predicate { ) } - return PredicateResult( - status: PredicateStatus(bool: matches), - message: msg - ) - }.requireNonNil + return PredicateResult(bool: matches, message: msg) + } } public func || (left: Predicate, right: Predicate) -> Predicate { @@ -72,7 +47,7 @@ public func || (left: MatcherFunc, right: MatcherFunc) -> Predicate return satisfyAnyOf(left, right) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func satisfyAnyOfMatcher(_ matchers: [NMBMatcher]) -> NMBPredicate { return NMBPredicate { actualExpression in @@ -90,11 +65,15 @@ extension NMBObjCMatcher { let elementEvaluator = Predicate { expression in if let predicate = matcher as? NMBPredicate { // swiftlint:disable:next line_length - return predicate.satisfies({ try! expression.evaluate() }, location: actualExpression.location).toSwift() + return predicate.satisfies({ try expression.evaluate() }, location: actualExpression.location).toSwift() } else { let failureMessage = FailureMessage() - // swiftlint:disable:next line_length - let success = matcher.matches({ try! expression.evaluate() }, failureMessage: failureMessage, location: actualExpression.location) + let success = matcher.matches( + // swiftlint:disable:next force_try + { try! expression.evaluate() }, + failureMessage: failureMessage, + location: actualExpression.location + ) return PredicateResult(bool: success, message: failureMessage.toExpectationMessage()) } } @@ -102,7 +81,7 @@ extension NMBObjCMatcher { elementEvaluators.append(elementEvaluator) } - return try! satisfyAnyOf(elementEvaluators).satisfies(actualExpression).toObjectiveC() + return try satisfyAnyOf(elementEvaluators).satisfies(actualExpression).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift index a530c60..53d9191 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift @@ -1,13 +1,11 @@ import Foundation public func throwAssertion() -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - #if arch(x86_64) && (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE - failureMessage.postfixMessage = "throw an assertion" - failureMessage.actualValue = nil - - var succeeded = true + return Predicate { actualExpression in + #if arch(x86_64) && canImport(Darwin) && !SWIFT_PACKAGE + let message = ExpectationMessage.expectedTo("throw an assertion") + var actualError: Error? let caughtException: BadInstructionException? = catchBadInstruction { #if os(tvOS) if !NimbleEnvironment.activeInstance.suppressTVOSAssertionWarning { @@ -27,30 +25,27 @@ public func throwAssertion() -> Predicate { #endif do { try actualExpression.evaluate() - } catch let error { - succeeded = false - failureMessage.postfixMessage += "; threw error instead <\(error)>" + } catch { + actualError = error } } - if !succeeded { - return false + if let actualError = actualError { + return PredicateResult( + bool: false, + message: message.appended(message: "; threw error instead <\(actualError)>") + ) + } else { + return PredicateResult(bool: caughtException != nil, message: message) } - - if caughtException == nil { - return false - } - - return true #elseif SWIFT_PACKAGE fatalError("The throwAssertion Nimble matcher does not currently support Swift CLI." + " You can silence this error by placing the test case inside an #if !SWIFT_PACKAGE" + " conditional statement") #else fatalError("The throwAssertion Nimble matcher can only run on x86_64 platforms with " + - "Objective-C (e.g. Mac, iPhone 5s or later simulators). You can silence this error " + - "by placing the test case inside an #if arch(x86_64) or (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) conditional statement") - // swiftlint:disable:previous line_length + "Objective-C (e.g. macOS, iPhone 5s or later simulators). You can silence this error " + + "by placing the test case inside an #if arch(x86_64) or canImport(Darwin) conditional statement") #endif } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ThrowError.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ThrowError.swift index 872ca5c..d294ba3 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ThrowError.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ThrowError.swift @@ -12,22 +12,19 @@ import Foundation /// nil arguments indicates that the matcher should not attempt to match against /// that parameter. public func throwError() -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - + return Predicate { actualExpression in var actualError: Error? do { _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError + } catch { + actualError = error } - failureMessage.postfixMessage = "throw any error" if let actualError = actualError { - failureMessage.actualValue = "<\(actualError)>" + return PredicateResult(bool: true, message: .expectedCustomValueTo("throw any error", "<\(actualError)>")) } else { - failureMessage.actualValue = "no error" + return PredicateResult(bool: false, message: .expectedCustomValueTo("throw any error", "no error")) } - return actualError != nil } } @@ -43,15 +40,15 @@ public func throwError() -> Predicate { /// nil arguments indicates that the matcher should not attempt to match against /// that parameter. public func throwError(_ error: T, closure: ((Error) -> Void)? = nil) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - + return Predicate { actualExpression in var actualError: Error? do { _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError + } catch { + actualError = error } + let failureMessage = FailureMessage() setFailureMessageForError( failureMessage, actualError: actualError, @@ -59,20 +56,23 @@ public func throwError(_ error: T, closure: ((Error) -> Void)? = nil) errorType: nil, closure: closure ) + var matches = false if let actualError = actualError, errorMatchesExpectedError(actualError, expectedError: error) { matches = true + if let closure = closure { let assertions = gatherFailingExpectations { closure(actualError) } let messages = assertions.map { $0.message } - if messages.count > 0 { + if !messages.isEmpty { matches = false } } } - return matches + + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) } } @@ -88,15 +88,15 @@ public func throwError(_ error: T, closure: ((Error) -> Void)? = nil) /// nil arguments indicates that the matcher should not attempt to match against /// that parameter. public func throwError(_ error: T, closure: ((T) -> Void)? = nil) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - + return Predicate { actualExpression in var actualError: Error? do { _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError + } catch { + actualError = error } + let failureMessage = FailureMessage() setFailureMessageForError( failureMessage, actualError: actualError, @@ -104,6 +104,7 @@ public func throwError(_ error: T, closure: ((T) -> Void)? errorType: nil, closure: closure ) + var matches = false if let actualError = actualError as? T, error == actualError { matches = true @@ -113,12 +114,13 @@ public func throwError(_ error: T, closure: ((T) -> Void)? closure(actualError) } let messages = assertions.map { $0.message } - if messages.count > 0 { + if !messages.isEmpty { matches = false } } } - return matches + + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) } } @@ -136,15 +138,15 @@ public func throwError(_ error: T, closure: ((T) -> Void)? public func throwError( errorType: T.Type, closure: ((T) -> Void)? = nil) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - + return Predicate { actualExpression in var actualError: Error? do { _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError + } catch { + actualError = error } + let failureMessage = FailureMessage() setFailureMessageForError( failureMessage, actualError: actualError, @@ -152,16 +154,18 @@ public func throwError( errorType: errorType, closure: closure ) + var matches = false if let actualError = actualError { matches = true + if let actualError = actualError as? T { if let closure = closure { let assertions = gatherFailingExpectations { closure(actualError) } let messages = assertions.map { $0.message } - if messages.count > 0 { + if !messages.isEmpty { matches = false } } @@ -176,14 +180,14 @@ public func throwError( } } let messages = assertions.map { $0.message } - if messages.count > 0 { + if !messages.isEmpty { matches = false } } } } - return matches + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) } } @@ -195,15 +199,15 @@ public func throwError( /// /// The closure only gets called when an error was thrown. public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - + return Predicate { actualExpression in var actualError: Error? do { _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError + } catch { + actualError = error } + let failureMessage = FailureMessage() setFailureMessageForError(failureMessage, actualError: actualError, closure: closure) var matches = false @@ -214,11 +218,12 @@ public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate { closure(actualError) } let messages = assertions.map { $0.message } - if messages.count > 0 { + if !messages.isEmpty { matches = false } } - return matches + + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) } } @@ -230,15 +235,15 @@ public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate { /// /// The closure only gets called when an error was thrown. public func throwError(closure: @escaping ((T) -> Void)) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - + return Predicate { actualExpression in var actualError: Error? do { _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError + } catch { + actualError = error } + let failureMessage = FailureMessage() setFailureMessageForError(failureMessage, actualError: actualError, closure: closure) var matches = false @@ -249,10 +254,11 @@ public func throwError(closure: @escaping ((T) -> Void)) -> Predicate< closure(actualError) } let messages = assertions.map { $0.message } - if messages.count > 0 { + if !messages.isEmpty { matches = false } } - return matches + + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Async.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Await.swift similarity index 94% rename from Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Async.swift rename to Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Await.swift index c77a8fc..276f618 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Async.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Await.swift @@ -2,7 +2,7 @@ import CoreFoundation import Dispatch import Foundation -#if !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) +#if canImport(CDispatch) import CDispatch #endif @@ -32,7 +32,7 @@ internal class AssertionWaitLock: WaitLock { func acquireWaitingLock(_ fnName: String, file: FileString, line: UInt) { let info = WaitingInfo(name: fnName, file: file, lineNumber: line) - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) let isMainThread = Thread.isMainThread #else let isMainThread = _CFIsMainThread() @@ -45,10 +45,15 @@ internal class AssertionWaitLock: WaitLock { nimblePrecondition( currentWaiter == nil, "InvalidNimbleAPIUsage", - "Nested async expectations are not allowed to avoid creating flaky tests.\n\n" + - "The call to\n\t\(info)\n" + - "triggered this exception because\n\t\(currentWaiter!)\n" + - "is currently managing the main run loop." + """ + Nested async expectations are not allowed to avoid creating flaky tests. + + The call to + \t\(info) + triggered this exception because + \t\(currentWaiter!) + is currently managing the main run loop. + """ ) currentWaiter = info } @@ -180,25 +185,18 @@ internal class AwaitPromiseBuilder { // checked. // // In addition, stopping the run loop is used to halt code executed on the main run loop. - #if swift(>=4.0) trigger.timeoutSource.schedule( deadline: DispatchTime.now() + timeoutInterval, repeating: .never, leeway: timeoutLeeway ) - #else - trigger.timeoutSource.scheduleOneshot( - deadline: DispatchTime.now() + timeoutInterval, - leeway: timeoutLeeway - ) - #endif trigger.timeoutSource.setEventHandler { guard self.promise.asyncResult.isIncomplete() else { return } let timedOutSem = DispatchSemaphore(value: 0) let semTimedOutOrBlocked = DispatchSemaphore(value: 0) semTimedOutOrBlocked.signal() let runLoop = CFRunLoopGetMain() - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) let runLoopMode = CFRunLoopMode.defaultMode.rawValue #else let runLoopMode = kCFRunLoopDefaultMode @@ -263,7 +261,11 @@ internal class AwaitPromiseBuilder { self.trigger.timeoutSource.resume() while self.promise.asyncResult.isIncomplete() { // Stopping the run loop does not work unless we run only 1 mode + #if (swift(>=4.2) && canImport(Darwin)) || compiler(>=5.0) + _ = RunLoop.current.run(mode: .default, before: .distantFuture) + #else _ = RunLoop.current.run(mode: .defaultRunLoopMode, before: .distantFuture) + #endif } self.trigger.timeoutSource.cancel() @@ -329,11 +331,7 @@ internal class Awaiter { let asyncSource = createTimerSource(asyncQueue) let trigger = AwaitTrigger(timeoutSource: timeoutSource, actionSource: asyncSource) { let interval = DispatchTimeInterval.nanoseconds(Int(pollInterval * TimeInterval(NSEC_PER_SEC))) - #if swift(>=4.0) asyncSource.schedule(deadline: .now(), repeating: interval, leeway: pollLeeway) - #else - asyncSource.scheduleRepeating(deadline: .now(), interval: interval, leeway: pollLeeway) - #endif asyncSource.setEventHandler { do { if let result = try closure() { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Functional.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Functional.swift index 6c5126a..c87af76 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Functional.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Functional.swift @@ -1,12 +1,14 @@ import Foundation +#if !swift(>=4.2) extension Sequence { - internal func all(_ fn: (Iterator.Element) -> Bool) -> Bool { + internal func allSatisfy(_ predicate: (Element) throws -> Bool) rethrows -> Bool { for item in self { - if !fn(item) { + if try !predicate(item) { return false } } return true } } +#endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Stringers.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Stringers.swift index 7c4d273..4ab18d2 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Stringers.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Stringers.swift @@ -2,7 +2,7 @@ import Foundation internal func identityAsString(_ value: Any?) -> String { let anyObject: AnyObject? -#if os(Linux) +#if os(Linux) && !swift(>=4.1.50) anyObject = value as? AnyObject #else anyObject = value as AnyObject? @@ -122,6 +122,7 @@ extension String: TestOutputStringConvertible { extension Data: TestOutputStringConvertible { public var testDescription: String { #if os(Linux) + // swiftlint:disable:next todo // FIXME: Swift on Linux triggers a segfault when calling NSData's hash() (last checked on 03-11-16) return "Data" #else @@ -158,7 +159,7 @@ public func stringify(_ value: T?) -> String { return String(describing: value) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) @objc public class NMBStringer: NSObject { @objc public class func stringify(_ obj: Any?) -> String { return Nimble.stringify(obj) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/LinuxMain.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/LinuxMain.swift index 16c6953..ee03ebd 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/LinuxMain.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/LinuxMain.swift @@ -1,37 +1,8 @@ import XCTest -@testable import NimbleTests -// This is the entry point for NimbleTests on Linux +import NimbleTests -XCTMain([ - testCase(AsyncTest.allTests), - testCase(SynchronousTest.allTests), - testCase(UserDescriptionTest.allTests), +var tests = [XCTestCaseEntry]() +tests += NimbleTests.__allTests() - // Matchers - testCase(AllPassTest.allTests), - testCase(BeAKindOfSwiftTest.allTests), - testCase(BeAnInstanceOfTest.allTests), - testCase(BeCloseToTest.allTests), - testCase(BeginWithTest.allTests), - testCase(BeGreaterThanOrEqualToTest.allTests), - testCase(BeGreaterThanTest.allTests), - testCase(BeIdenticalToObjectTest.allTests), - testCase(BeIdenticalToTest.allTests), - testCase(BeLessThanOrEqualToTest.allTests), - testCase(BeLessThanTest.allTests), - testCase(BeTruthyTest.allTests), - testCase(BeTrueTest.allTests), - testCase(BeFalsyTest.allTests), - testCase(BeFalseTest.allTests), - testCase(BeNilTest.allTests), - testCase(ContainTest.allTests), - testCase(EndWithTest.allTests), - testCase(EqualTest.allTests), - testCase(HaveCountTest.allTests), - testCase(MatchTest.allTests), - // testCase(RaisesExceptionTest.allTests), - testCase(ThrowErrorTest.allTests), - testCase(SatisfyAnyOfTest.allTests), - testCase(PostNotificationTest.allTests), -]) +XCTMain(tests) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/AsynchronousTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/AsynchronousTest.swift index c44b9e6..bfa34c2 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/AsynchronousTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/AsynchronousTest.swift @@ -4,25 +4,6 @@ import XCTest import Nimble final class AsyncTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (AsyncTest) -> () throws -> Void)] { - return [ - ("testToEventuallyPositiveMatches", testToEventuallyPositiveMatches), - ("testToEventuallyNegativeMatches", testToEventuallyNegativeMatches), - ("testWaitUntilWithCustomDefaultsTimeout", testWaitUntilWithCustomDefaultsTimeout), - ("testWaitUntilPositiveMatches", testWaitUntilPositiveMatches), - ("testToEventuallyWithCustomDefaultTimeout", testToEventuallyWithCustomDefaultTimeout), - ("testWaitUntilTimesOutIfNotCalled", testWaitUntilTimesOutIfNotCalled), - ("testWaitUntilTimesOutWhenExceedingItsTime", testWaitUntilTimesOutWhenExceedingItsTime), - ("testWaitUntilNegativeMatches", testWaitUntilNegativeMatches), - ("testWaitUntilDetectsStalledMainThreadActivity", testWaitUntilDetectsStalledMainThreadActivity), - ("testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed", testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed), - ("testWaitUntilErrorsIfDoneIsCalledMultipleTimes", testWaitUntilErrorsIfDoneIsCalledMultipleTimes), - ("testWaitUntilMustBeInMainThread", testWaitUntilMustBeInMainThread), - ("testToEventuallyMustBeInMainThread", testToEventuallyMustBeInMainThread), - ("testSubjectUnderTestIsReleasedFromMemory", testSubjectUnderTestIsReleasedFromMemory), - ] - } - class Error: Swift.Error {} let errorToThrow = Error() @@ -70,20 +51,12 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { var asyncOperation: () -> Void = { sleepThenSetValueTo(1) } - if #available(OSX 10.10, *) { - DispatchQueue.global().async(execute: asyncOperation) - } else { - DispatchQueue.global(priority: .default).async(execute: asyncOperation) - } + DispatchQueue.global().async(execute: asyncOperation) expect { value }.toEventually(equal(1)) asyncOperation = { sleepThenSetValueTo(0) } - if #available(OSX 10.10, *) { - DispatchQueue.global().async(execute: asyncOperation) - } else { - DispatchQueue.global(priority: .default).async(execute: asyncOperation) - } + DispatchQueue.global().async(execute: asyncOperation) expect { value }.toEventuallyNot(equal(1)) } @@ -124,11 +97,7 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { done() waiting = false } - if #available(OSX 10.10, *) { - DispatchQueue.global().async(execute: asyncOperation) - } else { - DispatchQueue.global(priority: .default).async(execute: asyncOperation) - } + DispatchQueue.global().async(execute: asyncOperation) } } @@ -161,15 +130,16 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { func testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed() { // Currently we are unable to catch Objective-C exceptions when built by the Swift Package Manager #if !SWIFT_PACKAGE - let referenceLine = #line + 9 - var msg = "Unexpected exception raised: Nested async expectations are not allowed " - msg += "to avoid creating flaky tests." - msg += "\n\n" - msg += "The call to\n\t" - msg += "expect(...).toEventually(...) at \(#file):\(referenceLine + 7)\n" - msg += "triggered this exception because\n\t" - msg += "waitUntil(...) at \(#file):\(referenceLine + 1)\n" - msg += "is currently managing the main run loop." + let referenceLine = #line + 10 + let msg = """ + Unexpected exception raised: Nested async expectations are not allowed to avoid creating flaky tests. + + The call to + \texpect(...).toEventually(...) at \(#file):\(referenceLine + 7) + triggered this exception because + \twaitUntil(...) at \(#file):\(referenceLine + 1) + is currently managing the main run loop. + """ failsWithErrorMessage(msg) { // reference line waitUntil(timeout: 2.0) { done in var protected: Int = 0 @@ -204,11 +174,7 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { }.to(raiseException(named: "InvalidNimbleAPIUsage")) executedAsyncBlock = true } - if #available(OSX 10.10, *) { - DispatchQueue.global().async(execute: asyncOperation) - } else { - DispatchQueue.global(priority: .default).async(execute: asyncOperation) - } + DispatchQueue.global().async(execute: asyncOperation) expect(executedAsyncBlock).toEventually(beTruthy()) #endif } @@ -222,11 +188,7 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { }.to(raiseException(named: "InvalidNimbleAPIUsage")) executedAsyncBlock = true } - if #available(OSX 10.10, *) { - DispatchQueue.global().async(execute: asyncOperation) - } else { - DispatchQueue.global(priority: .default).async(execute: asyncOperation) - } + DispatchQueue.global().async(execute: asyncOperation) expect(executedAsyncBlock).toEventually(beTruthy()) #endif } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Helpers/XCTestCaseProvider.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Helpers/XCTestCaseProvider.swift index 08a67c6..08567fd 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Helpers/XCTestCaseProvider.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Helpers/XCTestCaseProvider.swift @@ -4,7 +4,7 @@ import XCTest // XCTestCaseProvider should be adopted by all XCTestCase subclasses. It provides a // mechanism for us to fail tests in Xcode which haven't been included in the `allTests` // list for swift-corelibs-xctest which is unable to dynamically discover tests. Note -// that only `static var allTests` needs to be explicitly implemented, as `allTestNames` +// that only `static var __allTests` needs to be explicitly implemented, as `allTestNames` // has a default implementation provided by a protocol extension. // Implementation note: This is broken down into two separate protocols because we need a @@ -12,7 +12,7 @@ import XCTest public protocol XCTestCaseProviderStatic { // This should be explicitly implemented by XCTestCase subclasses - static var allTests: [(String, (Self) -> () throws -> Void)] { get } + static var __allTests: [(String, (Self) -> () -> ())] { get } } public protocol XCTestCaseNameProvider { @@ -20,17 +20,21 @@ public protocol XCTestCaseNameProvider { var allTestNames: [String] { get } } +#if os(macOS) public protocol XCTestCaseProvider: XCTestCaseProviderStatic, XCTestCaseNameProvider {} extension XCTestCaseProvider { var allTestNames: [String] { - return type(of: self).allTests.map({ name, _ in + return type(of: self).__allTests.map({ name, _ in return name }) } } +#else +public protocol XCTestCaseProvider {} +#endif -#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS) +#if os(macOS) extension XCTestCase { override open func tearDown() { @@ -45,7 +49,13 @@ extension XCTestCase { extension XCTestCaseNameProvider { fileprivate func assertContainsTest(_ name: String) { let contains = self.allTestNames.contains(name) - XCTAssert(contains, "Test '\(name)' is missing from the allTests array") + XCTAssert( + contains, + """ + Test '\(name)' is missing from the __allTests array. + Please run `$ swift test --generate-linuxmain` to update the manifests. + """ + ) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Helpers/utils.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Helpers/utils.swift index a1bbc68..c90b72a 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Helpers/utils.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Helpers/utils.swift @@ -3,12 +3,12 @@ import Foundation @testable import Nimble import XCTest -func failsWithErrorMessage(_ messages: [String], file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: @escaping () throws -> Void) { +func failsWithErrorMessage(_ messages: [String], file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: () throws -> Void) { var filePath = file var lineNumber = line let recorder = AssertionRecorder() - withAssertionHandler(recorder, closure: closure) + withAssertionHandler(recorder, file: file, line: line, closure: closure) for msg in messages { var lastFailure: AssertionRecord? @@ -37,7 +37,12 @@ func failsWithErrorMessage(_ messages: [String], file: FileString = #file, line: } else { let knownFailures = recorder.assertions.filter { !$0.success }.map { $0.message.stringValue } let knownFailuresJoined = knownFailures.joined(separator: ", ") - message = "Expected error message (\(msg)), got (\(knownFailuresJoined))\n\nAssertions Received:\n\(recorder.assertions)" + message = """ + Expected error message (\(msg)), got (\(knownFailuresJoined)) + + Assertions Received: + \(recorder.assertions) + """ } NimbleAssertionHandler.assert(false, message: FailureMessage(stringValue: message), @@ -45,7 +50,7 @@ func failsWithErrorMessage(_ messages: [String], file: FileString = #file, line: } } -func failsWithErrorMessage(_ message: String, file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: @escaping () -> Void) { +func failsWithErrorMessage(_ message: String, file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: () -> Void) { return failsWithErrorMessage( [message], file: file, @@ -55,7 +60,7 @@ func failsWithErrorMessage(_ message: String, file: FileString = #file, line: UI ) } -func failsWithErrorMessageForNil(_ message: String, file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: @escaping () -> Void) { +func failsWithErrorMessageForNil(_ message: String, file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: () -> Void) { failsWithErrorMessage("\(message) (use beNil() to match nils)", file: file, line: line, preferOriginalSourceLocation: preferOriginalSourceLocation, closure: closure) } @@ -68,15 +73,15 @@ func deferToMainQueue(action: @escaping () -> Void) { #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE public class NimbleHelper: NSObject { - @objc public class func expectFailureMessage(_ message: NSString, block: @escaping () -> Void, file: FileString, line: UInt) { + @objc public class func expectFailureMessage(_ message: NSString, block: () -> Void, file: FileString, line: UInt) { failsWithErrorMessage(String(describing: message), file: file, line: line, preferOriginalSourceLocation: true, closure: block) } - @objc public class func expectFailureMessages(_ messages: [NSString], block: @escaping () -> Void, file: FileString, line: UInt) { + @objc public class func expectFailureMessages(_ messages: [NSString], block: () -> Void, file: FileString, line: UInt) { failsWithErrorMessage(messages.map({String(describing: $0)}), file: file, line: line, preferOriginalSourceLocation: true, closure: block) } - @objc public class func expectFailureMessageForNil(_ message: NSString, block: @escaping () -> Void, file: FileString, line: UInt) { + @objc public class func expectFailureMessageForNil(_ message: NSString, block: () -> Void, file: FileString, line: UInt) { failsWithErrorMessageForNil(String(describing: message), file: file, line: line, preferOriginalSourceLocation: true, closure: block) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/AllPassTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/AllPassTest.swift index 2050881..683121c 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/AllPassTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/AllPassTest.swift @@ -43,17 +43,6 @@ extension Optional where Wrapped: Comparable { } final class AllPassTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (AllPassTest) -> () throws -> Void)] { - return [ - ("testAllPassArray", testAllPassArray), - ("testAllPassMatcher", testAllPassMatcher), - ("testAllPassCollectionsWithOptionalsDontWork", testAllPassCollectionsWithOptionalsDontWork), - ("testAllPassCollectionsWithOptionalsUnwrappingOneOptionalLayer", testAllPassCollectionsWithOptionalsUnwrappingOneOptionalLayer), - ("testAllPassSet", testAllPassSet), - ("testAllPassWithNilAsExpectedValue", testAllPassWithNilAsExpectedValue), - ] - } - func testAllPassArray() { expect([1, 2, 3, 4]).to(allPass({$0 < 5})) expect([1, 2, 3, 4]).toNot(allPass({$0 > 5})) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift index bb9041b..64a439b 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift @@ -8,13 +8,6 @@ private class TestClassConformingToProtocol: TestProtocol {} private struct TestStructConformingToProtocol: TestProtocol {} final class BeAKindOfSwiftTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeAKindOfSwiftTest) -> () throws -> Void)] { - return [ - ("testPositiveMatch", testPositiveMatch), - ("testFailureMessages", testFailureMessages), - ] - } - enum TestEnum { case one, two } @@ -54,23 +47,17 @@ final class BeAKindOfSwiftTest: XCTestCase, XCTestCaseProvider { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - final class BeAKindOfObjCTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeAKindOfObjCTest) -> () throws -> Void)] { - return [ - ("testPositiveMatch", testPositiveMatch), - ("testFailureMessages", testFailureMessages), - ] - } - func testPositiveMatch() { +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) expect(TestNull()).to(beAKindOf(NSNull.self)) expect(NSObject()).to(beAKindOf(NSObject.self)) expect(NSNumber(value: 1)).toNot(beAKindOf(NSDate.self)) +#endif } func testFailureMessages() { +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) failsWithErrorMessageForNil("expected to not be a kind of NSNull, got ") { expect(nil as NSNull?).toNot(beAKindOf(NSNull.self)) } @@ -83,7 +70,6 @@ final class BeAKindOfObjCTest: XCTestCase, XCTestCaseProvider { failsWithErrorMessage("expected to not be a kind of NSNumber, got <__NSCFNumber instance>") { expect(NSNumber(value: 1)).toNot(beAKindOf(NSNumber.self)) } +#endif } } - -#endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift index aeea28a..df431e6 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift @@ -7,15 +7,6 @@ private class TestClassConformingToProtocol: TestProtocol {} private struct TestStructConformingToProtocol: TestProtocol {} final class BeAnInstanceOfTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeAnInstanceOfTest) -> () throws -> Void)] { - return [ - ("testPositiveMatch", testPositiveMatch), - ("testPositiveMatchSwiftTypes", testPositiveMatchSwiftTypes), - ("testFailureMessages", testFailureMessages), - ("testFailureMessagesSwiftTypes", testFailureMessagesSwiftTypes), - ] - } - func testPositiveMatch() { expect(NSNull()).to(beAnInstanceOf(NSNull.self)) expect(NSNumber(value: 1)).toNot(beAnInstanceOf(NSDate.self)) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeCloseToTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeCloseToTest.swift index cb7a3ec..f724be6 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeCloseToTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeCloseToTest.swift @@ -3,24 +3,6 @@ import XCTest import Nimble final class BeCloseToTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeCloseToTest) -> () throws -> Void)] { - return [ - ("testBeCloseTo", testBeCloseTo), - ("testBeCloseToWithin", testBeCloseToWithin), - ("testBeCloseToWithNSNumber", testBeCloseToWithNSNumber), - ("testBeCloseToWithDate", testBeCloseToWithDate), - ("testBeCloseToWithNSDate", testBeCloseToWithNSDate), - ("testBeCloseToOperator", testBeCloseToOperator), - ("testBeCloseToWithinOperator", testBeCloseToWithinOperator), - ("testPlusMinusOperator", testPlusMinusOperator), - ("testBeCloseToOperatorWithDate", testBeCloseToOperatorWithDate), - ("testBeCloseToWithinOperatorWithDate", testBeCloseToWithinOperatorWithDate), - ("testPlusMinusOperatorWithDate", testPlusMinusOperatorWithDate), - ("testBeCloseToArray", testBeCloseToArray), - ("testBeCloseToWithCGFloat", testBeCloseToWithCGFloat), - ] - } - func testBeCloseTo() { expect(1.2).to(beCloseTo(1.2001)) expect(1.2 as CDouble).to(beCloseTo(1.2001)) @@ -34,8 +16,8 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { func testBeCloseToWithin() { expect(1.2).to(beCloseTo(9.300, within: 10)) - failsWithErrorMessage("expected to not be close to <1.2001> (within 1), got <1.2>") { - expect(1.2).toNot(beCloseTo(1.2001, within: 1.0)) + failsWithErrorMessage("expected to not be close to <1.2001> (within 1.1), got <1.2>") { + expect(1.2).toNot(beCloseTo(1.2001, within: 1.1)) } } @@ -44,8 +26,8 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect(NSNumber(value: 1.2)).to(beCloseTo(NSNumber(value: 9.300), within: 10)) expect(1.2).to(beCloseTo(NSNumber(value: 9.300), within: 10)) - failsWithErrorMessage("expected to not be close to <1.2001> (within 1), got <1.2>") { - expect(NSNumber(value: 1.2)).toNot(beCloseTo(1.2001, within: 1.0)) + failsWithErrorMessage("expected to not be close to <1.2001> (within 1.1), got <1.2>") { + expect(NSNumber(value: 1.2)).toNot(beCloseTo(1.2001, within: 1.1)) } } @@ -53,8 +35,8 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect(CGFloat(1.2)).to(beCloseTo(1.2001)) expect(CGFloat(1.2)).to(beCloseTo(CGFloat(1.2001))) - failsWithErrorMessage("expected to not be close to <1.2001> (within 1), got <1.2>") { - expect(CGFloat(1.2)).toNot(beCloseTo(1.2001, within: 1.0)) + failsWithErrorMessage("expected to not be close to <1.2001> (within 1.1), got <1.2>") { + expect(CGFloat(1.2)).toNot(beCloseTo(1.2001, within: 1.1)) } } @@ -89,11 +71,11 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect(1.2) ≈ (9.300, 10) expect(1.2) == (9.300, 10) - failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") { - expect(1.2) ≈ (1.0, 0.1) + failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") { + expect(1.3) ≈ (1.1, 0.1) } - failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") { - expect(1.2) == (1.0, 0.1) + failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") { + expect(1.3) == (1.1, 0.1) } } @@ -101,11 +83,11 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect(1.2) ≈ 9.300 ± 10 expect(1.2) == 9.300 ± 10 - failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") { - expect(1.2) ≈ 1.0 ± 0.1 + failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") { + expect(1.3) ≈ 1.1 ± 0.1 } - failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") { - expect(1.2) == 1.0 ± 0.1 + failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") { + expect(1.3) == 1.1 ± 0.1 } } @@ -150,11 +132,11 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect([0.0, 1.1, 2.2]) ≈ [0.0001, 1.1001, 2.2001] expect([0.0, 1.1, 2.2]).to(beCloseTo([0.1, 1.2, 2.3], within: 0.1)) - failsWithErrorMessage("expected to be close to <[0, 1]> (each within 0.0001), got <[0, 1.1]>") { - expect([0.0, 1.1]) ≈ [0.0, 1.0] + failsWithErrorMessage("expected to be close to <[0.1, 1.1]> (each within 0.0001), got <[0.1, 1.2]>") { + expect([0.1, 1.2]) ≈ [0.1, 1.1] } - failsWithErrorMessage("expected to be close to <[0.2, 1.2]> (each within 0.1), got <[0, 1.1]>") { - expect([0.0, 1.1]).to(beCloseTo([0.2, 1.2], within: 0.1)) + failsWithErrorMessage("expected to be close to <[0.3, 1.3]> (each within 0.1), got <[0.1, 1.2]>") { + expect([0.1, 1.2]).to(beCloseTo([0.3, 1.3], within: 0.1)) } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift index 067ddeb..637bc7a 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeEmptyTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeEmptyTest) -> () throws -> Void)] { - return [ - ("testBeEmptyPositive", testBeEmptyPositive), - ("testBeEmptyNegative", testBeEmptyNegative), - ] - } - func testBeEmptyPositive() { expect([] as [Int]).to(beEmpty()) expect([1]).toNot(beEmpty()) @@ -41,16 +34,12 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect("").to(beEmpty()) expect("foo").toNot(beEmpty()) + + expect([] as TestOptionSet).to(beEmpty()) + expect(TestOptionSet.one).toNot(beEmpty()) } func testBeEmptyNegative() { - failsWithErrorMessageForNil("expected to be empty, got ") { - expect(nil as NSString?).to(beEmpty()) - } - failsWithErrorMessageForNil("expected to not be empty, got ") { - expect(nil as [CInt]?).toNot(beEmpty()) - } - failsWithErrorMessage("expected to not be empty, got <()>") { expect(NSArray()).toNot(beEmpty()) } @@ -58,12 +47,14 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect([1]).to(beEmpty()) } +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) failsWithErrorMessage("expected to not be empty, got <{()}>") { expect(NSSet()).toNot(beEmpty()) } failsWithErrorMessage("expected to be empty, got <{(1)}>") { expect(NSSet(object: NSNumber(value: 1))).to(beEmpty()) } +#endif failsWithErrorMessage("expected to not be empty, got <()>") { expect(NSIndexSet()).toNot(beEmpty()) @@ -78,5 +69,49 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { failsWithErrorMessage("expected to be empty, got ") { expect("foo").to(beEmpty()) } + + failsWithErrorMessage("expected to not be empty, got ") { + expect([] as TestOptionSet).toNot(beEmpty()) + } + failsWithErrorMessage("expected to be empty, got ") { + expect(TestOptionSet.one).to(beEmpty()) + } + } + + func testNilMatches() { + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as NSString?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as NSString?).toNot(beEmpty()) + } + + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as [CInt]?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as [CInt]?).toNot(beEmpty()) + } + + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as TestOptionSet?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as TestOptionSet?).toNot(beEmpty()) + } + } +} + +private struct TestOptionSet: OptionSet, CustomStringConvertible { + let rawValue: Int + + static let one = TestOptionSet(rawValue: 1 << 0) + + init(rawValue: Int) { + self.rawValue = rawValue + } + + var description: String { + return "TestOptionSet(rawValue: \(rawValue))" } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift index bd73361..4c91fec 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeGreaterThanOrEqualToTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeGreaterThanOrEqualToTest) -> () throws -> Void)] { - return [ - ("testGreaterThanOrEqualTo", testGreaterThanOrEqualTo), - ("testGreaterThanOrEqualToOperator", testGreaterThanOrEqualToOperator), - ] - } - func testGreaterThanOrEqualTo() { expect(10).to(beGreaterThanOrEqualTo(10)) expect(10).to(beGreaterThanOrEqualTo(2)) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanTest.swift index 9c33e4b..3d742f4 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeGreaterThanTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeGreaterThanTest) -> () throws -> Void)] { - return [ - ("testGreaterThan", testGreaterThan), - ("testGreaterThanOperator", testGreaterThanOperator), - ] - } - func testGreaterThan() { expect(10).to(beGreaterThan(2)) expect(1).toNot(beGreaterThan(2)) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToObjectTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToObjectTest.swift index 923fa76..b1155fb 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToObjectTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToObjectTest.swift @@ -3,17 +3,6 @@ import XCTest import Nimble final class BeIdenticalToObjectTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeIdenticalToObjectTest) -> () throws -> Void)] { - return [ - ("testBeIdenticalToPositive", testBeIdenticalToPositive), - ("testBeIdenticalToNegative", testBeIdenticalToNegative), - ("testBeIdenticalToPositiveMessage", testBeIdenticalToPositiveMessage), - ("testBeIdenticalToNegativeMessage", testBeIdenticalToNegativeMessage), - ("testFailsOnNils", testFailsOnNils), - ("testOperators", testOperators), - ] - } - private class BeIdenticalToObjectTester {} private let testObjectA = BeIdenticalToObjectTester() private let testObjectB = BeIdenticalToObjectTester() diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift index 6b629b0..8830647 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift @@ -3,17 +3,6 @@ import XCTest @testable import Nimble final class BeIdenticalToTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeIdenticalToTest) -> () throws -> Void)] { - return [ - ("testBeIdenticalToPositive", testBeIdenticalToPositive), - ("testBeIdenticalToNegative", testBeIdenticalToNegative), - ("testBeIdenticalToPositiveMessage", testBeIdenticalToPositiveMessage), - ("testBeIdenticalToNegativeMessage", testBeIdenticalToNegativeMessage), - ("testOperators", testOperators), - ("testBeAlias", testBeAlias), - ] - } - func testBeIdenticalToPositive() { let value = NSDate() expect(value).to(beIdenticalTo(value)) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift index 428ace4..f389469 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeLessThanOrEqualToTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeLessThanOrEqualToTest) -> () throws -> Void)] { - return [ - ("testLessThanOrEqualTo", testLessThanOrEqualTo), - ("testLessThanOrEqualToOperator", testLessThanOrEqualToOperator), - ] - } - func testLessThanOrEqualTo() { expect(10).to(beLessThanOrEqualTo(10)) expect(2).to(beLessThanOrEqualTo(10)) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLessThanTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLessThanTest.swift index 90ba1b9..d560232 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLessThanTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLessThanTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeLessThanTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeLessThanTest) -> () throws -> Void)] { - return [ - ("testLessThan", testLessThan), - ("testLessThanOperator", testLessThanOperator), - ] - } - func testLessThan() { expect(2).to(beLessThan(10)) expect(2).toNot(beLessThan(1)) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLogicalTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLogicalTest.swift index 947a1b4..d9ef8ea 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLogicalTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLogicalTest.swift @@ -30,18 +30,6 @@ enum ConvertsToBool: ExpressibleByBooleanLiteral, CustomStringConvertible { } final class BeTruthyTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeTruthyTest) -> () throws -> Void)] { - return [ - ("testShouldMatchNonNilTypes", testShouldMatchNonNilTypes), - ("testShouldMatchTrue", testShouldMatchTrue), - ("testShouldNotMatchNilTypes", testShouldNotMatchNilTypes), - ("testShouldNotMatchFalse", testShouldNotMatchFalse), - ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), - ("testShouldMatchBoolConvertibleTypesThatConvertToTrue", testShouldMatchBoolConvertibleTypesThatConvertToTrue), - ("testShouldNotMatchBoolConvertibleTypesThatConvertToFalse", testShouldNotMatchBoolConvertibleTypesThatConvertToFalse), - ] - } - func testShouldMatchNonNilTypes() { expect(true as Bool?).to(beTruthy()) @@ -123,14 +111,6 @@ final class BeTruthyTest: XCTestCase, XCTestCaseProvider { } final class BeTrueTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeTrueTest) -> () throws -> Void)] { - return [ - ("testShouldMatchTrue", testShouldMatchTrue), - ("testShouldNotMatchFalse", testShouldNotMatchFalse), - ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), - ] - } - func testShouldMatchTrue() { expect(true).to(beTrue()) @@ -159,16 +139,6 @@ final class BeTrueTest: XCTestCase, XCTestCaseProvider { } final class BeFalsyTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeFalsyTest) -> () throws -> Void)] { - return [ - ("testShouldMatchNilTypes", testShouldMatchNilTypes), - ("testShouldNotMatchTrue", testShouldNotMatchTrue), - ("testShouldNotMatchNonNilTypes", testShouldNotMatchNonNilTypes), - ("testShouldMatchFalse", testShouldMatchFalse), - ("testShouldMatchNilBools", testShouldMatchNilBools), - ] - } - func testShouldMatchNilTypes() { expect(false as Bool?).to(beFalsy()) @@ -234,14 +204,6 @@ final class BeFalsyTest: XCTestCase, XCTestCaseProvider { } final class BeFalseTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeFalseTest) -> () throws -> Void)] { - return [ - ("testShouldNotMatchTrue", testShouldNotMatchTrue), - ("testShouldMatchFalse", testShouldMatchFalse), - ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), - ] - } - func testShouldNotMatchTrue() { expect(true).toNot(beFalse()) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeNilTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeNilTest.swift index 69f4185..9e37116 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeNilTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeNilTest.swift @@ -2,12 +2,6 @@ import XCTest import Nimble final class BeNilTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeNilTest) -> () throws -> Void)] { - return [ - ("testBeNil", testBeNil), - ] - } - func producesNil() -> [Int]? { return nil } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeVoidTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeVoidTest.swift index a8eefc1..bb5d324 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeVoidTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeVoidTest.swift @@ -2,12 +2,6 @@ import XCTest import Nimble final class BeVoidTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeVoidTest) -> () throws -> Void)] { - return [ - ("testBeVoid", testBeVoid), - ] - } - func testBeVoid() { expect(()).to(beVoid()) expect(() as ()?).to(beVoid()) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift index 276c7d0..3a5162e 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeginWithTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeginWithTest) -> () throws -> Void)] { - return [ - ("testPositiveMatches", testPositiveMatches), - ("testNegativeMatches", testNegativeMatches), - ] - } - func testPositiveMatches() { expect([1, 2, 3]).to(beginWith(1)) expect([1, 2, 3]).toNot(beginWith(2)) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ContainElementSatisfyingTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ContainElementSatisfyingTest.swift index a9fe80e..6944375 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ContainElementSatisfyingTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ContainElementSatisfyingTest.swift @@ -3,20 +3,6 @@ import XCTest import Nimble final class ContainElementSatisfyingTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (ContainElementSatisfyingTest) -> () throws -> Void)] { - return [ - ("testContainElementSatisfying", testContainElementSatisfying), - ("testContainElementSatisfyingDefaultErrorMessage", testContainElementSatisfyingDefaultErrorMessage), - ("testContainElementSatisfyingSpecificErrorMessage", testContainElementSatisfyingSpecificErrorMessage), - ("testContainElementSatisfyingNegativeCase", - testContainElementSatisfyingNegativeCase), - ("testContainElementSatisfyingNegativeCaseDefaultErrorMessage", - testContainElementSatisfyingNegativeCaseDefaultErrorMessage), - ("testContainElementSatisfyingNegativeCaseSpecificErrorMessage", - testContainElementSatisfyingNegativeCaseSpecificErrorMessage), - ] - } - func testContainElementSatisfying() { var orderIndifferentArray = [1, 2, 3] expect(orderIndifferentArray).to(containElementSatisfying({ number in diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift index 1d8a1eb..f69f351 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift @@ -3,22 +3,12 @@ import XCTest import Nimble final class ContainTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (ContainTest) -> () throws -> Void)] { - return [ - ("testContain", testContain), - ("testContainSubstring", testContainSubstring), - ("testContainObjCSubstring", testContainObjCSubstring), - ("testVariadicArguments", testVariadicArguments), - ("testCollectionArguments", testCollectionArguments), - ] - } - - func testContain() { + func testContainSequence() { expect([1, 2, 3]).to(contain(1)) + expect([1, 2, 3]).toNot(contain(4)) expect([1, 2, 3] as [CInt]).to(contain(1 as CInt)) expect([1, 2, 3] as [CInt]).toNot(contain(4 as CInt)) expect(["foo", "bar", "baz"]).to(contain("baz")) - expect([1, 2, 3]).toNot(contain(4)) expect(["foo", "bar", "baz"]).toNot(contain("ba")) #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) expect(NSArray(array: ["a"])).to(contain(NSString(string: "a"))) @@ -41,6 +31,25 @@ final class ContainTest: XCTestCase, XCTestCaseProvider { } } + func testContainSetAlgebra() { + expect([.a, .b, .c] as TestOptionSet).to(contain(.a)) + expect([.a, .b, .c] as TestOptionSet).toNot(contain(.d)) + + failsWithErrorMessage("expected to contain <8>, got <7>") { + expect([.a, .b, .c] as TestOptionSet).to(contain(.d)) + } + failsWithErrorMessage("expected to not contain <2>, got <7>") { + expect([.a, .b, .c] as TestOptionSet).toNot(contain(.b)) + } + + failsWithErrorMessageForNil("expected to contain <1>, got ") { + expect(nil as TestOptionSet?).to(contain(.a)) + } + failsWithErrorMessageForNil("expected to not contain <1>, got ") { + expect(nil as TestOptionSet?).toNot(contain(.a)) + } + } + func testContainSubstring() { expect("foo").to(contain("o")) expect("foo").to(contain("oo")) @@ -93,3 +102,23 @@ final class ContainTest: XCTestCase, XCTestCaseProvider { } } } + +private struct TestOptionSet: OptionSet, CustomStringConvertible { + let rawValue: Int + + // swiftlint:disable identifier_name + static let a = TestOptionSet(rawValue: 1 << 0) + static let b = TestOptionSet(rawValue: 1 << 1) + static let c = TestOptionSet(rawValue: 1 << 2) + static let d = TestOptionSet(rawValue: 1 << 3) + static let e = TestOptionSet(rawValue: 1 << 4) + // swiftlint:enable identifier_name + + init(rawValue: Int) { + self.rawValue = rawValue + } + + var description: String { + return "\(rawValue)" + } +} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ElementsEqualTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ElementsEqualTest.swift new file mode 100644 index 0000000..ec7a0dd --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ElementsEqualTest.swift @@ -0,0 +1,27 @@ +import Foundation +import XCTest +import Nimble + +final class ElementsEqualTest: XCTestCase, XCTestCaseProvider { + + func testSequenceElementsEquality() { + failsWithErrorMessageForNil("expected to elementsEqual , got ") { + expect(nil as [Int]?).to(elementsEqual(nil as [Int]?)) + } + let sequence = [1, 2] + failsWithErrorMessageForNil("expected to elementsEqual <[1, 2]>, got ") { + expect(nil as [Int]?).to(elementsEqual(sequence)) + } + + failsWithErrorMessageForNil("expected to elementsEqual , got <[1, 2]>") { + expect(sequence).to(elementsEqual(nil as [Int]?)) + } + + let sequence1 = [1, 2, 3] + let sequence2 = [1, 2, 3, 4, 5] + expect(sequence1).toNot(elementsEqual(sequence2)) + expect(sequence1).toNot(elementsEqual([3, 2, 1])) + expect(sequence1).to(elementsEqual([1, 2, 3])) + + } +} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift index 30e3b26..88005e8 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class EndWithTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (EndWithTest) -> () throws -> Void)] { - return [ - ("testEndWithPositives", testEndWithPositives), - ("testEndWithNegatives", testEndWithNegatives), - ] - } - func testEndWithPositives() { expect([1, 2, 3]).to(endWith(3)) expect([1, 2, 3]).toNot(endWith(2)) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift index 85be751..18b0647 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift @@ -3,24 +3,6 @@ import XCTest import Nimble final class EqualTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (EqualTest) -> () throws -> Void)] { - return [ - ("testEquality", testEquality), - ("testArrayEquality", testArrayEquality), - ("testSetEquality", testSetEquality), - ("testDoesNotMatchNils", testDoesNotMatchNils), - ("testDictionaryEquality", testDictionaryEquality), - ("testDataEquality", testDataEquality), - ("testNSObjectEquality", testNSObjectEquality), - ("testOperatorEquality", testOperatorEquality), - ("testOperatorEqualityWithArrays", testOperatorEqualityWithArrays), - ("testOperatorEqualityWithDictionaries", testOperatorEqualityWithDictionaries), - ("testOptionalEquality", testOptionalEquality), - ("testArrayOfOptionalsEquality", testArrayOfOptionalsEquality), - ("testDictionariesWithDifferentSequences", testDictionariesWithDifferentSequences), - ] - } - func testEquality() { expect(1 as CInt).to(equal(1 as CInt)) expect(1 as CInt).to(equal(1)) @@ -152,6 +134,7 @@ final class EqualTest: XCTestCase, XCTestCaseProvider { expect(actual).toNot(equal(unexpected)) #if os(Linux) + // swiftlint:disable:next todo // FIXME: Swift on Linux triggers a segfault when calling NSData's hash() (last checked on 03-11) let expectedErrorMessage = "expected to equal >, got >" #else diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/HaveCountTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/HaveCountTest.swift index a0294c3..4ef610e 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/HaveCountTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/HaveCountTest.swift @@ -2,23 +2,25 @@ import XCTest import Nimble final class HaveCountTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (HaveCountTest) -> () throws -> Void)] { - return [ - ("testHaveCountForArray", testHaveCountForArray), - ("testHaveCountForDictionary", testHaveCountForDictionary), - ("testHaveCountForSet", testHaveCountForSet), - ] - } - func testHaveCountForArray() { expect([1, 2, 3]).to(haveCount(3)) expect([1, 2, 3]).notTo(haveCount(1)) - failsWithErrorMessage("expected to have Array with count 1, got 3\nActual Value: [1, 2, 3]") { + failsWithErrorMessage( + """ + expected to have Array with count 1, got 3 + Actual Value: [1, 2, 3] + """ + ) { expect([1, 2, 3]).to(haveCount(1)) } - failsWithErrorMessage("expected to not have Array with count 3, got 3\nActual Value: [1, 2, 3]") { + failsWithErrorMessage( + """ + expected to not have Array with count 3, got 3 + Actual Value: [1, 2, 3] + """ + ) { expect([1, 2, 3]).notTo(haveCount(3)) } } @@ -28,13 +30,22 @@ final class HaveCountTest: XCTestCase, XCTestCaseProvider { expect(dictionary).to(haveCount(3)) expect(dictionary).notTo(haveCount(1)) - failsWithErrorMessage("expected to have Dictionary with count 1, got 3\nActual Value: \(stringify(dictionary))") { + failsWithErrorMessage( + """ + expected to have Dictionary with count 1, got 3 + Actual Value: \(stringify(dictionary)) + """ + ) { expect(dictionary).to(haveCount(1)) } - failsWithErrorMessage("expected to not have Dictionary with count 3, got 3" + - "\nActual Value: \(stringify(dictionary))") { - expect(dictionary).notTo(haveCount(3)) + failsWithErrorMessage( + """ + expected to not have Dictionary with count 3, got 3 + Actual Value: \(stringify(dictionary)) + """ + ) { + expect(dictionary).notTo(haveCount(3)) } } @@ -43,14 +54,22 @@ final class HaveCountTest: XCTestCase, XCTestCaseProvider { expect(set).to(haveCount(3)) expect(set).notTo(haveCount(1)) - failsWithErrorMessage("expected to have Set with count 1, got 3" + - "\nActual Value: \(stringify(set))") { - expect(set).to(haveCount(1)) + failsWithErrorMessage( + """ + expected to have Set with count 1, got 3 + Actual Value: \(stringify(set)) + """ + ) { + expect(set).to(haveCount(1)) } - failsWithErrorMessage("expected to not have Set with count 3, got 3" + - "\nActual Value: \(stringify(set))") { - expect(set).notTo(haveCount(3)) + failsWithErrorMessage( + """ + expected to not have Set with count 3, got 3 + Actual Value: \(stringify(set)) + """ + ) { + expect(set).notTo(haveCount(3)) } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift index 2d626f2..41e5159 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift @@ -3,18 +3,6 @@ import XCTest import Nimble final class MatchErrorTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (MatchErrorTest) -> () throws -> Void)] { - return [ - ("testMatchErrorPositive", testMatchErrorPositive), - ("testMatchErrorNegative", testMatchErrorNegative), - ("testMatchNSErrorPositive", testMatchNSErrorPositive), - ("testMatchNSErrorNegative", testMatchNSErrorNegative), - ("testMatchPositiveMessage", testMatchPositiveMessage), - ("testMatchNegativeMessage", testMatchNegativeMessage), - ("testDoesNotMatchNils", testDoesNotMatchNils), - ] - } - func testMatchErrorPositive() { expect(NimbleError.laugh).to(matchError(NimbleError.laugh)) expect(NimbleError.laugh).to(matchError(NimbleError.self)) @@ -31,10 +19,12 @@ final class MatchErrorTest: XCTestCase, XCTestCaseProvider { } func testMatchNSErrorPositive() { +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) let error1 = NSError(domain: "err", code: 0, userInfo: nil) let error2 = NSError(domain: "err", code: 0, userInfo: nil) expect(error1).to(matchError(error2)) +#endif } func testMatchNSErrorNegative() { @@ -45,7 +35,7 @@ final class MatchErrorTest: XCTestCase, XCTestCaseProvider { } func testMatchPositiveMessage() { - failsWithErrorMessage("expected to match error , got ") { + failsWithErrorMessage("expected to match error , got ") { expect(EquatableError.parameterized(x: 1)).to(matchError(EquatableError.parameterized(x: 2))) } failsWithErrorMessage("expected to match error , got ") { @@ -55,11 +45,13 @@ final class MatchErrorTest: XCTestCase, XCTestCaseProvider { expect(CustomDebugStringConvertibleError.a).to(matchError(CustomDebugStringConvertibleError.b)) } +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) failsWithErrorMessage("expected to match error , got ") { let error1 = NSError(domain: "err", code: 0, userInfo: nil) let error2 = NSError(domain: "err", code: 1, userInfo: nil) expect(error1).to(matchError(error2)) } +#endif } func testMatchNegativeMessage() { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/MatchTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/MatchTest.swift index a95ba56..1285ecc 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/MatchTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/MatchTest.swift @@ -2,16 +2,6 @@ import XCTest import Nimble final class MatchTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (MatchTest) -> () throws -> Void)] { - return [ - ("testMatchPositive", testMatchPositive), - ("testMatchNegative", testMatchNegative), - ("testMatchPositiveMessage", testMatchPositiveMessage), - ("testMatchNegativeMessage", testMatchNegativeMessage), - ("testMatchNils", testMatchNils), - ] - } - func testMatchPositive() { expect("11:14").to(match("\\d{2}:\\d{2}")) } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift index ac7f9ec..32f5100 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift @@ -3,18 +3,6 @@ import Nimble import Foundation final class PostNotificationTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (PostNotificationTest) -> () throws -> Void)] { - return [ - ("testPassesWhenNoNotificationsArePosted", testPassesWhenNoNotificationsArePosted), - ("testPassesWhenExpectedNotificationIsPosted", testPassesWhenExpectedNotificationIsPosted), - ("testPassesWhenAllExpectedNotificationsArePosted", testPassesWhenAllExpectedNotificationsArePosted), - ("testFailsWhenNoNotificationsArePosted", testFailsWhenNoNotificationsArePosted), - ("testFailsWhenNotificationWithWrongNameIsPosted", testFailsWhenNotificationWithWrongNameIsPosted), - ("testFailsWhenNotificationWithWrongObjectIsPosted", testFailsWhenNotificationWithWrongObjectIsPosted), - ("testPassesWhenExpectedNotificationEventuallyIsPosted", testPassesWhenExpectedNotificationEventuallyIsPosted), - ] - } - let notificationCenter = NotificationCenter() func testPassesWhenNoNotificationsArePosted() { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift index f62f633..beca75b 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift @@ -3,17 +3,7 @@ import Nimble #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE -final class RaisesExceptionTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (RaisesExceptionTest) -> () throws -> Void)] { - return [ - ("testPositiveMatches", testPositiveMatches), - ("testPositiveMatchesWithClosures", testPositiveMatchesWithClosures), - ("testNegativeMatches", testNegativeMatches), - ("testNegativeMatchesDoNotCallClosureWithoutException", testNegativeMatchesDoNotCallClosureWithoutException), - ("testNegativeMatchesWithClosure", testNegativeMatchesWithClosure), - ] - } - +final class RaisesExceptionTest: XCTestCase { var anException = NSException(name: NSExceptionName("laugh"), reason: "Lulz", userInfo: ["key": "value"]) func testPositiveMatches() { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/SatisfyAllOfTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/SatisfyAllOfTest.swift index 42ed892..be60a41 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/SatisfyAllOfTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/SatisfyAllOfTest.swift @@ -3,13 +3,6 @@ import Nimble import Foundation final class SatisfyAllOfTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (SatisfyAllOfTest) -> () throws -> Void)] { - return [ - ("testSatisfyAllOf", testSatisfyAllOf), - ("testOperatorAnd", testOperatorAnd), - ] - } - func testSatisfyAllOf() { expect(2).to(satisfyAllOf(equal(2), beLessThan(3))) #if SUPPORT_IMPLICIT_BRIDGING_CONVERSION diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/SatisfyAnyOfTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/SatisfyAnyOfTest.swift index 0bd9495..0cba8d5 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/SatisfyAnyOfTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/SatisfyAnyOfTest.swift @@ -3,13 +3,6 @@ import Nimble import Foundation final class SatisfyAnyOfTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (SatisfyAnyOfTest) -> () throws -> Void)] { - return [ - ("testSatisfyAnyOf", testSatisfyAnyOf), - ("testOperatorOr", testOperatorOr), - ] - } - func testSatisfyAnyOf() { expect(2).to(satisfyAnyOf(equal(2), equal(3))) #if SUPPORT_IMPLICIT_BRIDGING_CONVERSION diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift index 68086e0..edd9e0e 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift @@ -4,24 +4,15 @@ import Nimble #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE -final class ThrowAssertionTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (ThrowAssertionTest) -> () throws -> Void)] { - return [ - ("testPositiveMatch", testPositiveMatch), - ("testErrorThrown", testErrorThrown), - ("testPostAssertionCodeNotRun", testPostAssertionCodeNotRun), - ("testNegativeMatch", testNegativeMatch), - ("testPositiveMessage", testPositiveMessage), - ("testNegativeMessage", testNegativeMessage), - ] - } +private let error: Error = NSError(domain: "test", code: 0, userInfo: nil) +final class ThrowAssertionTest: XCTestCase { func testPositiveMatch() { expect { () -> Void in fatalError() }.to(throwAssertion()) } func testErrorThrown() { - expect { throw NSError(domain: "test", code: 0, userInfo: nil) }.toNot(throwAssertion()) + expect { throw error }.toNot(throwAssertion()) } func testPostAssertionCodeNotRun() { @@ -50,6 +41,10 @@ final class ThrowAssertionTest: XCTestCase, XCTestCaseProvider { failsWithErrorMessage("expected to throw an assertion") { expect { () -> Void? in return }.to(throwAssertion()) } + + failsWithErrorMessage("expected to throw an assertion; threw error instead <\(error)>") { + expect { throw error }.to(throwAssertion()) + } } func testNegativeMessage() { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ThrowErrorTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ThrowErrorTest.swift index f11c8c5..7a7253f 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ThrowErrorTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ThrowErrorTest.swift @@ -10,6 +10,15 @@ enum EquatableError: Error { case parameterized(x: Int) } +extension EquatableError: CustomDebugStringConvertible { + var debugDescription: String { + switch self { + case .parameterized(let x): + return "parameterized(x: \(x))" + } + } +} + extension EquatableError: Equatable { } @@ -21,8 +30,10 @@ func == (lhs: EquatableError, rhs: EquatableError) -> Bool { } enum CustomDebugStringConvertibleError: Error { + // swiftlint:disable identifier_name case a case b + // swiftlint:enable identifier_name } extension CustomDebugStringConvertibleError: CustomDebugStringConvertible { @@ -32,18 +43,6 @@ extension CustomDebugStringConvertibleError: CustomDebugStringConvertible { } final class ThrowErrorTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (ThrowErrorTest) -> () throws -> Void)] { - return [ - ("testPositiveMatches", testPositiveMatches), - ("testPositiveMatchesWithClosures", testPositiveMatchesWithClosures), - ("testNegativeMatches", testNegativeMatches), - ("testPositiveNegatedMatches", testPositiveNegatedMatches), - ("testNegativeNegatedMatches", testNegativeNegatedMatches), - ("testNegativeMatchesDoNotCallClosureWithoutError", testNegativeMatchesDoNotCallClosureWithoutError), - ("testNegativeMatchesWithClosure", testNegativeMatchesWithClosure), - ] - } - func testPositiveMatches() { expect { throw NimbleError.laugh }.to(throwError()) expect { throw NimbleError.laugh }.to(throwError(NimbleError.laugh)) @@ -80,11 +79,11 @@ final class ThrowErrorTest: XCTestCase, XCTestCaseProvider { func testNegativeMatches() { // Same case, different arguments - failsWithErrorMessage("expected to throw error , got ") { + failsWithErrorMessage("expected to throw error , got ") { expect { throw EquatableError.parameterized(x: 1) }.to(throwError(EquatableError.parameterized(x: 2))) } // Same case, different arguments - failsWithErrorMessage("expected to throw error , got ") { + failsWithErrorMessage("expected to throw error , got ") { expect { throw EquatableError.parameterized(x: 1) }.to(throwError(EquatableError.parameterized(x: 2))) } // Different case diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ToSucceedTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ToSucceedTest.swift index dde999a..0079f23 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ToSucceedTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ToSucceedTest.swift @@ -2,12 +2,6 @@ import XCTest import Nimble final class ToSucceedTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (ToSucceedTest) -> () throws -> Void)] { - return [ - ("testToSucceed", testToSucceed), - ] - } - func testToSucceed() { expect({ return .succeeded diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/SynchronousTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/SynchronousTest.swift similarity index 71% rename from Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/SynchronousTests.swift rename to Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/SynchronousTest.swift index ce8181b..1f412dd 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/SynchronousTests.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/SynchronousTest.swift @@ -3,24 +3,6 @@ import XCTest import Nimble final class SynchronousTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (SynchronousTest) -> () throws -> Void)] { - return [ - ("testFailAlwaysFails", testFailAlwaysFails), - ("testUnexpectedErrorsThrownFails", testUnexpectedErrorsThrownFails), - ("testToMatchesIfMatcherReturnsTrue", testToMatchesIfMatcherReturnsTrue), - ("testToProvidesActualValueExpression", testToProvidesActualValueExpression), - ("testToProvidesAMemoizedActualValueExpression", testToProvidesActualValueExpression), - ("testToProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl", testToProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl), - ("testToMatchAgainstLazyProperties", testToMatchAgainstLazyProperties), - ("testToNotMatchesIfMatcherReturnsTrue", testToNotMatchesIfMatcherReturnsTrue), - ("testToNotProvidesActualValueExpression", testToNotProvidesActualValueExpression), - ("testToNotProvidesAMemoizedActualValueExpression", testToNotProvidesAMemoizedActualValueExpression), - ("testToNotProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl", testToNotProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl), - ("testToNotNegativeMatches", testToNotNegativeMatches), - ("testNotToMatchesLikeToNot", testNotToMatchesLikeToNot), - ] - } - class Error: Swift.Error {} let errorToThrow = Error() @@ -49,6 +31,12 @@ final class SynchronousTest: XCTestCase, XCTestCaseProvider { func testToMatchesIfMatcherReturnsTrue() { expect(1).to(MatcherFunc { _, _ in true }) expect {1}.to(MatcherFunc { _, _ in true }) + + expect(1).to(MatcherFunc { _, _ in true }.predicate) + expect {1}.to(MatcherFunc { _, _ in true }.predicate) + + expect(1).to(Predicate.simple("match") { _ in .matches }) + expect {1}.to(Predicate.simple("match") { _ in .matches }) } func testToProvidesActualValueExpression() { @@ -88,6 +76,12 @@ final class SynchronousTest: XCTestCase, XCTestCaseProvider { func testToNotMatchesIfMatcherReturnsTrue() { expect(1).toNot(MatcherFunc { _, _ in false }) expect {1}.toNot(MatcherFunc { _, _ in false }) + + expect(1).toNot(MatcherFunc { _, _ in false }.predicate) + expect {1}.toNot(MatcherFunc { _, _ in false }.predicate) + + expect(1).toNot(Predicate.simple("match") { _ in .doesNotMatch }) + expect {1}.toNot(Predicate.simple("match") { _ in .doesNotMatch }) } func testToNotProvidesActualValueExpression() { @@ -116,13 +110,33 @@ final class SynchronousTest: XCTestCase, XCTestCaseProvider { expect(callCount).to(equal(1)) } + func testToNegativeMatches() { + failsWithErrorMessage("expected to match, got <1>") { + expect(1).to(MatcherFunc { _, _ in false }) + } + failsWithErrorMessage("expected to match, got <1>") { + expect(1).to(MatcherFunc { _, _ in false }.predicate) + } + failsWithErrorMessage("expected to match, got <1>") { + expect(1).to(Predicate.simple("match") { _ in .doesNotMatch }) + } + } + func testToNotNegativeMatches() { failsWithErrorMessage("expected to not match, got <1>") { expect(1).toNot(MatcherFunc { _, _ in true }) } + failsWithErrorMessage("expected to not match, got <1>") { + expect(1).toNot(MatcherFunc { _, _ in true }.predicate) + } + failsWithErrorMessage("expected to not match, got <1>") { + expect(1).toNot(Predicate.simple("match") { _ in .matches }) + } } func testNotToMatchesLikeToNot() { expect(1).notTo(MatcherFunc { _, _ in false }) + expect(1).notTo(MatcherFunc { _, _ in false }.predicate) + expect(1).notTo(Predicate.simple("match") { _ in .doesNotMatch }) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/UserDescriptionTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/UserDescriptionTest.swift index 9bb64b6..0c451c8 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/UserDescriptionTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/UserDescriptionTest.swift @@ -2,62 +2,69 @@ import XCTest import Nimble final class UserDescriptionTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (UserDescriptionTest) -> () throws -> Void)] { - return [ - ("testToMatcher_CustomFailureMessage", testToMatcher_CustomFailureMessage), - ("testNotToMatcher_CustomFailureMessage", testNotToMatcher_CustomFailureMessage), - ("testToNotMatcher_CustomFailureMessage", testToNotMatcher_CustomFailureMessage), - ("testToEventuallyMatch_CustomFailureMessage", testToEventuallyMatch_CustomFailureMessage), - ("testToEventuallyNotMatch_CustomFailureMessage", testToEventuallyNotMatch_CustomFailureMessage), - ("testToNotEventuallyMatch_CustomFailureMessage", testToNotEventuallyMatch_CustomFailureMessage), - ] - } - func testToMatcher_CustomFailureMessage() { failsWithErrorMessage( - "These aren't equal!\n" + - "expected to match, got <1>") { - expect(1).to(MatcherFunc { _, _ in false }, description: "These aren't equal!") + """ + These aren't equal! + expected to match, got <1> + """ + ) { + expect(1).to(MatcherFunc { _, _ in false }, description: "These aren't equal!") } } func testNotToMatcher_CustomFailureMessage() { failsWithErrorMessage( - "These aren't equal!\n" + - "expected to not match, got <1>") { - expect(1).notTo(MatcherFunc { _, _ in true }, description: "These aren't equal!") + """ + These aren't equal! + expected to not match, got <1> + """ + ) { + expect(1).notTo(MatcherFunc { _, _ in true }, description: "These aren't equal!") } } func testToNotMatcher_CustomFailureMessage() { failsWithErrorMessage( - "These aren't equal!\n" + - "expected to not match, got <1>") { - expect(1).toNot(MatcherFunc { _, _ in true }, description: "These aren't equal!") + """ + These aren't equal! + expected to not match, got <1> + """ + ) { + expect(1).toNot(MatcherFunc { _, _ in true }, description: "These aren't equal!") } } func testToEventuallyMatch_CustomFailureMessage() { failsWithErrorMessage( - "These aren't eventually equal!\n" + - "expected to eventually equal <1>, got <0>") { - expect { 0 }.toEventually(equal(1), description: "These aren't eventually equal!") + """ + These aren't eventually equal! + expected to eventually equal <1>, got <0> + """ + ) { + expect { 0 }.toEventually(equal(1), description: "These aren't eventually equal!") } } func testToEventuallyNotMatch_CustomFailureMessage() { failsWithErrorMessage( - "These are eventually equal!\n" + - "expected to eventually not equal <1>, got <1>") { - expect { 1 }.toEventuallyNot(equal(1), description: "These are eventually equal!") + """ + These are eventually equal! + expected to eventually not equal <1>, got <1> + """ + ) { + expect { 1 }.toEventuallyNot(equal(1), description: "These are eventually equal!") } } func testToNotEventuallyMatch_CustomFailureMessage() { failsWithErrorMessage( - "These are eventually equal!\n" + - "expected to eventually not equal <1>, got <1>") { - expect { 1 }.toEventuallyNot(equal(1), description: "These are eventually equal!") + """ + These are eventually equal! + expected to eventually not equal <1>, got <1> + """ + ) { + expect { 1 }.toEventuallyNot(equal(1), description: "These are eventually equal!") } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/XCTestManifests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/XCTestManifests.swift new file mode 100644 index 0000000..e0fcd0a --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/XCTestManifests.swift @@ -0,0 +1,386 @@ +import XCTest + +extension AllPassTest { + static let __allTests = [ + ("testAllPassArray", testAllPassArray), + ("testAllPassCollectionsWithOptionalsDontWork", testAllPassCollectionsWithOptionalsDontWork), + ("testAllPassCollectionsWithOptionalsUnwrappingOneOptionalLayer", testAllPassCollectionsWithOptionalsUnwrappingOneOptionalLayer), + ("testAllPassMatcher", testAllPassMatcher), + ("testAllPassSet", testAllPassSet), + ("testAllPassWithNilAsExpectedValue", testAllPassWithNilAsExpectedValue), + ] +} + +extension AsyncTest { + static let __allTests = [ + ("testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed", testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed), + ("testSubjectUnderTestIsReleasedFromMemory", testSubjectUnderTestIsReleasedFromMemory), + ("testToEventuallyMustBeInMainThread", testToEventuallyMustBeInMainThread), + ("testToEventuallyNegativeMatches", testToEventuallyNegativeMatches), + ("testToEventuallyPositiveMatches", testToEventuallyPositiveMatches), + ("testToEventuallyWithCustomDefaultTimeout", testToEventuallyWithCustomDefaultTimeout), + ("testWaitUntilDetectsStalledMainThreadActivity", testWaitUntilDetectsStalledMainThreadActivity), + ("testWaitUntilErrorsIfDoneIsCalledMultipleTimes", testWaitUntilErrorsIfDoneIsCalledMultipleTimes), + ("testWaitUntilMustBeInMainThread", testWaitUntilMustBeInMainThread), + ("testWaitUntilNegativeMatches", testWaitUntilNegativeMatches), + ("testWaitUntilPositiveMatches", testWaitUntilPositiveMatches), + ("testWaitUntilTimesOutIfNotCalled", testWaitUntilTimesOutIfNotCalled), + ("testWaitUntilTimesOutWhenExceedingItsTime", testWaitUntilTimesOutWhenExceedingItsTime), + ("testWaitUntilWithCustomDefaultsTimeout", testWaitUntilWithCustomDefaultsTimeout), + ] +} + +extension BeAKindOfObjCTest { + static let __allTests = [ + ("testFailureMessages", testFailureMessages), + ("testPositiveMatch", testPositiveMatch), + ] +} + +extension BeAKindOfSwiftTest { + static let __allTests = [ + ("testFailureMessages", testFailureMessages), + ("testPositiveMatch", testPositiveMatch), + ] +} + +extension BeAnInstanceOfTest { + static let __allTests = [ + ("testFailureMessages", testFailureMessages), + ("testFailureMessagesSwiftTypes", testFailureMessagesSwiftTypes), + ("testPositiveMatch", testPositiveMatch), + ("testPositiveMatchSwiftTypes", testPositiveMatchSwiftTypes), + ] +} + +extension BeCloseToTest { + static let __allTests = [ + ("testBeCloseTo", testBeCloseTo), + ("testBeCloseToArray", testBeCloseToArray), + ("testBeCloseToOperator", testBeCloseToOperator), + ("testBeCloseToOperatorWithDate", testBeCloseToOperatorWithDate), + ("testBeCloseToWithCGFloat", testBeCloseToWithCGFloat), + ("testBeCloseToWithDate", testBeCloseToWithDate), + ("testBeCloseToWithin", testBeCloseToWithin), + ("testBeCloseToWithinOperator", testBeCloseToWithinOperator), + ("testBeCloseToWithinOperatorWithDate", testBeCloseToWithinOperatorWithDate), + ("testBeCloseToWithNSDate", testBeCloseToWithNSDate), + ("testBeCloseToWithNSNumber", testBeCloseToWithNSNumber), + ("testPlusMinusOperator", testPlusMinusOperator), + ("testPlusMinusOperatorWithDate", testPlusMinusOperatorWithDate), + ] +} + +extension BeEmptyTest { + static let __allTests = [ + ("testBeEmptyNegative", testBeEmptyNegative), + ("testBeEmptyPositive", testBeEmptyPositive), + ("testNilMatches", testNilMatches), + ] +} + +extension BeFalseTest { + static let __allTests = [ + ("testShouldMatchFalse", testShouldMatchFalse), + ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), + ("testShouldNotMatchTrue", testShouldNotMatchTrue), + ] +} + +extension BeFalsyTest { + static let __allTests = [ + ("testShouldMatchFalse", testShouldMatchFalse), + ("testShouldMatchNilBools", testShouldMatchNilBools), + ("testShouldMatchNilTypes", testShouldMatchNilTypes), + ("testShouldNotMatchNonNilTypes", testShouldNotMatchNonNilTypes), + ("testShouldNotMatchTrue", testShouldNotMatchTrue), + ] +} + +extension BeGreaterThanOrEqualToTest { + static let __allTests = [ + ("testGreaterThanOrEqualTo", testGreaterThanOrEqualTo), + ("testGreaterThanOrEqualToOperator", testGreaterThanOrEqualToOperator), + ] +} + +extension BeGreaterThanTest { + static let __allTests = [ + ("testGreaterThan", testGreaterThan), + ("testGreaterThanOperator", testGreaterThanOperator), + ] +} + +extension BeIdenticalToObjectTest { + static let __allTests = [ + ("testBeIdenticalToNegative", testBeIdenticalToNegative), + ("testBeIdenticalToNegativeMessage", testBeIdenticalToNegativeMessage), + ("testBeIdenticalToPositive", testBeIdenticalToPositive), + ("testBeIdenticalToPositiveMessage", testBeIdenticalToPositiveMessage), + ("testFailsOnNils", testFailsOnNils), + ("testOperators", testOperators), + ] +} + +extension BeIdenticalToTest { + static let __allTests = [ + ("testBeAlias", testBeAlias), + ("testBeIdenticalToNegative", testBeIdenticalToNegative), + ("testBeIdenticalToNegativeMessage", testBeIdenticalToNegativeMessage), + ("testBeIdenticalToPositive", testBeIdenticalToPositive), + ("testBeIdenticalToPositiveMessage", testBeIdenticalToPositiveMessage), + ("testOperators", testOperators), + ] +} + +extension BeLessThanOrEqualToTest { + static let __allTests = [ + ("testLessThanOrEqualTo", testLessThanOrEqualTo), + ("testLessThanOrEqualToOperator", testLessThanOrEqualToOperator), + ] +} + +extension BeLessThanTest { + static let __allTests = [ + ("testLessThan", testLessThan), + ("testLessThanOperator", testLessThanOperator), + ] +} + +extension BeNilTest { + static let __allTests = [ + ("testBeNil", testBeNil), + ] +} + +extension BeTrueTest { + static let __allTests = [ + ("testShouldMatchTrue", testShouldMatchTrue), + ("testShouldNotMatchFalse", testShouldNotMatchFalse), + ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), + ] +} + +extension BeTruthyTest { + static let __allTests = [ + ("testShouldMatchBoolConvertibleTypesThatConvertToTrue", testShouldMatchBoolConvertibleTypesThatConvertToTrue), + ("testShouldMatchNonNilTypes", testShouldMatchNonNilTypes), + ("testShouldMatchTrue", testShouldMatchTrue), + ("testShouldNotMatchBoolConvertibleTypesThatConvertToFalse", testShouldNotMatchBoolConvertibleTypesThatConvertToFalse), + ("testShouldNotMatchFalse", testShouldNotMatchFalse), + ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), + ("testShouldNotMatchNilTypes", testShouldNotMatchNilTypes), + ] +} + +extension BeVoidTest { + static let __allTests = [ + ("testBeVoid", testBeVoid), + ] +} + +extension BeginWithTest { + static let __allTests = [ + ("testNegativeMatches", testNegativeMatches), + ("testPositiveMatches", testPositiveMatches), + ] +} + +extension ContainElementSatisfyingTest { + static let __allTests = [ + ("testContainElementSatisfying", testContainElementSatisfying), + ("testContainElementSatisfyingDefaultErrorMessage", testContainElementSatisfyingDefaultErrorMessage), + ("testContainElementSatisfyingNegativeCase", testContainElementSatisfyingNegativeCase), + ("testContainElementSatisfyingNegativeCaseDefaultErrorMessage", testContainElementSatisfyingNegativeCaseDefaultErrorMessage), + ("testContainElementSatisfyingNegativeCaseSpecificErrorMessage", testContainElementSatisfyingNegativeCaseSpecificErrorMessage), + ("testContainElementSatisfyingSpecificErrorMessage", testContainElementSatisfyingSpecificErrorMessage), + ] +} + +extension ContainTest { + static let __allTests = [ + ("testCollectionArguments", testCollectionArguments), + ("testContainObjCSubstring", testContainObjCSubstring), + ("testContainSequence", testContainSequence), + ("testContainSetAlgebra", testContainSetAlgebra), + ("testContainSubstring", testContainSubstring), + ("testVariadicArguments", testVariadicArguments), + ] +} + +extension ElementsEqualTest { + static let __allTests = [ + ("testSequenceElementsEquality", testSequenceElementsEquality), + ] +} + +extension EndWithTest { + static let __allTests = [ + ("testEndWithNegatives", testEndWithNegatives), + ("testEndWithPositives", testEndWithPositives), + ] +} + +extension EqualTest { + static let __allTests = [ + ("testArrayEquality", testArrayEquality), + ("testArrayOfOptionalsEquality", testArrayOfOptionalsEquality), + ("testDataEquality", testDataEquality), + ("testDictionariesWithDifferentSequences", testDictionariesWithDifferentSequences), + ("testDictionaryEquality", testDictionaryEquality), + ("testDoesNotMatchNils", testDoesNotMatchNils), + ("testEquality", testEquality), + ("testNSObjectEquality", testNSObjectEquality), + ("testOperatorEquality", testOperatorEquality), + ("testOperatorEqualityWithArrays", testOperatorEqualityWithArrays), + ("testOperatorEqualityWithDictionaries", testOperatorEqualityWithDictionaries), + ("testOptionalEquality", testOptionalEquality), + ("testSetEquality", testSetEquality), + ] +} + +extension HaveCountTest { + static let __allTests = [ + ("testHaveCountForArray", testHaveCountForArray), + ("testHaveCountForDictionary", testHaveCountForDictionary), + ("testHaveCountForSet", testHaveCountForSet), + ] +} + +extension MatchErrorTest { + static let __allTests = [ + ("testDoesNotMatchNils", testDoesNotMatchNils), + ("testMatchErrorNegative", testMatchErrorNegative), + ("testMatchErrorPositive", testMatchErrorPositive), + ("testMatchNegativeMessage", testMatchNegativeMessage), + ("testMatchNSErrorNegative", testMatchNSErrorNegative), + ("testMatchNSErrorPositive", testMatchNSErrorPositive), + ("testMatchPositiveMessage", testMatchPositiveMessage), + ] +} + +extension MatchTest { + static let __allTests = [ + ("testMatchNegative", testMatchNegative), + ("testMatchNegativeMessage", testMatchNegativeMessage), + ("testMatchNils", testMatchNils), + ("testMatchPositive", testMatchPositive), + ("testMatchPositiveMessage", testMatchPositiveMessage), + ] +} + +extension PostNotificationTest { + static let __allTests = [ + ("testFailsWhenNoNotificationsArePosted", testFailsWhenNoNotificationsArePosted), + ("testFailsWhenNotificationWithWrongNameIsPosted", testFailsWhenNotificationWithWrongNameIsPosted), + ("testFailsWhenNotificationWithWrongObjectIsPosted", testFailsWhenNotificationWithWrongObjectIsPosted), + ("testPassesWhenAllExpectedNotificationsArePosted", testPassesWhenAllExpectedNotificationsArePosted), + ("testPassesWhenExpectedNotificationEventuallyIsPosted", testPassesWhenExpectedNotificationEventuallyIsPosted), + ("testPassesWhenExpectedNotificationIsPosted", testPassesWhenExpectedNotificationIsPosted), + ("testPassesWhenNoNotificationsArePosted", testPassesWhenNoNotificationsArePosted), + ] +} + +extension SatisfyAllOfTest { + static let __allTests = [ + ("testOperatorAnd", testOperatorAnd), + ("testSatisfyAllOf", testSatisfyAllOf), + ] +} + +extension SatisfyAnyOfTest { + static let __allTests = [ + ("testOperatorOr", testOperatorOr), + ("testSatisfyAnyOf", testSatisfyAnyOf), + ] +} + +extension SynchronousTest { + static let __allTests = [ + ("testFailAlwaysFails", testFailAlwaysFails), + ("testNotToMatchesLikeToNot", testNotToMatchesLikeToNot), + ("testToMatchAgainstLazyProperties", testToMatchAgainstLazyProperties), + ("testToMatchesIfMatcherReturnsTrue", testToMatchesIfMatcherReturnsTrue), + ("testToNegativeMatches", testToNegativeMatches), + ("testToNotMatchesIfMatcherReturnsTrue", testToNotMatchesIfMatcherReturnsTrue), + ("testToNotNegativeMatches", testToNotNegativeMatches), + ("testToNotProvidesActualValueExpression", testToNotProvidesActualValueExpression), + ("testToNotProvidesAMemoizedActualValueExpression", testToNotProvidesAMemoizedActualValueExpression), + ("testToNotProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl", testToNotProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl), + ("testToProvidesActualValueExpression", testToProvidesActualValueExpression), + ("testToProvidesAMemoizedActualValueExpression", testToProvidesAMemoizedActualValueExpression), + ("testToProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl", testToProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl), + ("testUnexpectedErrorsThrownFails", testUnexpectedErrorsThrownFails), + ] +} + +extension ThrowErrorTest { + static let __allTests = [ + ("testNegativeMatches", testNegativeMatches), + ("testNegativeMatchesDoNotCallClosureWithoutError", testNegativeMatchesDoNotCallClosureWithoutError), + ("testNegativeMatchesWithClosure", testNegativeMatchesWithClosure), + ("testNegativeNegatedMatches", testNegativeNegatedMatches), + ("testPositiveMatches", testPositiveMatches), + ("testPositiveMatchesWithClosures", testPositiveMatchesWithClosures), + ("testPositiveNegatedMatches", testPositiveNegatedMatches), + ] +} + +extension ToSucceedTest { + static let __allTests = [ + ("testToSucceed", testToSucceed), + ] +} + +extension UserDescriptionTest { + static let __allTests = [ + ("testNotToMatcher_CustomFailureMessage", testNotToMatcher_CustomFailureMessage), + ("testToEventuallyMatch_CustomFailureMessage", testToEventuallyMatch_CustomFailureMessage), + ("testToEventuallyNotMatch_CustomFailureMessage", testToEventuallyNotMatch_CustomFailureMessage), + ("testToMatcher_CustomFailureMessage", testToMatcher_CustomFailureMessage), + ("testToNotEventuallyMatch_CustomFailureMessage", testToNotEventuallyMatch_CustomFailureMessage), + ("testToNotMatcher_CustomFailureMessage", testToNotMatcher_CustomFailureMessage), + ] +} + +#if !os(macOS) +public func __allTests() -> [XCTestCaseEntry] { + return [ + testCase(AllPassTest.__allTests), + testCase(AsyncTest.__allTests), + testCase(BeAKindOfObjCTest.__allTests), + testCase(BeAKindOfSwiftTest.__allTests), + testCase(BeAnInstanceOfTest.__allTests), + testCase(BeCloseToTest.__allTests), + testCase(BeEmptyTest.__allTests), + testCase(BeFalseTest.__allTests), + testCase(BeFalsyTest.__allTests), + testCase(BeGreaterThanOrEqualToTest.__allTests), + testCase(BeGreaterThanTest.__allTests), + testCase(BeIdenticalToObjectTest.__allTests), + testCase(BeIdenticalToTest.__allTests), + testCase(BeLessThanOrEqualToTest.__allTests), + testCase(BeLessThanTest.__allTests), + testCase(BeNilTest.__allTests), + testCase(BeTrueTest.__allTests), + testCase(BeTruthyTest.__allTests), + testCase(BeVoidTest.__allTests), + testCase(BeginWithTest.__allTests), + testCase(ContainElementSatisfyingTest.__allTests), + testCase(ContainTest.__allTests), + testCase(ElementsEqualTest.__allTests), + testCase(EndWithTest.__allTests), + testCase(EqualTest.__allTests), + testCase(HaveCountTest.__allTests), + testCase(MatchErrorTest.__allTests), + testCase(MatchTest.__allTests), + testCase(PostNotificationTest.__allTests), + testCase(SatisfyAllOfTest.__allTests), + testCase(SatisfyAnyOfTest.__allTests), + testCase(SynchronousTest.__allTests), + testCase(ThrowErrorTest.__allTests), + testCase(ToSucceedTest.__allTests), + testCase(UserDescriptionTest.__allTests), + ] +} +#endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCAsyncTest.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCAsyncTest.m index f052e74..06f5b32 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCAsyncTest.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCAsyncTest.m @@ -29,6 +29,11 @@ waitUntil(^(void (^done)(void)){ done(); }); + waitUntil(^(void (^done)(void)){ + dispatch_async(dispatch_get_main_queue(), ^{ + done(); + }); + }); expectFailureMessage(@"Waited more than 1.0 second", ^{ waitUntil(^(void (^done)(void)){ /* ... */ }); diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCContainTest.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCContainTest.m index 8b954fe..62d6e45 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCContainTest.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCContainTest.m @@ -64,4 +64,13 @@ }); } +- (void)testUnsupportedTypes { + expectFailureMessage(@"expected to contain (only works for NSArrays, NSSets, NSHashTables, and NSStrings), got <1>", ^{ + expect(@1).to(contain(@"foo")); + }); + expectFailureMessage(@"expected to not contain (only works for NSArrays, NSSets, NSHashTables, and NSStrings), got <1>", ^{ + expect(@1).toNot(contain(@"foo")); + }); +} + @end diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCEndWithTest.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCEndWithTest.m index b960f01..b48b3fc 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCEndWithTest.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCEndWithTest.m @@ -13,7 +13,6 @@ expect(@"hello world!").toNot(endWith(@"hello")); expect(array).to(endWith(@2)); expect(array).toNot(endWith(@1)); - expect(@1).toNot(contain(@"foo")); } - (void)testNegativeMatches { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCHaveCountTest.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCHaveCountTest.m index 31053c8..ea0e31f 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCHaveCountTest.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCHaveCountTest.m @@ -171,4 +171,13 @@ }); } +- (void)testNilMatches { + expectNilFailureMessage(@"expected to have a collection with count 3, got ", ^{ + expect(nil).to(haveCount(3)); + }); + expectNilFailureMessage(@"expected to not have a collection with count 3, got ", ^{ + expect(nil).toNot(haveCount(3)); + }); +} + @end diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/test b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/test index 0766351..c213afe 100755 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/test +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/test @@ -63,7 +63,7 @@ function test_ios { function test_tvos { run osascript -e 'tell app "Simulator" to quit' - run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-tvOS" -configuration "Debug" -sdk "appletvsimulator$BUILD_TVOS_SDK_VERSION" -destination "name=Apple TV 1080p,OS=$RUNTIME_TVOS_SDK_VERSION" build-for-testing test-without-building + run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-tvOS" -configuration "Debug" -sdk "appletvsimulator$BUILD_TVOS_SDK_VERSION" -destination "name=Apple TV,OS=$RUNTIME_TVOS_SDK_VERSION" build-for-testing test-without-building } function test_macos { @@ -74,13 +74,17 @@ function test_podspec { echo "Gathering CocoaPods installation information..." run bundle exec pod --version echo "Linting podspec..." + # To work around the lint error: "ERROR | swift: Specification `Nimble` specifies an inconsistent `swift_version` (`4.0`) compared to the one present in your `.swift-version` file (`4.1`). Please remove the `.swift-version` file which is now deprecated and only use the `swift_version` attribute within your podspec." + # `.swift-version` is for swiftenv, not for CocoaPods, so we can't remove the file as suggested. + run mv .swift-version .swift-version.backup # Note: remove `--allow-warnings` once old Matcher API has been removed - run bundle exec pod lib lint Nimble.podspec --allow-warnings + run bundle exec pod lib lint Nimble.podspec --allow-warnings --skip-import-validation + run mv .swift-version.backup .swift-version } function test_swiftpm { if [ -d .build ]; then - run swift build --clean + run swift package clean fi run swift build && swift test } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.hound.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.hound.yml index b867fd9..5a66441 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.hound.yml +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.hound.yml @@ -1,2 +1,4 @@ swift: - config_file: .swiftlint.yml + config_file: .swiftlint.yml +rubocop: + enabled: false diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.swift-version b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.swift-version index 8c50098..fae6e3d 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.swift-version +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.swift-version @@ -1 +1 @@ -3.1 +4.2.1 diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.travis.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.travis.yml index cdf7a69..960afba 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.travis.yml +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.travis.yml @@ -1,47 +1,48 @@ -osx_image: xcode8.3 language: generic matrix: include: - - os: osx + - name: CocoaPods Lint & Danger + os: osx + osx_image: xcode10.1 + language: ruby + script: + - PODSPEC=1 ./script/travis-script-macos + - bundle exec danger + - &xcode + name: Xcode 10.1 / Swift 4.2 + os: osx env: - - PLATFORM=macos - XCODE_ACTION="build-for-testing test-without-building" - - os: osx - osx_image: xcode9.3 - env: - - PLATFORM=macos - - XCODE_ACTION="build-for-testing test-without-building" - - os: osx - env: - - PLATFORM=ios - - XCODE_ACTION="build-for-testing test-without-building" - - os: osx - env: - - PLATFORM=tvos - - XCODE_ACTION="build-for-testing test-without-building" - - os: osx - env: - - PLATFORM=swiftpm - - os: osx - osx_image: xcode9.3 - env: - - PLATFORM=swiftpm - - os: osx - env: - - PODSPEC=1 - - os: linux - sudo: required - dist: trusty - - os: linux + osx_image: xcode10.1 + script: + - PLATFORM=macos ./script/travis-script-macos + - PLATFORM=macos_static ./script/travis-script-macos + - PLATFORM=ios ./script/travis-script-macos + - PLATFORM=tvos ./script/travis-script-macos + - <<: *xcode + name: Xcode 10.2 / Swift 5.0 + osx_image: xcode10.2 + - &swiftpm_darwin + name: SwiftPM / Darwin / Swift 4.2 + os: osx + osx_image: xcode10.1 + script: PLATFORM=swiftpm ./script/travis-script-macos + - <<: *swiftpm_darwin + name: SwiftPM / Darwin / Swift 5.0 + osx_image: xcode10.2 + - &swiftpm_linux + name: SwiftPM / Linux / Swift 4.2 + os: linux sudo: required dist: trusty env: - - SWIFT_VERSION=4.1 -install: - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./script/travis-install-macos; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./script/travis-install-linux; fi - - if [[ "$PODSPEC" ]]; then gem install bundler; bundle install; fi -script: - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./script/travis-script-macos; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./script/travis-script-linux; fi - - if [[ "$PODSPEC" ]]; then danger; fi + - SWIFT_VERSION=4.2.1 + install: ./script/travis-install-linux + script: ./script/travis-script-linux + - <<: *swiftpm_linux + name: SwiftPM / Linux / Swift 5.0 Development + env: + - SWIFT_VERSION=5.0-DEVELOPMENT-SNAPSHOT-2019-02-28-a + +notifications: + email: false diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Dangerfile b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Dangerfile index 719de60..ff6259f 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Dangerfile +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Dangerfile @@ -2,11 +2,11 @@ @SDM_DANGER_BIG_PR_LINES = 50 # set the files to watch and fail if there are changes -@SDM_DANGER_IMMUTABLE_FILES = ['LICENSE', 'CONTRIBUTING.md', 'CODE_OF_CONDUCT.md'] +@SDM_DANGER_IMMUTABLE_FILES = ['LICENSE', 'CODE_OF_CONDUCT.md'] # Sometimes it's a README fix, or something like that which is trivial not_declared_trivial = !(github.pr_title.include? "#trivial") -has_app_changes = !git.modified_files.grep(/Sources/).empty? +has_app_changes = git.modified_files.grep(/Sources/).any? { |file| file.end_with?(".swift") || file.end_with?(".h") } no_test_modify = git.modified_files.grep(/Tests/).empty? # Warns when changing source files diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/en-us/SharedExamples.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/en-us/SharedExamples.md index 339bf34..1f14e64 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/en-us/SharedExamples.md +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/en-us/SharedExamples.md @@ -18,7 +18,7 @@ import Nimble class EdibleSharedExamplesConfiguration: QuickConfiguration { override class func configure(_ configuration: Configuration) { - sharedExamples("something edible") { (sharedExampleContext: SharedExampleContext) in + sharedExamples("something edible") { (sharedExampleContext: @escaping SharedExampleContext) in it("makes dolphins happy") { let dolphin = Dolphin(happy: false) let edible = sharedExampleContext()["edible"] diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ko-kr/BehavioralTesting.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ko-kr/BehavioralTesting.md index 39dd525..ca2b5e1 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ko-kr/BehavioralTesting.md +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ko-kr/BehavioralTesting.md @@ -7,7 +7,7 @@ - 동작이 동일하게 유지되더라도 응용 프로그램 코드가 변경되면 중단되는 테스트는 **취약한 테스트 (brittle tests)**입니다. 우리가 `GorillaDB` 라는 바나나 데이터베이스를 가지고 있다고 가정합시다. -`GorillaDB` 는 key-value로 바나나들을 저장하고 있습니다. 우리는 바바나를 다음과 같이 저장할 수 있습니다 : +`GorillaDB` 는 key-value로 바나나들을 저장하고 있습니다. 우리는 바나나를 다음과 같이 저장할 수 있습니다 : ```swift let database = GorillaDB() diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ko-kr/InstallingQuick.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ko-kr/InstallingQuick.md index 8596930..6b875d5 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ko-kr/InstallingQuick.md +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ko-kr/InstallingQuick.md @@ -72,7 +72,7 @@ Git 서브모듈에 대한 자세한 내용은 [여기](http://git-scm.com/book 먼저, 코코아팟의 버전을 0.36.0 이상의 버전으로 업데이트하세요. Swift를 사용하여 코코아팟을 설치하는 데 필요합니다. -그리고, Quick과 Nimble을 Podfile 에 추가하세요. 또한, ```use_frameworks!```은 코코아팟에서 Swift를 사용하기 데 필요합니다: +그리고, Quick과 Nimble을 Podfile 에 추가하세요. 또한, ```use_frameworks!```은 코코아팟에서 Swift를 사용하기에 필요합니다: ```rb diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.swift-version b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.swift-version index 9f55b2c..bf77d54 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.swift-version +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.swift-version @@ -1 +1 @@ -3.0 +4.2 diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.swiftlint.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.swiftlint.yml index cb105e7..146ea6a 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.swiftlint.yml +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.swiftlint.yml @@ -1,8 +1,5 @@ disabled_rules: - - todo - - variable_name - - force_try - - force_cast + - included: - Sources @@ -10,6 +7,8 @@ included: excluded: - Carthage/Checkouts + - Tests/NimbleTests/XCTestManifests.swift + - Tests/NimbleTests/Helpers/XCTestCaseProvider.swift trailing_comma: mandatory_comma: true @@ -17,3 +16,16 @@ trailing_comma: line_length: ignores_comments: true ignores_function_declarations: true + +identifier_name: + max_length: 50 + excluded: + - x + - l + - r + - e + - n1 + - n2 + - to + allowed_symbols: + - _ diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.travis.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.travis.yml index 20d7f7d..fb72977 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.travis.yml +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.travis.yml @@ -1,39 +1,52 @@ -osx_image: xcode8.3 +osx_image: xcode10.1 language: generic matrix: include: - os: osx sudo: required env: TYPE=podspec + install: bundle install + name: CocoaPods Lint - os: osx - env: TYPE=ios NIMBLE_RUNTIME_IOS_SDK_VERSION=10.0 + env: TYPE=ios + name: iOS / Swift 4.2.1 - os: osx - env: TYPE=tvos NIMBLE_RUNTIME_TVOS_SDK_VERSION=10.0 + env: TYPE=tvos + name: tvOS / Swift 4.2.1 - os: osx env: TYPE=macos + name: macOS / Swift 4.2.1 - os: osx env: TYPE=macos - osx_image: xcode9 + osx_image: xcode10.2 + name: macOS / Swift 5.0 - os: osx - env: TYPE=swiftpm + env: + - TYPE=swiftpm - os: osx - env: TYPE=swiftpm - osx_image: xcode9 - - os: linux - dist: trusty - sudo: required - env: TYPE=swiftpm - install: - - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" - - os: linux + env: + - TYPE=swiftpm + osx_image: xcode10.2 + - &linux + name: Linux / Swift 4.2.1 + os: linux dist: trusty sudo: required env: - TYPE=swiftpm - - SWIFT_VERSION=4.0.2 + - SWIFT_VERSION=4.2.1 install: - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" -install: - - if [[ "$TYPE" == "podspec" ]]; then sudo gem install bundler; bundle install; fi + - <<: *linux + name: Linux / Swift 5.0 Development + env: + - TYPE=swiftpm + - SWIFT_VERSION=5.0-DEVELOPMENT-SNAPSHOT-2019-02-28-a + install: + - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" +install: true script: - ./test $TYPE + +notifications: + email: false diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Cartfile.private b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Cartfile.private index 8e95dd6..23d7e11 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Cartfile.private +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Cartfile.private @@ -1 +1 @@ -github "mattgallagher/CwlPreconditionTesting" "cb7ab89273cfd0725a7a2f865cc6fc560a9b9083" +github "mattgallagher/CwlPreconditionTesting" "1e62a726d54c743f4585233f08fcaac7307319b5" diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Cartfile.resolved b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Cartfile.resolved index 3984e09..32a1c25 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Cartfile.resolved +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Cartfile.resolved @@ -1,2 +1,2 @@ github "mattgallagher/CwlCatchException" "b14c111e9b33cd142bd4bc75c482cfd5c3490923" -github "mattgallagher/CwlPreconditionTesting" "cb7ab89273cfd0725a7a2f865cc6fc560a9b9083" +github "mattgallagher/CwlPreconditionTesting" "1e62a726d54c743f4585233f08fcaac7307319b5" diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h index f9dbedd..7c50da1 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h @@ -20,6 +20,8 @@ #import +extern bool _swift_reportFatalErrorsToDebugger; + //! Project version number for CwlUtils. FOUNDATION_EXPORT double CwlPreconditionTestingVersionNumber; diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h index 3434a71..4e28f95 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h @@ -20,6 +20,8 @@ #import +extern bool _swift_reportFatalErrorsToDebugger; + //! Project version number for CwlUtils. FOUNDATION_EXPORT double CwlPreconditionTesting_POSIXVersionNumber; diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile index eca9219..206f109 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile @@ -1,4 +1,4 @@ # A sample Gemfile source "https://rubygems.org" -gem 'cocoapods', '1.5.0' +gem 'cocoapods', '~> 1.6.0.rc.2' diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile.lock b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile.lock index 36a0839..cc03cbf 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile.lock +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile.lock @@ -2,75 +2,75 @@ GEM remote: https://rubygems.org/ specs: CFPropertyList (3.0.0) - activesupport (4.2.10) + activesupport (4.2.11) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - atomos (0.1.2) + atomos (0.1.3) claide (1.0.2) - cocoapods (1.5.0) + cocoapods (1.6.0.rc.2) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.5.0) + cocoapods-core (= 1.6.0.rc.2) cocoapods-deintegrate (>= 1.0.2, < 2.0) - cocoapods-downloader (>= 1.2.0, < 2.0) + cocoapods-downloader (>= 1.2.2, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) cocoapods-stats (>= 1.0.0, < 2.0) - cocoapods-trunk (>= 1.3.0, < 2.0) + cocoapods-trunk (>= 1.3.1, < 2.0) cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) - fourflusher (~> 2.0.1) + fourflusher (>= 2.2.0, < 3.0) gh_inspector (~> 1.0) - molinillo (~> 0.6.5) + molinillo (~> 0.6.6) nap (~> 1.0) - ruby-macho (~> 1.1) - xcodeproj (>= 1.5.7, < 2.0) - cocoapods-core (1.5.0) + ruby-macho (~> 1.3, >= 1.3.1) + xcodeproj (>= 1.8.0, < 2.0) + cocoapods-core (1.6.0.rc.2) activesupport (>= 4.0.2, < 6) fuzzy_match (~> 2.0.4) nap (~> 1.0) cocoapods-deintegrate (1.0.2) - cocoapods-downloader (1.2.0) + cocoapods-downloader (1.2.2) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) - cocoapods-stats (1.0.0) - cocoapods-trunk (1.3.0) + cocoapods-stats (1.1.0) + cocoapods-trunk (1.3.1) nap (>= 0.8, < 2.0) netrc (~> 0.11) cocoapods-try (1.1.0) colored2 (3.1.2) - concurrent-ruby (1.0.5) + concurrent-ruby (1.1.4) escape (0.0.4) - fourflusher (2.0.1) + fourflusher (2.2.0) fuzzy_match (2.0.4) gh_inspector (1.1.3) i18n (0.9.5) concurrent-ruby (~> 1.0) minitest (5.11.3) - molinillo (0.6.5) - nanaimo (0.2.5) + molinillo (0.6.6) + nanaimo (0.2.6) nap (1.1.0) netrc (0.11.0) - ruby-macho (1.1.0) + ruby-macho (1.3.1) thread_safe (0.3.6) tzinfo (1.2.5) thread_safe (~> 0.1) - xcodeproj (1.5.7) + xcodeproj (1.8.0) CFPropertyList (>= 2.3.3, < 4.0) - atomos (~> 0.1.2) + atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) - nanaimo (~> 0.2.4) + nanaimo (~> 0.2.6) PLATFORMS ruby DEPENDENCIES - cocoapods (= 1.5.0) + cocoapods (~> 1.6.0.rc.2) BUNDLED WITH - 1.16.1 + 1.17.2 diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.podspec b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.podspec index f3fed7e..d66190b 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.podspec +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Nimble" - s.version = "7.1.1" + s.version = "8.0.0" s.summary = "A Matcher Framework for Swift and Objective-C" s.description = <<-DESC Use Nimble to express the expected outcomes of Swift or Objective-C expressions. Inspired by Cedar. @@ -38,16 +38,18 @@ Pod::Spec.new do |s| "Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h", ] - s.private_header_files = "Sources/NimbleObjectiveC/CurrentTestCaseTracker.h" - s.exclude_files = "Sources/Nimble/Adapters/NonObjectiveC/*.swift" s.weak_framework = "XCTest" s.requires_arc = true s.compiler_flags = '-DPRODUCT_NAME=Nimble/Nimble' s.pod_target_xcconfig = { + 'APPLICATION_EXTENSION_API_ONLY' => 'YES', 'ENABLE_BITCODE' => 'NO', - 'OTHER_LDFLAGS' => '-weak-lswiftXCTest', + 'OTHER_LDFLAGS' => '$(inherited) -weak-lswiftXCTest -Xlinker -no_application_extension', 'OTHER_SWIFT_FLAGS' => '$(inherited) -suppress-warnings', 'FRAMEWORK_SEARCH_PATHS' => '$(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks"', } + + s.cocoapods_version = '>= 1.4.0' + s.swift_version = '4.2' end diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/project.pbxproj b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/project.pbxproj index 91ec261..2bf9a6a 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/project.pbxproj +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/project.pbxproj @@ -23,8 +23,8 @@ /* Begin PBXBuildFile section */ 1F0648CC19639F5A001F9C46 /* ObjectWithLazyProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */; }; 1F0648CD19639F5A001F9C46 /* ObjectWithLazyProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */; }; - 1F0648D41963AAB2001F9C46 /* SynchronousTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTests.swift */; }; - 1F0648D51963AAB2001F9C46 /* SynchronousTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTests.swift */; }; + 1F0648D41963AAB2001F9C46 /* SynchronousTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */; }; + 1F0648D51963AAB2001F9C46 /* SynchronousTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */; }; 1F14FB64194180C5009F2A08 /* utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F14FB63194180C5009F2A08 /* utils.swift */; }; 1F1871C51CA89EDB00A34BF2 /* DSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1871BC1CA89EDB00A34BF2 /* DSL.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1F1871C61CA89EDB00A34BF2 /* DSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871BD1CA89EDB00A34BF2 /* DSL.m */; }; @@ -50,10 +50,10 @@ 1F1871E01CA89EF600A34BF2 /* DSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1871BC1CA89EDB00A34BF2 /* DSL.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1F1871E11CA89EF600A34BF2 /* NMBExceptionCapture.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1871BE1CA89EDB00A34BF2 /* NMBExceptionCapture.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1F1871E21CA89EF600A34BF2 /* NMBStringify.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1871C01CA89EDB00A34BF2 /* NMBStringify.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 1F1871E41CA89FB600A34BF2 /* AsyncMatcherWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* AsyncMatcherWrapper.swift */; }; + 1F1871E41CA89FB600A34BF2 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* Async.swift */; }; 1F1871E61CA89FCD00A34BF2 /* MatcherFunc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */; }; - 1F1871E71CA8A18400A34BF2 /* AsyncMatcherWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* AsyncMatcherWrapper.swift */; }; - 1F1871E81CA8A18400A34BF2 /* AsyncMatcherWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* AsyncMatcherWrapper.swift */; }; + 1F1871E71CA8A18400A34BF2 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* Async.swift */; }; + 1F1871E81CA8A18400A34BF2 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* Async.swift */; }; 1F1871E91CA8A18700A34BF2 /* MatcherFunc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */; }; 1F1871EB1CA8A18800A34BF2 /* MatcherFunc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */; }; 1F1A742F1940169200FFFC47 /* Nimble.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1A742E1940169200FFFC47 /* Nimble.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -143,11 +143,11 @@ 1F5DF1891BDCA0F500C3A531 /* RaisesException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1E1968AB07008ED995 /* RaisesException.swift */; }; 1F5DF18A1BDCA0F500C3A531 /* ThrowError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29EA59651B551EE6002D767E /* ThrowError.swift */; }; 1F5DF18B1BDCA0F500C3A531 /* Functional.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD251968AB07008ED995 /* Functional.swift */; }; - 1F5DF18C1BDCA0F500C3A531 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Async.swift */; }; + 1F5DF18C1BDCA0F500C3A531 /* Await.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Await.swift */; }; 1F5DF18D1BDCA0F500C3A531 /* SourceLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD271968AB07008ED995 /* SourceLocation.swift */; }; 1F5DF18E1BDCA0F500C3A531 /* Stringers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD281968AB07008ED995 /* Stringers.swift */; }; 1F5DF1921BDCA10200C3A531 /* AsynchronousTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F925EE5195C121200ED456B /* AsynchronousTest.swift */; }; - 1F5DF1931BDCA10200C3A531 /* SynchronousTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTests.swift */; }; + 1F5DF1931BDCA10200C3A531 /* SynchronousTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */; }; 1F5DF1941BDCA10200C3A531 /* UserDescriptionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965B0D0B1B62C06D0005AE66 /* UserDescriptionTest.swift */; }; 1F5DF1951BDCA10200C3A531 /* utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F14FB63194180C5009F2A08 /* utils.swift */; }; 1F5DF1961BDCA10200C3A531 /* ObjectWithLazyProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */; }; @@ -273,8 +273,8 @@ 1FD8CD5B1968AB07008ED995 /* Equal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1C1968AB07008ED995 /* Equal.swift */; }; 1FD8CD5E1968AB07008ED995 /* RaisesException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1E1968AB07008ED995 /* RaisesException.swift */; }; 1FD8CD5F1968AB07008ED995 /* RaisesException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1E1968AB07008ED995 /* RaisesException.swift */; }; - 1FD8CD6A1968AB07008ED995 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Async.swift */; }; - 1FD8CD6B1968AB07008ED995 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Async.swift */; }; + 1FD8CD6A1968AB07008ED995 /* Await.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Await.swift */; }; + 1FD8CD6B1968AB07008ED995 /* Await.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Await.swift */; }; 1FDBD8671AF8A4FF0089F27B /* AssertionDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FDBD8661AF8A4FF0089F27B /* AssertionDispatcher.swift */; }; 1FDBD8681AF8A4FF0089F27B /* AssertionDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FDBD8661AF8A4FF0089F27B /* AssertionDispatcher.swift */; }; 1FE661571E6574E30035F243 /* ExpectationMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FE661561E6574E20035F243 /* ExpectationMessage.swift */; }; @@ -347,6 +347,13 @@ AE7ADE491C80C00D00B94CD3 /* MatchErrorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */; }; AE7ADE4A1C80C00D00B94CD3 /* MatchErrorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */; }; AE7ADE4B1C80C00D00B94CD3 /* MatchErrorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */; }; + B20058C120E92C7500C1264D /* ElementsEqual.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C020E92C7500C1264D /* ElementsEqual.swift */; }; + B20058C220E92CA900C1264D /* ElementsEqual.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C020E92C7500C1264D /* ElementsEqual.swift */; }; + B20058C320E92CA900C1264D /* ElementsEqual.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C020E92C7500C1264D /* ElementsEqual.swift */; }; + B20058C520E92CE400C1264D /* ElementsEqualTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C420E92CE400C1264D /* ElementsEqualTest.swift */; }; + B20058C620E92CE400C1264D /* ElementsEqualTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C420E92CE400C1264D /* ElementsEqualTest.swift */; }; + B20058C720E92CE400C1264D /* ElementsEqualTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C420E92CE400C1264D /* ElementsEqualTest.swift */; }; + CD037213207DCC580047AF28 /* XCTestManifests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD037212207DCC580047AF28 /* XCTestManifests.swift */; }; CD79C99E1D2CC832004B6F9A /* ObjCAsyncTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F4A56651A3B305F009E1637 /* ObjCAsyncTest.m */; }; CD79C99F1D2CC835004B6F9A /* ObjCSyncTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F8A37AF1B7C5042001C8357 /* ObjCSyncTest.m */; }; CD79C9A01D2CC839004B6F9A /* ObjCBeAnInstanceOfTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F4A56691A3B3108009E1637 /* ObjCBeAnInstanceOfTest.m */; }; @@ -487,7 +494,7 @@ /* Begin PBXFileReference section */ 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectWithLazyProperty.swift; sourceTree = ""; }; - 1F0648D31963AAB2001F9C46 /* SynchronousTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SynchronousTests.swift; sourceTree = ""; }; + 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SynchronousTest.swift; sourceTree = ""; }; 1F14FB63194180C5009F2A08 /* utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = utils.swift; sourceTree = ""; }; 1F1871BC1CA89EDB00A34BF2 /* DSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DSL.h; sourceTree = ""; }; 1F1871BD1CA89EDB00A34BF2 /* DSL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DSL.m; sourceTree = ""; }; @@ -498,7 +505,7 @@ 1F1871C21CA89EDB00A34BF2 /* NMBExpectation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NMBExpectation.swift; sourceTree = ""; }; 1F1871C31CA89EDB00A34BF2 /* NMBObjCMatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NMBObjCMatcher.swift; sourceTree = ""; }; 1F1871CD1CA89EE000A34BF2 /* ExceptionCapture.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExceptionCapture.swift; sourceTree = ""; }; - 1F1871E31CA89FB600A34BF2 /* AsyncMatcherWrapper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AsyncMatcherWrapper.swift; sourceTree = ""; }; + 1F1871E31CA89FB600A34BF2 /* Async.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Async.swift; sourceTree = ""; }; 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatcherFunc.swift; sourceTree = ""; }; 1F1A74291940169200FFFC47 /* Nimble.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 1F1A742D1940169200FFFC47 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -582,7 +589,7 @@ 1FD8CD1D1968AB07008ED995 /* MatcherProtocols.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatcherProtocols.swift; sourceTree = ""; }; 1FD8CD1E1968AB07008ED995 /* RaisesException.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = RaisesException.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 1FD8CD251968AB07008ED995 /* Functional.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Functional.swift; sourceTree = ""; }; - 1FD8CD261968AB07008ED995 /* Async.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Async.swift; sourceTree = ""; }; + 1FD8CD261968AB07008ED995 /* Await.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Await.swift; sourceTree = ""; }; 1FD8CD271968AB07008ED995 /* SourceLocation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SourceLocation.swift; sourceTree = ""; }; 1FD8CD281968AB07008ED995 /* Stringers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Stringers.swift; sourceTree = ""; }; 1FDBD8661AF8A4FF0089F27B /* AssertionDispatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssertionDispatcher.swift; sourceTree = ""; }; @@ -612,6 +619,9 @@ AE4BA9AC1C88DDB500B73906 /* Errors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Errors.swift; sourceTree = ""; }; AE7ADE441C80BF8000B94CD3 /* MatchError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatchError.swift; sourceTree = ""; }; AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatchErrorTest.swift; sourceTree = ""; }; + B20058C020E92C7500C1264D /* ElementsEqual.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementsEqual.swift; sourceTree = ""; }; + B20058C420E92CE400C1264D /* ElementsEqualTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementsEqualTest.swift; sourceTree = ""; }; + CD037212207DCC580047AF28 /* XCTestManifests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTestManifests.swift; sourceTree = ""; }; CDFB6A1E1F7E07C600AD8CC7 /* CwlCatchException.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlCatchException.swift; sourceTree = ""; }; CDFB6A201F7E07C600AD8CC7 /* CwlCatchException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CwlCatchException.m; sourceTree = ""; }; CDFB6A221F7E07C600AD8CC7 /* CwlCatchException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlCatchException.h; sourceTree = ""; }; @@ -633,7 +643,6 @@ DDB4D5EF19FE442800E9D9FE /* MatchTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatchTest.swift; sourceTree = ""; }; DDEFAEB31A93CBE6005CA37A /* ObjCAllPassTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ObjCAllPassTest.m; sourceTree = ""; }; F8A1BE2B1CB3710900031679 /* XCTestObservationCenter+Register.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "XCTestObservationCenter+Register.m"; sourceTree = ""; }; - F8A1BE321CB3777F00031679 /* CurrentTestCaseTracker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CurrentTestCaseTracker.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -698,7 +707,6 @@ 1F1871B91CA89E1B00A34BF2 /* NimbleObjectiveC */ = { isa = PBXGroup; children = ( - F8A1BE321CB3777F00031679 /* CurrentTestCaseTracker.h */, 1F1871BC1CA89EDB00A34BF2 /* DSL.h */, 1F1871BD1CA89EDB00A34BF2 /* DSL.m */, 1F1871BE1CA89EDB00A34BF2 /* NMBExceptionCapture.h */, @@ -770,9 +778,10 @@ isa = PBXGroup; children = ( 1F925EE5195C121200ED456B /* AsynchronousTest.swift */, - 1F0648D31963AAB2001F9C46 /* SynchronousTests.swift */, + 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */, 965B0D0B1B62C06D0005AE66 /* UserDescriptionTest.swift */, 6CAEDD091CAEA86F003F1584 /* LinuxSupport.swift */, + CD037212207DCC580047AF28 /* XCTestManifests.swift */, 1FFD729A1963FC8200CD29A2 /* objc */, 1F14FB61194180A7009F2A08 /* Helpers */, 1F925EE3195C11B000ED456B /* Matchers */, @@ -812,6 +821,7 @@ 1F925F01195C189500ED456B /* ContainTest.swift */, 1F925EFE195C187600ED456B /* EndWithTest.swift */, 1F925F04195C18B700ED456B /* EqualTest.swift */, + B20058C420E92CE400C1264D /* ElementsEqualTest.swift */, 472FD1361B9E094B00C7B8DA /* HaveCountTest.swift */, DDB4D5EF19FE442800E9D9FE /* MatchTest.swift */, 1F925EEB195C12C800ED456B /* RaisesExceptionTest.swift */, @@ -845,7 +855,7 @@ isa = PBXGroup; children = ( DDB1BC781A92235600F743C3 /* AllPass.swift */, - 1F1871E31CA89FB600A34BF2 /* AsyncMatcherWrapper.swift */, + 1F1871E31CA89FB600A34BF2 /* Async.swift */, 1FD8CD0E1968AB07008ED995 /* BeAKindOf.swift */, 1FD8CD0D1968AB07008ED995 /* BeAnInstanceOf.swift */, 1FD8CD0F1968AB07008ED995 /* BeCloseTo.swift */, @@ -863,6 +873,7 @@ 7B13BA051DD360AA00C9098C /* ContainElementSatisfying.swift */, 1FD8CD1B1968AB07008ED995 /* EndWith.swift */, 1FD8CD1C1968AB07008ED995 /* Equal.swift */, + B20058C020E92C7500C1264D /* ElementsEqual.swift */, 472FD1341B9E085700C7B8DA /* HaveCount.swift */, DDB4D5EC19FE43C200E9D9FE /* Match.swift */, 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */, @@ -884,7 +895,7 @@ isa = PBXGroup; children = ( 1FD8CD251968AB07008ED995 /* Functional.swift */, - 1FD8CD261968AB07008ED995 /* Async.swift */, + 1FD8CD261968AB07008ED995 /* Await.swift */, 1FD8CD271968AB07008ED995 /* SourceLocation.swift */, 1FD8CD281968AB07008ED995 /* Stringers.swift */, AE4BA9AC1C88DDB500B73906 /* Errors.swift */, @@ -1083,9 +1094,9 @@ isa = PBXNativeTarget; buildConfigurationList = 1F1A743F1940169200FFFC47 /* Build configuration list for PBXNativeTarget "Nimble-iOS" */; buildPhases = ( + 1F1A74261940169200FFFC47 /* Headers */, 1F1A74241940169200FFFC47 /* Sources */, 1F1A74251940169200FFFC47 /* Frameworks */, - 1F1A74261940169200FFFC47 /* Headers */, 1F1A74271940169200FFFC47 /* Resources */, ); buildRules = ( @@ -1122,9 +1133,9 @@ isa = PBXNativeTarget; buildConfigurationList = 1F5DF16A1BDCA0CE00C3A531 /* Build configuration list for PBXNativeTarget "Nimble-tvOS" */; buildPhases = ( + 1F5DF1521BDCA0CE00C3A531 /* Headers */, 1F5DF1501BDCA0CE00C3A531 /* Sources */, 1F5DF1511BDCA0CE00C3A531 /* Frameworks */, - 1F5DF1521BDCA0CE00C3A531 /* Headers */, 1F5DF1531BDCA0CE00C3A531 /* Resources */, ); buildRules = ( @@ -1158,9 +1169,9 @@ isa = PBXNativeTarget; buildConfigurationList = 1F925EC0195C0D6300ED456B /* Build configuration list for PBXNativeTarget "Nimble-macOS" */; buildPhases = ( + 1F925EAA195C0D6300ED456B /* Headers */, 1F925EA8195C0D6300ED456B /* Sources */, 1F925EA9195C0D6300ED456B /* Frameworks */, - 1F925EAA195C0D6300ED456B /* Headers */, 1F925EAB195C0D6300ED456B /* Resources */, ); buildRules = ( @@ -1345,6 +1356,7 @@ DDB4D5ED19FE43C200E9D9FE /* Match.swift in Sources */, 1F91DD311C74BF61002C309F /* BeVoid.swift in Sources */, 7B13BA0B1DD361D200C9098C /* ContainElementSatisfying.swift in Sources */, + B20058C220E92CA900C1264D /* ElementsEqual.swift in Sources */, 1FCF91531C61C8A400B15DCB /* PostNotification.swift in Sources */, 1FD8CD2E1968AB07008ED995 /* AssertionRecorder.swift in Sources */, 29EA59661B551EE6002D767E /* ThrowError.swift in Sources */, @@ -1368,11 +1380,11 @@ 1FE661581E6574E30035F243 /* ExpectationMessage.swift in Sources */, 1F1871E61CA89FCD00A34BF2 /* MatcherFunc.swift in Sources */, 1FD8CD421968AB07008ED995 /* BeEmpty.swift in Sources */, - 1F1871E41CA89FB600A34BF2 /* AsyncMatcherWrapper.swift in Sources */, + 1F1871E41CA89FB600A34BF2 /* Async.swift in Sources */, 1F1871CA1CA89EDB00A34BF2 /* NMBStringify.m in Sources */, A8A3B6EB2071487E00E25A08 /* SatisfyAllOf.swift in Sources */, 1FD8CD521968AB07008ED995 /* BeNil.swift in Sources */, - 1FD8CD6A1968AB07008ED995 /* Async.swift in Sources */, + 1FD8CD6A1968AB07008ED995 /* Await.swift in Sources */, CDFB6A241F7E07C700AD8CC7 /* CwlCatchException.swift in Sources */, 1FD8CD581968AB07008ED995 /* EndWith.swift in Sources */, 1FD8CD341968AB07008ED995 /* DSL.swift in Sources */, @@ -1429,6 +1441,7 @@ 1F4A56911A3B344A009E1637 /* ObjCBeNilTest.m in Sources */, 1F8A37B01B7C5042001C8357 /* ObjCSyncTest.m in Sources */, 1F4A56941A3B346F009E1637 /* ObjCContainTest.m in Sources */, + B20058C620E92CE400C1264D /* ElementsEqualTest.swift in Sources */, 1F299EAB19627B2D002641AF /* BeEmptyTest.swift in Sources */, 7B13BA111DD361EB00C9098C /* ObjCContainElementSatisfyingTest.m in Sources */, 1F925EF6195C147800ED456B /* BeCloseToTest.swift in Sources */, @@ -1443,7 +1456,7 @@ 1F4A56851A3B33A0009E1637 /* ObjCBeTruthyTest.m in Sources */, DD9A9A8F19CF439B00706F49 /* BeIdenticalToObjectTest.swift in Sources */, 1F4BB8B71DACA0E40048464B /* ThrowAssertionTest.swift in Sources */, - 1F0648D41963AAB2001F9C46 /* SynchronousTests.swift in Sources */, + 1F0648D41963AAB2001F9C46 /* SynchronousTest.swift in Sources */, 347155CA1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */, 4793854D1BA0BB2500296F85 /* ObjCHaveCountTest.m in Sources */, 1F925F08195C18CF00ED456B /* BeGreaterThanTest.swift in Sources */, @@ -1472,7 +1485,7 @@ 1F5DF1751BDCA0F500C3A531 /* FailureMessage.swift in Sources */, A8A3B6EC2071487F00E25A08 /* SatisfyAllOf.swift in Sources */, 1F5DF1801BDCA0F500C3A531 /* BeLessThanOrEqual.swift in Sources */, - 1F1871E81CA8A18400A34BF2 /* AsyncMatcherWrapper.swift in Sources */, + 1F1871E81CA8A18400A34BF2 /* Async.swift in Sources */, 1F5DF18A1BDCA0F500C3A531 /* ThrowError.swift in Sources */, 1F5DF1891BDCA0F500C3A531 /* RaisesException.swift in Sources */, 1F5DF1761BDCA0F500C3A531 /* AllPass.swift in Sources */, @@ -1506,12 +1519,13 @@ 1F1871E91CA8A18700A34BF2 /* MatcherFunc.swift in Sources */, 1F5DF17A1BDCA0F500C3A531 /* BeEmpty.swift in Sources */, CDFB6A511F7E087500AD8CC7 /* CwlCatchBadInstructionPosix.swift in Sources */, - 1F5DF18C1BDCA0F500C3A531 /* Async.swift in Sources */, + 1F5DF18C1BDCA0F500C3A531 /* Await.swift in Sources */, 1F1871D81CA89EEF00A34BF2 /* NMBStringify.m in Sources */, 1F5DF1821BDCA0F500C3A531 /* BeNil.swift in Sources */, 1F5DF16F1BDCA0F500C3A531 /* AssertionDispatcher.swift in Sources */, 964CFEFF1C4FF48900513336 /* ThrowAssertion.swift in Sources */, 1F5DF1841BDCA0F500C3A531 /* EndWith.swift in Sources */, + B20058C320E92CA900C1264D /* ElementsEqual.swift in Sources */, 1F5DF18D1BDCA0F500C3A531 /* SourceLocation.swift in Sources */, 1F5DF1701BDCA0F500C3A531 /* DSL.swift in Sources */, CDD80B851F20307B0002CD65 /* MatcherProtocols.swift in Sources */, @@ -1564,11 +1578,12 @@ 1F5DF19C1BDCA10200C3A531 /* BeginWithTest.swift in Sources */, 1F5DF1A01BDCA10200C3A531 /* BeIdenticalToTest.swift in Sources */, 1F5DF19A1BDCA10200C3A531 /* BeCloseToTest.swift in Sources */, + B20058C720E92CE400C1264D /* ElementsEqualTest.swift in Sources */, 1F5DF1A61BDCA10200C3A531 /* EndWithTest.swift in Sources */, CD79C9A31D2CC841004B6F9A /* ObjCBeFalseTest.m in Sources */, 1F5DF1A71BDCA10200C3A531 /* EqualTest.swift in Sources */, CD79C9AA1D2CC848004B6F9A /* ObjCBeLessThanOrEqualToTest.m in Sources */, - 1F5DF1931BDCA10200C3A531 /* SynchronousTests.swift in Sources */, + 1F5DF1931BDCA10200C3A531 /* SynchronousTest.swift in Sources */, CD79C9A11D2CC83B004B6F9A /* ObjCBeCloseToTest.m in Sources */, 1F5DF19D1BDCA10200C3A531 /* BeGreaterThanOrEqualToTest.swift in Sources */, A8A3B6F7207329DE00E25A08 /* SatisfyAllOfTest.swift in Sources */, @@ -1607,7 +1622,7 @@ 1F43728E1A1B343F00EB80F8 /* Stringers.swift in Sources */, 1F43728C1A1B343C00EB80F8 /* SourceLocation.swift in Sources */, 1FD8CD4F1968AB07008ED995 /* BeLessThanOrEqual.swift in Sources */, - 1F1871E71CA8A18400A34BF2 /* AsyncMatcherWrapper.swift in Sources */, + 1F1871E71CA8A18400A34BF2 /* Async.swift in Sources */, 1FDBD8681AF8A4FF0089F27B /* AssertionDispatcher.swift in Sources */, 1F43728B1A1B343900EB80F8 /* Functional.swift in Sources */, AE4BA9AE1C88DDB500B73906 /* Errors.swift in Sources */, @@ -1620,6 +1635,7 @@ 1FD8CD2F1968AB07008ED995 /* AssertionRecorder.swift in Sources */, 7B13BA061DD360AA00C9098C /* ContainElementSatisfying.swift in Sources */, 1F91DD321C74BF61002C309F /* BeVoid.swift in Sources */, + B20058C120E92C7500C1264D /* ElementsEqual.swift in Sources */, 1FCF91541C61C8A400B15DCB /* PostNotification.swift in Sources */, DDB4D5EE19FE43C200E9D9FE /* Match.swift in Sources */, 29EA59671B551EE6002D767E /* ThrowError.swift in Sources */, @@ -1647,7 +1663,7 @@ 1F1871D41CA89EEE00A34BF2 /* NMBStringify.m in Sources */, A8F6B5BD2070186D00FCB5ED /* SatisfyAllOf.swift in Sources */, 1FD8CD531968AB07008ED995 /* BeNil.swift in Sources */, - 1FD8CD6B1968AB07008ED995 /* Async.swift in Sources */, + 1FD8CD6B1968AB07008ED995 /* Await.swift in Sources */, CDFB6A231F7E07C700AD8CC7 /* CwlCatchException.swift in Sources */, 964CFEFE1C4FF48900513336 /* ThrowAssertion.swift in Sources */, 1FD8CD591968AB07008ED995 /* EndWith.swift in Sources */, @@ -1678,10 +1694,12 @@ DDB4D5F119FE442800E9D9FE /* MatchTest.swift in Sources */, 1F4A56741A3B3210009E1637 /* ObjCBeginWithTest.m in Sources */, 1F4A56831A3B336F009E1637 /* ObjCBeLessThanOrEqualToTest.m in Sources */, + CD037213207DCC580047AF28 /* XCTestManifests.swift in Sources */, 7B13BA0D1DD361DE00C9098C /* ContainElementSatisfyingTest.swift in Sources */, 1F925F03195C189500ED456B /* ContainTest.swift in Sources */, A8A3B6FD2073644700E25A08 /* ObjcStringersTest.m in Sources */, 1F4A56891A3B33CB009E1637 /* ObjCBeFalsyTest.m in Sources */, + B20058C520E92CE400C1264D /* ElementsEqualTest.swift in Sources */, 1F4A568F1A3B342B009E1637 /* ObjCBeFalseTest.m in Sources */, 1F925F12195C190B00ED456B /* BeGreaterThanOrEqualToTest.swift in Sources */, 1F925EF0195C136500ED456B /* BeLogicalTest.swift in Sources */, @@ -1718,7 +1736,7 @@ 1F4A56861A3B33A0009E1637 /* ObjCBeTruthyTest.m in Sources */, DD9A9A9019CF43AD00706F49 /* BeIdenticalToObjectTest.swift in Sources */, 1F4BB8B61DACA0E30048464B /* ThrowAssertionTest.swift in Sources */, - 1F0648D51963AAB2001F9C46 /* SynchronousTests.swift in Sources */, + 1F0648D51963AAB2001F9C46 /* SynchronousTest.swift in Sources */, 347155CB1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */, 4793854E1BA0BB2500296F85 /* ObjCHaveCountTest.m in Sources */, 1F925F09195C18CF00ED456B /* BeGreaterThanTest.swift in Sources */, @@ -1790,6 +1808,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + APPLICATION_EXTENSION_API_ONLY = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -1837,13 +1856,13 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; TVOS_DEPLOYMENT_TARGET = 9.0; VERSIONING_SYSTEM = "apple-generic"; @@ -1855,6 +1874,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + APPLICATION_EXTENSION_API_ONLY = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -1895,12 +1915,12 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; @@ -1933,9 +1953,12 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( + "$(inherited)", "-weak_framework", XCTest, "-weak-lswiftXCTest", + "-Xlinker", + "-no_application_extension", ); PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Nimble; @@ -1967,9 +1990,12 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; OTHER_LDFLAGS = ( + "$(inherited)", "-weak_framework", XCTest, "-weak-lswiftXCTest", + "-Xlinker", + "-no_application_extension", ); PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Nimble; @@ -2043,9 +2069,12 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = ( + "$(inherited)", "-weak_framework", XCTest, "-weak-lswiftXCTest", + "-Xlinker", + "-no_application_extension", ); PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Nimble; @@ -2080,9 +2109,12 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; OTHER_LDFLAGS = ( + "$(inherited)", "-weak_framework", XCTest, "-weak-lswiftXCTest", + "-Xlinker", + "-no_application_extension", ); PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Nimble; @@ -2160,9 +2192,12 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; METAL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = ( + "$(inherited)", "-weak_framework", XCTest, "-weak-lswiftXCTest", + "-Xlinker", + "-no_application_extension", ); PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Nimble; @@ -2197,9 +2232,12 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; METAL_ENABLE_DEBUG_INFO = NO; OTHER_LDFLAGS = ( + "$(inherited)", "-weak_framework", XCTest, "-weak-lswiftXCTest", + "-Xlinker", + "-no_application_extension", ); PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Nimble; diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..3ddf867 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + BuildSystemType + Latest + + diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Package.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Package.swift index 8d0b745..dfa6226 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Package.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Package.swift @@ -1,11 +1,21 @@ -// swift-tools-version:3.0 - +// swift-tools-version:4.2 import PackageDescription let package = Package( name: "Nimble", - exclude: [ - "Sources/NimbleObjectiveC", - "Tests/NimbleTests/objc", - ] + products: [ + .library(name: "Nimble", targets: ["Nimble"]), + ], + targets: [ + .target( + name: "Nimble", + dependencies: [] + ), + .testTarget( + name: "NimbleTests", + dependencies: ["Nimble"], + exclude: ["objc"] + ), + ], + swiftLanguageVersions: [.v4_2] ) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Package@swift-4.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Package@swift-4.swift deleted file mode 100644 index 740b842..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Package@swift-4.swift +++ /dev/null @@ -1,22 +0,0 @@ -// swift-tools-version:4.0 - -import PackageDescription - -let package = Package( - name: "Nimble", - products: [ - .library(name: "Nimble", targets: ["Nimble"]), - ], - targets: [ - .target( - name: "Nimble", - dependencies: [] - ), - .testTarget( - name: "NimbleTests", - dependencies: ["Nimble"], - exclude: ["objc"] - ), - ], - swiftLanguageVersions: [4] -) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/README.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/README.md index 19c562f..dde7fc4 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/README.md +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/README.md @@ -4,6 +4,7 @@ [![CocoaPods](https://img.shields.io/cocoapods/v/Nimble.svg)](https://cocoapods.org/pods/Nimble) [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Platforms](https://img.shields.io/cocoapods/p/Nimble.svg)](https://cocoapods.org/pods/Nimble) +[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com) Use Nimble to express the expected outcomes of Swift or Objective-C expressions. Inspired by @@ -306,8 +307,7 @@ In Nimble, it's easy to make expectations on values that are updated asynchronously. Just use `toEventually` or `toEventuallyNot`: ```swift -// Swift 3.0 and later - +// Swift DispatchQueue.main.async { ocean.add("dolphins") ocean.add("whales") @@ -316,17 +316,6 @@ expect(ocean).toEventually(contain("dolphins", "whales")) ``` -```swift -// Swift 2.3 and earlier - -dispatch_async(dispatch_get_main_queue()) { - ocean.add("dolphins") - ocean.add("whales") -} -expect(ocean).toEventually(contain("dolphins", "whales")) -``` - - ```objc // Objective-C @@ -857,11 +846,7 @@ Notes: ## Swift Error Handling -If you're using Swift 2.0 or newer, you can use the `throwError` matcher to check if an error is thrown. - -Note: -The following code sample references the `Swift.Error` protocol. -This is `Swift.ErrorProtocol` in versions of Swift prior to version 3.0. +You can use the `throwError` matcher to check if an error is thrown. ```swift // Swift @@ -1277,7 +1262,7 @@ public func equal(expectedValue: T?) -> Predicate { // Predicate { actual in ... } // // But shown with types here for clarity. - return Predicate { (actual: Expression) throws -> PredicateResult in + return Predicate { (actualExpression: Expression) throws -> PredicateResult in let msg = ExpectationMessage.expectedActualValueTo("equal <\(expectedValue)>") if let actualValue = try actualExpression.evaluate() { return PredicateResult( @@ -1673,11 +1658,11 @@ backported. The deprecating plan is a 3 major versions removal. Which is as follows: 1. Introduce new `Predicate` API, deprecation warning for old matcher APIs. - (Nimble `v7.x.x`) + (Nimble `v7.x.x` and `v8.x.x`) 2. Introduce warnings on migration-path features (`.predicate`, `Predicate`-constructors with similar arguments to old API). (Nimble - `v8.x.x`) - 3. Remove old API. (Nimble `v9.x.x`) + `v9.x.x`) + 3. Remove old API. (Nimble `v10.x.x`) # Installing Nimble diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift index 2e58fdf..abaf532 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift @@ -13,5 +13,6 @@ public protocol AssertionHandler { /// /// @see AssertionHandler public var NimbleAssertionHandler: AssertionHandler = { () -> AssertionHandler in + // swiftlint:disable:previous identifier_name return isXCTestAvailable() ? NimbleXCTestHandler() : NimbleXCTestUnavailableHandler() }() diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift index 740c392..0f5df59 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift @@ -37,21 +37,48 @@ public class AssertionRecorder: AssertionHandler { } } +extension NMBExceptionCapture { + internal func tryBlockThrows(_ unsafeBlock: () throws -> Void) throws { + var catchedError: Error? + tryBlock { + do { + try unsafeBlock() + } catch { + catchedError = error + } + } + if let error = catchedError { + throw error + } + } +} + /// Allows you to temporarily replace the current Nimble assertion handler with /// the one provided for the scope of the closure. /// /// Once the closure finishes, then the original Nimble assertion handler is restored. /// /// @see AssertionHandler -public func withAssertionHandler(_ tempAssertionHandler: AssertionHandler, closure: () throws -> Void) { +public func withAssertionHandler(_ tempAssertionHandler: AssertionHandler, + file: FileString = #file, + line: UInt = #line, + closure: () throws -> Void) { let environment = NimbleEnvironment.activeInstance let oldRecorder = environment.assertionHandler let capturer = NMBExceptionCapture(handler: nil, finally: ({ environment.assertionHandler = oldRecorder })) environment.assertionHandler = tempAssertionHandler - capturer.tryBlock { - try! closure() + + do { + try capturer.tryBlockThrows { + try closure() + } + } catch { + let failureMessage = FailureMessage() + failureMessage.stringValue = "unexpected error thrown: <\(error)>" + let location = SourceLocation(file: file, line: line) + tempAssertionHandler.assert(false, message: failureMessage, location: location) } } @@ -65,7 +92,7 @@ public func withAssertionHandler(_ tempAssertionHandler: AssertionHandler, closu /// assertion handler when this is true. Defaults to false. /// /// @see gatherFailingExpectations -public func gatherExpectations(silently: Bool = false, closure: @escaping () -> Void) -> [AssertionRecord] { +public func gatherExpectations(silently: Bool = false, closure: () -> Void) -> [AssertionRecord] { let previousRecorder = NimbleEnvironment.activeInstance.assertionHandler let recorder = AssertionRecorder() let handlers: [AssertionHandler] @@ -92,7 +119,7 @@ public func gatherExpectations(silently: Bool = false, closure: @escaping () -> /// /// @see gatherExpectations /// @see raiseException source for an example use case. -public func gatherFailingExpectations(silently: Bool = false, closure: @escaping () -> Void) -> [AssertionRecord] { +public func gatherFailingExpectations(silently: Bool = false, closure: () -> Void) -> [AssertionRecord] { let assertions = gatherExpectations(silently: silently, closure: closure) return assertions.filter { assertion in !assertion.success diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift index 88d9406..b3eb09a 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift @@ -1,10 +1,10 @@ import Foundation -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE private func from(objcPredicate: NMBPredicate) -> Predicate { return Predicate { actualExpression in - let result = objcPredicate.satisfies(({ try! actualExpression.evaluate() }), + let result = objcPredicate.satisfies(({ try actualExpression.evaluate() }), location: actualExpression.location) return result.toSwift() } @@ -15,6 +15,7 @@ internal struct ObjCMatcherWrapper: Matcher { func matches(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { return matcher.matches( + // swiftlint:disable:next force_try ({ try! actualExpression.evaluate() }), failureMessage: failureMessage, location: actualExpression.location) @@ -22,6 +23,7 @@ internal struct ObjCMatcherWrapper: Matcher { func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { return matcher.doesNotMatch( + // swiftlint:disable:next force_try ({ try! actualExpression.evaluate() }), failureMessage: failureMessage, location: actualExpression.location) @@ -30,13 +32,15 @@ internal struct ObjCMatcherWrapper: Matcher { // Equivalent to Expectation, but for Nimble's Objective-C interface public class NMBExpectation: NSObject { - internal let _actualBlock: () -> NSObject! + // swiftlint:disable identifier_name + internal let _actualBlock: () -> NSObject? internal var _negative: Bool internal let _file: FileString internal let _line: UInt internal var _timeout: TimeInterval = 1.0 + // swiftlint:enable identifier_name - @objc public init(actualBlock: @escaping () -> NSObject!, negative: Bool, file: FileString, line: UInt) { + @objc public init(actualBlock: @escaping () -> NSObject?, negative: Bool, file: FileString, line: UInt) { self._actualBlock = actualBlock self._negative = negative self._file = file diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift index 9ba2ffa..a91efe3 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift @@ -1,15 +1,17 @@ import Foundation -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) // swiftlint:disable line_length -public typealias MatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage) -> Bool -public typealias FullMatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage, _ shouldNotMatch: Bool) -> Bool +public typealias MatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage) throws -> Bool +public typealias FullMatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage, _ shouldNotMatch: Bool) throws -> Bool // swiftlint:enable line_length public class NMBObjCMatcher: NSObject, NMBMatcher { + // swiftlint:disable identifier_name let _match: MatcherBlock let _doesNotMatch: MatcherBlock + // swiftlint:enable identifier_name let canMatchNil: Bool public init(canMatchNil: Bool, matcher: @escaping MatcherBlock, notMatcher: @escaping MatcherBlock) { @@ -24,7 +26,7 @@ public class NMBObjCMatcher: NSObject, NMBMatcher { public convenience init(canMatchNil: Bool, matcher: @escaping MatcherBlock) { self.init(canMatchNil: canMatchNil, matcher: matcher, notMatcher: ({ actualExpression, failureMessage in - return !matcher(actualExpression, failureMessage) + return try !matcher(actualExpression, failureMessage) })) } @@ -34,9 +36,9 @@ public class NMBObjCMatcher: NSObject, NMBMatcher { public convenience init(canMatchNil: Bool, matcher: @escaping FullMatcherBlock) { self.init(canMatchNil: canMatchNil, matcher: ({ actualExpression, failureMessage in - return matcher(actualExpression, failureMessage, false) + return try matcher(actualExpression, failureMessage, false) }), notMatcher: ({ actualExpression, failureMessage in - return matcher(actualExpression, failureMessage, true) + return try matcher(actualExpression, failureMessage, true) })) } @@ -55,11 +57,16 @@ public class NMBObjCMatcher: NSObject, NMBMatcher { return true } - public func matches(_ actualBlock: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { + public func matches(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool { let expr = Expression(expression: actualBlock, location: location) - let result = _match( - expr, - failureMessage) + let result: Bool + do { + result = try _match(expr, failureMessage) + } catch let error { + failureMessage.stringValue = "unexpected error thrown: <\(error)>" + return false + } + if self.canMatch(Expression(expression: actualBlock, location: location), failureMessage: failureMessage) { return result } else { @@ -67,11 +74,16 @@ public class NMBObjCMatcher: NSObject, NMBMatcher { } } - public func doesNotMatch(_ actualBlock: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { + public func doesNotMatch(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool { let expr = Expression(expression: actualBlock, location: location) - let result = _doesNotMatch( - expr, - failureMessage) + let result: Bool + do { + result = try _doesNotMatch(expr, failureMessage) + } catch let error { + failureMessage.stringValue = "unexpected error thrown: <\(error)>" + return false + } + if self.canMatch(Expression(expression: actualBlock, location: location), failureMessage: failureMessage) { return result } else { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift index e1b5432..1b2e8c0 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift @@ -3,7 +3,7 @@ import Foundation /// "Global" state of Nimble is stored here. Only DSL functions should access / be aware of this /// class' existence -internal class NimbleEnvironment { +internal class NimbleEnvironment: NSObject { static var activeInstance: NimbleEnvironment { get { let env = Thread.current.threadDictionary["NimbleEnvironment"] @@ -20,6 +20,7 @@ internal class NimbleEnvironment { } } + // swiftlint:disable:next todo // TODO: eventually migrate the global to this environment value var assertionHandler: AssertionHandler { get { return NimbleAssertionHandler } @@ -29,17 +30,14 @@ internal class NimbleEnvironment { var suppressTVOSAssertionWarning: Bool = false var awaiter: Awaiter - init() { - let timeoutQueue: DispatchQueue - if #available(OSX 10.10, *) { - timeoutQueue = DispatchQueue.global(qos: .userInitiated) - } else { - timeoutQueue = DispatchQueue.global(priority: .high) - } - + override init() { + let timeoutQueue = DispatchQueue.global(qos: .userInitiated) awaiter = Awaiter( waitLock: AssertionWaitLock(), asyncQueue: .main, - timeoutQueue: timeoutQueue) + timeoutQueue: timeoutQueue + ) + + super.init() } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift index 0ad8590..719bf44 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift @@ -42,18 +42,29 @@ class NimbleXCTestUnavailableHandler: AssertionHandler { private(set) var currentTestCase: XCTestCase? + private var stashed_swift_reportFatalErrorsToDebugger: Bool = false + @objc func testCaseWillStart(_ testCase: XCTestCase) { + #if swift(>=3.2) + stashed_swift_reportFatalErrorsToDebugger = _swift_reportFatalErrorsToDebugger + _swift_reportFatalErrorsToDebugger = false + #endif + currentTestCase = testCase } @objc func testCaseDidFinish(_ testCase: XCTestCase) { currentTestCase = nil + + #if swift(>=3.2) + _swift_reportFatalErrorsToDebugger = stashed_swift_reportFatalErrorsToDebugger + #endif } } #endif func isXCTestAvailable() -> Bool { -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) // XCTest is weakly linked and so may not be present return NSClassFromString("XCTestCase") != nil #else @@ -61,20 +72,19 @@ func isXCTestAvailable() -> Bool { #endif } -private func recordFailure(_ message: String, location: SourceLocation) { +public func recordFailure(_ message: String, location: SourceLocation) { #if SWIFT_PACKAGE XCTFail("\(message)", file: location.file, line: location.line) #else if let testCase = CurrentTestCaseTracker.sharedInstance.currentTestCase { - #if swift(>=4) let line = Int(location.line) - #else - let line = location.line - #endif testCase.recordFailure(withDescription: message, inFile: location.file, atLine: line, expected: true) } else { - let msg = "Attempted to report a test failure to XCTest while no test case was running. " + - "The failure was:\n\"\(message)\"\nIt occurred at: \(location.file):\(location.line)" + let msg = """ + Attempted to report a test failure to XCTest while no test case was running. The failure was: + \"\(message)\" + It occurred at: \(location.file):\(location.line) + """ NSException(name: .internalInconsistencyException, reason: msg, userInfo: nil).raise() } #endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NonObjectiveC/ExceptionCapture.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NonObjectiveC/ExceptionCapture.swift index 8f8d360..d0871fc 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NonObjectiveC/ExceptionCapture.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NonObjectiveC/ExceptionCapture.swift @@ -1,6 +1,6 @@ import Foundation -#if !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) +#if !canImport(Darwin) // swift-corelibs-foundation doesn't provide NSException at all, so provide a dummy class NSException {} #endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/DSL+Wait.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/DSL+Wait.swift index e874136..c049417 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/DSL+Wait.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/DSL+Wait.swift @@ -14,7 +14,7 @@ internal class NMBWait: NSObject { // About these kind of lines, `@objc` attributes are only required for Objective-C // support, so that should be conditional on Darwin platforms and normal Xcode builds // (non-SwiftPM builds). -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE @objc internal class func until( timeout: TimeInterval, @@ -87,13 +87,19 @@ internal class NMBWait: NSObject { } } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE @objc(untilFile:line:action:) - internal class func until(_ file: FileString = #file, line: UInt = #line, action: @escaping (() -> Void) -> Void) { + internal class func until( + _ file: FileString = #file, + line: UInt = #line, + action: @escaping (@escaping () -> Void) -> Void) { until(timeout: 1, file: file, line: line, action: action) } #else - internal class func until(_ file: FileString = #file, line: UInt = #line, action: @escaping (() -> Void) -> Void) { + internal class func until( + _ file: FileString = #file, + line: UInt = #line, + action: @escaping (@escaping () -> Void) -> Void) { until(timeout: 1, file: file, line: line, action: action) } #endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/DSL.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/DSL.swift index e49bb0c..d6dc9cc 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/DSL.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/DSL.swift @@ -43,12 +43,13 @@ internal func nimblePrecondition( line: UInt = #line) { let result = expr() if !result { -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - let e = NSException( +#if canImport(Darwin) + let exception = NSException( name: NSExceptionName(name()), reason: message(), - userInfo: nil) - e.raise() + userInfo: nil + ) + exception.raise() #else preconditionFailure("\(name()) - \(message())", file: file, line: line) #endif @@ -56,9 +57,12 @@ internal func nimblePrecondition( } internal func internalError(_ msg: String, file: FileString = #file, line: UInt = #line) -> Never { + // swiftlint:disable line_length fatalError( - "Nimble Bug Found: \(msg) at \(file):\(line).\n" + - "Please file a bug to Nimble: https://github.com/Quick/Nimble/issues with the " + - "code snippet that caused this error." + """ + Nimble Bug Found: \(msg) at \(file):\(line). + Please file a bug to Nimble: https://github.com/Quick/Nimble/issues with the code snippet that caused this error. + """ ) + // swiftlint:enable line_length } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Expectation.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Expectation.swift index e3f616a..41625a1 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Expectation.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Expectation.swift @@ -1,23 +1,5 @@ import Foundation -// Deprecated -internal func expressionMatches(_ expression: Expression, matcher: U, to: String, description: String?) -> (Bool, FailureMessage) - where U: Matcher, U.ValueType == T { - let msg = FailureMessage() - msg.userDescription = description - msg.to = to - do { - let pass = try matcher.matches(expression, failureMessage: msg) - if msg.actualValue == "" { - msg.actualValue = "<\(stringify(try expression.evaluate()))>" - } - return (pass, msg) - } catch let error { - msg.stringValue = "unexpected error thrown: <\(error)>" - return (false, msg) - } -} - // Deprecated internal func expressionDoesNotMatch(_ expression: Expression, matcher: U, toNot: String, description: String?) -> (Bool, FailureMessage) where U: Matcher, U.ValueType == T { @@ -75,6 +57,10 @@ public struct Expectation { public let expression: Expression + public init(expression: Expression) { + self.expression = expression + } + public func verify(_ pass: Bool, _ message: FailureMessage) { let handler = NimbleEnvironment.activeInstance.assertionHandler handler.assert(pass, message: message, location: expression.location) @@ -85,8 +71,15 @@ public struct Expectation { /// DEPRECATED: Tests the actual value using a matcher to match. public func to(_ matcher: U, description: String? = nil) where U: Matcher, U.ValueType == T { - let (pass, msg) = expressionMatches(expression, matcher: matcher, to: "to", description: description) - verify(pass, msg) + let (pass, msg) = execute( + expression, + .toMatch, + matcher.predicate, + to: "to", + description: description, + captureExceptions: false + ) + verify(pass, msg) } /// DEPRECATED: Tests the actual value using a matcher to not match. @@ -127,6 +120,6 @@ public struct Expectation { } // see: - // - AsyncMatcherWrapper for extension + // - `async` for extension // - NMBExpectation for Objective-C interface } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/ExpectationMessage.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/ExpectationMessage.swift index 992ee0e..b0cbcc3 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/ExpectationMessage.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/ExpectationMessage.swift @@ -75,6 +75,7 @@ public indirect enum ExpectationMessage { } internal func visitLeafs(_ f: (ExpectationMessage) -> ExpectationMessage) -> ExpectationMessage { + // swiftlint:disable:previous identifier_name switch self { case .fail, .expectedTo, .expectedActualValueTo, .expectedCustomValueTo: return f(self) @@ -90,6 +91,7 @@ public indirect enum ExpectationMessage { /// Replaces a primary expectation with one returned by f. Preserves all composite expectations /// that were built upon it (aka - all appended(message:) and appended(details:). public func replacedExpectation(_ f: @escaping (ExpectationMessage) -> ExpectationMessage) -> ExpectationMessage { + // swiftlint:disable:previous identifier_name func walk(_ msg: ExpectationMessage) -> ExpectationMessage { switch msg { case .fail, .expectedTo, .expectedActualValueTo, .expectedCustomValueTo: @@ -124,6 +126,7 @@ public indirect enum ExpectationMessage { return visitLeafs(walk) } + // swiftlint:disable:next todo // TODO: test & verify correct behavior internal func prepended(message: String) -> ExpectationMessage { return .prepends(message, self) @@ -152,8 +155,10 @@ public indirect enum ExpectationMessage { // Backwards compatibility: converts ExpectationMessage tree to FailureMessage internal func update(failureMessage: FailureMessage) { switch self { - case let .fail(msg): + case let .fail(msg) where !msg.isEmpty: failureMessage.stringValue = msg + case .fail: + break case let .expectedTo(msg): failureMessage.actualValue = nil failureMessage.postfixMessage = msg @@ -181,32 +186,32 @@ public indirect enum ExpectationMessage { extension FailureMessage { internal func toExpectationMessage() -> ExpectationMessage { - let defaultMsg = FailureMessage() - if expected != defaultMsg.expected || _stringValueOverride != nil { + let defaultMessage = FailureMessage() + if expected != defaultMessage.expected || _stringValueOverride != nil { return .fail(stringValue) } - var msg: ExpectationMessage = .fail(userDescription ?? "") + var message: ExpectationMessage = .fail(userDescription ?? "") if actualValue != "" && actualValue != nil { - msg = .expectedCustomValueTo(postfixMessage, actualValue ?? "") - } else if postfixMessage != defaultMsg.postfixMessage { + message = .expectedCustomValueTo(postfixMessage, actualValue ?? "") + } else if postfixMessage != defaultMessage.postfixMessage { if actualValue == nil { - msg = .expectedTo(postfixMessage) + message = .expectedTo(postfixMessage) } else { - msg = .expectedActualValueTo(postfixMessage) + message = .expectedActualValueTo(postfixMessage) } } - if postfixActual != defaultMsg.postfixActual { - msg = .appends(msg, postfixActual) + if postfixActual != defaultMessage.postfixActual { + message = .appends(message, postfixActual) } - if let m = extendedMessage { - msg = .details(msg, m) + if let extended = extendedMessage { + message = .details(message, extended) } - return msg + return message } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) public class NMBExpectationMessage: NSObject { private let msg: ExpectationMessage diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Expression.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Expression.swift index 5a233fd..b6b2ee3 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Expression.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Expression.swift @@ -24,8 +24,10 @@ internal func memoizedClosure(_ closure: @escaping () throws -> T) -> (Bool) /// This provides a common consumable API for matchers to utilize to allow /// Nimble to change internals to how the captured closure is managed. public struct Expression { + // swiftlint:disable identifier_name internal let _expression: (Bool) throws -> T? internal let _withoutCaching: Bool + // swiftlint:enable identifier_name public let location: SourceLocation public let isClosure: Bool diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/FailureMessage.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/FailureMessage.swift index 2bc57eb..503b540 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/FailureMessage.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/FailureMessage.swift @@ -28,6 +28,7 @@ public class FailureMessage: NSObject { } } + // swiftlint:disable:next identifier_name internal var _stringValueOverride: String? internal var hasOverriddenStringValue: Bool { return _stringValueOverride != nil diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/AllPass.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/AllPass.swift index 8affa62..dbbccb9 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/AllPass.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/AllPass.swift @@ -63,12 +63,12 @@ private func createPredicate(_ elementMatcher: Predicate) } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func allPassMatcher(_ matcher: NMBMatcher) -> NMBPredicate { return NMBPredicate { actualExpression in let location = actualExpression.location - let actualValue = try! actualExpression.evaluate() + let actualValue = try actualExpression.evaluate() var nsObjects = [NSObject]() var collectionIsUsable = true @@ -99,10 +99,11 @@ extension NMBObjCMatcher { let expr = Expression(expression: ({ nsObjects }), location: location) let pred: Predicate<[NSObject]> = createPredicate(Predicate { expr in if let predicate = matcher as? NMBPredicate { - return predicate.satisfies(({ try! expr.evaluate() }), location: expr.location).toSwift() + return predicate.satisfies(({ try expr.evaluate() }), location: expr.location).toSwift() } else { let failureMessage = FailureMessage() let result = matcher.matches( + // swiftlint:disable:next force_try ({ try! expr.evaluate() }), failureMessage: failureMessage, location: expr.location @@ -114,7 +115,7 @@ extension NMBObjCMatcher { ) } }) - return try! pred.satisfies(expr).toObjectiveC() + return try pred.satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Async.swift similarity index 63% rename from Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift rename to Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Async.swift index 3cba8b0..5022fe2 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Async.swift @@ -23,92 +23,29 @@ private func async(style: ExpectationStyle, predicate: Predicate, timeout: } switch result { case .completed: return lastPredicateResult! - case .timedOut: return PredicateResult(status: .fail, message: lastPredicateResult!.message) + case .timedOut: + let message = lastPredicateResult?.message ?? .fail("timed out before returning a value") + return PredicateResult(status: .fail, message: message) case let .errorThrown(error): return PredicateResult(status: .fail, message: .fail("unexpected error thrown: <\(error)>")) case let .raisedException(exception): return PredicateResult(status: .fail, message: .fail("unexpected exception raised: \(exception)")) case .blockedRunLoop: // swiftlint:disable:next line_length - return PredicateResult(status: .fail, message: lastPredicateResult!.message.appended(message: " (timed out, but main thread was unresponsive).")) + let message = lastPredicateResult?.message.appended(message: " (timed out, but main run loop was unresponsive).") ?? + .fail("main run loop was unresponsive") + return PredicateResult(status: .fail, message: message) case .incomplete: - internalError("Reached .incomplete state for toEventually(...).") - } - } -} - -// Deprecated -internal struct AsyncMatcherWrapper: Matcher - where U: Matcher, U.ValueType == T { - let fullMatcher: U - let timeoutInterval: TimeInterval - let pollInterval: TimeInterval - - init(fullMatcher: U, timeoutInterval: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval) { - self.fullMatcher = fullMatcher - self.timeoutInterval = timeoutInterval - self.pollInterval = pollInterval - } - - func matches(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { - let uncachedExpression = actualExpression.withoutCaching() - let fnName = "expect(...).toEventually(...)" - let result = pollBlock( - pollInterval: pollInterval, - timeoutInterval: timeoutInterval, - file: actualExpression.location.file, - line: actualExpression.location.line, - fnName: fnName) { - try self.fullMatcher.matches(uncachedExpression, failureMessage: failureMessage) - } - switch result { - case let .completed(isSuccessful): return isSuccessful - case .timedOut: return false - case let .errorThrown(error): - failureMessage.stringValue = "an unexpected error thrown: <\(error)>" - return false - case let .raisedException(exception): - failureMessage.stringValue = "an unexpected exception thrown: <\(exception)>" - return false - case .blockedRunLoop: - failureMessage.postfixMessage += " (timed out, but main thread was unresponsive)." - return false - case .incomplete: - internalError("Reached .incomplete state for toEventually(...).") - } - } - - func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { - let uncachedExpression = actualExpression.withoutCaching() - let result = pollBlock( - pollInterval: pollInterval, - timeoutInterval: timeoutInterval, - file: actualExpression.location.file, - line: actualExpression.location.line, - fnName: "expect(...).toEventuallyNot(...)") { - try self.fullMatcher.doesNotMatch(uncachedExpression, failureMessage: failureMessage) - } - switch result { - case let .completed(isSuccessful): return isSuccessful - case .timedOut: return false - case let .errorThrown(error): - failureMessage.stringValue = "an unexpected error thrown: <\(error)>" - return false - case let .raisedException(exception): - failureMessage.stringValue = "an unexpected exception thrown: <\(exception)>" - return false - case .blockedRunLoop: - failureMessage.postfixMessage += " (timed out, but main thread was unresponsive)." - return false - case .incomplete: - internalError("Reached .incomplete state for toEventuallyNot(...).") + internalError("Reached .incomplete state for \(fnName)(...).") } } } private let toEventuallyRequiresClosureError = FailureMessage( - // swiftlint:disable:next line_length - stringValue: "expect(...).toEventually(...) requires an explicit closure (eg - expect { ... }.toEventually(...) )\nSwift 1.2 @autoclosure behavior has changed in an incompatible way for Nimble to function" + stringValue: """ + expect(...).toEventually(...) requires an explicit closure (eg - expect { ... }.toEventually(...) ) + Swift 1.2 @autoclosure behavior has changed in an incompatible way for Nimble to function + """ ) extension Expectation { @@ -182,14 +119,19 @@ extension Expectation { public func toEventually(_ matcher: U, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) where U: Matcher, U.ValueType == T { if expression.isClosure { - let (pass, msg) = expressionMatches( + let (pass, msg) = execute( expression, - matcher: AsyncMatcherWrapper( - fullMatcher: matcher, - timeoutInterval: timeout, - pollInterval: pollInterval), + .toMatch, + async( + style: .toMatch, + predicate: matcher.predicate, + timeout: timeout, + poll: pollInterval, + fnName: "toEventually" + ), to: "to eventually", - description: description + description: description, + captureExceptions: false ) verify(pass, msg) } else { @@ -208,10 +150,13 @@ extension Expectation { if expression.isClosure { let (pass, msg) = expressionDoesNotMatch( expression, - matcher: AsyncMatcherWrapper( - fullMatcher: matcher, - timeoutInterval: timeout, - pollInterval: pollInterval), + matcher: async( + style: .toNotMatch, + predicate: matcher.predicate, + timeout: timeout, + poll: pollInterval, + fnName: "toEventuallyNot" + ), toNot: "to eventually not", description: description ) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift index 5674525..3a68b09 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift @@ -29,7 +29,7 @@ public func beAKindOf(_ expectedType: T.Type) -> Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) /// A Nimble matcher that succeeds when the actual value is an instance of the given class. /// @see beAnInstanceOf if you want to match against the exact class @@ -59,8 +59,8 @@ public func beAKindOf(_ expectedClass: AnyClass) -> Predicate { extension NMBObjCMatcher { @objc public class func beAKindOfMatcher(_ expected: AnyClass) -> NMBMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - return try! beAKindOf(expected).matches(actualExpression, failureMessage: failureMessage) + return NMBPredicate { actualExpression in + return try beAKindOf(expected).satisfies(actualExpression).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift index 70c5661..3cef3a7 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift @@ -33,7 +33,7 @@ public func beAnInstanceOf(_ expectedClass: AnyClass) -> Predicate { } else { actualString = "" } - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) let matches = instance != nil && instance!.isMember(of: expectedClass) #else let matches = instance != nil && type(of: instance!) == expectedClass @@ -45,11 +45,11 @@ public func beAnInstanceOf(_ expectedClass: AnyClass) -> Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func beAnInstanceOfMatcher(_ expected: AnyClass) -> NMBMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - return try! beAnInstanceOf(expected).matches(actualExpression, failureMessage: failureMessage) + return NMBPredicate { actualExpression in + return try beAnInstanceOf(expected).satisfies(actualExpression).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift index dfb4e28..d6fd1ee 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift @@ -1,5 +1,6 @@ import Foundation +// swiftlint:disable:next identifier_name public let DefaultDelta = 0.0001 internal func isCloseTo(_ actualValue: NMBDoubleConvertible?, @@ -34,31 +35,45 @@ public func beCloseTo(_ expectedValue: NMBDoubleConvertible, within delta: Doubl } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) public class NMBObjCBeCloseToMatcher: NSObject, NMBMatcher { + // swiftlint:disable identifier_name var _expected: NSNumber var _delta: CDouble + // swiftlint:enable identifier_name init(expected: NSNumber, within: CDouble) { _expected = expected _delta = within } - @objc public func matches(_ actualExpression: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { + @objc public func matches(_ actualExpression: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool { let actualBlock: () -> NMBDoubleConvertible? = ({ return actualExpression() as? NMBDoubleConvertible }) let expr = Expression(expression: actualBlock, location: location) let matcher = beCloseTo(self._expected, within: self._delta) - return try! matcher.matches(expr, failureMessage: failureMessage) + + do { + return try matcher.matches(expr, failureMessage: failureMessage) + } catch let error { + failureMessage.stringValue = "unexpected error thrown: <\(error)>" + return false + } } - @objc public func doesNotMatch(_ actualExpression: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { + @objc public func doesNotMatch(_ actualExpression: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool { let actualBlock: () -> NMBDoubleConvertible? = ({ return actualExpression() as? NMBDoubleConvertible }) let expr = Expression(expression: actualBlock, location: location) let matcher = beCloseTo(self._expected, within: self._delta) - return try! matcher.doesNotMatch(expr, failureMessage: failureMessage) + + do { + return try matcher.doesNotMatch(expr, failureMessage: failureMessage) + } catch let error { + failureMessage.stringValue = "unexpected error thrown: <\(error)>" + return false + } } @objc public var within: (CDouble) -> NMBObjCBeCloseToMatcher { @@ -98,14 +113,17 @@ public func beCloseTo(_ expectedValues: [Double], within delta: Double = Default infix operator ≈ : ComparisonPrecedence +// swiftlint:disable:next identifier_name public func ≈(lhs: Expectation<[Double]>, rhs: [Double]) { lhs.to(beCloseTo(rhs)) } +// swiftlint:disable:next identifier_name public func ≈(lhs: Expectation, rhs: NMBDoubleConvertible) { lhs.to(beCloseTo(rhs)) } +// swiftlint:disable:next identifier_name public func ≈(lhs: Expectation, rhs: (expected: NMBDoubleConvertible, delta: Double)) { lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) } @@ -121,6 +139,7 @@ precedencegroup PlusMinusOperatorPrecedence { } infix operator ± : PlusMinusOperatorPrecedence +// swiftlint:disable:next identifier_name public func ±(lhs: NMBDoubleConvertible, rhs: Double) -> (expected: NMBDoubleConvertible, delta: Double) { return (expected: lhs, delta: rhs) } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeEmpty.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeEmpty.swift index 3cbc15d..79bf923 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeEmpty.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeEmpty.swift @@ -13,6 +13,17 @@ public func beEmpty() -> Predicate { } } +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For strings, it is an empty string. +public func beEmpty() -> Predicate { + return Predicate.simple("be empty") { actualExpression in + guard let actual = try actualExpression.evaluate() else { + return .fail + } + return PredicateStatus(bool: actual.isEmpty) + } +} + /// A Nimble matcher that succeeds when a value is "empty". For collections, this /// means the are no items in that collection. For strings, it is an empty string. public func beEmpty() -> Predicate { @@ -61,19 +72,19 @@ public func beEmpty() -> Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func beEmptyMatcher() -> NMBPredicate { return NMBPredicate { actualExpression in let location = actualExpression.location - let actualValue = try! actualExpression.evaluate() + let actualValue = try actualExpression.evaluate() if let value = actualValue as? NMBCollection { let expr = Expression(expression: ({ value as NMBCollection }), location: location) - return try! beEmpty().satisfies(expr).toObjectiveC() + return try beEmpty().satisfies(expr).toObjectiveC() } else if let value = actualValue as? NSString { let expr = Expression(expression: ({ value as String }), location: location) - return try! beEmpty().satisfies(expr).toObjectiveC() + return try beEmpty().satisfies(expr).toObjectiveC() } else if let actualValue = actualValue { // swiftlint:disable:next line_length let badTypeErrorMsg = "be empty (only works for NSArrays, NSSets, NSIndexSets, NSDictionaries, NSHashTables, and NSStrings)" diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift index 8717f97..4a4cdd2 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift @@ -13,13 +13,13 @@ public func beGreaterThan(_ expectedValue: T?) -> Predicate { /// A Nimble matcher that succeeds when the actual value is greater than the expected value. public func beGreaterThan(_ expectedValue: NMBComparable?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be greater than <\(stringify(expectedValue))>" + let errorMessage = "be greater than <\(stringify(expectedValue))>" + return Predicate.simple(errorMessage) { actualExpression in let actualValue = try actualExpression.evaluate() let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) == ComparisonResult.orderedDescending - return matches - }.requireNonNil + return PredicateStatus(bool: matches) + } } public func >(lhs: Expectation, rhs: T) { @@ -30,12 +30,12 @@ public func > (lhs: Expectation, rhs: NMBComparable?) { lhs.to(beGreaterThan(rhs)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } - return try! beGreaterThan(expected).matches(expr, failureMessage: failureMessage) + return try beGreaterThan(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift index 55d8e7b..39d9e63 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift @@ -3,25 +3,25 @@ import Foundation /// A Nimble matcher that succeeds when the actual value is greater than /// or equal to the expected value. public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be greater than or equal to <\(stringify(expectedValue))>" + let message = "be greater than or equal to <\(stringify(expectedValue))>" + return Predicate.simple(message) { actualExpression in let actualValue = try actualExpression.evaluate() if let actual = actualValue, let expected = expectedValue { - return actual >= expected + return PredicateStatus(bool: actual >= expected) } - return false - }.requireNonNil + return .fail + } } /// A Nimble matcher that succeeds when the actual value is greater than /// or equal to the expected value. public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be greater than or equal to <\(stringify(expectedValue))>" + let message = "be greater than or equal to <\(stringify(expectedValue))>" + return Predicate.simple(message) { actualExpression in let actualValue = try actualExpression.evaluate() let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) != ComparisonResult.orderedAscending - return matches - }.requireNonNil + return PredicateStatus(bool: matches) + } } public func >=(lhs: Expectation, rhs: T) { @@ -32,12 +32,12 @@ public func >=(lhs: Expectation, rhs: T) { lhs.to(beGreaterThanOrEqualTo(rhs)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beGreaterThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func beGreaterThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } - return try! beGreaterThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage) + return try beGreaterThanOrEqualTo(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift index ad19def..49e503e 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift @@ -3,20 +3,27 @@ import Foundation /// A Nimble matcher that succeeds when the actual value is the same instance /// as the expected instance. public func beIdenticalTo(_ expected: Any?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - #if os(Linux) + return Predicate.define { actualExpression in + #if os(Linux) && !swift(>=4.1.50) let actual = try actualExpression.evaluate() as? AnyObject #else let actual = try actualExpression.evaluate() as AnyObject? #endif - failureMessage.actualValue = "\(identityAsString(actual))" - failureMessage.postfixMessage = "be identical to \(identityAsString(expected))" - #if os(Linux) - return actual === (expected as? AnyObject) && actual !== nil + + let bool: Bool + #if os(Linux) && !swift(>=4.1.50) + bool = actual === (expected as? AnyObject) && actual !== nil #else - return actual === (expected as AnyObject?) && actual !== nil + bool = actual === (expected as AnyObject?) && actual !== nil #endif - }.requireNonNil + return PredicateResult( + bool: bool, + message: .expectedCustomValueTo( + "be identical to \(identityAsString(expected))", + "\(identityAsString(actual))" + ) + ) + } } public func === (lhs: Expectation, rhs: Any?) { @@ -34,12 +41,12 @@ public func be(_ expected: Any?) -> Predicate { return beIdenticalTo(expected) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beIdenticalToMatcher(_ expected: NSObject?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func beIdenticalToMatcher(_ expected: NSObject?) -> NMBMatcher { + return NMBPredicate { actualExpression in let aExpr = actualExpression.cast { $0 as Any? } - return try! beIdenticalTo(expected).matches(aExpr, failureMessage: failureMessage) + return try beIdenticalTo(expected).satisfies(aExpr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThan.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThan.swift index 8047efd..ef0a7d4 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThan.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThan.swift @@ -2,23 +2,23 @@ import Foundation /// A Nimble matcher that succeeds when the actual value is less than the expected value. public func beLessThan(_ expectedValue: T?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be less than <\(stringify(expectedValue))>" + let message = "be less than <\(stringify(expectedValue))>" + return Predicate.simple(message) { actualExpression in if let actual = try actualExpression.evaluate(), let expected = expectedValue { - return actual < expected + return PredicateStatus(bool: actual < expected) } - return false - }.requireNonNil + return .fail + } } /// A Nimble matcher that succeeds when the actual value is less than the expected value. public func beLessThan(_ expectedValue: NMBComparable?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be less than <\(stringify(expectedValue))>" + let message = "be less than <\(stringify(expectedValue))>" + return Predicate.simple(message) { actualExpression in let actualValue = try actualExpression.evaluate() let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) == ComparisonResult.orderedAscending - return matches - }.requireNonNil + return PredicateStatus(bool: matches) + } } public func <(lhs: Expectation, rhs: T) { @@ -29,12 +29,12 @@ public func < (lhs: Expectation, rhs: NMBComparable?) { lhs.to(beLessThan(rhs)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beLessThanMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func beLessThanMatcher(_ expected: NMBComparable?) -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } - return try! beLessThan(expected).matches(expr, failureMessage: failureMessage) + return try beLessThan(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift index f9e9f4e..30ce043 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift @@ -3,23 +3,22 @@ import Foundation /// A Nimble matcher that succeeds when the actual value is less than /// or equal to the expected value. public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be less than or equal to <\(stringify(expectedValue))>" + return Predicate.simple("be less than or equal to <\(stringify(expectedValue))>") { actualExpression in if let actual = try actualExpression.evaluate(), let expected = expectedValue { - return actual <= expected + return PredicateStatus(bool: actual <= expected) } - return false - }.requireNonNil + return .fail + } } /// A Nimble matcher that succeeds when the actual value is less than /// or equal to the expected value. public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be less than or equal to <\(stringify(expectedValue))>" + return Predicate.simple("be less than or equal to <\(stringify(expectedValue))>") { actualExpression in let actualValue = try actualExpression.evaluate() - return actualValue != nil && actualValue!.NMB_compare(expectedValue) != ComparisonResult.orderedDescending - }.requireNonNil + let matches = actualValue.map { $0.NMB_compare(expectedValue) != .orderedDescending } ?? false + return PredicateStatus(bool: matches) + } } public func <=(lhs: Expectation, rhs: T) { @@ -30,12 +29,12 @@ public func <=(lhs: Expectation, rhs: T) { lhs.to(beLessThanOrEqualTo(rhs)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beLessThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func beLessThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } - return try! beLessThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage) + return try beLessThanOrEqualTo(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLogical.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLogical.swift index 2b18b4c..788234b 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLogical.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLogical.swift @@ -100,14 +100,6 @@ public func beTruthy() -> Predicate< return Predicate.simpleNilable("be truthy") { actualExpression in let actualValue = try actualExpression.evaluate() if let actualValue = actualValue { - // FIXME: This is a workaround to SR-2290. - // See: - // - https://bugs.swift.org/browse/SR-2290 - // - https://github.com/norio-nomura/Nimble/pull/5#issuecomment-237835873 - if let number = actualValue as? NSNumber { - return PredicateStatus(bool: number.boolValue == true) - } - return PredicateStatus(bool: actualValue == (true as T)) } return PredicateStatus(bool: actualValue != nil) @@ -120,47 +112,42 @@ public func beFalsy() -> Predicate NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in + @objc public class func beTruthyMatcher() -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } - return try! beTruthy().matches(expr, failureMessage: failureMessage) + return try beTruthy().satisfies(expr).toObjectiveC() } } - @objc public class func beFalsyMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in + @objc public class func beFalsyMatcher() -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } - return try! beFalsy().matches(expr, failureMessage: failureMessage) + return try beFalsy().satisfies(expr).toObjectiveC() } } - @objc public class func beTrueMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in + @objc public class func beTrueMatcher() -> NMBMatcher { + return NMBPredicate { actualExpression in let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } - return try! beTrue().matches(expr, failureMessage: failureMessage) + return try beTrue().satisfies(expr).toObjectiveC() } } - @objc public class func beFalseMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } - return try! beFalse().matches(expr, failureMessage: failureMessage) + @objc public class func beFalseMatcher() -> NMBMatcher { + return NMBPredicate { actualExpression in + let expr = actualExpression.cast { value -> Bool? in + guard let value = value else { return nil } + return (value as? NSNumber)?.boolValue ?? false + } + return try beFalse().satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeNil.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeNil.swift index a22e0f4..0f21d41 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeNil.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeNil.swift @@ -8,11 +8,11 @@ public func beNil() -> Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beNilMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in - return try! beNil().matches(actualExpression, failureMessage: failureMessage) + @objc public class func beNilMatcher() -> NMBMatcher { + return NMBPredicate { actualExpression in + return try beNil().satisfies(actualExpression).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeVoid.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeVoid.swift index f5bf22a..9a7eafd 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeVoid.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeVoid.swift @@ -2,17 +2,18 @@ import Foundation /// A Nimble matcher that succeeds when the actual value is Void. public func beVoid() -> Predicate<()> { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "be void" + return Predicate.simpleNilable("be void") { actualExpression in let actualValue: ()? = try actualExpression.evaluate() - return actualValue != nil + return PredicateStatus(bool: actualValue != nil) } } -public func == (lhs: Expectation<()>, rhs: ()) { - lhs.to(beVoid()) -} +extension Expectation where T == () { + public static func == (lhs: Expectation<()>, rhs: ()) { + lhs.to(beVoid()) + } -public func != (lhs: Expectation<()>, rhs: ()) { - lhs.toNot(beVoid()) + public static func != (lhs: Expectation<()>, rhs: ()) { + lhs.toNot(beVoid()) + } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeginWith.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeginWith.swift index c2ab568..3183eb9 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeginWith.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeginWith.swift @@ -35,24 +35,24 @@ public func beginWith(_ startingElement: Any) -> Predicate public func beginWith(_ startingSubstring: String) -> Predicate { return Predicate.simple("begin with <\(startingSubstring)>") { actualExpression in if let actual = try actualExpression.evaluate() { - let range = actual.range(of: startingSubstring) - return PredicateStatus(bool: range != nil && range!.lowerBound == actual.startIndex) + return PredicateStatus(bool: actual.hasPrefix(startingSubstring)) } return .fail } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func beginWithMatcher(_ expected: Any) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let actual = try! actualExpression.evaluate() - if (actual as? String) != nil { + @objc public class func beginWithMatcher(_ expected: Any) -> NMBMatcher { + return NMBPredicate { actualExpression in + let actual = try actualExpression.evaluate() + if actual is String { let expr = actualExpression.cast { $0 as? String } - return try! beginWith(expected as! String).matches(expr, failureMessage: failureMessage) + // swiftlint:disable:next force_cast + return try beginWith(expected as! String).satisfies(expr).toObjectiveC() } else { let expr = actualExpression.cast { $0 as? NMBOrderedCollection } - return try! beginWith(expected).matches(expr, failureMessage: failureMessage) + return try beginWith(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Contain.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Contain.swift index f1afb72..1d16fb1 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Contain.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Contain.swift @@ -1,22 +1,43 @@ import Foundation -/// A Nimble matcher that succeeds when the actual sequence contains the expected value. +/// A Nimble matcher that succeeds when the actual sequence contains the expected values. public func contain(_ items: T...) -> Predicate - where S.Iterator.Element == T { + where S.Element == T { return contain(items) } +/// A Nimble matcher that succeeds when the actual sequence contains the expected values. public func contain(_ items: [T]) -> Predicate - where S.Iterator.Element == T { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "contain <\(arrayAsString(items))>" + where S.Element == T { + return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in if let actual = try actualExpression.evaluate() { - return items.all { + let matches = items.allSatisfy { return actual.contains($0) } + return PredicateStatus(bool: matches) + } + return .fail + } +} + +/// A Nimble matcher that succeeds when the actual set contains the expected values. +public func contain(_ items: T...) -> Predicate + where S.Element == T { + return contain(items) +} + +/// A Nimble matcher that succeeds when the actual set contains the expected values. +public func contain(_ items: [T]) -> Predicate + where S.Element == T { + return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in + if let actual = try actualExpression.evaluate() { + let matches = items.allSatisfy { + return actual.contains($0) + } + return PredicateStatus(bool: matches) + } + return .fail } - return false - }.requireNonNil } /// A Nimble matcher that succeeds when the actual string contains the expected substring. @@ -25,16 +46,16 @@ public func contain(_ substrings: String...) -> Predicate { } public func contain(_ substrings: [String]) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "contain <\(arrayAsString(substrings))>" + return Predicate.simple("contain <\(arrayAsString(substrings))>") { actualExpression in if let actual = try actualExpression.evaluate() { - return substrings.all { + let matches = substrings.allSatisfy { let range = actual.range(of: $0) return range != nil && !range!.isEmpty } + return PredicateStatus(bool: matches) } - return false - }.requireNonNil + return .fail + } } /// A Nimble matcher that succeeds when the actual string contains the expected substring. @@ -43,13 +64,13 @@ public func contain(_ substrings: NSString...) -> Predicate { } public func contain(_ substrings: [NSString]) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "contain <\(arrayAsString(substrings))>" + return Predicate.simple("contain <\(arrayAsString(substrings))>") { actualExpression in if let actual = try actualExpression.evaluate() { - return substrings.all { actual.range(of: $0.description).length != 0 } + let matches = substrings.allSatisfy { actual.range(of: $0.description).length != 0 } + return PredicateStatus(bool: matches) } - return false - }.requireNonNil + return .fail + } } /// A Nimble matcher that succeeds when the actual collection contains the expected object. @@ -58,37 +79,45 @@ public func contain(_ items: Any?...) -> Predicate { } public func contain(_ items: [Any?]) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "contain <\(arrayAsString(items))>" - guard let actual = try actualExpression.evaluate() else { return false } - return items.all { item in - return item != nil && actual.contains(item!) + return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + let matches = items.allSatisfy { item in + return item.map { actual.contains($0) } ?? false } - }.requireNonNil + return PredicateStatus(bool: matches) + } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func containMatcher(_ expected: [NSObject]) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func containMatcher(_ expected: [NSObject]) -> NMBMatcher { + return NMBPredicate { actualExpression in let location = actualExpression.location - let actualValue = try! actualExpression.evaluate() + let actualValue = try actualExpression.evaluate() if let value = actualValue as? NMBContainer { let expr = Expression(expression: ({ value as NMBContainer }), location: location) // A straightforward cast on the array causes this to crash, so we have to cast the individual items let expectedOptionals: [Any?] = expected.map({ $0 as Any? }) - return try! contain(expectedOptionals).matches(expr, failureMessage: failureMessage) + return try contain(expectedOptionals).satisfies(expr).toObjectiveC() } else if let value = actualValue as? NSString { let expr = Expression(expression: ({ value as String }), location: location) - return try! contain(expected as! [String]).matches(expr, failureMessage: failureMessage) - } else if actualValue != nil { - // swiftlint:disable:next line_length - failureMessage.postfixMessage = "contain <\(arrayAsString(expected))> (only works for NSArrays, NSSets, NSHashTables, and NSStrings)" - } else { - failureMessage.postfixMessage = "contain <\(arrayAsString(expected))>" + // swiftlint:disable:next force_cast + return try contain(expected as! [String]).satisfies(expr).toObjectiveC() } - return false + + let message: ExpectationMessage + if actualValue != nil { + message = ExpectationMessage.expectedActualValueTo( + // swiftlint:disable:next line_length + "contain <\(arrayAsString(expected))> (only works for NSArrays, NSSets, NSHashTables, and NSStrings)" + ) + } else { + message = ExpectationMessage + .expectedActualValueTo("contain <\(arrayAsString(expected))>") + .appendedBeNilHint() + } + return NMBPredicateResult(status: .fail, message: message.toObjectiveC()) } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift index ae0d854..331f3bc 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift @@ -2,43 +2,44 @@ import Foundation public func containElementSatisfying(_ predicate: @escaping ((T) -> Bool), _ predicateDescription: String = "") -> Predicate where S.Iterator.Element == T { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.actualValue = nil - + return Predicate.define { actualExpression in + let message: ExpectationMessage if predicateDescription == "" { - failureMessage.postfixMessage = "find object in collection that satisfies predicate" + message = .expectedTo("find object in collection that satisfies predicate") } else { - failureMessage.postfixMessage = "find object in collection \(predicateDescription)" + message = .expectedTo("find object in collection \(predicateDescription)") } if let sequence = try actualExpression.evaluate() { for object in sequence { if predicate(object) { - return true + return PredicateResult(bool: true, message: message) } } - return false + return PredicateResult(bool: false, message: message) } - return false - }.requireNonNil + return PredicateResult(status: .fail, message: message) + } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func containElementSatisfyingMatcher(_ predicate: @escaping ((NSObject) -> Bool)) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let value = try! actualExpression.evaluate() + @objc public class func containElementSatisfyingMatcher(_ predicate: @escaping ((NSObject) -> Bool)) -> NMBMatcher { + return NMBPredicate { actualExpression in + let value = try actualExpression.evaluate() guard let enumeration = value as? NSFastEnumeration else { - // swiftlint:disable:next line_length - failureMessage.postfixMessage = "containElementSatisfying must be provided an NSFastEnumeration object" - failureMessage.actualValue = nil - failureMessage.expected = "" - failureMessage.to = "" - return false + let message = ExpectationMessage.fail( + "containElementSatisfying must be provided an NSFastEnumeration object" + ) + return NMBPredicateResult(status: .fail, message: message.toObjectiveC()) } + let message = ExpectationMessage + .expectedTo("find object in collection that satisfies predicate") + .toObjectiveC() + var iterator = NSFastEnumerationIterator(enumeration) while let item = iterator.next() { guard let object = item as? NSObject else { @@ -46,14 +47,11 @@ public func containElementSatisfying(_ predicate: @escaping ((T) } if predicate(object) { - return true + return NMBPredicateResult(status: .matches, message: message) } } - failureMessage.actualValue = nil - failureMessage.postfixMessage = "" - failureMessage.to = "to find object in collection that satisfies predicate" - return false + return NMBPredicateResult(status: .doesNotMatch, message: message) } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ElementsEqual.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ElementsEqual.swift new file mode 100644 index 0000000..1704e94 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ElementsEqual.swift @@ -0,0 +1,16 @@ +/// A Nimble matcher that succeeds when the actual sequence contain the same elements in the same order to the exepected sequence. +public func elementsEqual(_ expectedValue: S?) -> Predicate where S.Element: Equatable { + // A matcher abstraction for https://developer.apple.com/documentation/swift/sequence/2949668-elementsequal + return Predicate.define("elementsEqual <\(stringify(expectedValue))>") { (actualExpression, msg) in + let actualValue = try actualExpression.evaluate() + switch (expectedValue, actualValue) { + case (nil, _?): + return PredicateResult(status: .fail, message: msg.appendedBeNilHint()) + case (nil, nil), (_, nil): + return PredicateResult(status: .fail, message: msg) + case (let expected?, let actual?): + let matches = expected.elementsEqual(actual) + return PredicateResult(bool: matches, message: msg) + } + } +} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/EndWith.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/EndWith.swift index a6f9f91..13bdb31 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/EndWith.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/EndWith.swift @@ -4,9 +4,7 @@ import Foundation /// is equal to the expected value. public func endWith(_ endingElement: T) -> Predicate where S.Iterator.Element == T { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "end with <\(endingElement)>" - + return Predicate.simple("end with <\(endingElement)>") { actualExpression in if let actualValue = try actualExpression.evaluate() { var actualGenerator = actualValue.makeIterator() var lastItem: T? @@ -16,55 +14,54 @@ public func endWith(_ endingElement: T) -> Predicate< item = actualGenerator.next() } while(item != nil) - return lastItem == endingElement + return PredicateStatus(bool: lastItem == endingElement) } - return false - }.requireNonNil + return .fail + } } /// A Nimble matcher that succeeds when the actual collection's last element /// is equal to the expected object. public func endWith(_ endingElement: Any) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "end with <\(endingElement)>" - guard let collection = try actualExpression.evaluate() else { return false } - guard collection.count > 0 else { return false } + return Predicate.simple("end with <\(endingElement)>") { actualExpression in + guard let collection = try actualExpression.evaluate() else { return .fail } + guard collection.count > 0 else { return PredicateStatus(bool: false) } #if os(Linux) guard let collectionValue = collection.object(at: collection.count - 1) as? NSObject else { - return false + return .fail } #else let collectionValue = collection.object(at: collection.count - 1) as AnyObject #endif - return collectionValue.isEqual(endingElement) - }.requireNonNil + return PredicateStatus(bool: collectionValue.isEqual(endingElement)) + } } /// A Nimble matcher that succeeds when the actual string contains the expected substring /// where the expected substring's location is the actual string's length minus the /// expected substring's length. public func endWith(_ endingSubstring: String) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "end with <\(endingSubstring)>" + return Predicate.simple("end with <\(endingSubstring)>") { actualExpression in if let collection = try actualExpression.evaluate() { - return collection.hasSuffix(endingSubstring) + return PredicateStatus(bool: collection.hasSuffix(endingSubstring)) } - return false - }.requireNonNil + return .fail + } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func endWithMatcher(_ expected: Any) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let actual = try! actualExpression.evaluate() - if (actual as? String) != nil { + @objc public class func endWithMatcher(_ expected: Any) -> NMBMatcher { + return NMBPredicate { actualExpression in + let actual = try actualExpression.evaluate() + if actual is String { let expr = actualExpression.cast { $0 as? String } - return try! endWith(expected as! String).matches(expr, failureMessage: failureMessage) + // swiftlint:disable:next force_cast + return try endWith(expected as! String).satisfies(expr).toObjectiveC() } else { let expr = actualExpression.cast { $0 as? NMBOrderedCollection } - return try! endWith(expected).matches(expr, failureMessage: failureMessage) + return try endWith(expected).satisfies(expr).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Equal.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Equal.swift index 9467154..b08d5f6 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Equal.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Equal.swift @@ -7,103 +7,30 @@ import Foundation public func equal(_ expectedValue: T?) -> Predicate { return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in let actualValue = try actualExpression.evaluate() - let matches = actualValue == expectedValue && expectedValue != nil - if expectedValue == nil || actualValue == nil { - if expectedValue == nil && actualValue != nil { - return PredicateResult( - status: .fail, - message: msg.appendedBeNilHint() - ) - } + switch (expectedValue, actualValue) { + case (nil, _?): + return PredicateResult(status: .fail, message: msg.appendedBeNilHint()) + case (nil, nil), (_, nil): return PredicateResult(status: .fail, message: msg) + case (let expected?, let actual?): + let matches = expected == actual + return PredicateResult(bool: matches, message: msg) } - return PredicateResult(status: PredicateStatus(bool: matches), message: msg) - } -} - -/// A Nimble matcher that succeeds when the actual value is equal to the expected value. -/// 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]?) -> Predicate<[T: C]> { - return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in - let actualValue = try actualExpression.evaluate() - if expectedValue == nil || actualValue == nil { - if expectedValue == nil && actualValue != nil { - return PredicateResult( - status: .fail, - message: msg.appendedBeNilHint() - ) - } - return PredicateResult(status: .fail, message: msg) - } - return PredicateResult( - status: PredicateStatus(bool: expectedValue! == actualValue!), - message: msg - ) - } -} - -/// A Nimble matcher that succeeds when the actual collection is equal to the expected collection. -/// Items must implement the Equatable protocol. -public func equal(_ expectedValue: [T]?) -> Predicate<[T]> { - return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in - let actualValue = try actualExpression.evaluate() - if expectedValue == nil || actualValue == nil { - if expectedValue == nil && actualValue != nil { - return PredicateResult( - status: .fail, - message: msg.appendedBeNilHint() - ) - } - return PredicateResult( - status: .fail, - message: msg - ) - } - return PredicateResult( - bool: expectedValue! == actualValue!, - message: msg - ) } } /// A Nimble matcher allowing comparison of collection with optional type public func equal(_ expectedValue: [T?]) -> Predicate<[T?]> { return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in - if let actualValue = try actualExpression.evaluate() { - let doesNotMatch = PredicateResult( - status: .doesNotMatch, - message: msg - ) - - if expectedValue.count != actualValue.count { - return doesNotMatch - } - - for (index, item) in actualValue.enumerated() { - let otherItem = expectedValue[index] - if item == nil && otherItem == nil { - continue - } else if item == nil && otherItem != nil { - return doesNotMatch - } else if item != nil && otherItem == nil { - return doesNotMatch - } else if item! != otherItem! { - return doesNotMatch - } - } - - return PredicateResult( - status: .matches, - message: msg - ) - } else { + guard let actualValue = try actualExpression.evaluate() else { return PredicateResult( status: .fail, message: msg.appendedBeNilHint() ) } + + let matches = expectedValue == actualValue + return PredicateResult(bool: matches, message: msg) } } @@ -128,44 +55,45 @@ private func equal(_ expectedValue: Set?, stringify: @escaping (Set?) - var errorMessage: ExpectationMessage = .expectedActualValueTo("equal <\(stringify(expectedValue))>") - if let expectedValue = expectedValue { - if let actualValue = try actualExpression.evaluate() { - errorMessage = .expectedCustomValueTo( - "equal <\(stringify(expectedValue))>", - "<\(stringify(actualValue))>" - ) - - if expectedValue == actualValue { - return PredicateResult( - status: .matches, - message: errorMessage - ) - } - - let missing = expectedValue.subtracting(actualValue) - if missing.count > 0 { - errorMessage = errorMessage.appended(message: ", missing <\(stringify(missing))>") - } - - let extra = actualValue.subtracting(expectedValue) - if extra.count > 0 { - errorMessage = errorMessage.appended(message: ", extra <\(stringify(extra))>") - } - return PredicateResult( - status: .doesNotMatch, - message: errorMessage - ) - } - return PredicateResult( - status: .fail, - message: errorMessage.appendedBeNilHint() - ) - } else { + guard let expectedValue = expectedValue else { return PredicateResult( status: .fail, message: errorMessage.appendedBeNilHint() ) } + + guard let actualValue = try actualExpression.evaluate() else { + return PredicateResult( + status: .fail, + message: errorMessage.appendedBeNilHint() + ) + } + + errorMessage = .expectedCustomValueTo( + "equal <\(stringify(expectedValue))>", + "<\(stringify(actualValue))>" + ) + + if expectedValue == actualValue { + return PredicateResult( + status: .matches, + message: errorMessage + ) + } + + let missing = expectedValue.subtracting(actualValue) + if missing.count > 0 { + errorMessage = errorMessage.appended(message: ", missing <\(stringify(missing))>") + } + + let extra = actualValue.subtracting(expectedValue) + if extra.count > 0 { + errorMessage = errorMessage.appended(message: ", extra <\(stringify(extra))>") + } + return PredicateResult( + status: .doesNotMatch, + message: errorMessage + ) } } @@ -209,11 +137,11 @@ public func !=(lhs: Expectation<[T: C]>, rhs: [T: C]?) { lhs.toNot(equal(rhs)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func equalMatcher(_ expected: NSObject) -> NMBMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - return try! equal(expected).matches(actualExpression, failureMessage: failureMessage) + return NMBPredicate { actualExpression in + return try equal(expected).satisfies(actualExpression).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/HaveCount.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/HaveCount.swift index 93335a8..984e2d4 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/HaveCount.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/HaveCount.swift @@ -7,52 +7,67 @@ import Foundation /// A Nimble matcher that succeeds when the actual Collection's count equals /// the expected value -public func haveCount(_ expectedValue: T.IndexDistance) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in +public func haveCount(_ expectedValue: Int) -> Predicate { + return Predicate.define { actualExpression in if let actualValue = try actualExpression.evaluate() { - // swiftlint:disable:next line_length - failureMessage.postfixMessage = "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))" + let message = ExpectationMessage + .expectedCustomValueTo( + "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))", + "\(actualValue.count)" + ) + .appended(details: "Actual Value: \(stringify(actualValue))") + let result = expectedValue == actualValue.count - failureMessage.actualValue = "\(actualValue.count)" - failureMessage.extendedMessage = "Actual Value: \(stringify(actualValue))" - return result + return PredicateResult(bool: result, message: message) } else { - return false + return PredicateResult(status: .fail, message: .fail("")) } - }.requireNonNil + } } /// A Nimble matcher that succeeds when the actual collection's count equals /// the expected value public func haveCount(_ expectedValue: Int) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in + return Predicate { actualExpression in if let actualValue = try actualExpression.evaluate() { - // swiftlint:disable:next line_length - failureMessage.postfixMessage = "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))" + let message = ExpectationMessage + .expectedCustomValueTo( + "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))", + "\(actualValue.count)" + ) + .appended(details: "Actual Value: \(stringify(actualValue))") + let result = expectedValue == actualValue.count - failureMessage.actualValue = "\(actualValue.count)" - failureMessage.extendedMessage = "Actual Value: \(stringify(actualValue))" - return result + return PredicateResult(bool: result, message: message) } else { - return false + return PredicateResult(status: .fail, message: .fail("")) } } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { - @objc public class func haveCountMatcher(_ expected: NSNumber) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + @objc public class func haveCountMatcher(_ expected: NSNumber) -> NMBMatcher { + return NMBPredicate { actualExpression in let location = actualExpression.location - let actualValue = try! actualExpression.evaluate() + let actualValue = try actualExpression.evaluate() if let value = actualValue as? NMBCollection { let expr = Expression(expression: ({ value as NMBCollection}), location: location) - return try! haveCount(expected.intValue).matches(expr, failureMessage: failureMessage) - } else if let actualValue = actualValue { - failureMessage.postfixMessage = "get type of NSArray, NSSet, NSDictionary, or NSHashTable" - failureMessage.actualValue = "\(String(describing: type(of: actualValue)))" + return try haveCount(expected.intValue).satisfies(expr).toObjectiveC() } - return false + + let message: ExpectationMessage + if let actualValue = actualValue { + message = ExpectationMessage.expectedCustomValueTo( + "get type of NSArray, NSSet, NSDictionary, or NSHashTable", + "\(String(describing: type(of: actualValue)))" + ) + } else { + message = ExpectationMessage + .expectedActualValueTo("have a collection with count \(stringify(expected.intValue))") + .appendedBeNilHint() + } + return NMBPredicateResult(status: .fail, message: message.toObjectiveC()) } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Match.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Match.swift index 1e5762f..dbcff09 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Match.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Match.swift @@ -3,26 +3,25 @@ import Foundation /// A Nimble matcher that succeeds when the actual string satisfies the regular expression /// described by the expected string. public func match(_ expectedValue: String?) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - failureMessage.postfixMessage = "match <\(stringify(expectedValue))>" - + return Predicate.simple("match <\(stringify(expectedValue))>") { actualExpression in if let actual = try actualExpression.evaluate() { if let regexp = expectedValue { - return actual.range(of: regexp, options: .regularExpression) != nil + let bool = actual.range(of: regexp, options: .regularExpression) != nil + return PredicateStatus(bool: bool) } } - return false - }.requireNonNil + return .fail + } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func matchMatcher(_ expected: NSString) -> NMBMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + return NMBPredicate { actualExpression in let actual = actualExpression.cast { $0 as? String } - return try! match(expected.description).matches(actual, failureMessage: failureMessage) + return try match(expected.description).satisfies(actual).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatchError.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatchError.swift index 9c86fb7..4ad71d4 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatchError.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatchError.swift @@ -6,16 +6,24 @@ import Foundation /// Errors are tried to be compared by their implementation of Equatable, /// otherwise they fallback to comparison by _domain and _code. public func matchError(_ error: T) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - let actualError: Error? = try actualExpression.evaluate() + return Predicate.define { actualExpression in + let actualError = try actualExpression.evaluate() + + let failureMessage = FailureMessage() + setFailureMessageForError( + failureMessage, + postfixMessageVerb: "match", + actualError: actualError, + error: error + ) - setFailureMessageForError(failureMessage, postfixMessageVerb: "match", actualError: actualError, error: error) var matches = false if let actualError = actualError, errorMatchesExpectedError(actualError, expectedError: error) { matches = true } - return matches - }.requireNonNil + + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + } } /// A Nimble matcher that succeeds when the actual expression evaluates to an @@ -24,35 +32,45 @@ public func matchError(_ error: T) -> Predicate { /// Errors are tried to be compared by their implementation of Equatable, /// otherwise they fallback to comparision by _domain and _code. public func matchError(_ error: T) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - let actualError: Error? = try actualExpression.evaluate() + return Predicate.define { actualExpression in + let actualError = try actualExpression.evaluate() - setFailureMessageForError(failureMessage, postfixMessageVerb: "match", actualError: actualError, error: error) + let failureMessage = FailureMessage() + setFailureMessageForError( + failureMessage, + postfixMessageVerb: "match", + actualError: actualError, + error: error + ) var matches = false if let actualError = actualError as? T, error == actualError { matches = true } - return matches - }.requireNonNil + + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + } } /// A Nimble matcher that succeeds when the actual expression evaluates to an /// error of the specified type public func matchError(_ errorType: T.Type) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - let actualError: Error? = try actualExpression.evaluate() + return Predicate.define { actualExpression in + let actualError = try actualExpression.evaluate() + let failureMessage = FailureMessage() setFailureMessageForError( failureMessage, postfixMessageVerb: "match", actualError: actualError, errorType: errorType ) + var matches = false if actualError as? T != nil { matches = true } - return matches - }.requireNonNil + + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift index 82f3cf0..38bb297 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift @@ -1,6 +1,6 @@ import Foundation // `CGFloat` is in Foundation (swift-corelibs-foundation) on Linux. -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) import CoreGraphics #endif @@ -28,11 +28,11 @@ extension Matcher { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) /// Objective-C interface to the Swift variant of Matcher. @objc public protocol NMBMatcher { - func matches(_ actualBlock: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool - func doesNotMatch(_ actualBlock: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool + func matches(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool + func doesNotMatch(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool } #endif @@ -41,7 +41,8 @@ public protocol NMBContainer { func contains(_ anObject: Any) -> Bool } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) +// swiftlint:disable:next todo // FIXME: NSHashTable can not conform to NMBContainer since swift-DEVELOPMENT-SNAPSHOT-2016-04-25-a //extension NSHashTable : NMBContainer {} // Corelibs Foundation does not include this class yet #endif @@ -54,7 +55,7 @@ public protocol NMBCollection { var count: Int { get } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NSHashTable: NMBCollection {} // Corelibs Foundation does not include these classes yet extension NSMapTable: NMBCollection {} #endif @@ -131,7 +132,7 @@ extension NSDate: TestOutputStringConvertible { /// beGreaterThan(), beGreaterThanOrEqualTo(), and equal() matchers. /// /// Types that conform to Swift's Comparable protocol will work implicitly too -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) @objc public protocol NMBComparable { func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult } @@ -144,11 +145,13 @@ public protocol NMBComparable { extension NSNumber: NMBComparable { public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult { + // swiftlint:disable:next force_cast return compare(otherObject as! NSNumber) } } extension NSString: NMBComparable { public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult { + // swiftlint:disable:next force_cast return compare(otherObject as! String) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/PostNotification.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/PostNotification.swift index ee886f1..7d3e44c 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/PostNotification.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/PostNotification.swift @@ -1,36 +1,9 @@ import Foundation -// A workaround to SR-6419. -extension NotificationCenter { -#if !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) - #if swift(>=4.0) - #if swift(>=4.0.2) - #else - func addObserver(forName name: Notification.Name?, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Void) -> NSObjectProtocol { - return addObserver(forName: name, object: obj, queue: queue, usingBlock: block) - } - #endif - #elseif swift(>=3.2) - #if swift(>=3.2.2) - #else - // swiftlint:disable:next line_length - func addObserver(forName name: Notification.Name?, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Void) -> NSObjectProtocol { - return addObserver(forName: name, object: obj, queue: queue, usingBlock: block) - } - #endif - #else - // swiftlint:disable:next line_length - func addObserver(forName name: Notification.Name?, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Void) -> NSObjectProtocol { - return addObserver(forName: name, object: obj, queue: queue, usingBlock: block) - } - #endif -#endif -} - internal class NotificationCollector { private(set) var observedNotifications: [Notification] private let notificationCenter: NotificationCenter - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) private var token: AnyObject? #else private var token: NSObjectProtocol? @@ -43,14 +16,14 @@ internal class NotificationCollector { func startObserving() { // swiftlint:disable:next line_length - self.token = self.notificationCenter.addObserver(forName: nil, object: nil, queue: nil, using: { [weak self] n in + self.token = self.notificationCenter.addObserver(forName: nil, object: nil, queue: nil) { [weak self] notification in // linux-swift gets confused by .append(n) - self?.observedNotifications.append(n) - }) + self?.observedNotifications.append(notification) + } } deinit { - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) if let token = self.token { self.notificationCenter.removeObserver(token) } @@ -74,7 +47,8 @@ public func postNotifications( let collector = NotificationCollector(notificationCenter: center) collector.startObserving() var once: Bool = false - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in + + return Predicate { actualExpression in let collectorNotificationsExpression = Expression(memoizedExpression: { _ in return collector.observedNotifications }, location: actualExpression.location, withoutCaching: true) @@ -85,12 +59,13 @@ public func postNotifications( _ = try actualExpression.evaluate() } + let failureMessage = FailureMessage() let match = try notificationsMatcher.matches(collectorNotificationsExpression, failureMessage: failureMessage) if collector.observedNotifications.isEmpty { failureMessage.actualValue = "no notifications" } else { failureMessage.actualValue = "<\(stringify(collector.observedNotifications))>" } - return match + return PredicateResult(bool: match, message: failureMessage.toExpectationMessage()) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Predicate.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Predicate.swift index d32b0e2..2604411 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Predicate.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Predicate.swift @@ -218,6 +218,7 @@ extension Predicate: Matcher { extension Predicate { // Someday, make this public? Needs documentation internal func after(f: @escaping (Expression, PredicateResult) throws -> PredicateResult) -> Predicate { + // swiftlint:disable:previous identifier_name return Predicate { actual -> PredicateResult in let result = try self.satisfies(actual) return try f(actual, result) @@ -241,8 +242,8 @@ extension Predicate { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) -public typealias PredicateBlock = (_ actualExpression: Expression) -> NMBPredicateResult +#if canImport(Darwin) +public typealias PredicateBlock = (_ actualExpression: Expression) throws -> NMBPredicateResult public class NMBPredicate: NSObject { private let predicate: PredicateBlock @@ -251,20 +252,24 @@ public class NMBPredicate: NSObject { self.predicate = predicate } - func satisfies(_ expression: @escaping () -> NSObject!, location: SourceLocation) -> NMBPredicateResult { + func satisfies(_ expression: @escaping () throws -> NSObject?, location: SourceLocation) -> NMBPredicateResult { let expr = Expression(expression: expression, location: location) - return self.predicate(expr) + do { + return try self.predicate(expr) + } catch let error { + return PredicateResult(status: .fail, message: .fail("unexpected error thrown: <\(error)>")).toObjectiveC() + } } } extension NMBPredicate: NMBMatcher { - public func matches(_ actualBlock: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { + public func matches(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool { let result = satisfies(actualBlock, location: location).toSwift() result.message.update(failureMessage: failureMessage) return result.status.toBoolean(expectation: .toMatch) } - public func doesNotMatch(_ actualBlock: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { + public func doesNotMatch(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool { let result = satisfies(actualBlock, location: location).toSwift() result.message.update(failureMessage: failureMessage) return result.status.toBoolean(expectation: .toNotMatch) @@ -307,7 +312,7 @@ final public class NMBPredicateStatus: NSObject { public static let doesNotMatch: NMBPredicateStatus = NMBPredicateStatus(status: 1) public static let fail: NMBPredicateStatus = NMBPredicateStatus(status: 2) - public override var hashValue: Int { return self.status.hashValue } + public override var hash: Int { return self.status.hashValue } public override func isEqual(_ object: Any?) -> Bool { guard let otherPredicate = object as? NMBPredicateStatus else { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/RaisesException.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/RaisesException.swift index 60553bd..f44c810 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/RaisesException.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/RaisesException.swift @@ -1,7 +1,7 @@ import Foundation // This matcher requires the Objective-C, and being built by Xcode rather than the Swift Package Manager -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE /// A Nimble matcher that succeeds when the actual expression raises an /// exception with the specified name, reason, and/or userInfo. @@ -17,18 +17,21 @@ public func raiseException( reason: String? = nil, userInfo: NSDictionary? = nil, closure: ((NSException) -> Void)? = nil) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - + return Predicate { actualExpression in var exception: NSException? let capture = NMBExceptionCapture(handler: ({ e in exception = e }), finally: nil) - capture.tryBlock { - _ = try! actualExpression.evaluate() - return + do { + try capture.tryBlockThrows { + _ = try actualExpression.evaluate() + } + } catch { + return PredicateResult(status: .fail, message: .fail("unexpected error thrown: <\(error)>")) } + let failureMessage = FailureMessage() setFailureMessageForException( failureMessage, exception: exception, @@ -37,13 +40,15 @@ public func raiseException( userInfo: userInfo, closure: closure ) - return exceptionMatchesNonNilFieldsOrClosure( + + let matches = exceptionMatchesNonNilFieldsOrClosure( exception, named: named, reason: reason, userInfo: userInfo, closure: closure ) + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) } } @@ -117,10 +122,12 @@ internal func exceptionMatchesNonNilFieldsOrClosure( } public class NMBObjCRaiseExceptionMatcher: NSObject, NMBMatcher { + // swiftlint:disable identifier_name internal var _name: String? internal var _reason: String? internal var _userInfo: NSDictionary? internal var _block: ((NSException) -> Void)? + // swiftlint:enable identifier_name internal init(name: String?, reason: String?, userInfo: NSDictionary?, block: ((NSException) -> Void)?) { _name = name @@ -129,19 +136,24 @@ public class NMBObjCRaiseExceptionMatcher: NSObject, NMBMatcher { _block = block } - @objc public func matches(_ actualBlock: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { + @objc public func matches(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool { let block: () -> Any? = ({ _ = actualBlock(); return nil }) let expr = Expression(expression: block, location: location) - return try! raiseException( - named: _name, - reason: _reason, - userInfo: _userInfo, - closure: _block - ).matches(expr, failureMessage: failureMessage) + do { + return try raiseException( + named: _name, + reason: _reason, + userInfo: _userInfo, + closure: _block + ).matches(expr, failureMessage: failureMessage) + } catch let error { + failureMessage.stringValue = "unexpected error thrown: <\(error)>" + return false + } } - @objc public func doesNotMatch(_ actualBlock: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { + @objc public func doesNotMatch(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool { return !matches(actualBlock, failureMessage: failureMessage, location: location) } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift index 6c63a15..da3ea9a 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift @@ -4,33 +4,11 @@ import Foundation /// provided in the variable list of matchers. public func satisfyAllOf(_ matchers: U...) -> Predicate where U: Matcher, U.ValueType == T { - return satisfyAllOf(matchers) -} - -/// Deprecated. Please use `satisfyAnyOf(_) -> Predicate` instead. -internal func satisfyAllOf(_ matchers: [U]) -> Predicate - where U: Matcher, U.ValueType == T { - return NonNilMatcherFunc { actualExpression, failureMessage in - let postfixMessages = NSMutableArray() - var matches = true - for matcher in matchers { - if try matcher.doesNotMatch(actualExpression, failureMessage: failureMessage) { - matches = false - } - postfixMessages.add(NSString(string: "{\(failureMessage.postfixMessage)}")) - } - - failureMessage.postfixMessage = "match all of: " + postfixMessages.componentsJoined(by: ", and ") - if let actualValue = try actualExpression.evaluate() { - failureMessage.actualValue = "\(actualValue)" - } - - return matches - }.predicate + return satisfyAllOf(matchers.map { $0.predicate }) } internal func satisfyAllOf(_ predicates: [Predicate]) -> Predicate { - return Predicate { actualExpression in + return Predicate.define { actualExpression in var postfixMessages = [String]() var matches = true for predicate in predicates { @@ -53,18 +31,15 @@ internal func satisfyAllOf(_ predicates: [Predicate]) -> Predicate { ) } - return PredicateResult( - bool: matches, - message: msg - ) - }.requireNonNil + return PredicateResult(bool: matches, message: msg) + } } public func && (left: Predicate, right: Predicate) -> Predicate { return satisfyAllOf(left, right) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func satisfyAllOfMatcher(_ matchers: [NMBMatcher]) -> NMBPredicate { return NMBPredicate { actualExpression in @@ -82,11 +57,15 @@ extension NMBObjCMatcher { let elementEvaluator = Predicate { expression in if let predicate = matcher as? NMBPredicate { // swiftlint:disable:next line_length - return predicate.satisfies({ try! expression.evaluate() }, location: actualExpression.location).toSwift() + return predicate.satisfies({ try expression.evaluate() }, location: actualExpression.location).toSwift() } else { let failureMessage = FailureMessage() - // swiftlint:disable:next line_length - let success = matcher.matches({ try! expression.evaluate() }, failureMessage: failureMessage, location: actualExpression.location) + let success = matcher.matches( + // swiftlint:disable:next force_try + { try! expression.evaluate() }, + failureMessage: failureMessage, + location: actualExpression.location + ) return PredicateResult(bool: success, message: failureMessage.toExpectationMessage()) } } @@ -94,7 +73,7 @@ extension NMBObjCMatcher { elementEvaluators.append(elementEvaluator) } - return try! satisfyAllOf(elementEvaluators).satisfies(actualExpression).toObjectiveC() + return try satisfyAllOf(elementEvaluators).satisfies(actualExpression).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift index d02a0ff..6724956 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift @@ -4,33 +4,11 @@ import Foundation /// provided in the variable list of matchers. public func satisfyAnyOf(_ matchers: U...) -> Predicate where U: Matcher, U.ValueType == T { - return satisfyAnyOf(matchers) -} - -/// Deprecated. Please use `satisfyAnyOf(_) -> Predicate` instead. -internal func satisfyAnyOf(_ matchers: [U]) -> Predicate - where U: Matcher, U.ValueType == T { - return NonNilMatcherFunc { actualExpression, failureMessage in - let postfixMessages = NSMutableArray() - var matches = false - for matcher in matchers { - if try matcher.matches(actualExpression, failureMessage: failureMessage) { - matches = true - } - postfixMessages.add(NSString(string: "{\(failureMessage.postfixMessage)}")) - } - - failureMessage.postfixMessage = "match one of: " + postfixMessages.componentsJoined(by: ", or ") - if let actualValue = try actualExpression.evaluate() { - failureMessage.actualValue = "\(actualValue)" - } - - return matches - }.predicate + return satisfyAnyOf(matchers.map { $0.predicate }) } internal func satisfyAnyOf(_ predicates: [Predicate]) -> Predicate { - return Predicate { actualExpression in + return Predicate.define { actualExpression in var postfixMessages = [String]() var matches = false for predicate in predicates { @@ -53,11 +31,8 @@ internal func satisfyAnyOf(_ predicates: [Predicate]) -> Predicate { ) } - return PredicateResult( - status: PredicateStatus(bool: matches), - message: msg - ) - }.requireNonNil + return PredicateResult(bool: matches, message: msg) + } } public func || (left: Predicate, right: Predicate) -> Predicate { @@ -72,7 +47,7 @@ public func || (left: MatcherFunc, right: MatcherFunc) -> Predicate return satisfyAnyOf(left, right) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) extension NMBObjCMatcher { @objc public class func satisfyAnyOfMatcher(_ matchers: [NMBMatcher]) -> NMBPredicate { return NMBPredicate { actualExpression in @@ -90,11 +65,15 @@ extension NMBObjCMatcher { let elementEvaluator = Predicate { expression in if let predicate = matcher as? NMBPredicate { // swiftlint:disable:next line_length - return predicate.satisfies({ try! expression.evaluate() }, location: actualExpression.location).toSwift() + return predicate.satisfies({ try expression.evaluate() }, location: actualExpression.location).toSwift() } else { let failureMessage = FailureMessage() - // swiftlint:disable:next line_length - let success = matcher.matches({ try! expression.evaluate() }, failureMessage: failureMessage, location: actualExpression.location) + let success = matcher.matches( + // swiftlint:disable:next force_try + { try! expression.evaluate() }, + failureMessage: failureMessage, + location: actualExpression.location + ) return PredicateResult(bool: success, message: failureMessage.toExpectationMessage()) } } @@ -102,7 +81,7 @@ extension NMBObjCMatcher { elementEvaluators.append(elementEvaluator) } - return try! satisfyAnyOf(elementEvaluators).satisfies(actualExpression).toObjectiveC() + return try satisfyAnyOf(elementEvaluators).satisfies(actualExpression).toObjectiveC() } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift index a530c60..53d9191 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift @@ -1,13 +1,11 @@ import Foundation public func throwAssertion() -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - #if arch(x86_64) && (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE - failureMessage.postfixMessage = "throw an assertion" - failureMessage.actualValue = nil - - var succeeded = true + return Predicate { actualExpression in + #if arch(x86_64) && canImport(Darwin) && !SWIFT_PACKAGE + let message = ExpectationMessage.expectedTo("throw an assertion") + var actualError: Error? let caughtException: BadInstructionException? = catchBadInstruction { #if os(tvOS) if !NimbleEnvironment.activeInstance.suppressTVOSAssertionWarning { @@ -27,30 +25,27 @@ public func throwAssertion() -> Predicate { #endif do { try actualExpression.evaluate() - } catch let error { - succeeded = false - failureMessage.postfixMessage += "; threw error instead <\(error)>" + } catch { + actualError = error } } - if !succeeded { - return false + if let actualError = actualError { + return PredicateResult( + bool: false, + message: message.appended(message: "; threw error instead <\(actualError)>") + ) + } else { + return PredicateResult(bool: caughtException != nil, message: message) } - - if caughtException == nil { - return false - } - - return true #elseif SWIFT_PACKAGE fatalError("The throwAssertion Nimble matcher does not currently support Swift CLI." + " You can silence this error by placing the test case inside an #if !SWIFT_PACKAGE" + " conditional statement") #else fatalError("The throwAssertion Nimble matcher can only run on x86_64 platforms with " + - "Objective-C (e.g. Mac, iPhone 5s or later simulators). You can silence this error " + - "by placing the test case inside an #if arch(x86_64) or (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) conditional statement") - // swiftlint:disable:previous line_length + "Objective-C (e.g. macOS, iPhone 5s or later simulators). You can silence this error " + + "by placing the test case inside an #if arch(x86_64) or canImport(Darwin) conditional statement") #endif } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ThrowError.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ThrowError.swift index 872ca5c..d294ba3 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ThrowError.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ThrowError.swift @@ -12,22 +12,19 @@ import Foundation /// nil arguments indicates that the matcher should not attempt to match against /// that parameter. public func throwError() -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - + return Predicate { actualExpression in var actualError: Error? do { _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError + } catch { + actualError = error } - failureMessage.postfixMessage = "throw any error" if let actualError = actualError { - failureMessage.actualValue = "<\(actualError)>" + return PredicateResult(bool: true, message: .expectedCustomValueTo("throw any error", "<\(actualError)>")) } else { - failureMessage.actualValue = "no error" + return PredicateResult(bool: false, message: .expectedCustomValueTo("throw any error", "no error")) } - return actualError != nil } } @@ -43,15 +40,15 @@ public func throwError() -> Predicate { /// nil arguments indicates that the matcher should not attempt to match against /// that parameter. public func throwError(_ error: T, closure: ((Error) -> Void)? = nil) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - + return Predicate { actualExpression in var actualError: Error? do { _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError + } catch { + actualError = error } + let failureMessage = FailureMessage() setFailureMessageForError( failureMessage, actualError: actualError, @@ -59,20 +56,23 @@ public func throwError(_ error: T, closure: ((Error) -> Void)? = nil) errorType: nil, closure: closure ) + var matches = false if let actualError = actualError, errorMatchesExpectedError(actualError, expectedError: error) { matches = true + if let closure = closure { let assertions = gatherFailingExpectations { closure(actualError) } let messages = assertions.map { $0.message } - if messages.count > 0 { + if !messages.isEmpty { matches = false } } } - return matches + + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) } } @@ -88,15 +88,15 @@ public func throwError(_ error: T, closure: ((Error) -> Void)? = nil) /// nil arguments indicates that the matcher should not attempt to match against /// that parameter. public func throwError(_ error: T, closure: ((T) -> Void)? = nil) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - + return Predicate { actualExpression in var actualError: Error? do { _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError + } catch { + actualError = error } + let failureMessage = FailureMessage() setFailureMessageForError( failureMessage, actualError: actualError, @@ -104,6 +104,7 @@ public func throwError(_ error: T, closure: ((T) -> Void)? errorType: nil, closure: closure ) + var matches = false if let actualError = actualError as? T, error == actualError { matches = true @@ -113,12 +114,13 @@ public func throwError(_ error: T, closure: ((T) -> Void)? closure(actualError) } let messages = assertions.map { $0.message } - if messages.count > 0 { + if !messages.isEmpty { matches = false } } } - return matches + + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) } } @@ -136,15 +138,15 @@ public func throwError(_ error: T, closure: ((T) -> Void)? public func throwError( errorType: T.Type, closure: ((T) -> Void)? = nil) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - + return Predicate { actualExpression in var actualError: Error? do { _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError + } catch { + actualError = error } + let failureMessage = FailureMessage() setFailureMessageForError( failureMessage, actualError: actualError, @@ -152,16 +154,18 @@ public func throwError( errorType: errorType, closure: closure ) + var matches = false if let actualError = actualError { matches = true + if let actualError = actualError as? T { if let closure = closure { let assertions = gatherFailingExpectations { closure(actualError) } let messages = assertions.map { $0.message } - if messages.count > 0 { + if !messages.isEmpty { matches = false } } @@ -176,14 +180,14 @@ public func throwError( } } let messages = assertions.map { $0.message } - if messages.count > 0 { + if !messages.isEmpty { matches = false } } } } - return matches + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) } } @@ -195,15 +199,15 @@ public func throwError( /// /// The closure only gets called when an error was thrown. public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - + return Predicate { actualExpression in var actualError: Error? do { _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError + } catch { + actualError = error } + let failureMessage = FailureMessage() setFailureMessageForError(failureMessage, actualError: actualError, closure: closure) var matches = false @@ -214,11 +218,12 @@ public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate { closure(actualError) } let messages = assertions.map { $0.message } - if messages.count > 0 { + if !messages.isEmpty { matches = false } } - return matches + + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) } } @@ -230,15 +235,15 @@ public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate { /// /// The closure only gets called when an error was thrown. public func throwError(closure: @escaping ((T) -> Void)) -> Predicate { - return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in - + return Predicate { actualExpression in var actualError: Error? do { _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError + } catch { + actualError = error } + let failureMessage = FailureMessage() setFailureMessageForError(failureMessage, actualError: actualError, closure: closure) var matches = false @@ -249,10 +254,11 @@ public func throwError(closure: @escaping ((T) -> Void)) -> Predicate< closure(actualError) } let messages = assertions.map { $0.message } - if messages.count > 0 { + if !messages.isEmpty { matches = false } } - return matches + + return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Async.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Await.swift similarity index 94% rename from Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Async.swift rename to Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Await.swift index c77a8fc..276f618 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Async.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Await.swift @@ -2,7 +2,7 @@ import CoreFoundation import Dispatch import Foundation -#if !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) +#if canImport(CDispatch) import CDispatch #endif @@ -32,7 +32,7 @@ internal class AssertionWaitLock: WaitLock { func acquireWaitingLock(_ fnName: String, file: FileString, line: UInt) { let info = WaitingInfo(name: fnName, file: file, lineNumber: line) - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) let isMainThread = Thread.isMainThread #else let isMainThread = _CFIsMainThread() @@ -45,10 +45,15 @@ internal class AssertionWaitLock: WaitLock { nimblePrecondition( currentWaiter == nil, "InvalidNimbleAPIUsage", - "Nested async expectations are not allowed to avoid creating flaky tests.\n\n" + - "The call to\n\t\(info)\n" + - "triggered this exception because\n\t\(currentWaiter!)\n" + - "is currently managing the main run loop." + """ + Nested async expectations are not allowed to avoid creating flaky tests. + + The call to + \t\(info) + triggered this exception because + \t\(currentWaiter!) + is currently managing the main run loop. + """ ) currentWaiter = info } @@ -180,25 +185,18 @@ internal class AwaitPromiseBuilder { // checked. // // In addition, stopping the run loop is used to halt code executed on the main run loop. - #if swift(>=4.0) trigger.timeoutSource.schedule( deadline: DispatchTime.now() + timeoutInterval, repeating: .never, leeway: timeoutLeeway ) - #else - trigger.timeoutSource.scheduleOneshot( - deadline: DispatchTime.now() + timeoutInterval, - leeway: timeoutLeeway - ) - #endif trigger.timeoutSource.setEventHandler { guard self.promise.asyncResult.isIncomplete() else { return } let timedOutSem = DispatchSemaphore(value: 0) let semTimedOutOrBlocked = DispatchSemaphore(value: 0) semTimedOutOrBlocked.signal() let runLoop = CFRunLoopGetMain() - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) let runLoopMode = CFRunLoopMode.defaultMode.rawValue #else let runLoopMode = kCFRunLoopDefaultMode @@ -263,7 +261,11 @@ internal class AwaitPromiseBuilder { self.trigger.timeoutSource.resume() while self.promise.asyncResult.isIncomplete() { // Stopping the run loop does not work unless we run only 1 mode + #if (swift(>=4.2) && canImport(Darwin)) || compiler(>=5.0) + _ = RunLoop.current.run(mode: .default, before: .distantFuture) + #else _ = RunLoop.current.run(mode: .defaultRunLoopMode, before: .distantFuture) + #endif } self.trigger.timeoutSource.cancel() @@ -329,11 +331,7 @@ internal class Awaiter { let asyncSource = createTimerSource(asyncQueue) let trigger = AwaitTrigger(timeoutSource: timeoutSource, actionSource: asyncSource) { let interval = DispatchTimeInterval.nanoseconds(Int(pollInterval * TimeInterval(NSEC_PER_SEC))) - #if swift(>=4.0) asyncSource.schedule(deadline: .now(), repeating: interval, leeway: pollLeeway) - #else - asyncSource.scheduleRepeating(deadline: .now(), interval: interval, leeway: pollLeeway) - #endif asyncSource.setEventHandler { do { if let result = try closure() { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Functional.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Functional.swift index 6c5126a..c87af76 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Functional.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Functional.swift @@ -1,12 +1,14 @@ import Foundation +#if !swift(>=4.2) extension Sequence { - internal func all(_ fn: (Iterator.Element) -> Bool) -> Bool { + internal func allSatisfy(_ predicate: (Element) throws -> Bool) rethrows -> Bool { for item in self { - if !fn(item) { + if try !predicate(item) { return false } } return true } } +#endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Stringers.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Stringers.swift index cd6de20..4ab18d2 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Stringers.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Stringers.swift @@ -2,7 +2,7 @@ import Foundation internal func identityAsString(_ value: Any?) -> String { let anyObject: AnyObject? -#if os(Linux) +#if os(Linux) && !swift(>=4.1.50) anyObject = value as? AnyObject #else anyObject = value as AnyObject? @@ -122,6 +122,7 @@ extension String: TestOutputStringConvertible { extension Data: TestOutputStringConvertible { public var testDescription: String { #if os(Linux) + // swiftlint:disable:next todo // FIXME: Swift on Linux triggers a segfault when calling NSData's hash() (last checked on 03-11-16) return "Data" #else @@ -144,7 +145,9 @@ extension Data: TestOutputStringConvertible { /// will return the result of constructing a string from the value. /// /// - SeeAlso: `TestOutputStringConvertible` -public func stringify(_ value: T) -> String { +public func stringify(_ value: T?) -> String { + guard let value = value else { return "nil" } + if let value = value as? TestOutputStringConvertible { return value.testDescription } @@ -156,15 +159,7 @@ public func stringify(_ value: T) -> String { return String(describing: value) } -/// -SeeAlso: `stringify(value: T)` -public func stringify(_ value: T?) -> String { - if let unboxed = value { - return stringify(unboxed) - } - return "nil" -} - -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) @objc public class NMBStringer: NSObject { @objc public class func stringify(_ obj: Any?) -> String { return Nimble.stringify(obj) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/NimbleObjectiveC/CurrentTestCaseTracker.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/NimbleObjectiveC/CurrentTestCaseTracker.h deleted file mode 100644 index 7439889..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/NimbleObjectiveC/CurrentTestCaseTracker.h +++ /dev/null @@ -1,14 +0,0 @@ -#import - -#if __has_include("Nimble-Swift.h") -#import "Nimble-Swift.h" -#else -#import -#endif - -SWIFT_CLASS("_TtC6Nimble22CurrentTestCaseTracker") -@interface CurrentTestCaseTracker : NSObject -+ (CurrentTestCaseTracker *)sharedInstance; -@end - -@interface CurrentTestCaseTracker (Register) @end diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/NimbleObjectiveC/DSL.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/NimbleObjectiveC/DSL.m index 4b099ac..670415b 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/NimbleObjectiveC/DSL.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/NimbleObjectiveC/DSL.m @@ -6,14 +6,6 @@ #import #endif -SWIFT_CLASS("_TtC6Nimble7NMBWait") -@interface NMBWait : NSObject - -+ (void)untilTimeout:(NSTimeInterval)timeout file:(NSString *)file line:(NSUInteger)line action:(void (^ _Nonnull)(void (^ _Nonnull)(void)))action; -+ (void)untilFile:(NSString *)file line:(NSUInteger)line action:(void (^ _Nonnull)(void (^ _Nonnull)(void)))action; - -@end - NS_ASSUME_NONNULL_BEGIN diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.m index 3381047..52684b7 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.m @@ -16,7 +16,7 @@ return self; } -- (void)tryBlock:(void(^ _Nonnull)(void))unsafeBlock { +- (void)tryBlock:(__attribute__((noescape)) void(^ _Nonnull)(void))unsafeBlock { @try { unsafeBlock(); } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/NimbleObjectiveC/XCTestObservationCenter+Register.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/NimbleObjectiveC/XCTestObservationCenter+Register.m index 35f26fd..fa5030a 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/NimbleObjectiveC/XCTestObservationCenter+Register.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/NimbleObjectiveC/XCTestObservationCenter+Register.m @@ -1,7 +1,12 @@ -#import "CurrentTestCaseTracker.h" #import #import +#if __has_include("Nimble-Swift.h") +#import "Nimble-Swift.h" +#else +#import +#endif + #pragma mark - Method Swizzling /// Swaps the implementations between two instance methods. diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/LinuxMain.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/LinuxMain.swift index 16c6953..ee03ebd 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/LinuxMain.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/LinuxMain.swift @@ -1,37 +1,8 @@ import XCTest -@testable import NimbleTests -// This is the entry point for NimbleTests on Linux +import NimbleTests -XCTMain([ - testCase(AsyncTest.allTests), - testCase(SynchronousTest.allTests), - testCase(UserDescriptionTest.allTests), +var tests = [XCTestCaseEntry]() +tests += NimbleTests.__allTests() - // Matchers - testCase(AllPassTest.allTests), - testCase(BeAKindOfSwiftTest.allTests), - testCase(BeAnInstanceOfTest.allTests), - testCase(BeCloseToTest.allTests), - testCase(BeginWithTest.allTests), - testCase(BeGreaterThanOrEqualToTest.allTests), - testCase(BeGreaterThanTest.allTests), - testCase(BeIdenticalToObjectTest.allTests), - testCase(BeIdenticalToTest.allTests), - testCase(BeLessThanOrEqualToTest.allTests), - testCase(BeLessThanTest.allTests), - testCase(BeTruthyTest.allTests), - testCase(BeTrueTest.allTests), - testCase(BeFalsyTest.allTests), - testCase(BeFalseTest.allTests), - testCase(BeNilTest.allTests), - testCase(ContainTest.allTests), - testCase(EndWithTest.allTests), - testCase(EqualTest.allTests), - testCase(HaveCountTest.allTests), - testCase(MatchTest.allTests), - // testCase(RaisesExceptionTest.allTests), - testCase(ThrowErrorTest.allTests), - testCase(SatisfyAnyOfTest.allTests), - testCase(PostNotificationTest.allTests), -]) +XCTMain(tests) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/AsynchronousTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/AsynchronousTest.swift index c44b9e6..bfa34c2 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/AsynchronousTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/AsynchronousTest.swift @@ -4,25 +4,6 @@ import XCTest import Nimble final class AsyncTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (AsyncTest) -> () throws -> Void)] { - return [ - ("testToEventuallyPositiveMatches", testToEventuallyPositiveMatches), - ("testToEventuallyNegativeMatches", testToEventuallyNegativeMatches), - ("testWaitUntilWithCustomDefaultsTimeout", testWaitUntilWithCustomDefaultsTimeout), - ("testWaitUntilPositiveMatches", testWaitUntilPositiveMatches), - ("testToEventuallyWithCustomDefaultTimeout", testToEventuallyWithCustomDefaultTimeout), - ("testWaitUntilTimesOutIfNotCalled", testWaitUntilTimesOutIfNotCalled), - ("testWaitUntilTimesOutWhenExceedingItsTime", testWaitUntilTimesOutWhenExceedingItsTime), - ("testWaitUntilNegativeMatches", testWaitUntilNegativeMatches), - ("testWaitUntilDetectsStalledMainThreadActivity", testWaitUntilDetectsStalledMainThreadActivity), - ("testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed", testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed), - ("testWaitUntilErrorsIfDoneIsCalledMultipleTimes", testWaitUntilErrorsIfDoneIsCalledMultipleTimes), - ("testWaitUntilMustBeInMainThread", testWaitUntilMustBeInMainThread), - ("testToEventuallyMustBeInMainThread", testToEventuallyMustBeInMainThread), - ("testSubjectUnderTestIsReleasedFromMemory", testSubjectUnderTestIsReleasedFromMemory), - ] - } - class Error: Swift.Error {} let errorToThrow = Error() @@ -70,20 +51,12 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { var asyncOperation: () -> Void = { sleepThenSetValueTo(1) } - if #available(OSX 10.10, *) { - DispatchQueue.global().async(execute: asyncOperation) - } else { - DispatchQueue.global(priority: .default).async(execute: asyncOperation) - } + DispatchQueue.global().async(execute: asyncOperation) expect { value }.toEventually(equal(1)) asyncOperation = { sleepThenSetValueTo(0) } - if #available(OSX 10.10, *) { - DispatchQueue.global().async(execute: asyncOperation) - } else { - DispatchQueue.global(priority: .default).async(execute: asyncOperation) - } + DispatchQueue.global().async(execute: asyncOperation) expect { value }.toEventuallyNot(equal(1)) } @@ -124,11 +97,7 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { done() waiting = false } - if #available(OSX 10.10, *) { - DispatchQueue.global().async(execute: asyncOperation) - } else { - DispatchQueue.global(priority: .default).async(execute: asyncOperation) - } + DispatchQueue.global().async(execute: asyncOperation) } } @@ -161,15 +130,16 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { func testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed() { // Currently we are unable to catch Objective-C exceptions when built by the Swift Package Manager #if !SWIFT_PACKAGE - let referenceLine = #line + 9 - var msg = "Unexpected exception raised: Nested async expectations are not allowed " - msg += "to avoid creating flaky tests." - msg += "\n\n" - msg += "The call to\n\t" - msg += "expect(...).toEventually(...) at \(#file):\(referenceLine + 7)\n" - msg += "triggered this exception because\n\t" - msg += "waitUntil(...) at \(#file):\(referenceLine + 1)\n" - msg += "is currently managing the main run loop." + let referenceLine = #line + 10 + let msg = """ + Unexpected exception raised: Nested async expectations are not allowed to avoid creating flaky tests. + + The call to + \texpect(...).toEventually(...) at \(#file):\(referenceLine + 7) + triggered this exception because + \twaitUntil(...) at \(#file):\(referenceLine + 1) + is currently managing the main run loop. + """ failsWithErrorMessage(msg) { // reference line waitUntil(timeout: 2.0) { done in var protected: Int = 0 @@ -204,11 +174,7 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { }.to(raiseException(named: "InvalidNimbleAPIUsage")) executedAsyncBlock = true } - if #available(OSX 10.10, *) { - DispatchQueue.global().async(execute: asyncOperation) - } else { - DispatchQueue.global(priority: .default).async(execute: asyncOperation) - } + DispatchQueue.global().async(execute: asyncOperation) expect(executedAsyncBlock).toEventually(beTruthy()) #endif } @@ -222,11 +188,7 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { }.to(raiseException(named: "InvalidNimbleAPIUsage")) executedAsyncBlock = true } - if #available(OSX 10.10, *) { - DispatchQueue.global().async(execute: asyncOperation) - } else { - DispatchQueue.global(priority: .default).async(execute: asyncOperation) - } + DispatchQueue.global().async(execute: asyncOperation) expect(executedAsyncBlock).toEventually(beTruthy()) #endif } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Helpers/XCTestCaseProvider.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Helpers/XCTestCaseProvider.swift index 08a67c6..08567fd 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Helpers/XCTestCaseProvider.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Helpers/XCTestCaseProvider.swift @@ -4,7 +4,7 @@ import XCTest // XCTestCaseProvider should be adopted by all XCTestCase subclasses. It provides a // mechanism for us to fail tests in Xcode which haven't been included in the `allTests` // list for swift-corelibs-xctest which is unable to dynamically discover tests. Note -// that only `static var allTests` needs to be explicitly implemented, as `allTestNames` +// that only `static var __allTests` needs to be explicitly implemented, as `allTestNames` // has a default implementation provided by a protocol extension. // Implementation note: This is broken down into two separate protocols because we need a @@ -12,7 +12,7 @@ import XCTest public protocol XCTestCaseProviderStatic { // This should be explicitly implemented by XCTestCase subclasses - static var allTests: [(String, (Self) -> () throws -> Void)] { get } + static var __allTests: [(String, (Self) -> () -> ())] { get } } public protocol XCTestCaseNameProvider { @@ -20,17 +20,21 @@ public protocol XCTestCaseNameProvider { var allTestNames: [String] { get } } +#if os(macOS) public protocol XCTestCaseProvider: XCTestCaseProviderStatic, XCTestCaseNameProvider {} extension XCTestCaseProvider { var allTestNames: [String] { - return type(of: self).allTests.map({ name, _ in + return type(of: self).__allTests.map({ name, _ in return name }) } } +#else +public protocol XCTestCaseProvider {} +#endif -#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS) +#if os(macOS) extension XCTestCase { override open func tearDown() { @@ -45,7 +49,13 @@ extension XCTestCase { extension XCTestCaseNameProvider { fileprivate func assertContainsTest(_ name: String) { let contains = self.allTestNames.contains(name) - XCTAssert(contains, "Test '\(name)' is missing from the allTests array") + XCTAssert( + contains, + """ + Test '\(name)' is missing from the __allTests array. + Please run `$ swift test --generate-linuxmain` to update the manifests. + """ + ) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Helpers/utils.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Helpers/utils.swift index a1bbc68..c90b72a 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Helpers/utils.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Helpers/utils.swift @@ -3,12 +3,12 @@ import Foundation @testable import Nimble import XCTest -func failsWithErrorMessage(_ messages: [String], file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: @escaping () throws -> Void) { +func failsWithErrorMessage(_ messages: [String], file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: () throws -> Void) { var filePath = file var lineNumber = line let recorder = AssertionRecorder() - withAssertionHandler(recorder, closure: closure) + withAssertionHandler(recorder, file: file, line: line, closure: closure) for msg in messages { var lastFailure: AssertionRecord? @@ -37,7 +37,12 @@ func failsWithErrorMessage(_ messages: [String], file: FileString = #file, line: } else { let knownFailures = recorder.assertions.filter { !$0.success }.map { $0.message.stringValue } let knownFailuresJoined = knownFailures.joined(separator: ", ") - message = "Expected error message (\(msg)), got (\(knownFailuresJoined))\n\nAssertions Received:\n\(recorder.assertions)" + message = """ + Expected error message (\(msg)), got (\(knownFailuresJoined)) + + Assertions Received: + \(recorder.assertions) + """ } NimbleAssertionHandler.assert(false, message: FailureMessage(stringValue: message), @@ -45,7 +50,7 @@ func failsWithErrorMessage(_ messages: [String], file: FileString = #file, line: } } -func failsWithErrorMessage(_ message: String, file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: @escaping () -> Void) { +func failsWithErrorMessage(_ message: String, file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: () -> Void) { return failsWithErrorMessage( [message], file: file, @@ -55,7 +60,7 @@ func failsWithErrorMessage(_ message: String, file: FileString = #file, line: UI ) } -func failsWithErrorMessageForNil(_ message: String, file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: @escaping () -> Void) { +func failsWithErrorMessageForNil(_ message: String, file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: () -> Void) { failsWithErrorMessage("\(message) (use beNil() to match nils)", file: file, line: line, preferOriginalSourceLocation: preferOriginalSourceLocation, closure: closure) } @@ -68,15 +73,15 @@ func deferToMainQueue(action: @escaping () -> Void) { #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE public class NimbleHelper: NSObject { - @objc public class func expectFailureMessage(_ message: NSString, block: @escaping () -> Void, file: FileString, line: UInt) { + @objc public class func expectFailureMessage(_ message: NSString, block: () -> Void, file: FileString, line: UInt) { failsWithErrorMessage(String(describing: message), file: file, line: line, preferOriginalSourceLocation: true, closure: block) } - @objc public class func expectFailureMessages(_ messages: [NSString], block: @escaping () -> Void, file: FileString, line: UInt) { + @objc public class func expectFailureMessages(_ messages: [NSString], block: () -> Void, file: FileString, line: UInt) { failsWithErrorMessage(messages.map({String(describing: $0)}), file: file, line: line, preferOriginalSourceLocation: true, closure: block) } - @objc public class func expectFailureMessageForNil(_ message: NSString, block: @escaping () -> Void, file: FileString, line: UInt) { + @objc public class func expectFailureMessageForNil(_ message: NSString, block: () -> Void, file: FileString, line: UInt) { failsWithErrorMessageForNil(String(describing: message), file: file, line: line, preferOriginalSourceLocation: true, closure: block) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/AllPassTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/AllPassTest.swift index 2050881..683121c 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/AllPassTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/AllPassTest.swift @@ -43,17 +43,6 @@ extension Optional where Wrapped: Comparable { } final class AllPassTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (AllPassTest) -> () throws -> Void)] { - return [ - ("testAllPassArray", testAllPassArray), - ("testAllPassMatcher", testAllPassMatcher), - ("testAllPassCollectionsWithOptionalsDontWork", testAllPassCollectionsWithOptionalsDontWork), - ("testAllPassCollectionsWithOptionalsUnwrappingOneOptionalLayer", testAllPassCollectionsWithOptionalsUnwrappingOneOptionalLayer), - ("testAllPassSet", testAllPassSet), - ("testAllPassWithNilAsExpectedValue", testAllPassWithNilAsExpectedValue), - ] - } - func testAllPassArray() { expect([1, 2, 3, 4]).to(allPass({$0 < 5})) expect([1, 2, 3, 4]).toNot(allPass({$0 > 5})) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift index bb9041b..64a439b 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift @@ -8,13 +8,6 @@ private class TestClassConformingToProtocol: TestProtocol {} private struct TestStructConformingToProtocol: TestProtocol {} final class BeAKindOfSwiftTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeAKindOfSwiftTest) -> () throws -> Void)] { - return [ - ("testPositiveMatch", testPositiveMatch), - ("testFailureMessages", testFailureMessages), - ] - } - enum TestEnum { case one, two } @@ -54,23 +47,17 @@ final class BeAKindOfSwiftTest: XCTestCase, XCTestCaseProvider { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - final class BeAKindOfObjCTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeAKindOfObjCTest) -> () throws -> Void)] { - return [ - ("testPositiveMatch", testPositiveMatch), - ("testFailureMessages", testFailureMessages), - ] - } - func testPositiveMatch() { +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) expect(TestNull()).to(beAKindOf(NSNull.self)) expect(NSObject()).to(beAKindOf(NSObject.self)) expect(NSNumber(value: 1)).toNot(beAKindOf(NSDate.self)) +#endif } func testFailureMessages() { +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) failsWithErrorMessageForNil("expected to not be a kind of NSNull, got ") { expect(nil as NSNull?).toNot(beAKindOf(NSNull.self)) } @@ -83,7 +70,6 @@ final class BeAKindOfObjCTest: XCTestCase, XCTestCaseProvider { failsWithErrorMessage("expected to not be a kind of NSNumber, got <__NSCFNumber instance>") { expect(NSNumber(value: 1)).toNot(beAKindOf(NSNumber.self)) } +#endif } } - -#endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift index aeea28a..df431e6 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift @@ -7,15 +7,6 @@ private class TestClassConformingToProtocol: TestProtocol {} private struct TestStructConformingToProtocol: TestProtocol {} final class BeAnInstanceOfTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeAnInstanceOfTest) -> () throws -> Void)] { - return [ - ("testPositiveMatch", testPositiveMatch), - ("testPositiveMatchSwiftTypes", testPositiveMatchSwiftTypes), - ("testFailureMessages", testFailureMessages), - ("testFailureMessagesSwiftTypes", testFailureMessagesSwiftTypes), - ] - } - func testPositiveMatch() { expect(NSNull()).to(beAnInstanceOf(NSNull.self)) expect(NSNumber(value: 1)).toNot(beAnInstanceOf(NSDate.self)) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeCloseToTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeCloseToTest.swift index cb7a3ec..f724be6 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeCloseToTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeCloseToTest.swift @@ -3,24 +3,6 @@ import XCTest import Nimble final class BeCloseToTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeCloseToTest) -> () throws -> Void)] { - return [ - ("testBeCloseTo", testBeCloseTo), - ("testBeCloseToWithin", testBeCloseToWithin), - ("testBeCloseToWithNSNumber", testBeCloseToWithNSNumber), - ("testBeCloseToWithDate", testBeCloseToWithDate), - ("testBeCloseToWithNSDate", testBeCloseToWithNSDate), - ("testBeCloseToOperator", testBeCloseToOperator), - ("testBeCloseToWithinOperator", testBeCloseToWithinOperator), - ("testPlusMinusOperator", testPlusMinusOperator), - ("testBeCloseToOperatorWithDate", testBeCloseToOperatorWithDate), - ("testBeCloseToWithinOperatorWithDate", testBeCloseToWithinOperatorWithDate), - ("testPlusMinusOperatorWithDate", testPlusMinusOperatorWithDate), - ("testBeCloseToArray", testBeCloseToArray), - ("testBeCloseToWithCGFloat", testBeCloseToWithCGFloat), - ] - } - func testBeCloseTo() { expect(1.2).to(beCloseTo(1.2001)) expect(1.2 as CDouble).to(beCloseTo(1.2001)) @@ -34,8 +16,8 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { func testBeCloseToWithin() { expect(1.2).to(beCloseTo(9.300, within: 10)) - failsWithErrorMessage("expected to not be close to <1.2001> (within 1), got <1.2>") { - expect(1.2).toNot(beCloseTo(1.2001, within: 1.0)) + failsWithErrorMessage("expected to not be close to <1.2001> (within 1.1), got <1.2>") { + expect(1.2).toNot(beCloseTo(1.2001, within: 1.1)) } } @@ -44,8 +26,8 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect(NSNumber(value: 1.2)).to(beCloseTo(NSNumber(value: 9.300), within: 10)) expect(1.2).to(beCloseTo(NSNumber(value: 9.300), within: 10)) - failsWithErrorMessage("expected to not be close to <1.2001> (within 1), got <1.2>") { - expect(NSNumber(value: 1.2)).toNot(beCloseTo(1.2001, within: 1.0)) + failsWithErrorMessage("expected to not be close to <1.2001> (within 1.1), got <1.2>") { + expect(NSNumber(value: 1.2)).toNot(beCloseTo(1.2001, within: 1.1)) } } @@ -53,8 +35,8 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect(CGFloat(1.2)).to(beCloseTo(1.2001)) expect(CGFloat(1.2)).to(beCloseTo(CGFloat(1.2001))) - failsWithErrorMessage("expected to not be close to <1.2001> (within 1), got <1.2>") { - expect(CGFloat(1.2)).toNot(beCloseTo(1.2001, within: 1.0)) + failsWithErrorMessage("expected to not be close to <1.2001> (within 1.1), got <1.2>") { + expect(CGFloat(1.2)).toNot(beCloseTo(1.2001, within: 1.1)) } } @@ -89,11 +71,11 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect(1.2) ≈ (9.300, 10) expect(1.2) == (9.300, 10) - failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") { - expect(1.2) ≈ (1.0, 0.1) + failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") { + expect(1.3) ≈ (1.1, 0.1) } - failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") { - expect(1.2) == (1.0, 0.1) + failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") { + expect(1.3) == (1.1, 0.1) } } @@ -101,11 +83,11 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect(1.2) ≈ 9.300 ± 10 expect(1.2) == 9.300 ± 10 - failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") { - expect(1.2) ≈ 1.0 ± 0.1 + failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") { + expect(1.3) ≈ 1.1 ± 0.1 } - failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") { - expect(1.2) == 1.0 ± 0.1 + failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") { + expect(1.3) == 1.1 ± 0.1 } } @@ -150,11 +132,11 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect([0.0, 1.1, 2.2]) ≈ [0.0001, 1.1001, 2.2001] expect([0.0, 1.1, 2.2]).to(beCloseTo([0.1, 1.2, 2.3], within: 0.1)) - failsWithErrorMessage("expected to be close to <[0, 1]> (each within 0.0001), got <[0, 1.1]>") { - expect([0.0, 1.1]) ≈ [0.0, 1.0] + failsWithErrorMessage("expected to be close to <[0.1, 1.1]> (each within 0.0001), got <[0.1, 1.2]>") { + expect([0.1, 1.2]) ≈ [0.1, 1.1] } - failsWithErrorMessage("expected to be close to <[0.2, 1.2]> (each within 0.1), got <[0, 1.1]>") { - expect([0.0, 1.1]).to(beCloseTo([0.2, 1.2], within: 0.1)) + failsWithErrorMessage("expected to be close to <[0.3, 1.3]> (each within 0.1), got <[0.1, 1.2]>") { + expect([0.1, 1.2]).to(beCloseTo([0.3, 1.3], within: 0.1)) } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift index 067ddeb..637bc7a 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeEmptyTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeEmptyTest) -> () throws -> Void)] { - return [ - ("testBeEmptyPositive", testBeEmptyPositive), - ("testBeEmptyNegative", testBeEmptyNegative), - ] - } - func testBeEmptyPositive() { expect([] as [Int]).to(beEmpty()) expect([1]).toNot(beEmpty()) @@ -41,16 +34,12 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect("").to(beEmpty()) expect("foo").toNot(beEmpty()) + + expect([] as TestOptionSet).to(beEmpty()) + expect(TestOptionSet.one).toNot(beEmpty()) } func testBeEmptyNegative() { - failsWithErrorMessageForNil("expected to be empty, got ") { - expect(nil as NSString?).to(beEmpty()) - } - failsWithErrorMessageForNil("expected to not be empty, got ") { - expect(nil as [CInt]?).toNot(beEmpty()) - } - failsWithErrorMessage("expected to not be empty, got <()>") { expect(NSArray()).toNot(beEmpty()) } @@ -58,12 +47,14 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect([1]).to(beEmpty()) } +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) failsWithErrorMessage("expected to not be empty, got <{()}>") { expect(NSSet()).toNot(beEmpty()) } failsWithErrorMessage("expected to be empty, got <{(1)}>") { expect(NSSet(object: NSNumber(value: 1))).to(beEmpty()) } +#endif failsWithErrorMessage("expected to not be empty, got <()>") { expect(NSIndexSet()).toNot(beEmpty()) @@ -78,5 +69,49 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { failsWithErrorMessage("expected to be empty, got ") { expect("foo").to(beEmpty()) } + + failsWithErrorMessage("expected to not be empty, got ") { + expect([] as TestOptionSet).toNot(beEmpty()) + } + failsWithErrorMessage("expected to be empty, got ") { + expect(TestOptionSet.one).to(beEmpty()) + } + } + + func testNilMatches() { + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as NSString?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as NSString?).toNot(beEmpty()) + } + + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as [CInt]?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as [CInt]?).toNot(beEmpty()) + } + + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as TestOptionSet?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as TestOptionSet?).toNot(beEmpty()) + } + } +} + +private struct TestOptionSet: OptionSet, CustomStringConvertible { + let rawValue: Int + + static let one = TestOptionSet(rawValue: 1 << 0) + + init(rawValue: Int) { + self.rawValue = rawValue + } + + var description: String { + return "TestOptionSet(rawValue: \(rawValue))" } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift index bd73361..4c91fec 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeGreaterThanOrEqualToTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeGreaterThanOrEqualToTest) -> () throws -> Void)] { - return [ - ("testGreaterThanOrEqualTo", testGreaterThanOrEqualTo), - ("testGreaterThanOrEqualToOperator", testGreaterThanOrEqualToOperator), - ] - } - func testGreaterThanOrEqualTo() { expect(10).to(beGreaterThanOrEqualTo(10)) expect(10).to(beGreaterThanOrEqualTo(2)) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanTest.swift index 9c33e4b..3d742f4 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeGreaterThanTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeGreaterThanTest) -> () throws -> Void)] { - return [ - ("testGreaterThan", testGreaterThan), - ("testGreaterThanOperator", testGreaterThanOperator), - ] - } - func testGreaterThan() { expect(10).to(beGreaterThan(2)) expect(1).toNot(beGreaterThan(2)) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToObjectTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToObjectTest.swift index 923fa76..b1155fb 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToObjectTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToObjectTest.swift @@ -3,17 +3,6 @@ import XCTest import Nimble final class BeIdenticalToObjectTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeIdenticalToObjectTest) -> () throws -> Void)] { - return [ - ("testBeIdenticalToPositive", testBeIdenticalToPositive), - ("testBeIdenticalToNegative", testBeIdenticalToNegative), - ("testBeIdenticalToPositiveMessage", testBeIdenticalToPositiveMessage), - ("testBeIdenticalToNegativeMessage", testBeIdenticalToNegativeMessage), - ("testFailsOnNils", testFailsOnNils), - ("testOperators", testOperators), - ] - } - private class BeIdenticalToObjectTester {} private let testObjectA = BeIdenticalToObjectTester() private let testObjectB = BeIdenticalToObjectTester() diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift index 6b629b0..8830647 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift @@ -3,17 +3,6 @@ import XCTest @testable import Nimble final class BeIdenticalToTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeIdenticalToTest) -> () throws -> Void)] { - return [ - ("testBeIdenticalToPositive", testBeIdenticalToPositive), - ("testBeIdenticalToNegative", testBeIdenticalToNegative), - ("testBeIdenticalToPositiveMessage", testBeIdenticalToPositiveMessage), - ("testBeIdenticalToNegativeMessage", testBeIdenticalToNegativeMessage), - ("testOperators", testOperators), - ("testBeAlias", testBeAlias), - ] - } - func testBeIdenticalToPositive() { let value = NSDate() expect(value).to(beIdenticalTo(value)) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift index 428ace4..f389469 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeLessThanOrEqualToTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeLessThanOrEqualToTest) -> () throws -> Void)] { - return [ - ("testLessThanOrEqualTo", testLessThanOrEqualTo), - ("testLessThanOrEqualToOperator", testLessThanOrEqualToOperator), - ] - } - func testLessThanOrEqualTo() { expect(10).to(beLessThanOrEqualTo(10)) expect(2).to(beLessThanOrEqualTo(10)) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLessThanTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLessThanTest.swift index 90ba1b9..d560232 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLessThanTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLessThanTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeLessThanTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeLessThanTest) -> () throws -> Void)] { - return [ - ("testLessThan", testLessThan), - ("testLessThanOperator", testLessThanOperator), - ] - } - func testLessThan() { expect(2).to(beLessThan(10)) expect(2).toNot(beLessThan(1)) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLogicalTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLogicalTest.swift index 947a1b4..d9ef8ea 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLogicalTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLogicalTest.swift @@ -30,18 +30,6 @@ enum ConvertsToBool: ExpressibleByBooleanLiteral, CustomStringConvertible { } final class BeTruthyTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeTruthyTest) -> () throws -> Void)] { - return [ - ("testShouldMatchNonNilTypes", testShouldMatchNonNilTypes), - ("testShouldMatchTrue", testShouldMatchTrue), - ("testShouldNotMatchNilTypes", testShouldNotMatchNilTypes), - ("testShouldNotMatchFalse", testShouldNotMatchFalse), - ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), - ("testShouldMatchBoolConvertibleTypesThatConvertToTrue", testShouldMatchBoolConvertibleTypesThatConvertToTrue), - ("testShouldNotMatchBoolConvertibleTypesThatConvertToFalse", testShouldNotMatchBoolConvertibleTypesThatConvertToFalse), - ] - } - func testShouldMatchNonNilTypes() { expect(true as Bool?).to(beTruthy()) @@ -123,14 +111,6 @@ final class BeTruthyTest: XCTestCase, XCTestCaseProvider { } final class BeTrueTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeTrueTest) -> () throws -> Void)] { - return [ - ("testShouldMatchTrue", testShouldMatchTrue), - ("testShouldNotMatchFalse", testShouldNotMatchFalse), - ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), - ] - } - func testShouldMatchTrue() { expect(true).to(beTrue()) @@ -159,16 +139,6 @@ final class BeTrueTest: XCTestCase, XCTestCaseProvider { } final class BeFalsyTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeFalsyTest) -> () throws -> Void)] { - return [ - ("testShouldMatchNilTypes", testShouldMatchNilTypes), - ("testShouldNotMatchTrue", testShouldNotMatchTrue), - ("testShouldNotMatchNonNilTypes", testShouldNotMatchNonNilTypes), - ("testShouldMatchFalse", testShouldMatchFalse), - ("testShouldMatchNilBools", testShouldMatchNilBools), - ] - } - func testShouldMatchNilTypes() { expect(false as Bool?).to(beFalsy()) @@ -234,14 +204,6 @@ final class BeFalsyTest: XCTestCase, XCTestCaseProvider { } final class BeFalseTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeFalseTest) -> () throws -> Void)] { - return [ - ("testShouldNotMatchTrue", testShouldNotMatchTrue), - ("testShouldMatchFalse", testShouldMatchFalse), - ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), - ] - } - func testShouldNotMatchTrue() { expect(true).toNot(beFalse()) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeNilTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeNilTest.swift index 69f4185..9e37116 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeNilTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeNilTest.swift @@ -2,12 +2,6 @@ import XCTest import Nimble final class BeNilTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeNilTest) -> () throws -> Void)] { - return [ - ("testBeNil", testBeNil), - ] - } - func producesNil() -> [Int]? { return nil } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeVoidTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeVoidTest.swift index a8eefc1..bb5d324 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeVoidTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeVoidTest.swift @@ -2,12 +2,6 @@ import XCTest import Nimble final class BeVoidTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeVoidTest) -> () throws -> Void)] { - return [ - ("testBeVoid", testBeVoid), - ] - } - func testBeVoid() { expect(()).to(beVoid()) expect(() as ()?).to(beVoid()) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift index 276c7d0..3a5162e 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class BeginWithTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (BeginWithTest) -> () throws -> Void)] { - return [ - ("testPositiveMatches", testPositiveMatches), - ("testNegativeMatches", testNegativeMatches), - ] - } - func testPositiveMatches() { expect([1, 2, 3]).to(beginWith(1)) expect([1, 2, 3]).toNot(beginWith(2)) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ContainElementSatisfyingTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ContainElementSatisfyingTest.swift index a9fe80e..6944375 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ContainElementSatisfyingTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ContainElementSatisfyingTest.swift @@ -3,20 +3,6 @@ import XCTest import Nimble final class ContainElementSatisfyingTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (ContainElementSatisfyingTest) -> () throws -> Void)] { - return [ - ("testContainElementSatisfying", testContainElementSatisfying), - ("testContainElementSatisfyingDefaultErrorMessage", testContainElementSatisfyingDefaultErrorMessage), - ("testContainElementSatisfyingSpecificErrorMessage", testContainElementSatisfyingSpecificErrorMessage), - ("testContainElementSatisfyingNegativeCase", - testContainElementSatisfyingNegativeCase), - ("testContainElementSatisfyingNegativeCaseDefaultErrorMessage", - testContainElementSatisfyingNegativeCaseDefaultErrorMessage), - ("testContainElementSatisfyingNegativeCaseSpecificErrorMessage", - testContainElementSatisfyingNegativeCaseSpecificErrorMessage), - ] - } - func testContainElementSatisfying() { var orderIndifferentArray = [1, 2, 3] expect(orderIndifferentArray).to(containElementSatisfying({ number in diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift index 1d8a1eb..f69f351 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift @@ -3,22 +3,12 @@ import XCTest import Nimble final class ContainTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (ContainTest) -> () throws -> Void)] { - return [ - ("testContain", testContain), - ("testContainSubstring", testContainSubstring), - ("testContainObjCSubstring", testContainObjCSubstring), - ("testVariadicArguments", testVariadicArguments), - ("testCollectionArguments", testCollectionArguments), - ] - } - - func testContain() { + func testContainSequence() { expect([1, 2, 3]).to(contain(1)) + expect([1, 2, 3]).toNot(contain(4)) expect([1, 2, 3] as [CInt]).to(contain(1 as CInt)) expect([1, 2, 3] as [CInt]).toNot(contain(4 as CInt)) expect(["foo", "bar", "baz"]).to(contain("baz")) - expect([1, 2, 3]).toNot(contain(4)) expect(["foo", "bar", "baz"]).toNot(contain("ba")) #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) expect(NSArray(array: ["a"])).to(contain(NSString(string: "a"))) @@ -41,6 +31,25 @@ final class ContainTest: XCTestCase, XCTestCaseProvider { } } + func testContainSetAlgebra() { + expect([.a, .b, .c] as TestOptionSet).to(contain(.a)) + expect([.a, .b, .c] as TestOptionSet).toNot(contain(.d)) + + failsWithErrorMessage("expected to contain <8>, got <7>") { + expect([.a, .b, .c] as TestOptionSet).to(contain(.d)) + } + failsWithErrorMessage("expected to not contain <2>, got <7>") { + expect([.a, .b, .c] as TestOptionSet).toNot(contain(.b)) + } + + failsWithErrorMessageForNil("expected to contain <1>, got ") { + expect(nil as TestOptionSet?).to(contain(.a)) + } + failsWithErrorMessageForNil("expected to not contain <1>, got ") { + expect(nil as TestOptionSet?).toNot(contain(.a)) + } + } + func testContainSubstring() { expect("foo").to(contain("o")) expect("foo").to(contain("oo")) @@ -93,3 +102,23 @@ final class ContainTest: XCTestCase, XCTestCaseProvider { } } } + +private struct TestOptionSet: OptionSet, CustomStringConvertible { + let rawValue: Int + + // swiftlint:disable identifier_name + static let a = TestOptionSet(rawValue: 1 << 0) + static let b = TestOptionSet(rawValue: 1 << 1) + static let c = TestOptionSet(rawValue: 1 << 2) + static let d = TestOptionSet(rawValue: 1 << 3) + static let e = TestOptionSet(rawValue: 1 << 4) + // swiftlint:enable identifier_name + + init(rawValue: Int) { + self.rawValue = rawValue + } + + var description: String { + return "\(rawValue)" + } +} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ElementsEqualTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ElementsEqualTest.swift new file mode 100644 index 0000000..ec7a0dd --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ElementsEqualTest.swift @@ -0,0 +1,27 @@ +import Foundation +import XCTest +import Nimble + +final class ElementsEqualTest: XCTestCase, XCTestCaseProvider { + + func testSequenceElementsEquality() { + failsWithErrorMessageForNil("expected to elementsEqual , got ") { + expect(nil as [Int]?).to(elementsEqual(nil as [Int]?)) + } + let sequence = [1, 2] + failsWithErrorMessageForNil("expected to elementsEqual <[1, 2]>, got ") { + expect(nil as [Int]?).to(elementsEqual(sequence)) + } + + failsWithErrorMessageForNil("expected to elementsEqual , got <[1, 2]>") { + expect(sequence).to(elementsEqual(nil as [Int]?)) + } + + let sequence1 = [1, 2, 3] + let sequence2 = [1, 2, 3, 4, 5] + expect(sequence1).toNot(elementsEqual(sequence2)) + expect(sequence1).toNot(elementsEqual([3, 2, 1])) + expect(sequence1).to(elementsEqual([1, 2, 3])) + + } +} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift index 30e3b26..88005e8 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift @@ -3,13 +3,6 @@ import XCTest import Nimble final class EndWithTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (EndWithTest) -> () throws -> Void)] { - return [ - ("testEndWithPositives", testEndWithPositives), - ("testEndWithNegatives", testEndWithNegatives), - ] - } - func testEndWithPositives() { expect([1, 2, 3]).to(endWith(3)) expect([1, 2, 3]).toNot(endWith(2)) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift index 85be751..18b0647 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift @@ -3,24 +3,6 @@ import XCTest import Nimble final class EqualTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (EqualTest) -> () throws -> Void)] { - return [ - ("testEquality", testEquality), - ("testArrayEquality", testArrayEquality), - ("testSetEquality", testSetEquality), - ("testDoesNotMatchNils", testDoesNotMatchNils), - ("testDictionaryEquality", testDictionaryEquality), - ("testDataEquality", testDataEquality), - ("testNSObjectEquality", testNSObjectEquality), - ("testOperatorEquality", testOperatorEquality), - ("testOperatorEqualityWithArrays", testOperatorEqualityWithArrays), - ("testOperatorEqualityWithDictionaries", testOperatorEqualityWithDictionaries), - ("testOptionalEquality", testOptionalEquality), - ("testArrayOfOptionalsEquality", testArrayOfOptionalsEquality), - ("testDictionariesWithDifferentSequences", testDictionariesWithDifferentSequences), - ] - } - func testEquality() { expect(1 as CInt).to(equal(1 as CInt)) expect(1 as CInt).to(equal(1)) @@ -152,6 +134,7 @@ final class EqualTest: XCTestCase, XCTestCaseProvider { expect(actual).toNot(equal(unexpected)) #if os(Linux) + // swiftlint:disable:next todo // FIXME: Swift on Linux triggers a segfault when calling NSData's hash() (last checked on 03-11) let expectedErrorMessage = "expected to equal >, got >" #else diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/HaveCountTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/HaveCountTest.swift index a0294c3..4ef610e 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/HaveCountTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/HaveCountTest.swift @@ -2,23 +2,25 @@ import XCTest import Nimble final class HaveCountTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (HaveCountTest) -> () throws -> Void)] { - return [ - ("testHaveCountForArray", testHaveCountForArray), - ("testHaveCountForDictionary", testHaveCountForDictionary), - ("testHaveCountForSet", testHaveCountForSet), - ] - } - func testHaveCountForArray() { expect([1, 2, 3]).to(haveCount(3)) expect([1, 2, 3]).notTo(haveCount(1)) - failsWithErrorMessage("expected to have Array with count 1, got 3\nActual Value: [1, 2, 3]") { + failsWithErrorMessage( + """ + expected to have Array with count 1, got 3 + Actual Value: [1, 2, 3] + """ + ) { expect([1, 2, 3]).to(haveCount(1)) } - failsWithErrorMessage("expected to not have Array with count 3, got 3\nActual Value: [1, 2, 3]") { + failsWithErrorMessage( + """ + expected to not have Array with count 3, got 3 + Actual Value: [1, 2, 3] + """ + ) { expect([1, 2, 3]).notTo(haveCount(3)) } } @@ -28,13 +30,22 @@ final class HaveCountTest: XCTestCase, XCTestCaseProvider { expect(dictionary).to(haveCount(3)) expect(dictionary).notTo(haveCount(1)) - failsWithErrorMessage("expected to have Dictionary with count 1, got 3\nActual Value: \(stringify(dictionary))") { + failsWithErrorMessage( + """ + expected to have Dictionary with count 1, got 3 + Actual Value: \(stringify(dictionary)) + """ + ) { expect(dictionary).to(haveCount(1)) } - failsWithErrorMessage("expected to not have Dictionary with count 3, got 3" + - "\nActual Value: \(stringify(dictionary))") { - expect(dictionary).notTo(haveCount(3)) + failsWithErrorMessage( + """ + expected to not have Dictionary with count 3, got 3 + Actual Value: \(stringify(dictionary)) + """ + ) { + expect(dictionary).notTo(haveCount(3)) } } @@ -43,14 +54,22 @@ final class HaveCountTest: XCTestCase, XCTestCaseProvider { expect(set).to(haveCount(3)) expect(set).notTo(haveCount(1)) - failsWithErrorMessage("expected to have Set with count 1, got 3" + - "\nActual Value: \(stringify(set))") { - expect(set).to(haveCount(1)) + failsWithErrorMessage( + """ + expected to have Set with count 1, got 3 + Actual Value: \(stringify(set)) + """ + ) { + expect(set).to(haveCount(1)) } - failsWithErrorMessage("expected to not have Set with count 3, got 3" + - "\nActual Value: \(stringify(set))") { - expect(set).notTo(haveCount(3)) + failsWithErrorMessage( + """ + expected to not have Set with count 3, got 3 + Actual Value: \(stringify(set)) + """ + ) { + expect(set).notTo(haveCount(3)) } } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift index 2d626f2..41e5159 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift @@ -3,18 +3,6 @@ import XCTest import Nimble final class MatchErrorTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (MatchErrorTest) -> () throws -> Void)] { - return [ - ("testMatchErrorPositive", testMatchErrorPositive), - ("testMatchErrorNegative", testMatchErrorNegative), - ("testMatchNSErrorPositive", testMatchNSErrorPositive), - ("testMatchNSErrorNegative", testMatchNSErrorNegative), - ("testMatchPositiveMessage", testMatchPositiveMessage), - ("testMatchNegativeMessage", testMatchNegativeMessage), - ("testDoesNotMatchNils", testDoesNotMatchNils), - ] - } - func testMatchErrorPositive() { expect(NimbleError.laugh).to(matchError(NimbleError.laugh)) expect(NimbleError.laugh).to(matchError(NimbleError.self)) @@ -31,10 +19,12 @@ final class MatchErrorTest: XCTestCase, XCTestCaseProvider { } func testMatchNSErrorPositive() { +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) let error1 = NSError(domain: "err", code: 0, userInfo: nil) let error2 = NSError(domain: "err", code: 0, userInfo: nil) expect(error1).to(matchError(error2)) +#endif } func testMatchNSErrorNegative() { @@ -45,7 +35,7 @@ final class MatchErrorTest: XCTestCase, XCTestCaseProvider { } func testMatchPositiveMessage() { - failsWithErrorMessage("expected to match error , got ") { + failsWithErrorMessage("expected to match error , got ") { expect(EquatableError.parameterized(x: 1)).to(matchError(EquatableError.parameterized(x: 2))) } failsWithErrorMessage("expected to match error , got ") { @@ -55,11 +45,13 @@ final class MatchErrorTest: XCTestCase, XCTestCaseProvider { expect(CustomDebugStringConvertibleError.a).to(matchError(CustomDebugStringConvertibleError.b)) } +#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) failsWithErrorMessage("expected to match error , got ") { let error1 = NSError(domain: "err", code: 0, userInfo: nil) let error2 = NSError(domain: "err", code: 1, userInfo: nil) expect(error1).to(matchError(error2)) } +#endif } func testMatchNegativeMessage() { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/MatchTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/MatchTest.swift index a95ba56..1285ecc 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/MatchTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/MatchTest.swift @@ -2,16 +2,6 @@ import XCTest import Nimble final class MatchTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (MatchTest) -> () throws -> Void)] { - return [ - ("testMatchPositive", testMatchPositive), - ("testMatchNegative", testMatchNegative), - ("testMatchPositiveMessage", testMatchPositiveMessage), - ("testMatchNegativeMessage", testMatchNegativeMessage), - ("testMatchNils", testMatchNils), - ] - } - func testMatchPositive() { expect("11:14").to(match("\\d{2}:\\d{2}")) } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift index ac7f9ec..32f5100 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift @@ -3,18 +3,6 @@ import Nimble import Foundation final class PostNotificationTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (PostNotificationTest) -> () throws -> Void)] { - return [ - ("testPassesWhenNoNotificationsArePosted", testPassesWhenNoNotificationsArePosted), - ("testPassesWhenExpectedNotificationIsPosted", testPassesWhenExpectedNotificationIsPosted), - ("testPassesWhenAllExpectedNotificationsArePosted", testPassesWhenAllExpectedNotificationsArePosted), - ("testFailsWhenNoNotificationsArePosted", testFailsWhenNoNotificationsArePosted), - ("testFailsWhenNotificationWithWrongNameIsPosted", testFailsWhenNotificationWithWrongNameIsPosted), - ("testFailsWhenNotificationWithWrongObjectIsPosted", testFailsWhenNotificationWithWrongObjectIsPosted), - ("testPassesWhenExpectedNotificationEventuallyIsPosted", testPassesWhenExpectedNotificationEventuallyIsPosted), - ] - } - let notificationCenter = NotificationCenter() func testPassesWhenNoNotificationsArePosted() { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift index f62f633..beca75b 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift @@ -3,17 +3,7 @@ import Nimble #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE -final class RaisesExceptionTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (RaisesExceptionTest) -> () throws -> Void)] { - return [ - ("testPositiveMatches", testPositiveMatches), - ("testPositiveMatchesWithClosures", testPositiveMatchesWithClosures), - ("testNegativeMatches", testNegativeMatches), - ("testNegativeMatchesDoNotCallClosureWithoutException", testNegativeMatchesDoNotCallClosureWithoutException), - ("testNegativeMatchesWithClosure", testNegativeMatchesWithClosure), - ] - } - +final class RaisesExceptionTest: XCTestCase { var anException = NSException(name: NSExceptionName("laugh"), reason: "Lulz", userInfo: ["key": "value"]) func testPositiveMatches() { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/SatisfyAllOfTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/SatisfyAllOfTest.swift index 42ed892..be60a41 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/SatisfyAllOfTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/SatisfyAllOfTest.swift @@ -3,13 +3,6 @@ import Nimble import Foundation final class SatisfyAllOfTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (SatisfyAllOfTest) -> () throws -> Void)] { - return [ - ("testSatisfyAllOf", testSatisfyAllOf), - ("testOperatorAnd", testOperatorAnd), - ] - } - func testSatisfyAllOf() { expect(2).to(satisfyAllOf(equal(2), beLessThan(3))) #if SUPPORT_IMPLICIT_BRIDGING_CONVERSION diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/SatisfyAnyOfTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/SatisfyAnyOfTest.swift index 0bd9495..0cba8d5 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/SatisfyAnyOfTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/SatisfyAnyOfTest.swift @@ -3,13 +3,6 @@ import Nimble import Foundation final class SatisfyAnyOfTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (SatisfyAnyOfTest) -> () throws -> Void)] { - return [ - ("testSatisfyAnyOf", testSatisfyAnyOf), - ("testOperatorOr", testOperatorOr), - ] - } - func testSatisfyAnyOf() { expect(2).to(satisfyAnyOf(equal(2), equal(3))) #if SUPPORT_IMPLICIT_BRIDGING_CONVERSION diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift index 68086e0..edd9e0e 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift @@ -4,24 +4,15 @@ import Nimble #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE -final class ThrowAssertionTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (ThrowAssertionTest) -> () throws -> Void)] { - return [ - ("testPositiveMatch", testPositiveMatch), - ("testErrorThrown", testErrorThrown), - ("testPostAssertionCodeNotRun", testPostAssertionCodeNotRun), - ("testNegativeMatch", testNegativeMatch), - ("testPositiveMessage", testPositiveMessage), - ("testNegativeMessage", testNegativeMessage), - ] - } +private let error: Error = NSError(domain: "test", code: 0, userInfo: nil) +final class ThrowAssertionTest: XCTestCase { func testPositiveMatch() { expect { () -> Void in fatalError() }.to(throwAssertion()) } func testErrorThrown() { - expect { throw NSError(domain: "test", code: 0, userInfo: nil) }.toNot(throwAssertion()) + expect { throw error }.toNot(throwAssertion()) } func testPostAssertionCodeNotRun() { @@ -50,6 +41,10 @@ final class ThrowAssertionTest: XCTestCase, XCTestCaseProvider { failsWithErrorMessage("expected to throw an assertion") { expect { () -> Void? in return }.to(throwAssertion()) } + + failsWithErrorMessage("expected to throw an assertion; threw error instead <\(error)>") { + expect { throw error }.to(throwAssertion()) + } } func testNegativeMessage() { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ThrowErrorTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ThrowErrorTest.swift index f11c8c5..7a7253f 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ThrowErrorTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ThrowErrorTest.swift @@ -10,6 +10,15 @@ enum EquatableError: Error { case parameterized(x: Int) } +extension EquatableError: CustomDebugStringConvertible { + var debugDescription: String { + switch self { + case .parameterized(let x): + return "parameterized(x: \(x))" + } + } +} + extension EquatableError: Equatable { } @@ -21,8 +30,10 @@ func == (lhs: EquatableError, rhs: EquatableError) -> Bool { } enum CustomDebugStringConvertibleError: Error { + // swiftlint:disable identifier_name case a case b + // swiftlint:enable identifier_name } extension CustomDebugStringConvertibleError: CustomDebugStringConvertible { @@ -32,18 +43,6 @@ extension CustomDebugStringConvertibleError: CustomDebugStringConvertible { } final class ThrowErrorTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (ThrowErrorTest) -> () throws -> Void)] { - return [ - ("testPositiveMatches", testPositiveMatches), - ("testPositiveMatchesWithClosures", testPositiveMatchesWithClosures), - ("testNegativeMatches", testNegativeMatches), - ("testPositiveNegatedMatches", testPositiveNegatedMatches), - ("testNegativeNegatedMatches", testNegativeNegatedMatches), - ("testNegativeMatchesDoNotCallClosureWithoutError", testNegativeMatchesDoNotCallClosureWithoutError), - ("testNegativeMatchesWithClosure", testNegativeMatchesWithClosure), - ] - } - func testPositiveMatches() { expect { throw NimbleError.laugh }.to(throwError()) expect { throw NimbleError.laugh }.to(throwError(NimbleError.laugh)) @@ -80,11 +79,11 @@ final class ThrowErrorTest: XCTestCase, XCTestCaseProvider { func testNegativeMatches() { // Same case, different arguments - failsWithErrorMessage("expected to throw error , got ") { + failsWithErrorMessage("expected to throw error , got ") { expect { throw EquatableError.parameterized(x: 1) }.to(throwError(EquatableError.parameterized(x: 2))) } // Same case, different arguments - failsWithErrorMessage("expected to throw error , got ") { + failsWithErrorMessage("expected to throw error , got ") { expect { throw EquatableError.parameterized(x: 1) }.to(throwError(EquatableError.parameterized(x: 2))) } // Different case diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ToSucceedTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ToSucceedTest.swift index dde999a..0079f23 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ToSucceedTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ToSucceedTest.swift @@ -2,12 +2,6 @@ import XCTest import Nimble final class ToSucceedTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (ToSucceedTest) -> () throws -> Void)] { - return [ - ("testToSucceed", testToSucceed), - ] - } - func testToSucceed() { expect({ return .succeeded diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/SynchronousTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/SynchronousTest.swift similarity index 71% rename from Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/SynchronousTests.swift rename to Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/SynchronousTest.swift index ce8181b..1f412dd 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/SynchronousTests.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/SynchronousTest.swift @@ -3,24 +3,6 @@ import XCTest import Nimble final class SynchronousTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (SynchronousTest) -> () throws -> Void)] { - return [ - ("testFailAlwaysFails", testFailAlwaysFails), - ("testUnexpectedErrorsThrownFails", testUnexpectedErrorsThrownFails), - ("testToMatchesIfMatcherReturnsTrue", testToMatchesIfMatcherReturnsTrue), - ("testToProvidesActualValueExpression", testToProvidesActualValueExpression), - ("testToProvidesAMemoizedActualValueExpression", testToProvidesActualValueExpression), - ("testToProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl", testToProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl), - ("testToMatchAgainstLazyProperties", testToMatchAgainstLazyProperties), - ("testToNotMatchesIfMatcherReturnsTrue", testToNotMatchesIfMatcherReturnsTrue), - ("testToNotProvidesActualValueExpression", testToNotProvidesActualValueExpression), - ("testToNotProvidesAMemoizedActualValueExpression", testToNotProvidesAMemoizedActualValueExpression), - ("testToNotProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl", testToNotProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl), - ("testToNotNegativeMatches", testToNotNegativeMatches), - ("testNotToMatchesLikeToNot", testNotToMatchesLikeToNot), - ] - } - class Error: Swift.Error {} let errorToThrow = Error() @@ -49,6 +31,12 @@ final class SynchronousTest: XCTestCase, XCTestCaseProvider { func testToMatchesIfMatcherReturnsTrue() { expect(1).to(MatcherFunc { _, _ in true }) expect {1}.to(MatcherFunc { _, _ in true }) + + expect(1).to(MatcherFunc { _, _ in true }.predicate) + expect {1}.to(MatcherFunc { _, _ in true }.predicate) + + expect(1).to(Predicate.simple("match") { _ in .matches }) + expect {1}.to(Predicate.simple("match") { _ in .matches }) } func testToProvidesActualValueExpression() { @@ -88,6 +76,12 @@ final class SynchronousTest: XCTestCase, XCTestCaseProvider { func testToNotMatchesIfMatcherReturnsTrue() { expect(1).toNot(MatcherFunc { _, _ in false }) expect {1}.toNot(MatcherFunc { _, _ in false }) + + expect(1).toNot(MatcherFunc { _, _ in false }.predicate) + expect {1}.toNot(MatcherFunc { _, _ in false }.predicate) + + expect(1).toNot(Predicate.simple("match") { _ in .doesNotMatch }) + expect {1}.toNot(Predicate.simple("match") { _ in .doesNotMatch }) } func testToNotProvidesActualValueExpression() { @@ -116,13 +110,33 @@ final class SynchronousTest: XCTestCase, XCTestCaseProvider { expect(callCount).to(equal(1)) } + func testToNegativeMatches() { + failsWithErrorMessage("expected to match, got <1>") { + expect(1).to(MatcherFunc { _, _ in false }) + } + failsWithErrorMessage("expected to match, got <1>") { + expect(1).to(MatcherFunc { _, _ in false }.predicate) + } + failsWithErrorMessage("expected to match, got <1>") { + expect(1).to(Predicate.simple("match") { _ in .doesNotMatch }) + } + } + func testToNotNegativeMatches() { failsWithErrorMessage("expected to not match, got <1>") { expect(1).toNot(MatcherFunc { _, _ in true }) } + failsWithErrorMessage("expected to not match, got <1>") { + expect(1).toNot(MatcherFunc { _, _ in true }.predicate) + } + failsWithErrorMessage("expected to not match, got <1>") { + expect(1).toNot(Predicate.simple("match") { _ in .matches }) + } } func testNotToMatchesLikeToNot() { expect(1).notTo(MatcherFunc { _, _ in false }) + expect(1).notTo(MatcherFunc { _, _ in false }.predicate) + expect(1).notTo(Predicate.simple("match") { _ in .doesNotMatch }) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/UserDescriptionTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/UserDescriptionTest.swift index 9bb64b6..0c451c8 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/UserDescriptionTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/UserDescriptionTest.swift @@ -2,62 +2,69 @@ import XCTest import Nimble final class UserDescriptionTest: XCTestCase, XCTestCaseProvider { - static var allTests: [(String, (UserDescriptionTest) -> () throws -> Void)] { - return [ - ("testToMatcher_CustomFailureMessage", testToMatcher_CustomFailureMessage), - ("testNotToMatcher_CustomFailureMessage", testNotToMatcher_CustomFailureMessage), - ("testToNotMatcher_CustomFailureMessage", testToNotMatcher_CustomFailureMessage), - ("testToEventuallyMatch_CustomFailureMessage", testToEventuallyMatch_CustomFailureMessage), - ("testToEventuallyNotMatch_CustomFailureMessage", testToEventuallyNotMatch_CustomFailureMessage), - ("testToNotEventuallyMatch_CustomFailureMessage", testToNotEventuallyMatch_CustomFailureMessage), - ] - } - func testToMatcher_CustomFailureMessage() { failsWithErrorMessage( - "These aren't equal!\n" + - "expected to match, got <1>") { - expect(1).to(MatcherFunc { _, _ in false }, description: "These aren't equal!") + """ + These aren't equal! + expected to match, got <1> + """ + ) { + expect(1).to(MatcherFunc { _, _ in false }, description: "These aren't equal!") } } func testNotToMatcher_CustomFailureMessage() { failsWithErrorMessage( - "These aren't equal!\n" + - "expected to not match, got <1>") { - expect(1).notTo(MatcherFunc { _, _ in true }, description: "These aren't equal!") + """ + These aren't equal! + expected to not match, got <1> + """ + ) { + expect(1).notTo(MatcherFunc { _, _ in true }, description: "These aren't equal!") } } func testToNotMatcher_CustomFailureMessage() { failsWithErrorMessage( - "These aren't equal!\n" + - "expected to not match, got <1>") { - expect(1).toNot(MatcherFunc { _, _ in true }, description: "These aren't equal!") + """ + These aren't equal! + expected to not match, got <1> + """ + ) { + expect(1).toNot(MatcherFunc { _, _ in true }, description: "These aren't equal!") } } func testToEventuallyMatch_CustomFailureMessage() { failsWithErrorMessage( - "These aren't eventually equal!\n" + - "expected to eventually equal <1>, got <0>") { - expect { 0 }.toEventually(equal(1), description: "These aren't eventually equal!") + """ + These aren't eventually equal! + expected to eventually equal <1>, got <0> + """ + ) { + expect { 0 }.toEventually(equal(1), description: "These aren't eventually equal!") } } func testToEventuallyNotMatch_CustomFailureMessage() { failsWithErrorMessage( - "These are eventually equal!\n" + - "expected to eventually not equal <1>, got <1>") { - expect { 1 }.toEventuallyNot(equal(1), description: "These are eventually equal!") + """ + These are eventually equal! + expected to eventually not equal <1>, got <1> + """ + ) { + expect { 1 }.toEventuallyNot(equal(1), description: "These are eventually equal!") } } func testToNotEventuallyMatch_CustomFailureMessage() { failsWithErrorMessage( - "These are eventually equal!\n" + - "expected to eventually not equal <1>, got <1>") { - expect { 1 }.toEventuallyNot(equal(1), description: "These are eventually equal!") + """ + These are eventually equal! + expected to eventually not equal <1>, got <1> + """ + ) { + expect { 1 }.toEventuallyNot(equal(1), description: "These are eventually equal!") } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/XCTestManifests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/XCTestManifests.swift new file mode 100644 index 0000000..e0fcd0a --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/XCTestManifests.swift @@ -0,0 +1,386 @@ +import XCTest + +extension AllPassTest { + static let __allTests = [ + ("testAllPassArray", testAllPassArray), + ("testAllPassCollectionsWithOptionalsDontWork", testAllPassCollectionsWithOptionalsDontWork), + ("testAllPassCollectionsWithOptionalsUnwrappingOneOptionalLayer", testAllPassCollectionsWithOptionalsUnwrappingOneOptionalLayer), + ("testAllPassMatcher", testAllPassMatcher), + ("testAllPassSet", testAllPassSet), + ("testAllPassWithNilAsExpectedValue", testAllPassWithNilAsExpectedValue), + ] +} + +extension AsyncTest { + static let __allTests = [ + ("testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed", testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed), + ("testSubjectUnderTestIsReleasedFromMemory", testSubjectUnderTestIsReleasedFromMemory), + ("testToEventuallyMustBeInMainThread", testToEventuallyMustBeInMainThread), + ("testToEventuallyNegativeMatches", testToEventuallyNegativeMatches), + ("testToEventuallyPositiveMatches", testToEventuallyPositiveMatches), + ("testToEventuallyWithCustomDefaultTimeout", testToEventuallyWithCustomDefaultTimeout), + ("testWaitUntilDetectsStalledMainThreadActivity", testWaitUntilDetectsStalledMainThreadActivity), + ("testWaitUntilErrorsIfDoneIsCalledMultipleTimes", testWaitUntilErrorsIfDoneIsCalledMultipleTimes), + ("testWaitUntilMustBeInMainThread", testWaitUntilMustBeInMainThread), + ("testWaitUntilNegativeMatches", testWaitUntilNegativeMatches), + ("testWaitUntilPositiveMatches", testWaitUntilPositiveMatches), + ("testWaitUntilTimesOutIfNotCalled", testWaitUntilTimesOutIfNotCalled), + ("testWaitUntilTimesOutWhenExceedingItsTime", testWaitUntilTimesOutWhenExceedingItsTime), + ("testWaitUntilWithCustomDefaultsTimeout", testWaitUntilWithCustomDefaultsTimeout), + ] +} + +extension BeAKindOfObjCTest { + static let __allTests = [ + ("testFailureMessages", testFailureMessages), + ("testPositiveMatch", testPositiveMatch), + ] +} + +extension BeAKindOfSwiftTest { + static let __allTests = [ + ("testFailureMessages", testFailureMessages), + ("testPositiveMatch", testPositiveMatch), + ] +} + +extension BeAnInstanceOfTest { + static let __allTests = [ + ("testFailureMessages", testFailureMessages), + ("testFailureMessagesSwiftTypes", testFailureMessagesSwiftTypes), + ("testPositiveMatch", testPositiveMatch), + ("testPositiveMatchSwiftTypes", testPositiveMatchSwiftTypes), + ] +} + +extension BeCloseToTest { + static let __allTests = [ + ("testBeCloseTo", testBeCloseTo), + ("testBeCloseToArray", testBeCloseToArray), + ("testBeCloseToOperator", testBeCloseToOperator), + ("testBeCloseToOperatorWithDate", testBeCloseToOperatorWithDate), + ("testBeCloseToWithCGFloat", testBeCloseToWithCGFloat), + ("testBeCloseToWithDate", testBeCloseToWithDate), + ("testBeCloseToWithin", testBeCloseToWithin), + ("testBeCloseToWithinOperator", testBeCloseToWithinOperator), + ("testBeCloseToWithinOperatorWithDate", testBeCloseToWithinOperatorWithDate), + ("testBeCloseToWithNSDate", testBeCloseToWithNSDate), + ("testBeCloseToWithNSNumber", testBeCloseToWithNSNumber), + ("testPlusMinusOperator", testPlusMinusOperator), + ("testPlusMinusOperatorWithDate", testPlusMinusOperatorWithDate), + ] +} + +extension BeEmptyTest { + static let __allTests = [ + ("testBeEmptyNegative", testBeEmptyNegative), + ("testBeEmptyPositive", testBeEmptyPositive), + ("testNilMatches", testNilMatches), + ] +} + +extension BeFalseTest { + static let __allTests = [ + ("testShouldMatchFalse", testShouldMatchFalse), + ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), + ("testShouldNotMatchTrue", testShouldNotMatchTrue), + ] +} + +extension BeFalsyTest { + static let __allTests = [ + ("testShouldMatchFalse", testShouldMatchFalse), + ("testShouldMatchNilBools", testShouldMatchNilBools), + ("testShouldMatchNilTypes", testShouldMatchNilTypes), + ("testShouldNotMatchNonNilTypes", testShouldNotMatchNonNilTypes), + ("testShouldNotMatchTrue", testShouldNotMatchTrue), + ] +} + +extension BeGreaterThanOrEqualToTest { + static let __allTests = [ + ("testGreaterThanOrEqualTo", testGreaterThanOrEqualTo), + ("testGreaterThanOrEqualToOperator", testGreaterThanOrEqualToOperator), + ] +} + +extension BeGreaterThanTest { + static let __allTests = [ + ("testGreaterThan", testGreaterThan), + ("testGreaterThanOperator", testGreaterThanOperator), + ] +} + +extension BeIdenticalToObjectTest { + static let __allTests = [ + ("testBeIdenticalToNegative", testBeIdenticalToNegative), + ("testBeIdenticalToNegativeMessage", testBeIdenticalToNegativeMessage), + ("testBeIdenticalToPositive", testBeIdenticalToPositive), + ("testBeIdenticalToPositiveMessage", testBeIdenticalToPositiveMessage), + ("testFailsOnNils", testFailsOnNils), + ("testOperators", testOperators), + ] +} + +extension BeIdenticalToTest { + static let __allTests = [ + ("testBeAlias", testBeAlias), + ("testBeIdenticalToNegative", testBeIdenticalToNegative), + ("testBeIdenticalToNegativeMessage", testBeIdenticalToNegativeMessage), + ("testBeIdenticalToPositive", testBeIdenticalToPositive), + ("testBeIdenticalToPositiveMessage", testBeIdenticalToPositiveMessage), + ("testOperators", testOperators), + ] +} + +extension BeLessThanOrEqualToTest { + static let __allTests = [ + ("testLessThanOrEqualTo", testLessThanOrEqualTo), + ("testLessThanOrEqualToOperator", testLessThanOrEqualToOperator), + ] +} + +extension BeLessThanTest { + static let __allTests = [ + ("testLessThan", testLessThan), + ("testLessThanOperator", testLessThanOperator), + ] +} + +extension BeNilTest { + static let __allTests = [ + ("testBeNil", testBeNil), + ] +} + +extension BeTrueTest { + static let __allTests = [ + ("testShouldMatchTrue", testShouldMatchTrue), + ("testShouldNotMatchFalse", testShouldNotMatchFalse), + ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), + ] +} + +extension BeTruthyTest { + static let __allTests = [ + ("testShouldMatchBoolConvertibleTypesThatConvertToTrue", testShouldMatchBoolConvertibleTypesThatConvertToTrue), + ("testShouldMatchNonNilTypes", testShouldMatchNonNilTypes), + ("testShouldMatchTrue", testShouldMatchTrue), + ("testShouldNotMatchBoolConvertibleTypesThatConvertToFalse", testShouldNotMatchBoolConvertibleTypesThatConvertToFalse), + ("testShouldNotMatchFalse", testShouldNotMatchFalse), + ("testShouldNotMatchNilBools", testShouldNotMatchNilBools), + ("testShouldNotMatchNilTypes", testShouldNotMatchNilTypes), + ] +} + +extension BeVoidTest { + static let __allTests = [ + ("testBeVoid", testBeVoid), + ] +} + +extension BeginWithTest { + static let __allTests = [ + ("testNegativeMatches", testNegativeMatches), + ("testPositiveMatches", testPositiveMatches), + ] +} + +extension ContainElementSatisfyingTest { + static let __allTests = [ + ("testContainElementSatisfying", testContainElementSatisfying), + ("testContainElementSatisfyingDefaultErrorMessage", testContainElementSatisfyingDefaultErrorMessage), + ("testContainElementSatisfyingNegativeCase", testContainElementSatisfyingNegativeCase), + ("testContainElementSatisfyingNegativeCaseDefaultErrorMessage", testContainElementSatisfyingNegativeCaseDefaultErrorMessage), + ("testContainElementSatisfyingNegativeCaseSpecificErrorMessage", testContainElementSatisfyingNegativeCaseSpecificErrorMessage), + ("testContainElementSatisfyingSpecificErrorMessage", testContainElementSatisfyingSpecificErrorMessage), + ] +} + +extension ContainTest { + static let __allTests = [ + ("testCollectionArguments", testCollectionArguments), + ("testContainObjCSubstring", testContainObjCSubstring), + ("testContainSequence", testContainSequence), + ("testContainSetAlgebra", testContainSetAlgebra), + ("testContainSubstring", testContainSubstring), + ("testVariadicArguments", testVariadicArguments), + ] +} + +extension ElementsEqualTest { + static let __allTests = [ + ("testSequenceElementsEquality", testSequenceElementsEquality), + ] +} + +extension EndWithTest { + static let __allTests = [ + ("testEndWithNegatives", testEndWithNegatives), + ("testEndWithPositives", testEndWithPositives), + ] +} + +extension EqualTest { + static let __allTests = [ + ("testArrayEquality", testArrayEquality), + ("testArrayOfOptionalsEquality", testArrayOfOptionalsEquality), + ("testDataEquality", testDataEquality), + ("testDictionariesWithDifferentSequences", testDictionariesWithDifferentSequences), + ("testDictionaryEquality", testDictionaryEquality), + ("testDoesNotMatchNils", testDoesNotMatchNils), + ("testEquality", testEquality), + ("testNSObjectEquality", testNSObjectEquality), + ("testOperatorEquality", testOperatorEquality), + ("testOperatorEqualityWithArrays", testOperatorEqualityWithArrays), + ("testOperatorEqualityWithDictionaries", testOperatorEqualityWithDictionaries), + ("testOptionalEquality", testOptionalEquality), + ("testSetEquality", testSetEquality), + ] +} + +extension HaveCountTest { + static let __allTests = [ + ("testHaveCountForArray", testHaveCountForArray), + ("testHaveCountForDictionary", testHaveCountForDictionary), + ("testHaveCountForSet", testHaveCountForSet), + ] +} + +extension MatchErrorTest { + static let __allTests = [ + ("testDoesNotMatchNils", testDoesNotMatchNils), + ("testMatchErrorNegative", testMatchErrorNegative), + ("testMatchErrorPositive", testMatchErrorPositive), + ("testMatchNegativeMessage", testMatchNegativeMessage), + ("testMatchNSErrorNegative", testMatchNSErrorNegative), + ("testMatchNSErrorPositive", testMatchNSErrorPositive), + ("testMatchPositiveMessage", testMatchPositiveMessage), + ] +} + +extension MatchTest { + static let __allTests = [ + ("testMatchNegative", testMatchNegative), + ("testMatchNegativeMessage", testMatchNegativeMessage), + ("testMatchNils", testMatchNils), + ("testMatchPositive", testMatchPositive), + ("testMatchPositiveMessage", testMatchPositiveMessage), + ] +} + +extension PostNotificationTest { + static let __allTests = [ + ("testFailsWhenNoNotificationsArePosted", testFailsWhenNoNotificationsArePosted), + ("testFailsWhenNotificationWithWrongNameIsPosted", testFailsWhenNotificationWithWrongNameIsPosted), + ("testFailsWhenNotificationWithWrongObjectIsPosted", testFailsWhenNotificationWithWrongObjectIsPosted), + ("testPassesWhenAllExpectedNotificationsArePosted", testPassesWhenAllExpectedNotificationsArePosted), + ("testPassesWhenExpectedNotificationEventuallyIsPosted", testPassesWhenExpectedNotificationEventuallyIsPosted), + ("testPassesWhenExpectedNotificationIsPosted", testPassesWhenExpectedNotificationIsPosted), + ("testPassesWhenNoNotificationsArePosted", testPassesWhenNoNotificationsArePosted), + ] +} + +extension SatisfyAllOfTest { + static let __allTests = [ + ("testOperatorAnd", testOperatorAnd), + ("testSatisfyAllOf", testSatisfyAllOf), + ] +} + +extension SatisfyAnyOfTest { + static let __allTests = [ + ("testOperatorOr", testOperatorOr), + ("testSatisfyAnyOf", testSatisfyAnyOf), + ] +} + +extension SynchronousTest { + static let __allTests = [ + ("testFailAlwaysFails", testFailAlwaysFails), + ("testNotToMatchesLikeToNot", testNotToMatchesLikeToNot), + ("testToMatchAgainstLazyProperties", testToMatchAgainstLazyProperties), + ("testToMatchesIfMatcherReturnsTrue", testToMatchesIfMatcherReturnsTrue), + ("testToNegativeMatches", testToNegativeMatches), + ("testToNotMatchesIfMatcherReturnsTrue", testToNotMatchesIfMatcherReturnsTrue), + ("testToNotNegativeMatches", testToNotNegativeMatches), + ("testToNotProvidesActualValueExpression", testToNotProvidesActualValueExpression), + ("testToNotProvidesAMemoizedActualValueExpression", testToNotProvidesAMemoizedActualValueExpression), + ("testToNotProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl", testToNotProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl), + ("testToProvidesActualValueExpression", testToProvidesActualValueExpression), + ("testToProvidesAMemoizedActualValueExpression", testToProvidesAMemoizedActualValueExpression), + ("testToProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl", testToProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl), + ("testUnexpectedErrorsThrownFails", testUnexpectedErrorsThrownFails), + ] +} + +extension ThrowErrorTest { + static let __allTests = [ + ("testNegativeMatches", testNegativeMatches), + ("testNegativeMatchesDoNotCallClosureWithoutError", testNegativeMatchesDoNotCallClosureWithoutError), + ("testNegativeMatchesWithClosure", testNegativeMatchesWithClosure), + ("testNegativeNegatedMatches", testNegativeNegatedMatches), + ("testPositiveMatches", testPositiveMatches), + ("testPositiveMatchesWithClosures", testPositiveMatchesWithClosures), + ("testPositiveNegatedMatches", testPositiveNegatedMatches), + ] +} + +extension ToSucceedTest { + static let __allTests = [ + ("testToSucceed", testToSucceed), + ] +} + +extension UserDescriptionTest { + static let __allTests = [ + ("testNotToMatcher_CustomFailureMessage", testNotToMatcher_CustomFailureMessage), + ("testToEventuallyMatch_CustomFailureMessage", testToEventuallyMatch_CustomFailureMessage), + ("testToEventuallyNotMatch_CustomFailureMessage", testToEventuallyNotMatch_CustomFailureMessage), + ("testToMatcher_CustomFailureMessage", testToMatcher_CustomFailureMessage), + ("testToNotEventuallyMatch_CustomFailureMessage", testToNotEventuallyMatch_CustomFailureMessage), + ("testToNotMatcher_CustomFailureMessage", testToNotMatcher_CustomFailureMessage), + ] +} + +#if !os(macOS) +public func __allTests() -> [XCTestCaseEntry] { + return [ + testCase(AllPassTest.__allTests), + testCase(AsyncTest.__allTests), + testCase(BeAKindOfObjCTest.__allTests), + testCase(BeAKindOfSwiftTest.__allTests), + testCase(BeAnInstanceOfTest.__allTests), + testCase(BeCloseToTest.__allTests), + testCase(BeEmptyTest.__allTests), + testCase(BeFalseTest.__allTests), + testCase(BeFalsyTest.__allTests), + testCase(BeGreaterThanOrEqualToTest.__allTests), + testCase(BeGreaterThanTest.__allTests), + testCase(BeIdenticalToObjectTest.__allTests), + testCase(BeIdenticalToTest.__allTests), + testCase(BeLessThanOrEqualToTest.__allTests), + testCase(BeLessThanTest.__allTests), + testCase(BeNilTest.__allTests), + testCase(BeTrueTest.__allTests), + testCase(BeTruthyTest.__allTests), + testCase(BeVoidTest.__allTests), + testCase(BeginWithTest.__allTests), + testCase(ContainElementSatisfyingTest.__allTests), + testCase(ContainTest.__allTests), + testCase(ElementsEqualTest.__allTests), + testCase(EndWithTest.__allTests), + testCase(EqualTest.__allTests), + testCase(HaveCountTest.__allTests), + testCase(MatchErrorTest.__allTests), + testCase(MatchTest.__allTests), + testCase(PostNotificationTest.__allTests), + testCase(SatisfyAllOfTest.__allTests), + testCase(SatisfyAnyOfTest.__allTests), + testCase(SynchronousTest.__allTests), + testCase(ThrowErrorTest.__allTests), + testCase(ToSucceedTest.__allTests), + testCase(UserDescriptionTest.__allTests), + ] +} +#endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCAsyncTest.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCAsyncTest.m index f052e74..06f5b32 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCAsyncTest.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCAsyncTest.m @@ -29,6 +29,11 @@ waitUntil(^(void (^done)(void)){ done(); }); + waitUntil(^(void (^done)(void)){ + dispatch_async(dispatch_get_main_queue(), ^{ + done(); + }); + }); expectFailureMessage(@"Waited more than 1.0 second", ^{ waitUntil(^(void (^done)(void)){ /* ... */ }); diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCContainTest.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCContainTest.m index 8b954fe..62d6e45 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCContainTest.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCContainTest.m @@ -64,4 +64,13 @@ }); } +- (void)testUnsupportedTypes { + expectFailureMessage(@"expected to contain (only works for NSArrays, NSSets, NSHashTables, and NSStrings), got <1>", ^{ + expect(@1).to(contain(@"foo")); + }); + expectFailureMessage(@"expected to not contain (only works for NSArrays, NSSets, NSHashTables, and NSStrings), got <1>", ^{ + expect(@1).toNot(contain(@"foo")); + }); +} + @end diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCEndWithTest.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCEndWithTest.m index b960f01..b48b3fc 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCEndWithTest.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCEndWithTest.m @@ -13,7 +13,6 @@ expect(@"hello world!").toNot(endWith(@"hello")); expect(array).to(endWith(@2)); expect(array).toNot(endWith(@1)); - expect(@1).toNot(contain(@"foo")); } - (void)testNegativeMatches { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCHaveCountTest.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCHaveCountTest.m index 31053c8..ea0e31f 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCHaveCountTest.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCHaveCountTest.m @@ -171,4 +171,13 @@ }); } +- (void)testNilMatches { + expectNilFailureMessage(@"expected to have a collection with count 3, got ", ^{ + expect(nil).to(haveCount(3)); + }); + expectNilFailureMessage(@"expected to not have a collection with count 3, got ", ^{ + expect(nil).toNot(haveCount(3)); + }); +} + @end diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/test b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/test index 0766351..c213afe 100755 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/test +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/test @@ -63,7 +63,7 @@ function test_ios { function test_tvos { run osascript -e 'tell app "Simulator" to quit' - run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-tvOS" -configuration "Debug" -sdk "appletvsimulator$BUILD_TVOS_SDK_VERSION" -destination "name=Apple TV 1080p,OS=$RUNTIME_TVOS_SDK_VERSION" build-for-testing test-without-building + run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-tvOS" -configuration "Debug" -sdk "appletvsimulator$BUILD_TVOS_SDK_VERSION" -destination "name=Apple TV,OS=$RUNTIME_TVOS_SDK_VERSION" build-for-testing test-without-building } function test_macos { @@ -74,13 +74,17 @@ function test_podspec { echo "Gathering CocoaPods installation information..." run bundle exec pod --version echo "Linting podspec..." + # To work around the lint error: "ERROR | swift: Specification `Nimble` specifies an inconsistent `swift_version` (`4.0`) compared to the one present in your `.swift-version` file (`4.1`). Please remove the `.swift-version` file which is now deprecated and only use the `swift_version` attribute within your podspec." + # `.swift-version` is for swiftenv, not for CocoaPods, so we can't remove the file as suggested. + run mv .swift-version .swift-version.backup # Note: remove `--allow-warnings` once old Matcher API has been removed - run bundle exec pod lib lint Nimble.podspec --allow-warnings + run bundle exec pod lib lint Nimble.podspec --allow-warnings --skip-import-validation + run mv .swift-version.backup .swift-version } function test_swiftpm { if [ -d .build ]; then - run swift build --clean + run swift package clean fi run swift build && swift test } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Gemfile b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Gemfile index 716d667..45cf683 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Gemfile +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Gemfile @@ -1,5 +1,5 @@ source "https://rubygems.org" -gem 'cocoapods', '~> 1.5.0' +gem 'cocoapods', '~> 1.7.0.beta' gem 'danger' gem 'danger-swiftlint' diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Gemfile.lock b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Gemfile.lock index 9a0bf21..ce57b59 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Gemfile.lock +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Gemfile.lock @@ -2,55 +2,55 @@ GEM remote: https://rubygems.org/ specs: CFPropertyList (3.0.0) - activesupport (4.2.10) + activesupport (4.2.11) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) addressable (2.5.0) public_suffix (~> 2.0, >= 2.0.2) - atomos (0.1.2) + atomos (0.1.3) claide (1.0.2) claide-plugins (0.9.2) cork nap open4 (~> 1.3) - cocoapods (1.5.0) + cocoapods (1.7.0.beta.1) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.5.0) - cocoapods-deintegrate (>= 1.0.2, < 2.0) - cocoapods-downloader (>= 1.2.0, < 2.0) + cocoapods-core (= 1.7.0.beta.1) + cocoapods-deintegrate (>= 1.0.3, < 2.0) + cocoapods-downloader (>= 1.2.2, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) cocoapods-stats (>= 1.0.0, < 2.0) - cocoapods-trunk (>= 1.3.0, < 2.0) + cocoapods-trunk (>= 1.3.1, < 2.0) cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) - fourflusher (~> 2.0.1) + fourflusher (>= 2.2.0, < 3.0) gh_inspector (~> 1.0) - molinillo (~> 0.6.5) + molinillo (~> 0.6.6) nap (~> 1.0) - ruby-macho (~> 1.1) - xcodeproj (>= 1.5.7, < 2.0) - cocoapods-core (1.5.0) + ruby-macho (~> 1.4) + xcodeproj (>= 1.8.1, < 2.0) + cocoapods-core (1.7.0.beta.1) activesupport (>= 4.0.2, < 6) fuzzy_match (~> 2.0.4) nap (~> 1.0) - cocoapods-deintegrate (1.0.2) - cocoapods-downloader (1.2.0) + cocoapods-deintegrate (1.0.3) + cocoapods-downloader (1.2.2) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) - cocoapods-stats (1.0.0) - cocoapods-trunk (1.3.0) + cocoapods-stats (1.1.0) + cocoapods-trunk (1.3.1) nap (>= 0.8, < 2.0) netrc (~> 0.11) cocoapods-try (1.1.0) colored (1.2) colored2 (3.1.2) - concurrent-ruby (1.0.5) + concurrent-ruby (1.1.4) cork (0.2.0) colored (~> 1.2) danger (4.0.4) @@ -71,7 +71,7 @@ GEM multipart-post (>= 1.2, < 3) faraday-http-cache (1.3.1) faraday (~> 0.8) - fourflusher (2.0.1) + fourflusher (2.2.0) fuzzy_match (2.0.4) gh_inspector (1.1.3) git (1.3.0) @@ -79,16 +79,16 @@ GEM concurrent-ruby (~> 1.0) kramdown (1.13.2) minitest (5.11.3) - molinillo (0.6.5) + molinillo (0.6.6) multipart-post (2.0.0) - nanaimo (0.2.5) + nanaimo (0.2.6) nap (1.1.0) netrc (0.11.0) octokit (4.6.2) sawyer (~> 0.8.0, >= 0.5.3) open4 (1.3.4) public_suffix (2.0.5) - ruby-macho (1.1.0) + ruby-macho (1.4.0) sawyer (0.8.1) addressable (>= 2.3.5, < 2.6) faraday (~> 0.8, < 1.0) @@ -98,20 +98,20 @@ GEM tzinfo (1.2.5) thread_safe (~> 0.1) unicode-display_width (1.1.2) - xcodeproj (1.5.7) + xcodeproj (1.8.1) CFPropertyList (>= 2.3.3, < 4.0) - atomos (~> 0.1.2) + atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) - nanaimo (~> 0.2.4) + nanaimo (~> 0.2.6) PLATFORMS ruby DEPENDENCIES - cocoapods (~> 1.5.0) + cocoapods (~> 1.7.0.beta) danger danger-swiftlint BUNDLED WITH - 1.16.1 + 1.17.2 diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package.resolved b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package.resolved index 635972c..9d724da 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package.resolved +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/Quick/Nimble.git", "state": { "branch": null, - "revision": "21f4fed2052cea480f5f1d2044d45aa25fdfb988", - "version": "7.1.1" + "revision": "a27c5186ce2d65f60d1237660b2509df3eb29023", + "version": "8.0.0" } } ] diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package.swift index 07b93b4..419d663 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package.swift @@ -1,47 +1,40 @@ -// swift-tools-version:3.1 +// swift-tools-version:4.2 -import Foundation import PackageDescription -var isTesting: Bool { - guard let value = ProcessInfo.processInfo.environment["SWIFT_PACKAGE_TEST_Quick"] else { return false } - return NSString(string: value).boolValue -} - -var package = Package( +let package = Package( name: "Quick", + products: [ + .library(name: "Quick", targets: ["Quick"]), + ], + dependencies: [ + .package(url: "https://github.com/Quick/Nimble.git", from: "8.0.0"), + ], targets: { + var targets: [Target] = [ + .testTarget( + name: "QuickTests", + dependencies: [ "Quick", "Nimble" ], + exclude: [ + "QuickAfterSuiteTests/AfterSuiteTests+ObjC.m", + "QuickFocusedTests/FocusedTests+ObjC.m", + "QuickTests/FunctionalTests/ObjC", + "QuickTests/Helpers", + "QuickTests/QuickConfigurationTests.m", + ] + ), + ] #if os(macOS) - return [ - Target(name: "QuickSpecBase"), - Target(name: "Quick", dependencies: [ "QuickSpecBase" ]), - Target(name: "QuickTests", dependencies: [ "Quick" ]), - ] + targets.append(contentsOf: [ + .target(name: "QuickSpecBase", dependencies: []), + .target(name: "Quick", dependencies: [ "QuickSpecBase" ]), + ]) #else - return [ - Target(name: "Quick"), - Target(name: "QuickTests", dependencies: [ "Quick" ]), - ] + targets.append(contentsOf: [ + .target(name: "Quick", dependencies: []), + ]) #endif + return targets }(), - exclude: { - var excludes = [ - "Sources/QuickObjectiveC", - "Tests/QuickTests/QuickAfterSuiteTests/AfterSuiteTests+ObjC.m", - "Tests/QuickTests/QuickFocusedTests/FocusedTests+ObjC.m", - "Tests/QuickTests/QuickTests/FunctionalTests/ObjC", - "Tests/QuickTests/QuickTests/Helpers", - "Tests/QuickTests/QuickTests/QuickConfigurationTests.m", - ] -#if !os(macOS) - excludes.append("Sources/QuickSpecBase") -#endif - return excludes - }() + swiftLanguageVersions: [.v4_2] ) - -if isTesting { - package.dependencies.append(contentsOf: [ - .Package(url: "https://github.com/Quick/Nimble.git", majorVersion: 7), - ]) -} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package@swift-4.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package@swift-4.swift deleted file mode 100644 index 7f230fd..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package@swift-4.swift +++ /dev/null @@ -1,40 +0,0 @@ -// swift-tools-version:4.0 - -import PackageDescription - -let package = Package( - name: "Quick", - products: [ - .library(name: "Quick", targets: ["Quick"]), - ], - dependencies: [ - .package(url: "https://github.com/Quick/Nimble.git", from: "7.0.1"), - ], - targets: { - var targets: [Target] = [ - .testTarget( - name: "QuickTests", - dependencies: [ "Quick", "Nimble" ], - exclude: [ - "QuickAfterSuiteTests/AfterSuiteTests+ObjC.m", - "QuickFocusedTests/FocusedTests+ObjC.m", - "QuickTests/FunctionalTests/ObjC", - "QuickTests/Helpers", - "QuickTests/QuickConfigurationTests.m", - ] - ), - ] -#if os(macOS) - targets.append(contentsOf: [ - .target(name: "QuickSpecBase", dependencies: []), - .target(name: "Quick", dependencies: [ "QuickSpecBase" ]), - ]) -#else - targets.append(contentsOf: [ - .target(name: "Quick", dependencies: []), - ]) -#endif - return targets - }(), - swiftLanguageVersions: [3] -) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Objective-C/___FILEBASENAME___.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Objective-C/___FILEBASENAME___.h index b934bcb..7b63eb5 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Objective-C/___FILEBASENAME___.h +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Objective-C/___FILEBASENAME___.h @@ -3,7 +3,7 @@ // ___PROJECTNAME___ // // Created by ___FULLUSERNAME___ on ___DATE___. -//___COPYRIGHT___ +// ___COPYRIGHT___ // @import Quick; diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Objective-C/___FILEBASENAME___.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Objective-C/___FILEBASENAME___.m index cd3f486..61e7d24 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Objective-C/___FILEBASENAME___.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Objective-C/___FILEBASENAME___.m @@ -3,7 +3,7 @@ // ___PROJECTNAME___ // // Created by ___FULLUSERNAME___ on ___DATE___. -//___COPYRIGHT___ +// ___COPYRIGHT___ // #import "___FILEBASENAMEASIDENTIFIER___.h" diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Swift/___FILEBASENAME___.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Swift/___FILEBASENAME___.swift index ae0acbb..67b9f64 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Swift/___FILEBASENAME___.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick Templates/Quick Configuration Class.xctemplate/Swift/___FILEBASENAME___.swift @@ -3,7 +3,7 @@ // ___PROJECTNAME___ // // Created by ___FULLUSERNAME___ on ___DATE___. -//___COPYRIGHT___ +// ___COPYRIGHT___ // import Quick diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick Templates/Quick Spec Class.xctemplate/Objective-C/___FILEBASENAME___.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick Templates/Quick Spec Class.xctemplate/Objective-C/___FILEBASENAME___.m index 3e8da5b..31443f2 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick Templates/Quick Spec Class.xctemplate/Objective-C/___FILEBASENAME___.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick Templates/Quick Spec Class.xctemplate/Objective-C/___FILEBASENAME___.m @@ -3,7 +3,7 @@ // ___PROJECTNAME___ // // Created by ___FULLUSERNAME___ on ___DATE___. -//___COPYRIGHT___ +// ___COPYRIGHT___ // #import diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick Templates/Quick Spec Class.xctemplate/Swift/___FILEBASENAME___.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick Templates/Quick Spec Class.xctemplate/Swift/___FILEBASENAME___.swift index a8371cf..63c1cfc 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick Templates/Quick Spec Class.xctemplate/Swift/___FILEBASENAME___.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick Templates/Quick Spec Class.xctemplate/Swift/___FILEBASENAME___.swift @@ -3,7 +3,7 @@ // ___PROJECTNAME___ // // Created by ___FULLUSERNAME___ on ___DATE___. -//___COPYRIGHT___ +// ___COPYRIGHT___ // import Quick diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick.podspec b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick.podspec index f268407..4565831 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick.podspec +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Quick" - s.version = "1.3.0" + s.version = "2.0.0" s.summary = "The Swift (and Objective-C) testing framework." s.description = <<-DESC @@ -12,7 +12,7 @@ Pod::Spec.new do |s| s.author = "Quick Contributors" s.ios.deployment_target = "7.0" - s.osx.deployment_target = "10.9" + s.osx.deployment_target = "10.10" s.tvos.deployment_target = '9.0' s.source = { :git => "https://github.com/Quick/Quick.git", :tag => "v#{s.version}" } @@ -34,5 +34,12 @@ Pod::Spec.new do |s| s.framework = "XCTest" s.requires_arc = true s.user_target_xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '$(PLATFORM_DIR)/Developer/Library/Frameworks' } - s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'NO' } + s.pod_target_xcconfig = { + 'APPLICATION_EXTENSION_API_ONLY' => 'YES', + 'ENABLE_BITCODE' => 'NO', + 'OTHER_LDFLAGS' => '$(inherited) -Xlinker -no_application_extension', + } + + s.cocoapods_version = '>= 1.4.0' + s.swift_version = '4.2' end diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick.xcodeproj/project.pbxproj b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick.xcodeproj/project.pbxproj index b8e2e96..931b615 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick.xcodeproj/project.pbxproj +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick.xcodeproj/project.pbxproj @@ -62,8 +62,6 @@ 1F118D231BDCA556005013A2 /* SharedExamples+BeforeEachTests+ObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = 4748E8931A6AEBB3009EC992 /* SharedExamples+BeforeEachTests+ObjC.m */; }; 1F118D241BDCA561005013A2 /* FocusedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9876BF1A4C87200004AA17 /* FocusedTests.swift */; }; 1F118D251BDCA561005013A2 /* FocusedTests+ObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = DAF28BC21A4DB8EC00A5D9BF /* FocusedTests+ObjC.m */; }; - 1F118D261BDCA5AF005013A2 /* World+DSL.h in Headers */ = {isa = PBXBuildFile; fileRef = DAED1EC81B110699006F61EC /* World+DSL.h */; }; - 1F118D271BDCA5AF005013A2 /* World.h in Headers */ = {isa = PBXBuildFile; fileRef = DAED1EC21B1105BC006F61EC /* World.h */; }; 1F118D291BDCA5B6005013A2 /* QuickConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = DAE714FC19FF6A62005905B8 /* QuickConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1F118D2A1BDCA5B6005013A2 /* QCKDSL.h in Headers */ = {isa = PBXBuildFile; fileRef = DA3124E319FCAEE8002858A7 /* QCKDSL.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1F118D2B1BDCA5B6005013A2 /* Quick.h in Headers */ = {isa = PBXBuildFile; fileRef = DAEB6B931943873100289F44 /* Quick.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -130,12 +128,6 @@ 8D010A571C11726F00633E2B /* DescribeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D010A561C11726F00633E2B /* DescribeTests.swift */; }; 8D010A581C11726F00633E2B /* DescribeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D010A561C11726F00633E2B /* DescribeTests.swift */; }; 8D010A591C11726F00633E2B /* DescribeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D010A561C11726F00633E2B /* DescribeTests.swift */; }; - 96327C631C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.h in Headers */ = {isa = PBXBuildFile; fileRef = 96327C611C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.h */; }; - 96327C641C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.h in Headers */ = {isa = PBXBuildFile; fileRef = 96327C611C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.h */; }; - 96327C651C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.h in Headers */ = {isa = PBXBuildFile; fileRef = 96327C611C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.h */; }; - 96327C661C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m in Sources */ = {isa = PBXBuildFile; fileRef = 96327C621C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m */; }; - 96327C671C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m in Sources */ = {isa = PBXBuildFile; fileRef = 96327C621C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m */; }; - 96327C681C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m in Sources */ = {isa = PBXBuildFile; fileRef = 96327C621C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m */; }; AE4E58131C73097A00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */ = {isa = PBXBuildFile; fileRef = AEB080BB1C72F028004917D3 /* XCTestObservationCenter+QCKSuspendObservation.m */; }; AE4E58141C73097A00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */ = {isa = PBXBuildFile; fileRef = AEB080BB1C72F028004917D3 /* XCTestObservationCenter+QCKSuspendObservation.m */; }; AE4E58151C73097C00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */ = {isa = PBXBuildFile; fileRef = AEB080BB1C72F028004917D3 /* XCTestObservationCenter+QCKSuspendObservation.m */; }; @@ -146,6 +138,9 @@ AED9C8641CC8A7BD00432F62 /* CrossReferencingSpecs.swift in Sources */ = {isa = PBXBuildFile; fileRef = AED9C8621CC8A7BD00432F62 /* CrossReferencingSpecs.swift */; }; AED9C8651CC8A7BD00432F62 /* CrossReferencingSpecs.swift in Sources */ = {isa = PBXBuildFile; fileRef = AED9C8621CC8A7BD00432F62 /* CrossReferencingSpecs.swift */; }; CD264DBD1DDA147A0038B0EB /* AfterSuiteTests+ObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = 64076D241D6D80B500E2B499 /* AfterSuiteTests+ObjC.m */; }; + CD564DA020B5B09C00C15E6B /* QuickSpec+QuickSpec_MethodList.m in Sources */ = {isa = PBXBuildFile; fileRef = 96327C621C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m */; }; + CD564DA120B5B09D00C15E6B /* QuickSpec+QuickSpec_MethodList.m in Sources */ = {isa = PBXBuildFile; fileRef = 96327C621C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m */; }; + CD564DA220B5B09E00C15E6B /* QuickSpec+QuickSpec_MethodList.m in Sources */ = {isa = PBXBuildFile; fileRef = 96327C621C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m */; }; CE175D4E1E8D6B4900EB5E84 /* Behavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE175D4D1E8D6B4900EB5E84 /* Behavior.swift */; }; CE175D4F1E8D6B4900EB5E84 /* Behavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE175D4D1E8D6B4900EB5E84 /* Behavior.swift */; }; CE175D501E8D6B4900EB5E84 /* Behavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE175D4D1E8D6B4900EB5E84 /* Behavior.swift */; }; @@ -240,10 +235,6 @@ DAE7150119FF6A62005905B8 /* QuickConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = DAE714FD19FF6A62005905B8 /* QuickConfiguration.m */; }; DAEB6B941943873100289F44 /* Quick.h in Headers */ = {isa = PBXBuildFile; fileRef = DAEB6B931943873100289F44 /* Quick.h */; settings = {ATTRIBUTES = (Public, ); }; }; DAEB6B9A1943873100289F44 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAEB6B8E1943873100289F44 /* Quick.framework */; }; - DAED1EC41B1105BC006F61EC /* World.h in Headers */ = {isa = PBXBuildFile; fileRef = DAED1EC21B1105BC006F61EC /* World.h */; }; - DAED1EC51B1105BC006F61EC /* World.h in Headers */ = {isa = PBXBuildFile; fileRef = DAED1EC21B1105BC006F61EC /* World.h */; }; - DAED1ECA1B110699006F61EC /* World+DSL.h in Headers */ = {isa = PBXBuildFile; fileRef = DAED1EC81B110699006F61EC /* World+DSL.h */; }; - DAED1ECB1B110699006F61EC /* World+DSL.h in Headers */ = {isa = PBXBuildFile; fileRef = DAED1EC81B110699006F61EC /* World+DSL.h */; }; DAF28BC31A4DB8EC00A5D9BF /* FocusedTests+ObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = DAF28BC21A4DB8EC00A5D9BF /* FocusedTests+ObjC.m */; }; DAF28BC41A4DB8EC00A5D9BF /* FocusedTests+ObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = DAF28BC21A4DB8EC00A5D9BF /* FocusedTests+ObjC.m */; }; DED3036B1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED3036A1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift */; }; @@ -561,8 +552,6 @@ DAEB6B931943873100289F44 /* Quick.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Quick.h; sourceTree = ""; }; DAEB6B991943873100289F44 /* Quick - macOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Quick - macOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; DAEB6B9F1943873100289F44 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - DAED1EC21B1105BC006F61EC /* World.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = World.h; sourceTree = ""; }; - DAED1EC81B110699006F61EC /* World+DSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "World+DSL.h"; sourceTree = ""; }; DAF28BC21A4DB8EC00A5D9BF /* FocusedTests+ObjC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "FocusedTests+ObjC.m"; sourceTree = ""; }; DED3036A1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSString+C99ExtendedIdentifier.swift"; sourceTree = ""; }; DED3037C1DF6CF140041394E /* BundleModuleNameTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BundleModuleNameTests.swift; sourceTree = ""; }; @@ -700,7 +689,6 @@ 6C3983EF1D1E93B700637469 /* Configuration */, 6C3983F01D1E93CE00637469 /* DSL */, DAEB6B931943873100289F44 /* Quick.h */, - DAED1EC21B1105BC006F61EC /* World.h */, 34F375A419515CA700CE1B99 /* QuickSpec.h */, 34F375A519515CA700CE1B99 /* QuickSpec.m */, CE57CEDC1C430BD200D63004 /* XCTestSuite+QuickTestSuiteBuilder.m */, @@ -721,7 +709,6 @@ 6C3983F01D1E93CE00637469 /* DSL */ = { isa = PBXGroup; children = ( - DAED1EC81B110699006F61EC /* World+DSL.h */, DA3124E319FCAEE8002858A7 /* QCKDSL.h */, DA3124E419FCAEE8002858A7 /* QCKDSL.m */, ); @@ -972,9 +959,6 @@ buildActionMask = 2147483647; files = ( 1F118D2B1BDCA5B6005013A2 /* Quick.h in Headers */, - 1F118D261BDCA5AF005013A2 /* World+DSL.h in Headers */, - 96327C651C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.h in Headers */, - 1F118D271BDCA5AF005013A2 /* World.h in Headers */, 1F118D2A1BDCA5B6005013A2 /* QCKDSL.h in Headers */, 1F118D2C1BDCA5B6005013A2 /* QuickSpec.h in Headers */, 1F118D291BDCA5B6005013A2 /* QuickConfiguration.h in Headers */, @@ -986,10 +970,7 @@ buildActionMask = 2147483647; files = ( DAE714FF19FF6A62005905B8 /* QuickConfiguration.h in Headers */, - 96327C641C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.h in Headers */, DA3124E919FCAEE8002858A7 /* QCKDSL.h in Headers */, - DAED1ECB1B110699006F61EC /* World+DSL.h in Headers */, - DAED1EC51B1105BC006F61EC /* World.h in Headers */, 34F375B819515CA700CE1B99 /* QuickSpec.h in Headers */, 5A5D11A7194740E000F6D13D /* Quick.h in Headers */, ); @@ -1000,10 +981,7 @@ buildActionMask = 2147483647; files = ( DAE714FE19FF6A62005905B8 /* QuickConfiguration.h in Headers */, - 96327C631C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.h in Headers */, DA3124E819FCAEE8002858A7 /* QCKDSL.h in Headers */, - DAED1ECA1B110699006F61EC /* World+DSL.h in Headers */, - DAED1EC41B1105BC006F61EC /* World.h in Headers */, 34F375B719515CA700CE1B99 /* QuickSpec.h in Headers */, DAEB6B941943873100289F44 /* Quick.h in Headers */, ); @@ -1016,9 +994,9 @@ isa = PBXNativeTarget; buildConfigurationList = 1F118CE61BDCA4AB005013A2 /* Build configuration list for PBXNativeTarget "Quick-tvOS" */; buildPhases = ( + 1F118CD21BDCA4AB005013A2 /* Headers */, 1F118CD01BDCA4AB005013A2 /* Sources */, 1F118CD11BDCA4AB005013A2 /* Frameworks */, - 1F118CD21BDCA4AB005013A2 /* Headers */, 1F118CD31BDCA4AB005013A2 /* Resources */, ); buildRules = ( @@ -1070,9 +1048,9 @@ isa = PBXNativeTarget; buildConfigurationList = 5A5D119319473F2100F6D13D /* Build configuration list for PBXNativeTarget "Quick-iOS" */; buildPhases = ( + 5A5D117919473F2100F6D13D /* Headers */, 5A5D117719473F2100F6D13D /* Sources */, 5A5D117819473F2100F6D13D /* Frameworks */, - 5A5D117919473F2100F6D13D /* Headers */, 5A5D117A19473F2100F6D13D /* Resources */, ); buildRules = ( @@ -1206,9 +1184,9 @@ isa = PBXNativeTarget; buildConfigurationList = DAEB6BA41943873200289F44 /* Build configuration list for PBXNativeTarget "Quick-macOS" */; buildPhases = ( + DAEB6B8B1943873100289F44 /* Headers */, DAEB6B891943873100289F44 /* Sources */, DAEB6B8A1943873100289F44 /* Frameworks */, - DAEB6B8B1943873100289F44 /* Headers */, DAEB6B8C1943873100289F44 /* Resources */, ); buildRules = ( @@ -1441,7 +1419,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 96327C681C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m in Sources */, 1F118D031BDCA536005013A2 /* World.swift in Sources */, CE590E201C431FE400253D19 /* QuickSelectedTestSuiteBuilder.swift in Sources */, 1F118CFC1BDCA536005013A2 /* Configuration.swift in Sources */, @@ -1497,6 +1474,7 @@ 1F118D201BDCA556005013A2 /* SharedExamplesTests.swift in Sources */, 1F118D0C1BDCA543005013A2 /* QuickConfigurationTests.m in Sources */, 1F118D391BDCA6E6005013A2 /* Configuration+BeforeEach.swift in Sources */, + CD564DA220B5B09E00C15E6B /* QuickSpec+QuickSpec_MethodList.m in Sources */, 1F118D181BDCA556005013A2 /* AfterEachTests.swift in Sources */, 1F118D1B1BDCA556005013A2 /* PendingTests+ObjC.m in Sources */, 34C586051C4ABD4100D4F057 /* XCTestCaseProvider.swift in Sources */, @@ -1524,7 +1502,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 96327C671C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m in Sources */, CE590E1B1C431FE300253D19 /* QuickSelectedTestSuiteBuilder.swift in Sources */, DA3124EB19FCAEE8002858A7 /* QCKDSL.m in Sources */, DA408BE319FF5599005DF92A /* Closures.swift in Sources */, @@ -1580,6 +1557,7 @@ 471590411A488F3F00FBA644 /* PendingTests+ObjC.m in Sources */, DA8F919E19F31921006F6675 /* FailureTests+ObjC.m in Sources */, DAE714F419FF65E7005905B8 /* Configuration+BeforeEach.swift in Sources */, + CD564DA120B5B09D00C15E6B /* QuickSpec+QuickSpec_MethodList.m in Sources */, 479C31E41A36172700DA8718 /* ItTests+ObjC.m in Sources */, 34C586031C4ABD4000D4F057 /* XCTestCaseProvider.swift in Sources */, 8D010A581C11726F00633E2B /* DescribeTests.swift in Sources */, @@ -1646,7 +1624,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 96327C661C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m in Sources */, CE57CEDE1C430BD200D63004 /* QuickSelectedTestSuiteBuilder.swift in Sources */, DA3124EA19FCAEE8002858A7 /* QCKDSL.m in Sources */, DA408BE219FF5599005DF92A /* Closures.swift in Sources */, @@ -1702,6 +1679,7 @@ 471590401A488F3F00FBA644 /* PendingTests+ObjC.m in Sources */, DA8F919D19F31921006F6675 /* FailureTests+ObjC.m in Sources */, DAE714F319FF65E7005905B8 /* Configuration+BeforeEach.swift in Sources */, + CD564DA020B5B09C00C15E6B /* QuickSpec+QuickSpec_MethodList.m in Sources */, 479C31E31A36171B00DA8718 /* ItTests+ObjC.m in Sources */, 34C586011C4ABD3F00D4F057 /* XCTestCaseProvider.swift in Sources */, 8D010A571C11726F00633E2B /* DescribeTests.swift in Sources */, @@ -1877,6 +1855,7 @@ 1F118CE71BDCA4AB005013A2 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -1892,6 +1871,11 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; + OTHER_LDFLAGS = ( + "$(inherited)", + "-Xlinker", + "-no_application_extension", + ); PRODUCT_BUNDLE_IDENTIFIER = "io.quick.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = Quick; SDKROOT = appletvos; @@ -1904,6 +1888,7 @@ 1F118CE81BDCA4AB005013A2 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; COPY_PHASE_STRIP = NO; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -1919,6 +1904,11 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ( + "$(inherited)", + "-Xlinker", + "-no_application_extension", + ); PRODUCT_BUNDLE_IDENTIFIER = "io.quick.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = Quick; SDKROOT = appletvos; @@ -2017,7 +2007,7 @@ 5A5D118F19473F2100F6D13D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - APPLICATION_EXTENSION_API_ONLY = NO; + APPLICATION_EXTENSION_API_ONLY = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -2037,6 +2027,11 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = NO; + OTHER_LDFLAGS = ( + "$(inherited)", + "-Xlinker", + "-no_application_extension", + ); PRODUCT_BUNDLE_IDENTIFIER = "io.quick.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Quick; PRODUCT_NAME = Quick; @@ -2051,7 +2046,7 @@ 5A5D119019473F2100F6D13D /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - APPLICATION_EXTENSION_API_ONLY = NO; + APPLICATION_EXTENSION_API_ONLY = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -2066,6 +2061,11 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ( + "$(inherited)", + "-Xlinker", + "-no_application_extension", + ); PRODUCT_BUNDLE_IDENTIFIER = "io.quick.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Quick; PRODUCT_NAME = Quick; @@ -2413,13 +2413,13 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -2468,12 +2468,12 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -2482,7 +2482,7 @@ DAEB6BA51943873200289F44 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - APPLICATION_EXTENSION_API_ONLY = NO; + APPLICATION_EXTENSION_API_ONLY = YES; COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -2496,7 +2496,12 @@ INFOPLIST_FILE = Sources/Quick/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; + OTHER_LDFLAGS = ( + "$(inherited)", + "-Xlinker", + "-no_application_extension", + ); PRODUCT_BUNDLE_IDENTIFIER = "io.quick.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Quick; PRODUCT_NAME = Quick; @@ -2509,7 +2514,7 @@ DAEB6BA61943873200289F44 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - APPLICATION_EXTENSION_API_ONLY = NO; + APPLICATION_EXTENSION_API_ONLY = YES; COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -2523,7 +2528,12 @@ INFOPLIST_FILE = Sources/Quick/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; + OTHER_LDFLAGS = ( + "$(inherited)", + "-Xlinker", + "-no_application_extension", + ); PRODUCT_BUNDLE_IDENTIFIER = "io.quick.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Quick; PRODUCT_NAME = Quick; diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..3ddf867 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + BuildSystemType + Latest + + diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/README.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/README.md index e6dc0ad..2cb397f 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/README.md +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/README.md @@ -4,6 +4,7 @@ [![CocoaPods](https://img.shields.io/cocoapods/v/Quick.svg)](https://cocoapods.org/pods/Quick) [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Platforms](https://img.shields.io/cocoapods/p/Quick.svg)](https://cocoapods.org/pods/Quick) +[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com) Quick is a behavior-driven development framework for Swift and Objective-C. Inspired by [RSpec](https://github.com/rspec/rspec), [Specta](https://github.com/specta/specta), and [Ginkgo](https://github.com/onsi/ginkgo). @@ -44,7 +45,8 @@ Certain versions of Quick and Nimble only support certain versions of Swift. Dep |Swift version |Quick version |Nimble version | |:--------------------|:---------------|:--------------| -|Swift 3 |v1.0.0 or later |v5.0.0 or later| +|Swift 4.2 |v1.3.2 or later |v7.3.2 or later| +|Swift 3 / Swift 4 |v1.0.0 or later |v5.0.0 or later| |Swift 2.2 / Swift 2.3|v0.9.3 |v4.1.0 | ## Documentation diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Rakefile b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Rakefile index a5214a4..d98ed39 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Rakefile +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Rakefile @@ -13,30 +13,38 @@ end namespace "podspec" do desc "Run lint for podspec" task :lint do + # To work around the lint error: "ERROR | swift: Specification `Nimble` specifies an inconsistent `swift_version` (`4.0`) compared to the one present in your `.swift-version` file (`4.1`). Please remove the `.swift-version` file which is now deprecated and only use the `swift_version` attribute within your podspec." + # `.swift-version` is for swiftenv, not for CocoaPods, so we can't remove the file as suggested. + run "mv .swift-version .swift-version.backup" run "bundle exec pod lib lint" + run "mv .swift-version.backup .swift-version" end end namespace "test" do desc "Run unit tests for all iOS targets" task :ios do |t| - run "xcodebuild -workspace Quick.xcworkspace -scheme Quick-iOS -destination 'platform=iOS Simulator,name=iPhone 6' clean #{xcode_action}" + run "xcodebuild -workspace Quick.xcworkspace -scheme Quick-iOS -destination 'platform=iOS Simulator,name=iPhone 6' OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' clean #{xcode_action} | xcpretty" end desc "Run unit tests for all tvOS targets" task :tvos do |t| - run "xcodebuild -workspace Quick.xcworkspace -scheme Quick-tvOS -destination 'platform=tvOS Simulator,name=Apple TV 1080p' clean #{xcode_action}" + run "xcodebuild -workspace Quick.xcworkspace -scheme Quick-tvOS -destination 'platform=tvOS Simulator,name=Apple TV' OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' clean #{xcode_action} | xcpretty" end desc "Run unit tests for all macOS targets" task :macos do |t| - run "xcodebuild -workspace Quick.xcworkspace -scheme Quick-macOS clean #{xcode_action}" + run "xcodebuild -workspace Quick.xcworkspace -scheme Quick-macOS OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' clean #{xcode_action} | xcpretty" + end + + desc "Run unit tests for all macOS targets using static linking" + task :macos_static do |t| + run "MACH_O_TYPE=staticlib xcodebuild -workspace Quick.xcworkspace -scheme Quick-macOS OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' clean #{xcode_action} | xcpretty" end desc "Run unit tests for the current platform built by the Swift Package Manager" task :swiftpm do |t| - env = { "SWIFT_PACKAGE_TEST_Quick" => "true" } - run env, "swift package clean && swift test" + run "swift package clean && swift test" end end diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Behavior.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Behavior.swift index 1d98702..7dfefac 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Behavior.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Behavior.swift @@ -4,7 +4,7 @@ open class Behavior { - open static var name: String { return String(describing: self) } + public static var name: String { return String(describing: self) } /** override this method in your behavior to define a set of reusable examples. diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Callsite.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Callsite.swift index f5e3711..951cf93 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Callsite.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Callsite.swift @@ -1,14 +1,8 @@ import Foundation -// `#if swift(>=3.2) && (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE` -// does not work as expected. -#if swift(>=3.2) - #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE - @objcMembers - public class _CallsiteBase: NSObject {} - #else - public class _CallsiteBase: NSObject {} - #endif +#if canImport(Darwin) && !SWIFT_PACKAGE +@objcMembers +public class _CallsiteBase: NSObject {} #else public class _CallsiteBase: NSObject {} #endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Configuration/Configuration.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Configuration/Configuration.swift index dbb95f1..fe33997 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Configuration/Configuration.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Configuration/Configuration.swift @@ -72,7 +72,7 @@ final public class Configuration: NSObject { provided with metadata on the example that the closure is being run prior to. */ -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) @objc(beforeEachWithMetadata:) public func beforeEach(_ closure: @escaping BeforeExampleWithMetadataClosure) { exampleHooks.appendBefore(closure) @@ -109,7 +109,7 @@ final public class Configuration: NSObject { is provided with metadata on the example that the closure is being run after. */ -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) @objc(afterEachWithMetadata:) public func afterEach(_ closure: @escaping AfterExampleWithMetadataClosure) { exampleHooks.appendAfter(closure) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Configuration/QuickConfiguration.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Configuration/QuickConfiguration.swift index 3da6be2..0874f64 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Configuration/QuickConfiguration.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Configuration/QuickConfiguration.swift @@ -10,7 +10,7 @@ open class QuickConfiguration: NSObject { open class func configure(_ configuration: Configuration) {} } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) internal func qck_enumerateSubclasses(_ klass: T.Type, block: (T.Type) -> Void) { var classesCount = objc_getClassList(nil, 0) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/DSL/World+DSL.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/DSL/World+DSL.swift index 5249027..14a46d6 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/DSL/World+DSL.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/DSL/World+DSL.swift @@ -56,7 +56,7 @@ extension World { currentExampleGroup.hooks.appendBefore(closure) } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE @objc(beforeEachWithMetadata:) internal func beforeEach(closure: @escaping BeforeExampleWithMetadataClosure) { currentExampleGroup.hooks.appendBefore(closure) @@ -74,7 +74,7 @@ extension World { currentExampleGroup.hooks.appendAfter(closure) } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE @objc(afterEachWithMetadata:) internal func afterEach(closure: @escaping AfterExampleWithMetadataClosure) { currentExampleGroup.hooks.appendAfter(closure) @@ -85,6 +85,7 @@ extension World { } #endif + @nonobjc internal func it(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { if beforesCurrentlyExecuting { raiseError("'it' cannot be used inside 'beforeEach', 'it' may only be used inside 'context' or 'describe'. ") @@ -100,18 +101,21 @@ extension World { currentExampleGroup.appendExample(example) } + @nonobjc internal func fit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { var focusedFlags = flags focusedFlags[Filter.focused] = true self.it(description, flags: focusedFlags, file: file, line: line, closure: closure) } + @nonobjc internal func xit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { var pendingFlags = flags pendingFlags[Filter.pending] = true self.it(description, flags: pendingFlags, file: file, line: line, closure: closure) } + @nonobjc internal func itBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, flags: FilterFlags, file: String, line: UInt) { guard currentExampleMetadata == nil else { raiseError("'itBehavesLike' cannot be used inside '\(currentPhase)', 'itBehavesLike' may only be used inside 'context' or 'describe'. ") @@ -131,6 +135,7 @@ extension World { } } + @nonobjc internal func fitBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, flags: FilterFlags, file: String, line: UInt) { var focusedFlags = flags focusedFlags[Filter.focused] = true @@ -167,24 +172,24 @@ extension World { self.itBehavesLike(behavior, context: context, flags: pendingFlags, file: file, line: line) } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE @objc(itWithDescription:flags:file:line:closure:) - private func objc_it(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { + internal func objc_it(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { it(description, flags: flags, file: file, line: line, closure: closure) } @objc(fitWithDescription:flags:file:line:closure:) - private func objc_fit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { + internal func objc_fit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { fit(description, flags: flags, file: file, line: line, closure: closure) } @objc(xitWithDescription:flags:file:line:closure:) - private func objc_xit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { + internal func objc_xit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { xit(description, flags: flags, file: file, line: line, closure: closure) } @objc(itBehavesLikeSharedExampleNamed:sharedExampleContext:flags:file:line:) - private func objc_itBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, flags: FilterFlags, file: String, line: UInt) { + internal func objc_itBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, flags: FilterFlags, file: String, line: UInt) { itBehavesLike(name, sharedExampleContext: sharedExampleContext, flags: flags, file: file, line: line) } #endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/ErrorUtility.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/ErrorUtility.swift index 155fefd..f13f43a 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/ErrorUtility.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/ErrorUtility.swift @@ -1,7 +1,7 @@ import Foundation internal func raiseError(_ message: String) -> Never { -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) NSException(name: .internalInconsistencyException, reason: message, userInfo: nil).raise() #endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Example.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Example.swift index c15b31a..594efa0 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Example.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Example.swift @@ -3,15 +3,9 @@ import Foundation private var numberOfExamplesRun = 0 private var numberOfIncludedExamples = 0 -// `#if swift(>=3.2) && (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE` -// does not work as expected. -#if swift(>=3.2) - #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE - @objcMembers - public class _ExampleBase: NSObject {} - #else - public class _ExampleBase: NSObject {} - #endif +#if canImport(Darwin) && !SWIFT_PACKAGE +@objcMembers +public class _ExampleBase: NSObject {} #else public class _ExampleBase: NSObject {} #endif @@ -81,6 +75,9 @@ final public class Example: _ExampleBase { let exampleMetadata = ExampleMetadata(example: self, exampleIndex: numberOfExamplesRun) world.currentExampleMetadata = exampleMetadata + defer { + world.currentExampleMetadata = nil + } world.exampleHooks.executeBefores(exampleMetadata) group!.phase = .beforesExecuting diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/ExampleMetadata.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/ExampleMetadata.swift index 3dd28ab..b07b3bd 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/ExampleMetadata.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/ExampleMetadata.swift @@ -1,14 +1,8 @@ import Foundation -// `#if swift(>=3.2) && (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE` -// does not work as expected. -#if swift(>=3.2) - #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE - @objcMembers - public class _ExampleMetadataBase: NSObject {} - #else - public class _ExampleMetadataBase: NSObject {} - #endif +#if canImport(Darwin) && !SWIFT_PACKAGE +@objcMembers +public class _ExampleMetadataBase: NSObject {} #else public class _ExampleMetadataBase: NSObject {} #endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Filter.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Filter.swift index da137f8..304f6ec 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Filter.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Filter.swift @@ -1,14 +1,8 @@ import Foundation -// `#if swift(>=3.2) && (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE` -// does not work as expected. -#if swift(>=3.2) - #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE - @objcMembers - public class _FilterBase: NSObject {} - #else - public class _FilterBase: NSObject {} - #endif +#if canImport(Darwin) && !SWIFT_PACKAGE +@objcMembers +public class _FilterBase: NSObject {} #else public class _FilterBase: NSObject {} #endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift index d7a1442..ed0cf8e 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift @@ -1,4 +1,4 @@ -#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) +#if canImport(Darwin) import Foundation diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/NSString+C99ExtendedIdentifier.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/NSString+C99ExtendedIdentifier.swift index ef73762..acb650b 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/NSString+C99ExtendedIdentifier.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/NSString+C99ExtendedIdentifier.swift @@ -1,8 +1,7 @@ -#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) +#if canImport(Darwin) import Foundation -public extension NSString { - +extension NSString { private static var invalidCharacters: CharacterSet = { var invalidCharacters = CharacterSet() @@ -22,12 +21,29 @@ public extension NSString { return invalidCharacters }() + /// This API is not meant to be used outside Quick, so will be unavailable in + /// a next major version. @objc(qck_c99ExtendedIdentifier) - var c99ExtendedIdentifier: String { + public var c99ExtendedIdentifier: String { let validComponents = components(separatedBy: NSString.invalidCharacters) let result = validComponents.joined(separator: "_") return result.isEmpty ? "_" : result } } + +/// Extension methods or properties for NSObject subclasses are invisible from +/// the Objective-C runtime on static linking unless the consumers add `-ObjC` +/// linker flag, so let's make a wrapper class to mitigate that situation. +/// +/// See: https://github.com/Quick/Quick/issues/785 and https://github.com/Quick/Quick/pull/803 +@objc +class QCKObjCStringUtils: NSObject { + override private init() {} + + @objc + static func c99ExtendedIdentifier(from string: String) -> String { + return string.c99ExtendedIdentifier + } +} #endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickMain.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickMain.swift index eb9aba5..63e099f 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickMain.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickMain.swift @@ -3,7 +3,7 @@ import XCTest // NOTE: This file is not intended to be included in the Xcode project or CocoaPods. // It is picked up by the Swift Package Manager during its build process. -#if SWIFT_PACKAGE && os(Linux) +#if SWIFT_PACKAGE && !canImport(Darwin) /// When using Quick with swift-corelibs-xctest, automatic discovery of specs and /// configurations is not available. Instead, you should create a standalone @@ -32,7 +32,7 @@ public func QCKMain(_ specs: [QuickSpec.Type], } world.finalizeConfiguration() - XCTMain(specs.flatMap { testCase($0.allTests) } + testCases) + XCTMain(specs.compactMap { testCase($0.allTests) } + testCases) } #endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickSelectedTestSuiteBuilder.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickSelectedTestSuiteBuilder.swift index 415b680..865c3ae 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickSelectedTestSuiteBuilder.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickSelectedTestSuiteBuilder.swift @@ -1,4 +1,4 @@ -#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) +#if canImport(Darwin) import Foundation /** diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickSpec.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickSpec.swift index 12845d8..62e50d4 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickSpec.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickSpec.swift @@ -5,7 +5,7 @@ import XCTest #if SWIFT_PACKAGE -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) import QuickSpecBase public typealias QuickSpecBase = _QuickSpecBase @@ -16,7 +16,7 @@ public typealias QuickSpecBase = XCTestCase open class QuickSpec: QuickSpecBase { open func spec() {} -#if !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) +#if !canImport(Darwin) public required init() { super.init(name: "", testClosure: { _ in }) } @@ -37,19 +37,11 @@ open class QuickSpec: QuickSpecBase { /// SwiftPM on macOS does not have the mechanism (test cases are automatically /// discovered powered by Objective-C runtime), so we needed the alternative /// way. - #if swift(>=4) override open class var defaultTestSuite: XCTestSuite { configureDefaultTestSuite() return super.defaultTestSuite } - #else - override open class func defaultTestSuite() -> XCTestSuite { - configureDefaultTestSuite() - - return super.defaultTestSuite() - } - #endif private static func configureDefaultTestSuite() { let world = World.sharedWorld diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickTestSuite.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickTestSuite.swift index 0fe76a7..5cdc6d8 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickTestSuite.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickTestSuite.swift @@ -1,4 +1,4 @@ -#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) +#if canImport(Darwin) import XCTest diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/World.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/World.swift index 127239a..e652871 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/World.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/World.swift @@ -12,15 +12,9 @@ public typealias SharedExampleContext = () -> [String: Any] */ public typealias SharedExampleClosure = (@escaping SharedExampleContext) -> Void -// `#if swift(>=3.2) && (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE` -// does not work as expected. -#if swift(>=3.2) - #if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE - @objcMembers - internal class _WorldBase: NSObject {} - #else - internal class _WorldBase: NSObject {} - #endif +#if canImport(Darwin) && !SWIFT_PACKAGE +@objcMembers +internal class _WorldBase: NSObject {} #else internal class _WorldBase: NSObject {} #endif @@ -57,7 +51,7 @@ final internal class World: _WorldBase { within this test suite. This is only true within the context of Quick functional tests. */ -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) // Convention of generating Objective-C selector has been changed on Swift 3 @objc(isRunningAdditionalSuites) internal var isRunningAdditionalSuites = false @@ -158,9 +152,9 @@ final internal class World: _WorldBase { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) @objc(examplesForSpecClass:) - private func objc_examples(_ specClass: AnyClass) -> [Example] { + internal func objc_examples(_ specClass: AnyClass) -> [Example] { return examples(specClass) } #endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.m index 937b818..17beaa7 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.m @@ -1,7 +1,12 @@ #import "QuickConfiguration.h" -#import "World.h" #import +#if __has_include("Quick-Swift.h") +#import "Quick-Swift.h" +#else +#import +#endif + typedef void (^QCKClassEnumerationBlock)(Class klass); /** diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/DSL/QCKDSL.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/DSL/QCKDSL.m index 10e8a3d..624832e 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/DSL/QCKDSL.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/DSL/QCKDSL.m @@ -1,6 +1,10 @@ #import "QCKDSL.h" -#import "World.h" -#import "World+DSL.h" + +#if __has_include("Quick-Swift.h") +#import "Quick-Swift.h" +#else +#import +#endif void qck_beforeSuite(QCKDSLEmptyBlock closure) { [[World sharedWorld] beforeSuite:closure]; diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/DSL/World+DSL.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/DSL/World+DSL.h deleted file mode 100644 index 9f528ec..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/DSL/World+DSL.h +++ /dev/null @@ -1,24 +0,0 @@ -#if __has_include("Quick-Swift.h") -#import "Quick-Swift.h" -#else -#import -#endif - -@interface World (SWIFT_EXTENSION(Quick)) -- (void)beforeSuite:(void (^ __nonnull)(void))closure; -- (void)afterSuite:(void (^ __nonnull)(void))closure; -- (void)sharedExamples:(NSString * __nonnull)name closure:(void (^ __nonnull)(NSDictionary * __nonnull (^ __nonnull)(void)))closure; -- (void)describe:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags closure:(void (^ __nonnull)(void))closure; -- (void)context:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags closure:(void (^ __nonnull)(void))closure; -- (void)fdescribe:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags closure:(void (^ __nonnull)(void))closure; -- (void)xdescribe:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags closure:(void (^ __nonnull)(void))closure; -- (void)beforeEach:(void (^ __nonnull)(void))closure; -- (void)beforeEachWithMetadata:(void (^ __nonnull)(ExampleMetadata * __nonnull))closure; -- (void)afterEach:(void (^ __nonnull)(void))closure; -- (void)afterEachWithMetadata:(void (^ __nonnull)(ExampleMetadata * __nonnull))closure; -- (void)itWithDescription:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags file:(NSString * __nonnull)file line:(NSUInteger)line closure:(void (^ __nonnull)(void))closure; -- (void)fitWithDescription:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags file:(NSString * __nonnull)file line:(NSUInteger)line closure:(void (^ __nonnull)(void))closure; -- (void)xitWithDescription:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags file:(NSString * __nonnull)file line:(NSUInteger)line closure:(void (^ __nonnull)(void))closure; -- (void)itBehavesLikeSharedExampleNamed:(NSString * __nonnull)name sharedExampleContext:(NSDictionary * __nonnull (^ __nonnull)(void))sharedExampleContext flags:(NSDictionary * __nonnull)flags file:(NSString * __nonnull)file line:(NSUInteger)line; -- (void)pending:(NSString * __nonnull)description closure:(void (^ __nonnull)(void))closure; -@end diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/QuickSpec.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/QuickSpec.m index 4d5d37b..ed70d35 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/QuickSpec.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/QuickSpec.m @@ -1,6 +1,6 @@ #import "QuickSpec.h" #import "QuickConfiguration.h" -#import "World.h" + #if __has_include("Quick-Swift.h") #import "Quick-Swift.h" #else @@ -109,8 +109,8 @@ static QuickSpec *currentSpec = nil; }); const char *types = [[NSString stringWithFormat:@"%s%s%s", @encode(void), @encode(id), @encode(SEL)] UTF8String]; - - NSString *originalName = example.name.qck_c99ExtendedIdentifier; + + NSString *originalName = [QCKObjCStringUtils c99ExtendedIdentifierFrom:example.name]; NSString *selectorName = originalName; NSUInteger i = 2; diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/World.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/World.h deleted file mode 100644 index 8cfed06..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/World.h +++ /dev/null @@ -1,22 +0,0 @@ -#if __has_include("Quick-Swift.h") -#import "Quick-Swift.h" -#else -#import -#endif - -@class ExampleGroup; -@class ExampleMetadata; - -SWIFT_CLASS("_TtC5Quick5World") -@interface World - -@property (nonatomic) ExampleGroup * __nullable currentExampleGroup; -@property (nonatomic) ExampleMetadata * __nullable currentExampleMetadata; -@property (nonatomic) BOOL isRunningAdditionalSuites; -+ (World * __nonnull)sharedWorld; -- (void)configure:(void (^ __nonnull)(Configuration * __nonnull))closure; -- (void)finalizeConfiguration; -- (ExampleGroup * __nonnull)rootExampleGroupForSpecClass:(Class __nonnull)cls; -- (NSArray * __nonnull)examplesForSpecClass:(Class __nonnull)specClass; -- (void)performWithCurrentExampleGroup:(ExampleGroup * __nonnull)group closure:(void (^ __nonnull)(void))closure; -@end diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/XCTestSuite+QuickTestSuiteBuilder.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/XCTestSuite+QuickTestSuiteBuilder.m index e39ed69..ae63036 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/XCTestSuite+QuickTestSuiteBuilder.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/XCTestSuite+QuickTestSuiteBuilder.m @@ -1,5 +1,6 @@ #import #import + #if __has_include("Quick-Swift.h") #import "Quick-Swift.h" #else diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/XCTestCaseProvider.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/XCTestCaseProvider.swift index 304eb30..05b0196 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/XCTestCaseProvider.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/XCTestCaseProvider.swift @@ -30,7 +30,7 @@ public extension XCTestCaseProvider where Self: XCTestCaseProviderStatic { } } -#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) +#if canImport(Darwin) extension XCTestCase { override open func tearDown() { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/AfterEachTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/AfterEachTests.swift index 45f6203..f6b6777 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/AfterEachTests.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/AfterEachTests.swift @@ -50,7 +50,7 @@ class FunctionalTests_AfterEachSpec: QuickSpec { afterEach { afterEachOrder.append(.noExamples) } } } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE describe("error handling when misusing ordering") { it("should throw an exception when including afterEach in it block") { expect { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/BeforeEachTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/BeforeEachTests.swift index 6709051..17b222e 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/BeforeEachTests.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/BeforeEachTests.swift @@ -35,7 +35,7 @@ class FunctionalTests_BeforeEachSpec: QuickSpec { beforeEach { beforeEachOrder.append(.noExamples) } } } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE describe("error handling when misusing ordering") { it("should throw an exception when including beforeEach in it block") { expect { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/BehaviorTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/BehaviorTests.swift index 21dadfe..54bcb42 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/BehaviorTests.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/BehaviorTests.swift @@ -17,7 +17,7 @@ class FunctionalTests_BehaviorTests_ContextSpec: QuickSpec { } } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE class FunctionalTests_BehaviorTests_ErrorSpec: QuickSpec { override func spec() { describe("error handling when misusing ordering") { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ContextTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ContextTests.swift index ab619be..eb6c03a 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ContextTests.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ContextTests.swift @@ -2,7 +2,7 @@ import XCTest import Quick import Nimble -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE class QuickContextTests: QuickSpec { override func spec() { describe("Context") { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/DescribeTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/DescribeTests.swift index 6c4ac07..a923f4d 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/DescribeTests.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/DescribeTests.swift @@ -2,7 +2,7 @@ import XCTest import Nimble import Quick -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE final class DescribeTests: XCTestCase, XCTestCaseProvider { static var allTests: [(String, (DescribeTests) -> () throws -> Void)] { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ItTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ItTests.swift index 106cf30..3016401 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ItTests.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ItTests.swift @@ -16,7 +16,7 @@ class FunctionalTests_ItSpec: QuickSpec { expect(exampleMetadata!.example.name).to(equal(name)) } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE describe("when an example has a unique name") { it("has a unique name") {} @@ -113,7 +113,7 @@ final class ItTests: XCTestCase, XCTestCaseProvider { ] } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE func testAllExamplesAreExecuted() { let result = qck_runSpec(FunctionalTests_ItSpec.self) XCTAssertEqual(result?.executionCount, 10) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/SharedExamplesTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/SharedExamplesTests.swift index 8a50cc1..f75f524 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/SharedExamplesTests.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/SharedExamplesTests.swift @@ -15,7 +15,7 @@ class FunctionalTests_SharedExamples_ContextSpec: QuickSpec { } } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE class FunctionalTests_SharedExamples_ErrorSpec: QuickSpec { override func spec() { describe("error handling when misusing ordering") { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QCKSpecRunner.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QCKSpecRunner.m index a2aa78c..a3437a1 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QCKSpecRunner.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QCKSpecRunner.m @@ -2,7 +2,6 @@ #import "QCKSpecRunner.h" #import "XCTestObservationCenter+QCKSuspendObservation.h" -#import "World.h" @interface XCTest (Redeclaration) - (XCTestRun *)run; diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+QuickSpec_MethodList.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+QuickSpec_MethodList.h index 99e20f8..5e5c447 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+QuickSpec_MethodList.h +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+QuickSpec_MethodList.h @@ -4,7 +4,13 @@ NS_ASSUME_NONNULL_BEGIN @interface QuickSpec (QuickSpec_MethodList) -+ (NSSet *)allSelectors; +/** + * This method will instantiate an instance of the class on which it is called, + * returning a list of selector names for it. + * + * @return a set of NSStrings representing the list of selectors it contains + */ ++ (NSSet *)allSelectors; @end diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+QuickSpec_MethodList.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+QuickSpec_MethodList.m index c648bd1..5a403f2 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+QuickSpec_MethodList.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+QuickSpec_MethodList.m @@ -4,27 +4,19 @@ @implementation QuickSpec (QuickSpec_MethodList) -/** - * This method will instantiate an instance of the class on which it is called, - * returning a list of selector names for it. - * - * @warning Only intended to be used in test assertions! - * - * @return a set of NSStrings representing the list of selectors it contains - */ + (NSSet *)allSelectors { QuickSpec *specInstance = [[[self class] alloc] init]; - NSMutableSet *allSelectors = [NSMutableSet set]; + NSMutableSet *allSelectors = [NSMutableSet set]; unsigned int methodCount = 0; - Method *mlist = class_copyMethodList(object_getClass(specInstance), &methodCount); + Method *methodList = class_copyMethodList(object_getClass(specInstance), &methodCount); - for(unsigned int i = 0; i < methodCount; i++) { - SEL selector = method_getName(mlist[i]); + for (unsigned int i = 0; i < methodCount; i++) { + SEL selector = method_getName(methodList[i]); [allSelectors addObject:NSStringFromSelector(selector)]; } - free(mlist); + free(methodList); return [allSelectors copy]; } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/script/release b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/script/release index 26409c4..77ff6c8 100755 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/script/release +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/script/release @@ -3,7 +3,7 @@ REMOTE_BRANCH=master POD_NAME=Quick PODSPEC=Quick.podspec -POD=${COCOAPODS:-pod} +POD=${COCOAPODS:-"bundle exec pod"} function help { echo "Usage: release VERSION RELEASE_NOTES [-f]" diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/script/travis-install-macos b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/script/travis-install-macos deleted file mode 100755 index 64edf92..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/script/travis-install-macos +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh -set -e - -git submodule update --init --recursive diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/.swift-version b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/.swift-version index 7d5c902..bf77d54 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/.swift-version +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/.swift-version @@ -1 +1 @@ -4.1 +4.2 diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/.travis.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/.travis.yml index 6c0cd1a..6e9fbf1 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/.travis.yml +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/.travis.yml @@ -30,6 +30,18 @@ matrix: os: osx osx_image: xcode9.3 language: objective-c + - script: + - set -o pipefail + - xcodebuild $XCODE_ACTION -scheme Result-Mac | xcpretty + - xcodebuild $XCODE_ACTION -scheme Result-iOS -sdk iphonesimulator -destination "name=iPhone SE" | xcpretty + - xcodebuild $XCODE_ACTION -scheme Result-tvOS -sdk appletvsimulator -destination "name=Apple TV" | xcpretty + - xcodebuild build -scheme Result-watchOS -sdk watchsimulator | xcpretty + env: + - JOB=Xcode + - XCODE_ACTION="build-for-testing test-without-building" + os: osx + osx_image: xcode10 + language: objective-c - script: - swift --version - swift build @@ -46,6 +58,14 @@ matrix: os: osx osx_image: xcode9.3 language: objective-c + - script: + - swift --version + - swift build + - swift test + env: JOB=SPM + os: osx + osx_image: xcode10 + language: objective-c - script: - swift --version - swift build @@ -57,6 +77,18 @@ matrix: language: generic install: - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" + - script: + - swift --version + - swift build + - swift test + env: + - JOB=Linux + - SWIFT_VERSION=5.0-DEVELOPMENT-SNAPSHOT-2018-12-28-a + sudo: required + dist: trusty + language: generic + install: + - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" notifications: email: false diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Package@swift-5.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Package@swift-5.swift new file mode 100644 index 0000000..6059b85 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Package@swift-5.swift @@ -0,0 +1,14 @@ +// swift-tools-version:5.0 +import PackageDescription + +let package = Package( + name: "Result", + products: [ + .library(name: "Result", targets: ["Result"]), + ], + targets: [ + .target(name: "Result", dependencies: [], path: "Result"), + .testTarget(name: "ResultTests", dependencies: ["Result"]), + ], + swiftLanguageVersions: [.v4, .v4_2, .v5] +) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/README.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/README.md index bf85e78..c030316 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/README.md +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/README.md @@ -28,12 +28,11 @@ func stringForKey(json: JSONObject, key: String) -> Result { return .failure(.noSuchKey(key)) } - if let value = value as? String { - return .success(value) - } - else { + guard let value = value as? String else { return .failure(.typeMismatch) } + + return .success(value) } ``` @@ -94,7 +93,7 @@ An in depth discussion of `map` and `flatMap` is beyond the scope of this docume ### Cocoapods ```ruby -pod 'Result', '~> 3.0.0' +pod 'Result', '~> 4.0.0' ``` ### Swift Package Manager @@ -107,7 +106,7 @@ let package = Package( targets: [], dependencies: [ .Package(url: "https://github.com/antitypical/Result.git", - majorVersion: 3) + majorVersion: 4) ] ) ``` diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.podspec b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.podspec index 09e59f9..ff0742f 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.podspec +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Result' - s.version = '4.0.0' + s.version = '4.1.0' s.summary = 'Swift type modelling the success/failure of arbitrary operations' s.homepage = 'https://github.com/antitypical/Result' @@ -14,6 +14,6 @@ Pod::Spec.new do |s| s.watchos.deployment_target = '2.0' s.tvos.deployment_target = '9.0' - s.swift_version = '4.0' s.cocoapods_version = '>= 1.4.0' + s.swift_version = '4.2' end diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/project.pbxproj b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/project.pbxproj index 651d0ca..6c4bc0a 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/project.pbxproj +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/project.pbxproj @@ -250,9 +250,9 @@ isa = PBXNativeTarget; buildConfigurationList = 57FCDE441BA280DC00130C48 /* Build configuration list for PBXNativeTarget "Result-tvOS" */; buildPhases = ( + 57FCDE411BA280DC00130C48 /* Headers */, 57FCDE3D1BA280DC00130C48 /* Sources */, 57FCDE401BA280DC00130C48 /* Frameworks */, - 57FCDE411BA280DC00130C48 /* Headers */, 57FCDE431BA280DC00130C48 /* Resources */, ); buildRules = ( @@ -286,9 +286,9 @@ isa = PBXNativeTarget; buildConfigurationList = D03579A01B2B788F005D26AE /* Build configuration list for PBXNativeTarget "Result-watchOS" */; buildPhases = ( + D035799D1B2B788F005D26AE /* Headers */, D035799A1B2B788F005D26AE /* Sources */, D035799C1B2B788F005D26AE /* Frameworks */, - D035799D1B2B788F005D26AE /* Headers */, D035799F1B2B788F005D26AE /* Resources */, ); buildRules = ( @@ -304,9 +304,9 @@ isa = PBXNativeTarget; buildConfigurationList = D45480721A9572F5009D7229 /* Build configuration list for PBXNativeTarget "Result-Mac" */; buildPhases = ( + D45480541A9572F5009D7229 /* Headers */, D45480521A9572F5009D7229 /* Sources */, D45480531A9572F5009D7229 /* Frameworks */, - D45480541A9572F5009D7229 /* Headers */, D45480551A9572F5009D7229 /* Resources */, ); buildRules = ( @@ -340,9 +340,9 @@ isa = PBXNativeTarget; buildConfigurationList = D45480941A957362009D7229 /* Build configuration list for PBXNativeTarget "Result-iOS" */; buildPhases = ( + D454807A1A957361009D7229 /* Headers */, D45480781A957361009D7229 /* Sources */, D45480791A957361009D7229 /* Frameworks */, - D454807A1A957361009D7229 /* Headers */, D454807B1A957361009D7229 /* Resources */, ); buildRules = ( @@ -401,11 +401,11 @@ }; D454807C1A957361009D7229 = { CreatedOnToolsVersion = 6.3; - LastSwiftMigration = 0920; + LastSwiftMigration = 1000; }; D45480861A957362009D7229 = { CreatedOnToolsVersion = 6.3; - LastSwiftMigration = 0920; + LastSwiftMigration = 1000; }; }; }; @@ -764,7 +764,7 @@ SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TVOS_DEPLOYMENT_TARGET = 9.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -820,7 +820,7 @@ SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TVOS_DEPLOYMENT_TARGET = 9.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/Info.plist b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/Info.plist index 52221a4..91eaae8 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/Info.plist +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 4.0.0 + 4.1.0 CFBundleSignature ???? CFBundleVersion diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/Result.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/Result.swift index de0330a..7576838 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/Result.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/Result.swift @@ -5,6 +5,19 @@ public enum Result: ResultProtocol, CustomStringConve case success(Value) case failure(Error) + /// The compatibility alias for the Swift 5's `Result` in the standard library. + /// + /// See https://github.com/apple/swift-evolution/blob/master/proposals/0235-add-result.md + /// and https://forums.swift.org/t/accepted-with-modifications-se-0235-add-result-to-the-standard-library/18603 + /// for the details. + public typealias Success = Value + /// The compatibility alias for the Swift 5's `Result` in the standard library. + /// + /// See https://github.com/apple/swift-evolution/blob/master/proposals/0235-add-result.md + /// and https://forums.swift.org/t/accepted-with-modifications-se-0235-add-result-to-the-standard-library/18603 + /// for the details. + public typealias Failure = Error + // MARK: Constructors /// Constructs a success wrapping a `value`. @@ -24,13 +37,23 @@ public enum Result: ResultProtocol, CustomStringConve /// Constructs a result from a function that uses `throw`, failing with `Error` if throws. public init(_ f: @autoclosure () throws -> Value) { - self.init(attempt: f) + self.init(catching: f) } /// Constructs a result from a function that uses `throw`, failing with `Error` if throws. + @available(*, deprecated, renamed: "init(catching:)") public init(attempt f: () throws -> Value) { + self.init(catching: f) + } + + /// The same as `init(attempt:)` aiming for the compatibility with the Swift 5's `Result` in the standard library. + /// + /// See https://github.com/apple/swift-evolution/blob/master/proposals/0235-add-result.md + /// and https://forums.swift.org/t/accepted-with-modifications-se-0235-add-result-to-the-standard-library/18603 + /// for the details. + public init(catching body: () throws -> Success) { do { - self = .success(try f()) + self = .success(try body()) } catch var error { if Error.self == AnyError.self { error = AnyError(error) @@ -42,7 +65,17 @@ public enum Result: ResultProtocol, CustomStringConve // MARK: Deconstruction /// Returns the value from `success` Results or `throw`s the error. + @available(*, deprecated, renamed: "get()") public func dematerialize() throws -> Value { + return try get() + } + + /// The same as `dematerialize()` aiming for the compatibility with the Swift 5's `Result` in the standard library. + /// + /// See https://github.com/apple/swift-evolution/blob/master/proposals/0235-add-result.md + /// and https://forums.swift.org/t/accepted-with-modifications-se-0235-add-result-to-the-standard-library/18603 + /// for the details. + public func get() throws -> Success { switch self { case let .success(value): return value @@ -115,7 +148,7 @@ public enum Result: ResultProtocol, CustomStringConve } } -extension Result where Error == AnyError { +extension Result where Result.Failure == AnyError { /// Constructs a result from an expression that uses `throw`, failing with `AnyError` if throws. public init(_ f: @autoclosure () throws -> Value) { self.init(attempt: f) @@ -140,7 +173,7 @@ public func materialize(_ f: () throws -> T) -> Result { @available(*, deprecated, renamed: "Result.init(_:)") public func materialize(_ f: @autoclosure () throws -> T) -> Result { - return Result(f) + return Result(try f()) } // MARK: - ErrorConvertible conformance diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/ResultProtocol.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/ResultProtocol.swift index 703ad89..e3ad022 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/ResultProtocol.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/ResultProtocol.swift @@ -11,7 +11,7 @@ public protocol ResultProtocol { var result: Result { get } } -public extension Result { +extension Result { /// Returns the value if self represents a success, `nil` otherwise. public var value: Value? { switch self { @@ -69,7 +69,7 @@ public extension Result { } } -public extension Result { +extension Result { // MARK: Higher-order functions @@ -92,7 +92,7 @@ public protocol ErrorConvertible: Swift.Error { static func error(from error: Swift.Error) -> Self } -public extension Result where Error: ErrorConvertible { +extension Result where Result.Failure: ErrorConvertible { /// Returns the result of applying `transform` to `Success`es’ values, or wrapping thrown errors. public func tryMap(_ transform: (Value) throws -> U) -> Result { @@ -111,7 +111,7 @@ public extension Result where Error: ErrorConvertible { // MARK: - Operators -extension Result where Value: Equatable, Error: Equatable { +extension Result where Result.Success: Equatable, Result.Failure: Equatable { /// Returns `true` if `left` and `right` are both `Success`es and their values are equal, or if `left` and `right` are both `Failure`s and their errors are equal. public static func ==(left: Result, right: Result) -> Bool { if let left = left.value, let right = right.value { @@ -124,9 +124,9 @@ extension Result where Value: Equatable, Error: Equatable { } #if swift(>=4.1) - extension Result: Equatable where Value: Equatable, Error: Equatable { } + extension Result: Equatable where Result.Success: Equatable, Result.Failure: Equatable { } #else - extension Result where Value: Equatable, Error: Equatable { + extension Result where Result.Success: Equatable, Result.Failure: Equatable { /// Returns `true` if `left` and `right` represent different cases, or if they represent the same case but different values. public static func !=(left: Result, right: Result) -> Bool { return !(left == right) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/Info.plist b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/Info.plist index 18f6dd6..7861e6f 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/Info.plist +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 4.0.0 + 4.1.0 CFBundleSignature ???? CFBundleVersion diff --git a/Carthage/Checkouts/Commandant/Commandant.podspec b/Carthage/Checkouts/Commandant/Commandant.podspec index cb75c85..ceebd8a 100644 --- a/Carthage/Checkouts/Commandant/Commandant.podspec +++ b/Carthage/Checkouts/Commandant/Commandant.podspec @@ -28,5 +28,5 @@ Commandant is a Swift framework for parsing command-line arguments, inspired by s.dependency "Result", "~> 4.0" s.cocoapods_version = ">= 1.4.0" - s.swift_version = "4.0" + s.swift_version = "4.2" end diff --git a/Carthage/Checkouts/Commandant/Commandant.xcodeproj/project.pbxproj b/Carthage/Checkouts/Commandant/Commandant.xcodeproj/project.pbxproj index 072ede3..85b879d 100644 --- a/Carthage/Checkouts/Commandant/Commandant.xcodeproj/project.pbxproj +++ b/Carthage/Checkouts/Commandant/Commandant.xcodeproj/project.pbxproj @@ -314,16 +314,16 @@ attributes = { LastSwiftMigration = 0700; LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = Carthage; TargetAttributes = { D00CCDD81A20717400109F8C = { CreatedOnToolsVersion = 6.1.1; - LastSwiftMigration = 0800; + LastSwiftMigration = 1020; }; D00CCDE31A20717400109F8C = { CreatedOnToolsVersion = 6.1.1; - LastSwiftMigration = 0800; + LastSwiftMigration = 1020; }; }; }; @@ -405,6 +405,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = D00CCDFA1A20719500109F8C /* Debug.xcconfig */; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_INFINITE_RECURSION = YES; @@ -416,7 +417,7 @@ ENABLE_TESTABILITY = YES; MACOSX_DEPLOYMENT_TARGET = 10.9; ONLY_ACTIVE_ARCH = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -426,6 +427,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = D00CCDFC1A20719500109F8C /* Release.xcconfig */; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_INFINITE_RECURSION = YES; @@ -436,7 +438,7 @@ CURRENT_PROJECT_VERSION = 1; MACOSX_DEPLOYMENT_TARGET = 10.9; SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -484,6 +486,7 @@ "$(inherited)", ); INFOPLIST_FILE = Tests/CommandantTests/Info.plist; + MACOSX_DEPLOYMENT_TARGET = 10.10; PRODUCT_BUNDLE_IDENTIFIER = "org.carthage.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -498,6 +501,7 @@ "$(inherited)", ); INFOPLIST_FILE = Tests/CommandantTests/Info.plist; + MACOSX_DEPLOYMENT_TARGET = 10.10; PRODUCT_BUNDLE_IDENTIFIER = "org.carthage.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -507,6 +511,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = D00CCDFB1A20719500109F8C /* Profile.xcconfig */; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_INFINITE_RECURSION = YES; @@ -516,7 +521,7 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CURRENT_PROJECT_VERSION = 1; MACOSX_DEPLOYMENT_TARGET = 10.9; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -547,6 +552,7 @@ "$(inherited)", ); INFOPLIST_FILE = Tests/CommandantTests/Info.plist; + MACOSX_DEPLOYMENT_TARGET = 10.10; PRODUCT_BUNDLE_IDENTIFIER = "org.carthage.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -556,6 +562,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = D00CCDFD1A20719500109F8C /* Test.xcconfig */; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_INFINITE_RECURSION = YES; @@ -565,7 +572,7 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CURRENT_PROJECT_VERSION = 1; MACOSX_DEPLOYMENT_TARGET = 10.9; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -597,6 +604,7 @@ "$(inherited)", ); INFOPLIST_FILE = Tests/CommandantTests/Info.plist; + MACOSX_DEPLOYMENT_TARGET = 10.10; PRODUCT_BUNDLE_IDENTIFIER = "org.carthage.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; diff --git a/Carthage/Checkouts/Commandant/Commandant.xcodeproj/xcshareddata/xcschemes/Commandant.xcscheme b/Carthage/Checkouts/Commandant/Commandant.xcodeproj/xcshareddata/xcschemes/Commandant.xcscheme index ec5f507..c4485c9 100644 --- a/Carthage/Checkouts/Commandant/Commandant.xcodeproj/xcshareddata/xcschemes/Commandant.xcscheme +++ b/Carthage/Checkouts/Commandant/Commandant.xcodeproj/xcshareddata/xcschemes/Commandant.xcscheme @@ -1,6 +1,6 @@ ) } -#if !swift(>=4.1) -private func ==(lhs: RawArgument, rhs: RawArgument) -> Bool { - switch (lhs, rhs) { - case let (.key(left), .key(right)): - return left == right - - case let (.value(left), .value(right)): - return left == right - - case let (.flag(left), .flag(right)): - return left == right - - default: - return false - } -} -#endif - extension RawArgument: CustomStringConvertible { fileprivate var description: String { switch self { diff --git a/Carthage/Checkouts/Commandant/Sources/Commandant/Command.swift b/Carthage/Checkouts/Commandant/Sources/Commandant/Command.swift index ff65ca8..d7ebcd1 100644 --- a/Carthage/Checkouts/Commandant/Sources/Commandant/Command.swift +++ b/Carthage/Checkouts/Commandant/Sources/Commandant/Command.swift @@ -15,7 +15,7 @@ public protocol CommandProtocol { /// The command's options type. associatedtype Options: OptionsProtocol - associatedtype ClientError: Error = Options.ClientError + associatedtype ClientError where ClientError == Options.ClientError /// The action that users should specify to use this subcommand (e.g., /// `help`). @@ -39,7 +39,7 @@ public struct CommandWrapper { public let usage: () -> CommandantError? /// Creates a command that wraps another. - fileprivate init(_ command: C) where C.ClientError == ClientError, C.Options.ClientError == ClientError { + fileprivate init(_ command: C) where C.ClientError == ClientError { verb = command.verb function = command.function run = { (arguments: ArgumentParser) -> Result<(), CommandantError> in @@ -93,7 +93,7 @@ public final class CommandRegistry { @discardableResult public func register(_ commands: C...) -> CommandRegistry - where C.ClientError == ClientError, C.Options.ClientError == ClientError + where C.ClientError == ClientError { for command in commands { commandsByVerb[command.verb] = CommandWrapper(command) @@ -205,10 +205,29 @@ extension CommandRegistry { func launchTask(_ path: String, arguments: [String]) -> Int32 { let task = Process() - task.launchPath = path task.arguments = arguments - task.launch() + do { + #if canImport(Darwin) + if #available(macOS 10.13, *) { + task.executableURL = URL(fileURLWithPath: path) + try task.run() + } else { + task.launchPath = path + task.launch() + } + #elseif compiler(>=5) + task.executableURL = URL(fileURLWithPath: path) + try task.run() + #else + task.launchPath = path + task.launch() + #endif + } catch let nserror as NSError { + return Int32(truncatingIfNeeded: nserror.code) + } catch { + return -1 + } task.waitUntilExit() return task.terminationStatus diff --git a/Carthage/Checkouts/Commandant/Sources/Commandant/HelpCommand.swift b/Carthage/Checkouts/Commandant/Sources/Commandant/HelpCommand.swift index b07ba63..fa4ac4b 100644 --- a/Carthage/Checkouts/Commandant/Sources/Commandant/HelpCommand.swift +++ b/Carthage/Checkouts/Commandant/Sources/Commandant/HelpCommand.swift @@ -22,14 +22,15 @@ public struct HelpCommand: CommandProtocol { public typealias Options = HelpOptions public let verb = "help" - public let function = "Display general or command-specific help" - + public let function: String + private let registry: CommandRegistry /// Initializes the command to provide help from the given registry of /// commands. - public init(registry: CommandRegistry) { + public init(registry: CommandRegistry, function: String? = nil) { self.registry = registry + self.function = function ?? "Display general or command-specific help" } public func run(_ options: Options) -> Result<(), ClientError> { diff --git a/Carthage/Checkouts/Commandant/Sources/Commandant/OrderedSet.swift b/Carthage/Checkouts/Commandant/Sources/Commandant/OrderedSet.swift index 6038637..f17e4c7 100644 --- a/Carthage/Checkouts/Commandant/Sources/Commandant/OrderedSet.swift +++ b/Carthage/Checkouts/Commandant/Sources/Commandant/OrderedSet.swift @@ -10,7 +10,7 @@ internal struct OrderedSet: Equatable { @discardableResult mutating func remove(_ member: T) -> T? { - if let index = values.index(of: member) { + if let index = values.firstIndex(of: member) { return values.remove(at: index) } else { return nil @@ -18,14 +18,6 @@ internal struct OrderedSet: Equatable { } } -#if !swift(>=4.1) -extension OrderedSet { - static func == (_ lhs: OrderedSet, rhs: OrderedSet) -> Bool { - return lhs.values == rhs.values - } -} -#endif - extension OrderedSet: Collection { subscript(position: Int) -> T { return values[position] From 1718e53e4927817e0deb7b005f3dd82fd59b00a4 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Mon, 18 Mar 2019 16:53:04 -0600 Subject: [PATCH 03/25] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20Swift=205,=20Xcod?= =?UTF-8?q?e=2010.2=20recommended=20settings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mas-cli.xcodeproj/project.pbxproj | 19 +++++++++++-------- .../xcshareddata/xcschemes/MasKit.xcscheme | 2 +- .../xcschemes/mas-cli Debug.xcscheme | 2 +- .../xcschemes/mas-cli Release.xcscheme | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/mas-cli.xcodeproj/project.pbxproj b/mas-cli.xcodeproj/project.pbxproj index 08651db..5f6923c 100644 --- a/mas-cli.xcodeproj/project.pbxproj +++ b/mas-cli.xcodeproj/project.pbxproj @@ -899,19 +899,21 @@ DefaultBuildSystemTypeForWorkspace = Latest; LastSwiftMigration = 0730; LastSwiftUpdateCheck = 1000; - LastUpgradeCheck = 1010; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "mas-cli"; TargetAttributes = { ED031A771B5127C00097692E = { CreatedOnToolsVersion = 7.0; - LastSwiftMigration = 1000; + LastSwiftMigration = 1020; }; F8FB715120F2B41400F56FDC = { CreatedOnToolsVersion = 10.0; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; F8FB715920F2B41400F56FDC = { CreatedOnToolsVersion = 10.0; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; }; @@ -921,6 +923,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = ED031A6F1B5127C00097692E; @@ -1236,7 +1239,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_FORCE_DYNAMIC_LINK_STDLIB = YES; SWIFT_FORCE_STATIC_LINK_STDLIB = NO; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -1259,7 +1262,7 @@ SWIFT_FORCE_DYNAMIC_LINK_STDLIB = YES; SWIFT_FORCE_STATIC_LINK_STDLIB = NO; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -1296,7 +1299,7 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_INCLUDE_PATHS = "$(inherited) $(SRCROOT)/PrivateFrameworks/CommerceKit $(SRCROOT)/PrivateFrameworks/StoreFoundation"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; VERSION_INFO_PREFIX = ""; }; name = Debug; @@ -1334,7 +1337,7 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SWIFT_INCLUDE_PATHS = "$(inherited) $(SRCROOT)/PrivateFrameworks/CommerceKit $(SRCROOT)/PrivateFrameworks/StoreFoundation"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; VERSION_INFO_PREFIX = ""; }; name = Release; @@ -1365,7 +1368,7 @@ PRODUCT_BUNDLE_IDENTIFIER = at.phatbl.MasKitTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -1394,7 +1397,7 @@ PRODUCT_BUNDLE_IDENTIFIER = at.phatbl.MasKitTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/mas-cli.xcodeproj/xcshareddata/xcschemes/MasKit.xcscheme b/mas-cli.xcodeproj/xcshareddata/xcschemes/MasKit.xcscheme index f3ba2b1..afb6bd1 100644 --- a/mas-cli.xcodeproj/xcshareddata/xcschemes/MasKit.xcscheme +++ b/mas-cli.xcodeproj/xcshareddata/xcschemes/MasKit.xcscheme @@ -1,6 +1,6 @@ Date: Mon, 18 Mar 2019 16:55:19 -0600 Subject: [PATCH 04/25] =?UTF-8?q?=F0=9F=8C=90=20Enable=20base=20localizati?= =?UTF-8?q?on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mas-cli.xcodeproj/project.pbxproj | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mas-cli.xcodeproj/project.pbxproj b/mas-cli.xcodeproj/project.pbxproj index 5f6923c..9591b0e 100644 --- a/mas-cli.xcodeproj/project.pbxproj +++ b/mas-cli.xcodeproj/project.pbxproj @@ -920,11 +920,11 @@ }; buildConfigurationList = ED031A731B5127C00097692E /* Build configuration list for PBXProject "mas-cli" */; compatibilityVersion = "Xcode 8.0"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( - English, en, + Base, ); mainGroup = ED031A6F1B5127C00097692E; productRefGroup = ED031A791B5127C00097692E /* Products */; @@ -1104,6 +1104,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -1169,6 +1170,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; From 82d30b5f9a02e2cc0e338beb0f6695d8806748d0 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Mon, 18 Mar 2019 16:56:20 -0600 Subject: [PATCH 05/25] =?UTF-8?q?=F0=9F=91=BD=20Update=20Data=20deprecated?= =?UTF-8?q?=20init=20usager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MasKitTests/Network/NetworkManagerTests.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MasKitTests/Network/NetworkManagerTests.swift b/MasKitTests/Network/NetworkManagerTests.swift index 5065737..a43ebd9 100644 --- a/MasKitTests/Network/NetworkManagerTests.swift +++ b/MasKitTests/Network/NetworkManagerTests.swift @@ -16,7 +16,7 @@ class NetworkManagerTests: XCTestCase { let manager = NetworkManager(session: session) // Create data and tell the session to always return it - let data = Data(bytes: [0, 1, 0, 1]) + let data = Data([0, 1, 0, 1]) session.data = data // Create a URL (using the file path API to avoid optionals) @@ -34,7 +34,7 @@ class NetworkManagerTests: XCTestCase { let manager = NetworkManager(session: session) // Create data and tell the session to always return it - let data = Data(bytes: [0, 1, 0, 1]) + let data = Data([0, 1, 0, 1]) session.data = data // Create a URL (using the file path API to avoid optionals) From cab82b8ec3ce7f6a747a6477635c8d04a1cdc062 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Fri, 13 Dec 2019 16:48:15 -0700 Subject: [PATCH 06/25] =?UTF-8?q?=E2=AC=86=EF=B8=8F=F0=9F=92=8E=20Upgrade?= =?UTF-8?q?=20gems?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile.lock | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5f655ab..8685df3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,9 +1,9 @@ GEM remote: https://rubygems.org/ specs: - addressable (2.5.2) - public_suffix (>= 2.0.2, < 4.0) - claide (1.0.2) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + claide (1.0.3) claide-plugins (0.9.2) cork nap @@ -11,38 +11,41 @@ GEM colored2 (3.1.2) cork (0.3.0) colored2 (~> 3.1) - danger (5.11.1) + danger (6.1.0) claide (~> 1.0) claide-plugins (>= 0.9.2) colored2 (~> 3.1) cork (~> 0.1) faraday (~> 0.9) - faraday-http-cache (~> 1.0) + faraday-http-cache (~> 2.0) git (~> 1.5) - kramdown (~> 1.5) + kramdown (~> 2.0) + kramdown-parser-gfm (~> 1.0) no_proxy_fix octokit (~> 4.7) terminal-table (~> 1) - faraday (0.15.4) + faraday (0.17.1) multipart-post (>= 1.2, < 3) - faraday-http-cache (1.3.1) + faraday-http-cache (2.0.0) faraday (~> 0.8) git (1.5.0) - kramdown (1.17.0) - multipart-post (2.0.0) + kramdown (2.1.0) + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + multipart-post (2.1.1) nap (1.1.0) no_proxy_fix (0.1.2) - octokit (4.13.0) + octokit (4.14.0) sawyer (~> 0.8.0, >= 0.5.3) open4 (1.3.4) - public_suffix (3.0.3) + public_suffix (4.0.1) rouge (2.0.7) - sawyer (0.8.1) - addressable (>= 2.3.5, < 2.6) - faraday (~> 0.8, < 1.0) + sawyer (0.8.2) + addressable (>= 2.3.5) + faraday (> 0.8, < 2.0) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) - unicode-display_width (1.4.1) + unicode-display_width (1.6.0) xcpretty (0.3.0) rouge (~> 2.0.7) @@ -54,4 +57,4 @@ DEPENDENCIES xcpretty BUNDLED WITH - 2.0.1 + 2.0.2 From 6e3e4f133213d82afbfbfe87a4975d0ff4d338b9 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Fri, 13 Dec 2019 16:52:02 -0700 Subject: [PATCH 07/25] =?UTF-8?q?=E2=9A=92=EF=B8=8F=20Apply=20Xcode=2011.3?= =?UTF-8?q?=20recommended=20settings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mas-cli.xcodeproj/project.pbxproj | 4 ++- .../xcshareddata/xcschemes/MasKit.xcscheme | 24 +++++++--------- .../xcschemes/mas-cli Debug.xcscheme | 28 ++++++++----------- .../xcschemes/mas-cli Release.xcscheme | 10 ++----- 4 files changed, 28 insertions(+), 38 deletions(-) diff --git a/mas-cli.xcodeproj/project.pbxproj b/mas-cli.xcodeproj/project.pbxproj index 9591b0e..d73e1d5 100644 --- a/mas-cli.xcodeproj/project.pbxproj +++ b/mas-cli.xcodeproj/project.pbxproj @@ -899,7 +899,7 @@ DefaultBuildSystemTypeForWorkspace = Latest; LastSwiftMigration = 0730; LastSwiftUpdateCheck = 1000; - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1130; ORGANIZATIONNAME = "mas-cli"; TargetAttributes = { ED031A771B5127C00097692E = { @@ -1228,6 +1228,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -1249,6 +1250,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; DEPLOYMENT_LOCATION = YES; FRAMEWORK_SEARCH_PATHS = ( diff --git a/mas-cli.xcodeproj/xcshareddata/xcschemes/MasKit.xcscheme b/mas-cli.xcodeproj/xcshareddata/xcschemes/MasKit.xcscheme index afb6bd1..bc3eec2 100644 --- a/mas-cli.xcodeproj/xcshareddata/xcschemes/MasKit.xcscheme +++ b/mas-cli.xcodeproj/xcshareddata/xcschemes/MasKit.xcscheme @@ -1,6 +1,6 @@ + + + + @@ -39,17 +48,6 @@ - - - - - - - - + shouldUseLaunchSchemeArgsEnv = "YES" + codeCoverageEnabled = "YES"> + + + + @@ -40,17 +49,6 @@ - - - - - - - - - - - - + + - - Date: Fri, 13 Dec 2019 16:55:45 -0700 Subject: [PATCH 08/25] =?UTF-8?q?=F0=9F=95=8A=EF=B8=8F=20Set=20swift=20ver?= =?UTF-8?q?sion=20at=20project=20level?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mas-cli.xcodeproj/project.pbxproj | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mas-cli.xcodeproj/project.pbxproj b/mas-cli.xcodeproj/project.pbxproj index d73e1d5..3a22441 100644 --- a/mas-cli.xcodeproj/project.pbxproj +++ b/mas-cli.xcodeproj/project.pbxproj @@ -1161,7 +1161,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.mphys.mas-cli"; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -1219,7 +1219,7 @@ MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "com.mphys.mas-cli"; SDKROOT = macosx; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; @@ -1303,7 +1303,6 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_INCLUDE_PATHS = "$(inherited) $(SRCROOT)/PrivateFrameworks/CommerceKit $(SRCROOT)/PrivateFrameworks/StoreFoundation"; - SWIFT_VERSION = 5.0; VERSION_INFO_PREFIX = ""; }; name = Debug; @@ -1341,7 +1340,6 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SWIFT_INCLUDE_PATHS = "$(inherited) $(SRCROOT)/PrivateFrameworks/CommerceKit $(SRCROOT)/PrivateFrameworks/StoreFoundation"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 5.0; VERSION_INFO_PREFIX = ""; }; name = Release; From 7bd17514c782865928617aaa9a6458012fe6c2ea Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Fri, 13 Dec 2019 16:56:14 -0700 Subject: [PATCH 09/25] =?UTF-8?q?=F0=9F=91=B7=F0=9F=8F=BB=E2=80=8D?= =?UTF-8?q?=E2=99=82=EF=B8=8F=20Use=20xcode11.2=20image=20on=20travis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index fb6da7d..12f0e3c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,13 +2,13 @@ # .travis.yml # mas-cli # -# https://travis-ci.org/mas-cli/mas +# https://travis-ci.com/mas-cli/mas # https://docs.travis-ci.com/user/reference/osx/ # https://docs.travis-ci.com/user/languages/objective-c/ # os: osx -osx_image: xcode10.1 # macOS 10.13 +osx_image: xcode11.2 # macOS 10.14 env: global: From 49c39bc08230305ebddaf89d44b1c571d3a6d10a Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Fri, 13 Dec 2019 17:01:17 -0700 Subject: [PATCH 10/25] =?UTF-8?q?=F0=9F=94=A5=20Remove=20obsolete=20.swift?= =?UTF-8?q?-version=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .swift-version | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .swift-version diff --git a/.swift-version b/.swift-version deleted file mode 100644 index bf77d54..0000000 --- a/.swift-version +++ /dev/null @@ -1 +0,0 @@ -4.2 From 54536ef0e283c599b565d67645e7bc60df76bc6e Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Fri, 13 Dec 2019 17:01:34 -0700 Subject: [PATCH 11/25] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20ruby=20(2.4.3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index 2bf1c1c..35cee72 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3.1 +2.4.3 From 09ae943a1fcac167ea87f1cefb9fc552b39a1d40 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Fri, 13 Dec 2019 17:08:16 -0700 Subject: [PATCH 12/25] =?UTF-8?q?=F0=9F=91=B7=F0=9F=8F=BB=E2=80=8D?= =?UTF-8?q?=E2=99=80=EF=B8=8F=20Use=20Bundler=202=20on=20travis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 3 +++ .travis.yml | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/.editorconfig b/.editorconfig index 0362eaf..da22b23 100644 --- a/.editorconfig +++ b/.editorconfig @@ -14,3 +14,6 @@ trim_trailing_whitespace = false [*.rb] indent_size = 2 + +[*.yml] +indent_size = 2 diff --git a/.travis.yml b/.travis.yml index 12f0e3c..147adef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,11 @@ env: - LC_ALL=en_US.UTF-8 - LANGUAGE=en_US.UTF-8 +# Bundler 2 +# https://docs.travis-ci.com/user/languages/ruby/#bundler-20 +before_install: + - gem install bundler + install: - script/bootstrap From 7f7c8f7ea7ecf69ffc2b2a7f494eef8ce4a4d4fa Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Fri, 13 Dec 2019 17:09:48 -0700 Subject: [PATCH 13/25] =?UTF-8?q?=F0=9F=91=B7=F0=9F=8F=BB=E2=80=8D?= =?UTF-8?q?=E2=99=82=EF=B8=8F=20Option=20into=20travis=20build=20config=20?= =?UTF-8?q?validation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 147adef..ec007d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,9 @@ # https://docs.travis-ci.com/user/languages/objective-c/ # +# https://docs.travis-ci.com/user/build-config-validation +version: ~> 1.0 + os: osx osx_image: xcode11.2 # macOS 10.14 From d83af90d4321a0b1ace1e1bf57bb8771d91d1a5b Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Fri, 13 Dec 2019 17:23:50 -0700 Subject: [PATCH 14/25] =?UTF-8?q?=F0=9F=93=9D=20Add=20swift=20runtime=20in?= =?UTF-8?q?stall=20notes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0c24a0b..49ba7ae 100644 --- a/README.md +++ b/README.md @@ -20,20 +20,31 @@ A simple command line interface for the Mac App Store. Designed for scripting an brew install mas ``` +⚠️ Note that macOS 10.13 (High Sierra) is required to install mas from the core Homebrew formula. + ### ☎️ Older macOS Versions -macOS 10.13 (High Sierra) is required to install mas from the core Homebrew formula. We provide a [custom Homebrew tap](https://github.com/mas-cli/homebrew-tap) with pre-built bottles for all macOS versions since 10.11. -#### 😴 TL;DR - -Just run this command: +To install mas from our tap: ```bash brew install mas-cli/tap/mas ``` +#### Known Installation Issues On macOS Before 10.14.4 + +Starting with [mas 2.0.0](https://github.com/mas-cli/mas/releases/tag/v2.0.0), if you get +an error similar to `dyld: Symbol not found: _$s11SubSequenceSlTl` when running mas, +you'll need to install the [Swift 5 Runtime Support for Command Line Tools](https://support.apple.com/kb/DL1998). + +Alternatively, you can: + +- Update to macOS 10.14.4 or later +- Install Xcode 10.2 or later at `/Applications/Xcode.app` +- Rebuild mas from source using Xcode 10.0 or later + ### 🐙 GitHub Releases Alternatively, binaries are available in the [GitHub Releases](https://github.com/mas-cli/mas/releases) From 0ddb0cd3ec2681574853ba637b58de798345373c Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Fri, 13 Dec 2019 17:36:15 -0700 Subject: [PATCH 15/25] =?UTF-8?q?=E2=9E=96=20Result,=20=E2=AC=86=EF=B8=8F?= =?UTF-8?q?=20Quick=20(2.2.0),=20Nimble=20(8.0.4),=20Commandant=20(0.17.0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cartfile | 3 +- Cartfile.resolved | 7 +- Carthage/Checkouts/Commandant/.gitmodules | 3 - Carthage/Checkouts/Commandant/.hound.yml | 2 + Carthage/Checkouts/Commandant/.swift-version | 2 +- Carthage/Checkouts/Commandant/.swiftlint.yml | 13 + Carthage/Checkouts/Commandant/.travis.yml | 18 +- .../Checkouts/Commandant/Cartfile.resolved | 1 - .../Checkouts/Commandant/Commandant.podspec | 6 +- .../Commandant.xcodeproj/project.pbxproj | 17 +- .../contents.xcworkspacedata | 3 - .../Checkouts/Commandant/Package.resolved | 9 - Carthage/Checkouts/Commandant/Package.swift | 11 +- .../Sources/Commandant/Argument.swift | 2 - .../Sources/Commandant/ArgumentParser.swift | 3 +- .../Sources/Commandant/Command.swift | 17 +- .../Sources/Commandant/Errors.swift | 1 - .../Sources/Commandant/HelpCommand.swift | 5 +- .../Commandant/Sources/Commandant/Info.plist | 2 +- .../Sources/Commandant/Option.swift | 5 +- .../Sources/Commandant/Result+Additions.swift | 27 ++ .../Sources/Commandant/Switch.swift | 2 - .../Tests/CommandantTests/CommandSpec.swift | 1 - .../Tests/CommandantTests/Info.plist | 2 +- .../Tests/CommandantTests/OptionSpec.swift | 21 +- .../OptionsWithEnumProtocolSpec.swift | 45 ++- .../Checkouts/Nimble/.github/workflows/ci.yml | 46 +++ Carthage/Checkouts/Nimble/.hound.yml | 2 +- Carthage/Checkouts/Nimble/.travis.yml | 54 +--- Carthage/Checkouts/Nimble/Cartfile.private | 2 +- Carthage/Checkouts/Nimble/Cartfile.resolved | 3 +- .../CwlCatchException/LICENSE.txt | 2 + .../CwlCatchException/Package.swift | 14 + .../Dependencies}/CwlCatchException/README.md | 2 +- .../CwlCatchException/CwlCatchException.swift | 6 +- .../CwlCatchException.m | 7 +- .../include/CwlCatchException.h | 7 +- .../CwlPreconditionTesting/Package.swift | 29 +- .../CwlPreconditionTesting/README.md | 24 +- .../CwlMachBadInstructionHandler.m | 61 ++-- .../include/CwlMachBadInstructionHandler.h | 10 +- .../mach_excServer.c | 7 +- .../mach_excServer.h | 8 + .../CwlBadInstructionException.swift | 84 ++--- .../CwlCatchBadInstruction.swift | 306 +++++++++--------- .../CwlCatchBadInstructionPosix.swift | 154 ++++----- .../CwlDarwinDefinitions.swift | 62 ++-- .../include}/CwlPreconditionTesting.h | 13 +- Carthage/Checkouts/Nimble/Gemfile | 2 +- Carthage/Checkouts/Nimble/Gemfile.lock | 28 +- Carthage/Checkouts/Nimble/Nimble.podspec | 19 +- .../Nimble/Nimble.xcodeproj/project.pbxproj | 85 ++--- .../xcschemes/Nimble-iOS.xcscheme | 2 +- .../xcschemes/Nimble-macOS.xcscheme | 2 +- .../xcschemes/Nimble-tvOS.xcscheme | 2 +- Carthage/Checkouts/Nimble/Package.resolved | 25 ++ Carthage/Checkouts/Nimble/Package.swift | 18 +- .../Checkouts/Nimble/Package@swift-4.2.swift | 30 ++ Carthage/Checkouts/Nimble/README.md | 23 ++ .../Nimble/Adapters/NMBExpectation.swift | 36 +-- .../Nimble/Adapters/NimbleXCTestHandler.swift | 4 +- .../Nimble/Sources/Nimble/Expression.swift | 4 +- .../Sources/Nimble/Matchers/BeCloseTo.swift | 16 +- .../Nimble/Matchers/BeGreaterThan.swift | 10 +- .../Matchers/BeGreaterThanOrEqualTo.swift | 10 +- .../Nimble/Matchers/BeIdenticalTo.swift | 13 +- .../Sources/Nimble/Matchers/BeLessThan.swift | 10 +- .../Nimble/Matchers/BeLessThanOrEqual.swift | 10 +- .../Nimble/Matchers/MatcherProtocols.swift | 8 +- .../Nimble/Matchers/PostNotification.swift | 55 +++- .../Nimble/Matchers/RaisesException.swift | 23 +- .../Nimble/Matchers/SatisfyAllOf.swift | 6 + .../Nimble/Matchers/SatisfyAnyOf.swift | 6 + .../Nimble/Matchers/ThrowAssertion.swift | 10 +- .../Checkouts/Nimble/Sources/Nimble/Nimble.h | 6 +- .../Nimble/Sources/Nimble/Utils/Await.swift | 6 +- .../Sources/Nimble/Utils/Stringers.swift | 15 +- .../Tests/NimbleTests/AsynchronousTest.swift | 6 +- .../Tests/NimbleTests/Helpers/utils.swift | 2 +- .../NimbleTests/Matchers/BeAKindOfTest.swift | 4 +- .../Matchers/BeAnInstanceOfTest.swift | 2 +- .../NimbleTests/Matchers/BeEmptyTest.swift | 6 +- .../Matchers/BeGreaterThanOrEqualToTest.swift | 2 - .../Matchers/BeIdenticalToTest.swift | 2 +- .../Matchers/BeLessThanOrEqualToTest.swift | 2 - .../NimbleTests/Matchers/BeginWithTest.swift | 2 - .../NimbleTests/Matchers/ContainTest.swift | 2 +- .../NimbleTests/Matchers/EndWithTest.swift | 2 - .../NimbleTests/Matchers/EqualTest.swift | 12 +- .../NimbleTests/Matchers/MatchErrorTest.swift | 4 +- .../Matchers/PostNotificationTest.swift | 18 +- .../Matchers/RaisesExceptionTest.swift | 2 +- .../Matchers/ThrowAssertionTest.swift | 2 +- Carthage/Checkouts/Nimble/script/release | 4 +- Carthage/Checkouts/Nimble/test | 16 +- .../Checkouts/Quick/.github/workflows/ci.yml | 37 +++ Carthage/Checkouts/Quick/.hound.yml | 2 +- Carthage/Checkouts/Quick/.travis.yml | 40 +-- .../Documentation/en-us/InstallingQuick.md | 24 +- .../Documentation/en-us/SharedExamples.md | 73 ++++- .../Quick/Documentation/ja/SharedExamples.md | 4 +- .../Documentation/ko-kr/SharedExamples.md | 4 +- .../Documentation/pt-br/SharedExamples.md | 6 +- .../Documentation/zh-cn/SharedExamples.md | 4 +- .../Externals/Nimble/.github/workflows/ci.yml | 46 +++ .../Quick/Externals/Nimble/.hound.yml | 2 +- .../Quick/Externals/Nimble/.travis.yml | 54 +--- .../Quick/Externals/Nimble/Cartfile.private | 2 +- .../Quick/Externals/Nimble/Cartfile.resolved | 3 +- .../Checkouts/CwlCatchException/Package.swift | 9 - .../CwlCatchException/LICENSE.txt | 15 + .../CwlCatchException/Package.swift | 14 + .../Dependencies/CwlCatchException/README.md | 46 +++ .../CwlCatchException/CwlCatchException.swift | 35 ++ .../CwlCatchException.m | 34 ++ .../include/CwlCatchException.h | 29 ++ .../CwlPreconditionTesting/Package.swift | 29 +- .../CwlPreconditionTesting/README.md | 24 +- .../CwlMachBadInstructionHandler.m | 61 ++-- .../include/CwlMachBadInstructionHandler.h | 10 +- .../mach_excServer.c | 7 +- .../mach_excServer.h | 8 + .../CwlBadInstructionException.swift | 84 ++--- .../CwlCatchBadInstruction.swift | 306 +++++++++--------- .../CwlCatchBadInstructionPosix.swift | 154 ++++----- .../CwlDarwinDefinitions.swift | 62 ++-- .../CwlPreconditionTesting.h} | 16 +- .../Checkouts/Quick/Externals/Nimble/Gemfile | 2 +- .../Quick/Externals/Nimble/Gemfile.lock | 28 +- .../Quick/Externals/Nimble/Nimble.podspec | 19 +- .../Nimble/Nimble.xcodeproj/project.pbxproj | 85 ++--- .../xcschemes/Nimble-iOS.xcscheme | 2 +- .../xcschemes/Nimble-macOS.xcscheme | 2 +- .../xcschemes/Nimble-tvOS.xcscheme | 2 +- .../Quick/Externals/Nimble/Package.resolved | 25 ++ .../Quick/Externals/Nimble/Package.swift | 18 +- .../Externals/Nimble/Package@swift-4.2.swift | 30 ++ .../Quick/Externals/Nimble/README.md | 23 ++ .../Nimble/Adapters/NMBExpectation.swift | 36 +-- .../Nimble/Adapters/NimbleXCTestHandler.swift | 4 +- .../Nimble/Sources/Nimble/Expression.swift | 4 +- .../Sources/Nimble/Matchers/BeCloseTo.swift | 16 +- .../Sources/Nimble/Matchers/BeEmpty.swift | 16 +- .../Nimble/Matchers/BeGreaterThan.swift | 10 +- .../Matchers/BeGreaterThanOrEqualTo.swift | 10 +- .../Nimble/Matchers/BeIdenticalTo.swift | 13 +- .../Sources/Nimble/Matchers/BeLessThan.swift | 10 +- .../Nimble/Matchers/BeLessThanOrEqual.swift | 10 +- .../Sources/Nimble/Matchers/Contain.swift | 20 ++ .../Nimble/Matchers/MatcherProtocols.swift | 8 +- .../Nimble/Matchers/PostNotification.swift | 55 +++- .../Nimble/Matchers/RaisesException.swift | 23 +- .../Nimble/Matchers/SatisfyAllOf.swift | 6 + .../Nimble/Matchers/SatisfyAnyOf.swift | 6 + .../Nimble/Matchers/ThrowAssertion.swift | 10 +- .../Externals/Nimble/Sources/Nimble/Nimble.h | 6 +- .../Nimble/Sources/Nimble/Utils/Await.swift | 6 +- .../Sources/Nimble/Utils/Stringers.swift | 15 +- .../Tests/NimbleTests/AsynchronousTest.swift | 6 +- .../Tests/NimbleTests/Helpers/utils.swift | 2 +- .../NimbleTests/Matchers/BeAKindOfTest.swift | 4 +- .../Matchers/BeAnInstanceOfTest.swift | 2 +- .../NimbleTests/Matchers/BeEmptyTest.swift | 23 +- .../Matchers/BeGreaterThanOrEqualToTest.swift | 2 - .../Matchers/BeIdenticalToTest.swift | 2 +- .../Matchers/BeLessThanOrEqualToTest.swift | 2 - .../NimbleTests/Matchers/BeginWithTest.swift | 2 - .../NimbleTests/Matchers/ContainTest.swift | 23 +- .../NimbleTests/Matchers/EndWithTest.swift | 2 - .../NimbleTests/Matchers/EqualTest.swift | 12 +- .../NimbleTests/Matchers/MatchErrorTest.swift | 4 +- .../Matchers/PostNotificationTest.swift | 18 +- .../Matchers/RaisesExceptionTest.swift | 2 +- .../Matchers/ThrowAssertionTest.swift | 2 +- .../Tests/NimbleTests/XCTestManifests.swift | 1 + .../Quick/Externals/Nimble/script/release | 4 +- .../Checkouts/Quick/Externals/Nimble/test | 16 +- Carthage/Checkouts/Quick/Gemfile | 2 +- Carthage/Checkouts/Quick/Gemfile.lock | 70 ++-- Carthage/Checkouts/Quick/Package.swift | 11 +- .../Checkouts/Quick/Package@swift-4.2.swift | 42 +++ Carthage/Checkouts/Quick/Quick.podspec | 9 +- .../Quick/Quick.xcodeproj/project.pbxproj | 136 +++++--- .../xcshareddata/xcschemes/Quick-iOS.xcscheme | 2 +- .../xcschemes/Quick-macOS.xcscheme | 2 +- .../xcschemes/Quick-tvOS.xcscheme | 2 +- Carthage/Checkouts/Quick/README.md | 1 + Carthage/Checkouts/Quick/Rakefile | 10 +- .../Quick/Sources/Quick/Behavior.swift | 8 +- .../Quick/Sources/Quick/Callsite.swift | 19 +- .../Configuration/QuickConfiguration.swift | 85 +++-- .../Quick/Sources/Quick/DSL/DSL.swift | 20 +- .../Quick/Sources/Quick/DSL/World+DSL.swift | 28 +- .../Quick/Sources/Quick/Example.swift | 17 +- .../Quick/Sources/Quick/ExampleGroup.swift | 7 + .../Quick/Sources/Quick/ExampleMetadata.swift | 2 +- .../Quick/Sources/Quick/Filter.swift | 2 +- .../Quick/NSBundle+CurrentTestBundle.swift | 2 +- .../Quick/Sources/Quick/QuickMain.swift | 9 +- .../Quick/Sources/Quick/QuickSpec.swift | 79 +++-- .../Quick/String+C99ExtendedIdentifier.swift | 46 +++ .../Checkouts/Quick/Sources/Quick/World.swift | 38 ++- .../Configuration/QuickConfiguration.m | 45 +-- .../Quick/Sources/QuickObjectiveC/QuickSpec.h | 2 +- .../Quick/Sources/QuickObjectiveC/QuickSpec.m | 74 +++-- .../Sources/QuickSpecBase/QuickSpecBase.m | 27 +- .../QuickSpecBase/include/QuickSpecBase.h | 6 +- .../Checkouts/Quick/Tests/LinuxMain.swift | 33 +- .../QuickFocusedTests/FocusedTests.swift | 4 + .../QuickTestHelpers/XCTestCaseProvider.swift | 8 +- .../FunctionalTests/CurrentSpecTests.swift | 24 +- .../QuickTests/FunctionalTests/ItTests.swift | 18 +- .../FunctionalTests/ObjC/ItTests+ObjC.m | 2 +- .../QuickSpec_SelectedTests.swift | 52 +++ ...assOfSubclassWithStructPropertyTests.swift | 11 + .../QuickTests/Helpers/QCKSpecRunner.m | 31 +- .../Helpers/QuickSpec+MethodList.swift | 24 ++ .../QuickTests/Helpers/QuickSpecRunner.swift | 93 ++++++ .../Helpers/QuickTestsBridgingHeader.h | 3 +- ...ervationCenter+QCKSuspendObservation.swift | 64 ++++ 220 files changed, 2934 insertions(+), 1834 deletions(-) create mode 100644 Carthage/Checkouts/Commandant/.hound.yml create mode 100644 Carthage/Checkouts/Commandant/.swiftlint.yml create mode 100644 Carthage/Checkouts/Commandant/Sources/Commandant/Result+Additions.swift create mode 100644 Carthage/Checkouts/Nimble/.github/workflows/ci.yml rename Carthage/Checkouts/{Quick/Externals/Nimble/Carthage/Checkouts => Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies}/CwlCatchException/LICENSE.txt (98%) create mode 100644 Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Package.swift rename Carthage/Checkouts/{Quick/Externals/Nimble/Carthage/Checkouts => Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies}/CwlCatchException/README.md (95%) rename Carthage/Checkouts/{Quick/Externals/Nimble/Carthage/Checkouts => Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies}/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift (84%) rename Carthage/Checkouts/{Quick/Externals/Nimble/Carthage/Checkouts => Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies}/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m (78%) rename Carthage/Checkouts/{Quick/Externals/Nimble/Carthage/Checkouts => Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies}/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h (83%) rename Carthage/Checkouts/{Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach => Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/include}/CwlPreconditionTesting.h (81%) create mode 100644 Carthage/Checkouts/Nimble/Package.resolved create mode 100644 Carthage/Checkouts/Nimble/Package@swift-4.2.swift create mode 100644 Carthage/Checkouts/Quick/.github/workflows/ci.yml create mode 100644 Carthage/Checkouts/Quick/Externals/Nimble/.github/workflows/ci.yml delete mode 100644 Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Package.swift create mode 100644 Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/LICENSE.txt create mode 100644 Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Package.swift create mode 100644 Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/README.md create mode 100644 Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift create mode 100644 Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m create mode 100644 Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h rename Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/{Posix/CwlPreconditionTesting_POSIX.h => include/CwlPreconditionTesting.h} (71%) create mode 100644 Carthage/Checkouts/Quick/Externals/Nimble/Package.resolved create mode 100644 Carthage/Checkouts/Quick/Externals/Nimble/Package@swift-4.2.swift create mode 100644 Carthage/Checkouts/Quick/Package@swift-4.2.swift create mode 100644 Carthage/Checkouts/Quick/Sources/Quick/String+C99ExtendedIdentifier.swift create mode 100644 Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/QuickSpec_SelectedTests.swift create mode 100644 Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/SubclassOfSubclassWithStructPropertyTests.swift create mode 100644 Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+MethodList.swift create mode 100644 Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpecRunner.swift create mode 100644 Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.swift diff --git a/Cartfile b/Cartfile index 66b8d0f..2e93317 100644 --- a/Cartfile +++ b/Cartfile @@ -1,2 +1 @@ -github "Carthage/Commandant" "master" -github "antitypical/Result" +github "Carthage/Commandant" diff --git a/Cartfile.resolved b/Cartfile.resolved index 7d9265e..c814d76 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,3 @@ -github "Carthage/Commandant" "191b3f7ba9c3c1ab148287af14345d0262748b1a" -github "Quick/Nimble" "v8.0.1" -github "Quick/Quick" "v2.0.0" -github "antitypical/Result" "4.1.0" +github "Carthage/Commandant" "0.17.0" +github "Quick/Nimble" "v8.0.4" +github "Quick/Quick" "v2.2.0" diff --git a/Carthage/Checkouts/Commandant/.gitmodules b/Carthage/Checkouts/Commandant/.gitmodules index 8283dfc..779d478 100644 --- a/Carthage/Checkouts/Commandant/.gitmodules +++ b/Carthage/Checkouts/Commandant/.gitmodules @@ -7,6 +7,3 @@ [submodule "Carthage/Checkouts/xcconfigs"] path = Carthage/Checkouts/xcconfigs url = https://github.com/jspahrsummers/xcconfigs.git -[submodule "Carthage/Checkouts/Result"] - path = Carthage/Checkouts/Result - url = https://github.com/antitypical/Result.git diff --git a/Carthage/Checkouts/Commandant/.hound.yml b/Carthage/Checkouts/Commandant/.hound.yml new file mode 100644 index 0000000..6941f63 --- /dev/null +++ b/Carthage/Checkouts/Commandant/.hound.yml @@ -0,0 +1,2 @@ +swiftlint: + config_file: .swiftlint.yml diff --git a/Carthage/Checkouts/Commandant/.swift-version b/Carthage/Checkouts/Commandant/.swift-version index bf77d54..819e07a 100644 --- a/Carthage/Checkouts/Commandant/.swift-version +++ b/Carthage/Checkouts/Commandant/.swift-version @@ -1 +1 @@ -4.2 +5.0 diff --git a/Carthage/Checkouts/Commandant/.swiftlint.yml b/Carthage/Checkouts/Commandant/.swiftlint.yml new file mode 100644 index 0000000..b561e8f --- /dev/null +++ b/Carthage/Checkouts/Commandant/.swiftlint.yml @@ -0,0 +1,13 @@ +included: + - Sources + - Tests + +disabled_rules: + - function_body_length + - identifier_name + - line_length + - opening_brace + - operator_whitespace + +trailing_comma: + mandatory_comma: true diff --git a/Carthage/Checkouts/Commandant/.travis.yml b/Carthage/Checkouts/Commandant/.travis.yml index 3ac9587..19b717b 100644 --- a/Carthage/Checkouts/Commandant/.travis.yml +++ b/Carthage/Checkouts/Commandant/.travis.yml @@ -40,33 +40,21 @@ branches: matrix: include: - - <<: *xcode - name: Xcode 10.1 / Swift 4.2.1 - osx_image: xcode10.1 - env: JOB=Xcode10.1 - <<: *xcode name: Xcode 10.2 / Swift 5.0 osx_image: xcode10.2 env: JOB=Xcode10.2 - <<: *cocoapods name: CocoaPods Lint - osx_image: xcode10.1 - - <<: *swiftpm_darwin - name: SwiftPM / Swift 4.2.1 - osx_image: xcode10.1 + osx_image: xcode10.2 - <<: *swiftpm_darwin name: SwiftPM / Swift 5.0 osx_image: xcode10.2 - <<: *swiftpm_linux - name: Linux / Swift 4.2.3 + name: Linux / Swift 5.0 env: - JOB=Linux - - SWIFT_VESION=4.2.3 - - <<: *swiftpm_linux - name: Linux / Swift 5.0 Development - env: - - JOB=Linux - - SWIFT_VERSION=5.0-DEVELOPMENT-SNAPSHOT-2019-02-28-a + - SWIFT_VERSION=5.0 notifications: email: false diff --git a/Carthage/Checkouts/Commandant/Cartfile.resolved b/Carthage/Checkouts/Commandant/Cartfile.resolved index 4ce3b13..8c30baf 100644 --- a/Carthage/Checkouts/Commandant/Cartfile.resolved +++ b/Carthage/Checkouts/Commandant/Cartfile.resolved @@ -1,4 +1,3 @@ github "Quick/Nimble" "v8.0.0" github "Quick/Quick" "v2.0.0" -github "antitypical/Result" "4.1.0" github "jspahrsummers/xcconfigs" "0.9" diff --git a/Carthage/Checkouts/Commandant/Commandant.podspec b/Carthage/Checkouts/Commandant/Commandant.podspec index ceebd8a..01428b6 100644 --- a/Carthage/Checkouts/Commandant/Commandant.podspec +++ b/Carthage/Checkouts/Commandant/Commandant.podspec @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.name = "Commandant" - s.version = "0.15.0" + s.version = "0.17.0" s.summary = "Type-safe command line argument handling" s.description = <<-DESC Commandant is a Swift framework for parsing command-line arguments, inspired by Argo @@ -25,8 +25,6 @@ Commandant is a Swift framework for parsing command-line arguments, inspired by s.source_files = "Sources/**/*.swift" - s.dependency "Result", "~> 4.0" - s.cocoapods_version = ">= 1.4.0" - s.swift_version = "4.2" + s.swift_version = "5.0" end diff --git a/Carthage/Checkouts/Commandant/Commandant.xcodeproj/project.pbxproj b/Carthage/Checkouts/Commandant/Commandant.xcodeproj/project.pbxproj index 85b879d..98b82b0 100644 --- a/Carthage/Checkouts/Commandant/Commandant.xcodeproj/project.pbxproj +++ b/Carthage/Checkouts/Commandant/Commandant.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 680759651FC5A25D00D6CA70 /* OptionsWithEnumProtocolSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 680759631FC5A1F600D6CA70 /* OptionsWithEnumProtocolSpec.swift */; }; + 7517D40F225772A90096873E /* Result+Additions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7517D40E225772A90096873E /* Result+Additions.swift */; }; CD2ED3411C1E6C5D0076092B /* Argument.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD2ED3401C1E6C5D0076092B /* Argument.swift */; }; CD2ED3431C1E6D540076092B /* ArgumentProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD2ED3421C1E6D540076092B /* ArgumentProtocol.swift */; }; CDCE78341FBAB047005A9F76 /* OrderedSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDCE78331FBAB047005A9F76 /* OrderedSet.swift */; }; @@ -22,7 +23,6 @@ D00CCE2B1A20748500109F8C /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00CCE2A1A20748500109F8C /* Errors.swift */; }; D00CCE2D1A2075ED00109F8C /* ArgumentParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00CCE2C1A2075ED00109F8C /* ArgumentParser.swift */; }; D00CCE2F1A2075F700109F8C /* Option.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00CCE2E1A2075F700109F8C /* Option.swift */; }; - D021309A1AF87D6E00B9EC20 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D02130981AF87D6E00B9EC20 /* Result.framework */; }; D0BF14FB1A4C8957003147BC /* HelpCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BF14FA1A4C8957003147BC /* HelpCommand.swift */; }; D8169D871ACB942D00923FB0 /* Switch.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8169D861ACB942D00923FB0 /* Switch.swift */; }; /* End PBXBuildFile section */ @@ -40,6 +40,7 @@ /* Begin PBXFileReference section */ 680759631FC5A1F600D6CA70 /* OptionsWithEnumProtocolSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OptionsWithEnumProtocolSpec.swift; sourceTree = ""; }; 6CAD549C1D371A4E00A2D031 /* LinuxMain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = LinuxMain.swift; path = Tests/LinuxMain.swift; sourceTree = SOURCE_ROOT; }; + 7517D40E225772A90096873E /* Result+Additions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Result+Additions.swift"; sourceTree = ""; }; CD2ED3401C1E6C5D0076092B /* Argument.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Argument.swift; sourceTree = ""; }; CD2ED3421C1E6D540076092B /* ArgumentProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArgumentProtocol.swift; sourceTree = ""; }; CDCE78331FBAB047005A9F76 /* OrderedSet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderedSet.swift; sourceTree = ""; }; @@ -75,7 +76,6 @@ D00CCE2A1A20748500109F8C /* Errors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Errors.swift; sourceTree = ""; }; D00CCE2C1A2075ED00109F8C /* ArgumentParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArgumentParser.swift; sourceTree = ""; }; D00CCE2E1A2075F700109F8C /* Option.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Option.swift; sourceTree = ""; }; - D02130981AF87D6E00B9EC20 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D0BF14FA1A4C8957003147BC /* HelpCommand.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HelpCommand.swift; sourceTree = ""; }; D8169D861ACB942D00923FB0 /* Switch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Switch.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -85,7 +85,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D021309A1AF87D6E00B9EC20 /* Result.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -137,7 +136,6 @@ D00CCDDC1A20717400109F8C /* Supporting Files */ = { isa = PBXGroup; children = ( - D02130981AF87D6E00B9EC20 /* Result.framework */, D00CCDDD1A20717400109F8C /* Info.plist */, ); name = "Supporting Files"; @@ -244,6 +242,7 @@ D00CCE2E1A2075F700109F8C /* Option.swift */, CDCE78331FBAB047005A9F76 /* OrderedSet.swift */, D8169D861ACB942D00923FB0 /* Switch.swift */, + 7517D40E225772A90096873E /* Result+Additions.swift */, ); name = Core; sourceTree = ""; @@ -332,6 +331,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = D00CCDCF1A20717400109F8C; @@ -375,6 +375,7 @@ D00CCE2B1A20748500109F8C /* Errors.swift in Sources */, D8169D871ACB942D00923FB0 /* Switch.swift in Sources */, D00CCE271A20741300109F8C /* Command.swift in Sources */, + 7517D40F225772A90096873E /* Result+Additions.swift in Sources */, D00CCE2D1A2075ED00109F8C /* ArgumentParser.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -417,7 +418,7 @@ ENABLE_TESTABILITY = YES; MACOSX_DEPLOYMENT_TARGET = 10.9; ONLY_ACTIVE_ARCH = YES; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -438,7 +439,7 @@ CURRENT_PROJECT_VERSION = 1; MACOSX_DEPLOYMENT_TARGET = 10.9; SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -521,7 +522,7 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CURRENT_PROJECT_VERSION = 1; MACOSX_DEPLOYMENT_TARGET = 10.9; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -572,7 +573,7 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CURRENT_PROJECT_VERSION = 1; MACOSX_DEPLOYMENT_TARGET = 10.9; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; diff --git a/Carthage/Checkouts/Commandant/Commandant.xcworkspace/contents.xcworkspacedata b/Carthage/Checkouts/Commandant/Commandant.xcworkspace/contents.xcworkspacedata index 1582c71..b4a1306 100644 --- a/Carthage/Checkouts/Commandant/Commandant.xcworkspace/contents.xcworkspacedata +++ b/Carthage/Checkouts/Commandant/Commandant.xcworkspace/contents.xcworkspacedata @@ -10,7 +10,4 @@ - - diff --git a/Carthage/Checkouts/Commandant/Package.resolved b/Carthage/Checkouts/Commandant/Package.resolved index 55eb058..6568272 100644 --- a/Carthage/Checkouts/Commandant/Package.resolved +++ b/Carthage/Checkouts/Commandant/Package.resolved @@ -18,15 +18,6 @@ "revision": "0b4ed6c706dd0cce923b5019a605a9bcc6b1b600", "version": "2.0.0" } - }, - { - "package": "Result", - "repositoryURL": "https://github.com/antitypical/Result.git", - "state": { - "branch": null, - "revision": "2ca499ba456795616fbc471561ff1d963e6ae160", - "version": "4.1.0" - } } ] }, diff --git a/Carthage/Checkouts/Commandant/Package.swift b/Carthage/Checkouts/Commandant/Package.swift index 2d21f1f..9096684 100644 --- a/Carthage/Checkouts/Commandant/Package.swift +++ b/Carthage/Checkouts/Commandant/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:4.2 +// swift-tools-version:5.0 import PackageDescription @@ -8,13 +8,12 @@ let package = Package( .library(name: "Commandant", targets: ["Commandant"]), ], dependencies: [ - .package(url: "https://github.com/antitypical/Result.git", from: "4.0.0"), .package(url: "https://github.com/Quick/Quick.git", from: "2.0.0"), - .package(url: "https://github.com/Quick/Nimble.git", from: "8.0.0") + .package(url: "https://github.com/Quick/Nimble.git", from: "8.0.0"), ], targets: [ - .target(name: "Commandant", dependencies: ["Result"]), - .testTarget(name: "CommandantTests", dependencies: ["Commandant", "Quick", "Nimble"]) + .target(name: "Commandant", dependencies: []), + .testTarget(name: "CommandantTests", dependencies: ["Commandant", "Quick", "Nimble"]), ], - swiftLanguageVersions: [.v4_2, .version("5")] + swiftLanguageVersions: [.v5] ) diff --git a/Carthage/Checkouts/Commandant/Sources/Commandant/Argument.swift b/Carthage/Checkouts/Commandant/Sources/Commandant/Argument.swift index cd7ff65..5383767 100644 --- a/Carthage/Checkouts/Commandant/Sources/Commandant/Argument.swift +++ b/Carthage/Checkouts/Commandant/Sources/Commandant/Argument.swift @@ -6,8 +6,6 @@ // Copyright (c) 2015 Carthage. All rights reserved. // -import Result - /// Describes an argument that can be provided on the command line. public struct Argument { /// The default value for this argument. This is the value that will be used diff --git a/Carthage/Checkouts/Commandant/Sources/Commandant/ArgumentParser.swift b/Carthage/Checkouts/Commandant/Sources/Commandant/ArgumentParser.swift index 22a9542..c36e640 100644 --- a/Carthage/Checkouts/Commandant/Sources/Commandant/ArgumentParser.swift +++ b/Carthage/Checkouts/Commandant/Sources/Commandant/ArgumentParser.swift @@ -7,7 +7,6 @@ // import Foundation -import Result /// Represents an argument passed on the command line. private enum RawArgument: Equatable { @@ -104,7 +103,7 @@ public final class ArgumentParser { /// /// If a value is found, the key and the value are both removed from the /// list of arguments remaining to be parsed. - internal func consumeValue(forKey key: String) -> Result> { + internal func consumeValue(forKey key: String) -> Result> { let oldArguments = rawArguments rawArguments.removeAll() diff --git a/Carthage/Checkouts/Commandant/Sources/Commandant/Command.swift b/Carthage/Checkouts/Commandant/Sources/Commandant/Command.swift index d7ebcd1..db5b9ba 100644 --- a/Carthage/Checkouts/Commandant/Sources/Commandant/Command.swift +++ b/Carthage/Checkouts/Commandant/Sources/Commandant/Command.swift @@ -7,16 +7,15 @@ // import Foundation -import Result /// Represents a subcommand that can be executed with its own set of arguments. public protocol CommandProtocol { - + /// The command's options type. associatedtype Options: OptionsProtocol associatedtype ClientError where ClientError == Options.ClientError - + /// The action that users should specify to use this subcommand (e.g., /// `help`). var verb: String { get } @@ -33,9 +32,9 @@ public protocol CommandProtocol { public struct CommandWrapper { public let verb: String public let function: String - + public let run: (ArgumentParser) -> Result<(), CommandantError> - + public let usage: () -> CommandantError? /// Creates a command that wraps another. @@ -134,10 +133,10 @@ extension CommandRegistry { /// If a matching command could not be found or a usage error occurred, /// a helpful error message will be written to `stderr`, then the process /// will exit with a failure error code. - public func main(defaultVerb: String, errorHandler: (ClientError) -> ()) -> Never { + public func main(defaultVerb: String, errorHandler: (ClientError) -> Void) -> Never { main(arguments: CommandLine.arguments, defaultVerb: defaultVerb, errorHandler: errorHandler) } - + /// Hands off execution to the CommandRegistry, by parsing `arguments` /// and then running whichever command has been identified in the argument /// list. @@ -155,7 +154,7 @@ extension CommandRegistry { /// If a matching command could not be found or a usage error occurred, /// a helpful error message will be written to `stderr`, then the process /// will exit with a failure error code. - public func main(arguments: [String], defaultVerb: String, errorHandler: (ClientError) -> ()) -> Never { + public func main(arguments: [String], defaultVerb: String, errorHandler: (ClientError) -> Void) -> Never { assert(arguments.count >= 1) var arguments = arguments @@ -170,7 +169,7 @@ extension CommandRegistry { // Remove the command name. arguments.remove(at: 0) } - + switch run(command: verb, arguments: arguments) { case .success?: exit(EXIT_SUCCESS) diff --git a/Carthage/Checkouts/Commandant/Sources/Commandant/Errors.swift b/Carthage/Checkouts/Commandant/Sources/Commandant/Errors.swift index f54bff0..30d1e5c 100644 --- a/Carthage/Checkouts/Commandant/Sources/Commandant/Errors.swift +++ b/Carthage/Checkouts/Commandant/Sources/Commandant/Errors.swift @@ -7,7 +7,6 @@ // import Foundation -import Result /// Possible errors that can originate from Commandant. /// diff --git a/Carthage/Checkouts/Commandant/Sources/Commandant/HelpCommand.swift b/Carthage/Checkouts/Commandant/Sources/Commandant/HelpCommand.swift index fa4ac4b..0fd3bbf 100644 --- a/Carthage/Checkouts/Commandant/Sources/Commandant/HelpCommand.swift +++ b/Carthage/Checkouts/Commandant/Sources/Commandant/HelpCommand.swift @@ -7,7 +7,6 @@ // import Foundation -import Result /// A basic implementation of a `help` command, using information available in a /// `CommandRegistry`. @@ -23,7 +22,7 @@ public struct HelpCommand: CommandProtocol { public let verb = "help" public let function: String - + private let registry: CommandRegistry /// Initializes the command to provide help from the given registry of @@ -61,7 +60,7 @@ public struct HelpCommand: CommandProtocol { public struct HelpOptions: OptionsProtocol { fileprivate let verb: String? - + private init(verb: String?) { self.verb = verb } diff --git a/Carthage/Checkouts/Commandant/Sources/Commandant/Info.plist b/Carthage/Checkouts/Commandant/Sources/Commandant/Info.plist index b3edca9..19bd642 100644 --- a/Carthage/Checkouts/Commandant/Sources/Commandant/Info.plist +++ b/Carthage/Checkouts/Commandant/Sources/Commandant/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.15.0 + 0.17.0 CFBundleSignature ???? CFBundleVersion diff --git a/Carthage/Checkouts/Commandant/Sources/Commandant/Option.swift b/Carthage/Checkouts/Commandant/Sources/Commandant/Option.swift index 9069a8a..1b04771 100644 --- a/Carthage/Checkouts/Commandant/Sources/Commandant/Option.swift +++ b/Carthage/Checkouts/Commandant/Sources/Commandant/Option.swift @@ -7,7 +7,6 @@ // import Foundation -import Result /// Represents a record of options for a command, which can be parsed from /// a list of command-line arguments. @@ -47,7 +46,7 @@ public protocol OptionsProtocol { /// An `OptionsProtocol` that has no options. public struct NoOptions: OptionsProtocol { public init() {} - + public static func evaluate(_ m: CommandMode) -> Result> { return .success(NoOptions()) } @@ -184,7 +183,7 @@ extension CommandMode { if let value = T.from(string: stringValue) { return .success(value) } - + let description = "Invalid value for '--\(key)': \(stringValue)" return .failure(.usageError(description: description)) } else { diff --git a/Carthage/Checkouts/Commandant/Sources/Commandant/Result+Additions.swift b/Carthage/Checkouts/Commandant/Sources/Commandant/Result+Additions.swift new file mode 100644 index 0000000..28d043d --- /dev/null +++ b/Carthage/Checkouts/Commandant/Sources/Commandant/Result+Additions.swift @@ -0,0 +1,27 @@ +// +// Result+Additions.swift +// Commandant +// +// Created by Dalton Claybrook on 4/5/19. +// Copyright © 2019 Carthage. All rights reserved. +// + +internal extension Result { + var value: Success? { + switch self { + case .success(let value): + return value + case .failure: + return nil + } + } + + var error: Failure? { + switch self { + case .success: + return nil + case .failure(let error): + return error + } + } +} diff --git a/Carthage/Checkouts/Commandant/Sources/Commandant/Switch.swift b/Carthage/Checkouts/Commandant/Sources/Commandant/Switch.swift index 5ed21ad..714b115 100644 --- a/Carthage/Checkouts/Commandant/Sources/Commandant/Switch.swift +++ b/Carthage/Checkouts/Commandant/Sources/Commandant/Switch.swift @@ -6,8 +6,6 @@ // Copyright (c) 2015 Carthage. All rights reserved. // -import Result - /// Describes a parameterless command line flag that defaults to false and can only /// be switched on. Canonical examples include `--force` and `--recurse`. /// diff --git a/Carthage/Checkouts/Commandant/Tests/CommandantTests/CommandSpec.swift b/Carthage/Checkouts/Commandant/Tests/CommandantTests/CommandSpec.swift index 1e18990..af270a0 100644 --- a/Carthage/Checkouts/Commandant/Tests/CommandantTests/CommandSpec.swift +++ b/Carthage/Checkouts/Commandant/Tests/CommandantTests/CommandSpec.swift @@ -9,7 +9,6 @@ import Commandant import Nimble import Quick -import Result class CommandWrapperSpec: QuickSpec { override func spec() { diff --git a/Carthage/Checkouts/Commandant/Tests/CommandantTests/Info.plist b/Carthage/Checkouts/Commandant/Tests/CommandantTests/Info.plist index cb62578..0189359 100644 --- a/Carthage/Checkouts/Commandant/Tests/CommandantTests/Info.plist +++ b/Carthage/Checkouts/Commandant/Tests/CommandantTests/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 0.15.0 + 0.17.0 CFBundleSignature ???? CFBundleVersion diff --git a/Carthage/Checkouts/Commandant/Tests/CommandantTests/OptionSpec.swift b/Carthage/Checkouts/Commandant/Tests/CommandantTests/OptionSpec.swift index d75b8e1..a9bb258 100644 --- a/Carthage/Checkouts/Commandant/Tests/CommandantTests/OptionSpec.swift +++ b/Carthage/Checkouts/Commandant/Tests/CommandantTests/OptionSpec.swift @@ -10,12 +10,11 @@ import Foundation import Nimble import Quick -import Result class OptionsProtocolSpec: QuickSpec { override func spec() { describe("CommandMode.Arguments") { - func tryArguments(_ arguments: String...) -> Result> { + func tryArguments(_ arguments: String...) -> Result> { return TestOptions.evaluate(.arguments(ArgumentParser(arguments))) } @@ -35,34 +34,34 @@ class OptionsProtocolSpec: QuickSpec { it("should succeed with some strings array arguments separated by comma") { let value = tryArguments("required", "--intValue", "3", "--optionalStringValue", "baz", "fuzzbuzz", "--stringsArray", "a,b,c").value - let expected = TestOptions(intValue: 3, stringValue: "foobar", stringsArray: ["a","b","c"], optionalStringsArray: nil, optionalStringValue: "baz", optionalFilename: "fuzzbuzz", requiredName: "required", enabled: false, force: false, glob: false, arguments: []) + let expected = TestOptions(intValue: 3, stringValue: "foobar", stringsArray: ["a", "b", "c"], optionalStringsArray: nil, optionalStringValue: "baz", optionalFilename: "fuzzbuzz", requiredName: "required", enabled: false, force: false, glob: false, arguments: []) expect(value).to(equal(expected)) } - + it("should succeed with some strings array arguments separated by space") { let value = tryArguments("required", "--intValue", "3", "--optionalStringValue", "baz", "--stringsArray", "a b c", "fuzzbuzz").value let expected = TestOptions(intValue: 3, stringValue: "foobar", stringsArray: ["a", "b", "c"], optionalStringsArray: nil, optionalStringValue: "baz", optionalFilename: "fuzzbuzz", requiredName: "required", enabled: false, force: false, glob: false, arguments: []) expect(value).to(equal(expected)) } - + it("should succeed with some strings array arguments separated by comma and space") { let value = tryArguments("required", "--intValue", "3", "--optionalStringValue", "baz", "--stringsArray", "a, b, c", "fuzzbuzz").value let expected = TestOptions(intValue: 3, stringValue: "foobar", stringsArray: ["a", "b", "c"], optionalStringsArray: nil, optionalStringValue: "baz", optionalFilename: "fuzzbuzz", requiredName: "required", enabled: false, force: false, glob: false, arguments: []) expect(value).to(equal(expected)) } - + it("should succeed with some optional string arguments") { let value = tryArguments("required", "--intValue", "3", "--optionalStringValue", "baz", "fuzzbuzz").value let expected = TestOptions(intValue: 3, stringValue: "foobar", stringsArray: [], optionalStringsArray: nil, optionalStringValue: "baz", optionalFilename: "fuzzbuzz", requiredName: "required", enabled: false, force: false, glob: false, arguments: []) expect(value).to(equal(expected)) } - + it("should succeed without optional array arguments") { let value = tryArguments("required").value let expected = TestOptions(intValue: 42, stringValue: "foobar", stringsArray: [], optionalStringsArray: nil, optionalStringValue: nil, optionalFilename: "filename", requiredName: "required", enabled: false, force: false, glob: false, arguments: []) expect(value).to(equal(expected)) } - + it("should succeed with some optional array arguments") { let value = tryArguments("required", "--intValue", "3", "--optionalStringsArray", "one, two", "fuzzbuzz").value let expected = TestOptions(intValue: 3, stringValue: "foobar", stringsArray: [], optionalStringsArray: ["one", "two"], optionalStringValue: nil, optionalFilename: "fuzzbuzz", requiredName: "required", enabled: false, force: false, glob: false, arguments: []) @@ -149,7 +148,7 @@ struct TestOptions: OptionsProtocol, Equatable { let glob: Bool let arguments: [String] - typealias ClientError = NoError + typealias ClientError = Never static func create(_ a: Int) -> (String) -> ([String]) -> ([String]?) -> (String?) -> (String) -> (String) -> (Bool) -> (Bool) -> (Bool) -> ([String]) -> TestOptions { return { b in { c in { d in { e in { f in { g in { h in { i in { j in { k in @@ -157,7 +156,7 @@ struct TestOptions: OptionsProtocol, Equatable { } } } } } } } } } } } - static func evaluate(_ m: CommandMode) -> Result> { + static func evaluate(_ m: CommandMode) -> Result> { return create <*> m <| Option(key: "intValue", defaultValue: 42, usage: "Some integer value") <*> m <| Option(key: "stringValue", defaultValue: "foobar", usage: "Some string value") @@ -178,7 +177,7 @@ func ==(lhs: TestOptions, rhs: TestOptions) -> Bool { } func ==(lhs: [T]?, rhs: [T]?) -> Bool { - switch (lhs,rhs) { + switch (lhs, rhs) { case let (lhs?, rhs?): return lhs == rhs case (nil, nil): diff --git a/Carthage/Checkouts/Commandant/Tests/CommandantTests/OptionsWithEnumProtocolSpec.swift b/Carthage/Checkouts/Commandant/Tests/CommandantTests/OptionsWithEnumProtocolSpec.swift index 650a17c..a72756b 100644 --- a/Carthage/Checkouts/Commandant/Tests/CommandantTests/OptionsWithEnumProtocolSpec.swift +++ b/Carthage/Checkouts/Commandant/Tests/CommandantTests/OptionsWithEnumProtocolSpec.swift @@ -10,15 +10,14 @@ import Foundation import Nimble import Quick -import Result class OptionsWithEnumProtocolSpec: QuickSpec { override func spec() { describe("CommandMode.Arguments") { - func tryArguments(_ arguments: String...) -> Result> { + func tryArguments(_ arguments: String...) -> Result> { return TestEnumOptions.evaluate(.arguments(ArgumentParser(arguments))) } - + it("should fail if a required argument is missing") { expect(tryArguments().value).to(beNil()) } @@ -30,78 +29,78 @@ class OptionsWithEnumProtocolSpec: QuickSpec { it("should fail if an option is missing a value") { expect(tryArguments("required", "--strictStringValue", "drop").value).to(beNil()) } - + it("should fail if an optional strict int parameter is wrong") { expect(tryArguments("required", "256").value).to(beNil()) } - + it("should succeed without optional string arguments") { let value = tryArguments("required").value let expected = TestEnumOptions(strictIntValue: .theAnswerToTheUltimateQuestionOfLifeTheUniverseAndEverything, strictStringValue: .foobar, strictStringsArray: [], optionalStrictStringsArray: nil, optionalStrictStringValue: nil, optionalStrictInt: .min, requiredName: "required", arguments: []) expect(value).to(equal(expected)) } - + it("should succeed without optional strict int value") { let value = tryArguments("required", "5").value let expected = TestEnumOptions(strictIntValue: .theAnswerToTheUltimateQuestionOfLifeTheUniverseAndEverything, strictStringValue: .foobar, strictStringsArray: [], optionalStrictStringsArray: nil, optionalStrictStringValue: nil, optionalStrictInt: .giveFive, requiredName: "required", arguments: []) expect(value).to(equal(expected)) } - + it("should succeed with some strings array arguments separated by comma") { let value = tryArguments("required", "--strictIntValue", "3", "--optionalStrictStringValue", "baz", "255", "--strictStringsArray", "a,b,c").value let expected = TestEnumOptions(strictIntValue: .three, strictStringValue: .foobar, strictStringsArray: [.a, .b, .c], optionalStrictStringsArray: nil, optionalStrictStringValue: .baz, optionalStrictInt: .max, requiredName: "required", arguments: []) expect(value).to(equal(expected)) } - + it("should succeed with some strings array arguments separated by space") { let value = tryArguments("required", "--strictIntValue", "3", "--optionalStrictStringValue", "baz", "--strictStringsArray", "a b c", "255").value let expected = TestEnumOptions(strictIntValue: .three, strictStringValue: .foobar, strictStringsArray: [.a, .b, .c], optionalStrictStringsArray: nil, optionalStrictStringValue: .baz, optionalStrictInt: .max, requiredName: "required", arguments: []) expect(value).to(equal(expected)) } - + it("should succeed with some strings array arguments separated by comma and space") { let value = tryArguments("required", "--strictIntValue", "3", "--optionalStrictStringValue", "baz", "--strictStringsArray", "a, b, c", "255").value let expected = TestEnumOptions(strictIntValue: .three, strictStringValue: .foobar, strictStringsArray: [.a, .b, .c], optionalStrictStringsArray: nil, optionalStrictStringValue: .baz, optionalStrictInt: .max, requiredName: "required", arguments: []) expect(value).to(equal(expected)) } - + it("should succeed with some optional string arguments") { let value = tryArguments("required", "--strictIntValue", "3", "--optionalStrictStringValue", "baz", "255").value let expected = TestEnumOptions(strictIntValue: .three, strictStringValue: .foobar, strictStringsArray: [], optionalStrictStringsArray: nil, optionalStrictStringValue: .baz, optionalStrictInt: .max, requiredName: "required", arguments: []) expect(value).to(equal(expected)) } - + it("should succeed without optional array arguments") { let value = tryArguments("required").value let expected = TestEnumOptions(strictIntValue: .theAnswerToTheUltimateQuestionOfLifeTheUniverseAndEverything, strictStringValue: .foobar, strictStringsArray: [], optionalStrictStringsArray: nil, optionalStrictStringValue: nil, optionalStrictInt: .min, requiredName: "required", arguments: []) expect(value).to(equal(expected)) } - + it("should succeed with some optional array arguments") { let value = tryArguments("required", "--strictIntValue", "3", "--optionalStrictStringsArray", "one, two", "255").value let expected = TestEnumOptions(strictIntValue: .three, strictStringValue: .foobar, strictStringsArray: [], optionalStrictStringsArray: [.one, .two], optionalStrictStringValue: nil, optionalStrictInt: .max, requiredName: "required", arguments: []) expect(value).to(equal(expected)) } - + it("should override previous optional arguments") { let value = tryArguments("required", "--strictIntValue", "3", "--strictStringValue", "fuzzbuzz", "--strictIntValue", "5", "--strictStringValue", "bazbuzz").value let expected = TestEnumOptions(strictIntValue: .giveFive, strictStringValue: .bazbuzz, strictStringsArray: [], optionalStrictStringsArray: nil, optionalStrictStringValue: nil, optionalStrictInt: .min, requiredName: "required", arguments: []) expect(value).to(equal(expected)) } - + it("should consume the rest of positional arguments") { let value = tryArguments("required", "255", "value1", "value2").value let expected = TestEnumOptions(strictIntValue: .theAnswerToTheUltimateQuestionOfLifeTheUniverseAndEverything, strictStringValue: .foobar, strictStringsArray: [], optionalStrictStringsArray: nil, optionalStrictStringValue: nil, optionalStrictInt: .max, requiredName: "required", arguments: [ "value1", "value2" ]) expect(value).to(equal(expected)) } - + it("should treat -- as the end of valued options") { let value = tryArguments("--", "--strictIntValue").value let expected = TestEnumOptions(strictIntValue: .theAnswerToTheUltimateQuestionOfLifeTheUniverseAndEverything, strictStringValue: .foobar, strictStringsArray: [], optionalStrictStringsArray: nil, optionalStrictStringValue: nil, optionalStrictInt: .min, requiredName: "--strictIntValue", arguments: []) expect(value).to(equal(expected)) } } - + describe("CommandMode.Usage") { it("should return an error containing usage information") { let error = TestEnumOptions.evaluate(.usage).error @@ -123,16 +122,16 @@ struct TestEnumOptions: OptionsProtocol, Equatable { let optionalStrictInt: StrictIntValue let requiredName: String let arguments: [String] - - typealias ClientError = NoError - + + typealias ClientError = Never + static func create(_ a: StrictIntValue) -> (StrictStringValue) -> ([StrictStringValue]) -> ([StrictStringValue]?) -> (StrictStringValue?) -> (String) -> (StrictIntValue) -> ([String]) -> TestEnumOptions { return { b in { c in { d in { e in { f in { g in { h in return self.init(strictIntValue: a, strictStringValue: b, strictStringsArray: c, optionalStrictStringsArray: d, optionalStrictStringValue: e, optionalStrictInt: g, requiredName: f, arguments: h) } } } } } } } } - - static func evaluate(_ m: CommandMode) -> Result> { + + static func evaluate(_ m: CommandMode) -> Result> { return create <*> m <| Option(key: "strictIntValue", defaultValue: .theAnswerToTheUltimateQuestionOfLifeTheUniverseAndEverything, usage: "`0` - zero, `255` - max, `3` - three, `5` - five or `42` - The Answer") <*> m <| Option(key: "strictStringValue", defaultValue: .foobar, usage: "`foobar`, `bazbuzzz`, `a`, `b`, `c`, `one`, `two`, `c`") @@ -157,7 +156,7 @@ extension TestEnumOptions: CustomStringConvertible { enum StrictStringValue: String, ArgumentProtocol { static var name: String = "Strict string value: `foobar`, `bazbuzz`, `one`, `two`, `baz`, `a`, `b` or `c`" - + case foobar case bazbuzz case one @@ -170,7 +169,7 @@ enum StrictStringValue: String, ArgumentProtocol { enum StrictIntValue: UInt8, ArgumentProtocol { static var name: String = "Strict int value: `3`, `5`, `42`, `0`, `255`" - + case min = 0 case three = 3 case giveFive = 5 diff --git a/Carthage/Checkouts/Nimble/.github/workflows/ci.yml b/Carthage/Checkouts/Nimble/.github/workflows/ci.yml new file mode 100644 index 0000000..2c4109d --- /dev/null +++ b/Carthage/Checkouts/Nimble/.github/workflows/ci.yml @@ -0,0 +1,46 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - '*' + +jobs: + cocoapods: + name: CocoaPods Lint + runs-on: macOS-10.14 + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-ruby@v1 + with: + ruby-version: '2.x' + - run: sudo xcode-select -s '/Applications/Xcode_10.3.app' + - run: bundle install --jobs=8 + - run: ./test podspec + + xcode: + name: Xcode ${{ matrix.xcode }} + runs-on: macOS-10.14 + strategy: + matrix: + xcode: [10.1, 10.3, 11] + steps: + - uses: actions/checkout@v1 + - run: sudo xcode-select -s '/Applications/Xcode_${{ matrix.xcode }}.app' + - run: ./test macos + - run: ./test ios + - run: ./test tvos + + swiftpm_darwin: + name: SwiftPM, Darwin, Xcode ${{ matrix.xcode }} + runs-on: macOS-10.14 + strategy: + matrix: + xcode: [10.1, 10.3, 11] + steps: + - uses: actions/checkout@v1 + - run: sudo xcode-select -s '/Applications/Xcode_${{ matrix.xcode }}.app' + - run: ./test swiftpm diff --git a/Carthage/Checkouts/Nimble/.hound.yml b/Carthage/Checkouts/Nimble/.hound.yml index b867fd9..f180504 100644 --- a/Carthage/Checkouts/Nimble/.hound.yml +++ b/Carthage/Checkouts/Nimble/.hound.yml @@ -1,2 +1,2 @@ -swift: +swiftlint: config_file: .swiftlint.yml diff --git a/Carthage/Checkouts/Nimble/.travis.yml b/Carthage/Checkouts/Nimble/.travis.yml index fb72977..7d1047d 100644 --- a/Carthage/Checkouts/Nimble/.travis.yml +++ b/Carthage/Checkouts/Nimble/.travis.yml @@ -1,49 +1,29 @@ -osx_image: xcode10.1 +branches: + only: + - master + language: generic matrix: include: - - os: osx - sudo: required - env: TYPE=podspec - install: bundle install - name: CocoaPods Lint - - os: osx - env: TYPE=ios - name: iOS / Swift 4.2.1 - - os: osx - env: TYPE=tvos - name: tvOS / Swift 4.2.1 - - os: osx - env: TYPE=macos - name: macOS / Swift 4.2.1 - - os: osx - env: TYPE=macos - osx_image: xcode10.2 - name: macOS / Swift 5.0 - - os: osx - env: - - TYPE=swiftpm - - os: osx - env: - - TYPE=swiftpm - osx_image: xcode10.2 - - &linux - name: Linux / Swift 4.2.1 + - &swiftpm_linux + name: SwiftPM / Linux / Swift 4.2.4 os: linux dist: trusty sudo: required env: - - TYPE=swiftpm - - SWIFT_VERSION=4.2.1 + - SWIFT_VERSION=4.2.4 install: - - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" - - <<: *linux - name: Linux / Swift 5.0 Development + - eval "$(curl -sL https://swiftenv.fuller.li/install.sh)" + script: + - ./test swiftpm + - <<: *swiftpm_linux + name: SwiftPM / Linux / Swift 5.0.3 env: - - TYPE=swiftpm - - SWIFT_VERSION=5.0-DEVELOPMENT-SNAPSHOT-2019-02-28-a - install: - - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" + - SWIFT_VERSION=5.0.3 + - <<: *swiftpm_linux + name: SwiftPM / Linux / Swift 5.1 Development + env: + - SWIFT_VERSION=5.1-DEVELOPMENT-SNAPSHOT-2019-09-05-a install: true script: - ./test $TYPE diff --git a/Carthage/Checkouts/Nimble/Cartfile.private b/Carthage/Checkouts/Nimble/Cartfile.private index 23d7e11..b5ed77e 100644 --- a/Carthage/Checkouts/Nimble/Cartfile.private +++ b/Carthage/Checkouts/Nimble/Cartfile.private @@ -1 +1 @@ -github "mattgallagher/CwlPreconditionTesting" "1e62a726d54c743f4585233f08fcaac7307319b5" +github "mattgallagher/CwlPreconditionTesting" == 1.2.0 diff --git a/Carthage/Checkouts/Nimble/Cartfile.resolved b/Carthage/Checkouts/Nimble/Cartfile.resolved index 32a1c25..fbe6949 100644 --- a/Carthage/Checkouts/Nimble/Cartfile.resolved +++ b/Carthage/Checkouts/Nimble/Cartfile.resolved @@ -1,2 +1 @@ -github "mattgallagher/CwlCatchException" "b14c111e9b33cd142bd4bc75c482cfd5c3490923" -github "mattgallagher/CwlPreconditionTesting" "1e62a726d54c743f4585233f08fcaac7307319b5" +github "mattgallagher/CwlPreconditionTesting" "1.2.0" diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/LICENSE.txt b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/LICENSE.txt similarity index 98% rename from Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/LICENSE.txt rename to Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/LICENSE.txt index ca8f5b8..693a2fe 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/LICENSE.txt +++ b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/LICENSE.txt @@ -1,3 +1,5 @@ +ISC License + Copyright © 2017 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. Permission to use, copy, modify, and/or distribute this software for any diff --git a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Package.swift b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Package.swift new file mode 100644 index 0000000..33689a2 --- /dev/null +++ b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Package.swift @@ -0,0 +1,14 @@ +// swift-tools-version:4.2 +import PackageDescription + +let package = Package( + name: "CwlCatchException", + products: [ + .library(name: "CwlCatchException", targets: ["CwlCatchException"]), + ], + targets: [ + .target(name: "CwlCatchException", dependencies: [.target(name: "CwlCatchExceptionSupport")]), + .target(name: "CwlCatchExceptionSupport"), + .testTarget(name: "CwlCatchExceptionTests", dependencies: [.target(name: "CwlCatchException")]) + ] +) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/README.md b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/README.md similarity index 95% rename from Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/README.md rename to Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/README.md index 0f97b03..052d7c0 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/README.md +++ b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/README.md @@ -1,7 +1,7 @@ # CwlCatchException A simple Swift wrapper around an Objective-C `@try`/`@catch` statement that selectively catches Objective-C exceptions by `NSException` subtype, rethrowing if any caught exception is not the expected subtype. -Look at [CwlCatchExceptionTests.swift](https://github.com/mattgallagher/CwlCatchException/blob/master/CwlCatchExceptionTests/CwlCatchExceptionTests.swift?ts=4) for syntax. +Look at [CwlCatchExceptionTests.swift](https://github.com/mattgallagher/CwlCatchException/blob/master/Tests/CwlCatchExceptionTests/CwlCatchExceptionTests.swift) for syntax. ## Adding to your project diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift similarity index 84% rename from Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift rename to Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift index 3e89e23..2cb9b29 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift +++ b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift @@ -3,7 +3,7 @@ // CwlAssertionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -24,12 +24,12 @@ import Foundation import CwlCatchExceptionSupport #endif -private func catchReturnTypeConverter(_ type: T.Type, block: () -> Void) -> T? { +private func catchReturnTypeConverter(_ type: T.Type, block: @escaping () -> Void) -> T? { return catchExceptionOfKind(type, block) as? T } extension NSException { - public static func catchException(in block: () -> Void) -> Self? { + public static func catchException(in block: @escaping () -> Void) -> Self? { return catchReturnTypeConverter(self, block: block) } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m similarity index 78% rename from Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m rename to Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m index 8cf414f..ff35465 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m +++ b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m @@ -3,7 +3,7 @@ // CwlAssertionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -20,10 +20,7 @@ #import "CwlCatchException.h" -#if !SWIFT_PACKAGE && NON_SWIFT_PACKAGE -__attribute__((visibility("hidden"))) -#endif -NSException* catchExceptionOfKind(Class __nonnull type, __attribute__((noescape)) void (^ __nonnull inBlock)(void)) { +NSException* __nullable catchExceptionOfKind(Class __nonnull type, void (^ __nonnull inBlock)(void)) { @try { inBlock(); } @catch (NSException *exception) { diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h similarity index 83% rename from Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h rename to Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h index 0c8dd87..47b06bf 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h +++ b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h @@ -3,7 +3,7 @@ // CwlCatchException // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -26,7 +26,4 @@ FOUNDATION_EXPORT double CwlCatchExceptionVersionNumber; //! Project version string for CwlCatchException. FOUNDATION_EXPORT const unsigned char CwlCatchExceptionVersionString[]; -#if !SWIFT_PACKAGE && NON_SWIFT_PACKAGE -__attribute__((visibility("hidden"))) -#endif -NSException* __nullable catchExceptionOfKind(Class __nonnull type, __attribute__((noescape)) void (^ __nonnull inBlock)(void)); +NSException* __nullable catchExceptionOfKind(Class __nonnull type, void (^ __nonnull inBlock)(void)); diff --git a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Package.swift b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Package.swift index 8792aac..12b0c06 100644 --- a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Package.swift +++ b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Package.swift @@ -1,19 +1,28 @@ +// swift-tools-version:4.0 import PackageDescription let package = Package( name: "CwlPreconditionTesting", - targets: [ - Target(name: "CwlPreconditionTesting", dependencies: [ - "CwlMachBadInstructionHandler" - ]), - Target(name: "CwlMachBadInstructionHandler") + products: [ + .library(name: "CwlPreconditionTesting", targets: ["CwlPreconditionTesting", "CwlMachBadInstructionHandler"]) ], dependencies: [ - .Package(url: "https://github.com/mattgallagher/CwlCatchException.git", Version(1, 0, 2, prereleaseIdentifiers: ["beta", "3"])), + .package(url: "https://github.com/mattgallagher/CwlCatchException.git", from: "1.2.0") ], - exclude: [ - "Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h", - "Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting.h", - "Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift", + targets: [ + .target( + name: "CwlPreconditionTesting", + dependencies: [ + .target(name: "CwlMachBadInstructionHandler"), + .product(name: "CwlCatchException") + ], + exclude: [ + "./Mach/CwlPreconditionTesting.h", + "./Posix/CwlPreconditionTesting.h", + "./CwlCatchBadInstructionPosix.swift" + ] + ), + .target(name: "CwlMachBadInstructionHandler"), + .testTarget(name: "CwlPreconditionTestingTests", dependencies: ["CwlPreconditionTesting"]) ] ) diff --git a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/README.md b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/README.md index a42a5b5..259d1fe 100644 --- a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/README.md +++ b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/README.md @@ -18,31 +18,17 @@ Minimum requirements are iOS 8 (simulator-only) or macOS 10.9. The project inclu 1. In a subdirectory of your project's directory, run `git clone https://github.com/mattgallagher/CwlPreconditionTesting.git` 2. Drag the "CwlPreconditionTesting.xcodeproj" file from the Finder into your own project's file tree in Xcode -3. Add the "CwlPreconditionTesting.framework" from the "Products" folder of the CwlPreconditionTesting project's file tree to the "Copy Files (Frameworks)" build phases of any target that you want to include this module. -4. Drag the "CwlCatchException.framework" from the "Dependencies" group (within the CwlPreconditionTesting project's file tree) onto the same "Copy Files (Frameworks)" build phase (this item may be red but that shouldn't be a problem). - -That third step is a little tricky if you're unfamiliar with Xcode but it involves: - -a. click on your project in the file tree -b. click on the target to whih you want to add this module -c. select the "Build Phases" tab -d. if you don't already have a "Copy File" build phase with a "Destination: Frameworks", add one using the "+" button in the top left of the tab -e. click the "+" within the "Copy File (Frameworks)" phase and from the list that appears, select the "CwlPreconditionTesting.framework" (if there are multiple frameworks with the same name, look for the one that appears *above* the corresponding macOS or iOS CwlPreconditionTesting testing target). - -When building using this approach, the "FetchDependencies" target will use the Swift Package Manager to download the "CwlCatchException" project from github. The download is stored in the "Build intermediates" directory for your project. Normally, you can ignore its existence but if you get any errors from the "FetchDependencies" target, you might need to clean the build folder (Hold "Option" key while selecting "Product" → "Clean Build Folder..." from the Xcode menubar). - -You can use the "Package.swift" to manage the behavior of the Swift Package Manager or if you want to download dependencies manually (instead of using this behind-the-scenes use of the Swift package manager), you should delete the "FetchDependencies" target and replace the "CwlCatchException" targets with alternatives that build the dependencies in accordance with your manual download. +3. Add the "CwlPreconditionTesting.framework" from the "Products" folder of the CwlPreconditionTesting project's file tree to the "Copy Files (Frameworks)" build phases of any targets that you want to include this module. +4. Drag the "CwlCatchException.framework" from the "Dependencies" group (within the CwlPreconditionTesting project's file tree) onto the same "Copy Files (Frameworks)" build phase ### Swift Package Manager -Add the following to the `dependencies` array in your "Package.swift" file: - - .Package(url: "https://github.com/mattgallagher/CwlPreconditionTesting.git", majorVersion: 1), - -Or, if you're using the `swift-tools-version:4.0` package manager, add the following to the `dependencies` array in your "Package.swift" file: +Assuming you're using the `swift-tools-version:4.0` package manager, add the following to the `dependencies` array in your "Package.swift" file: .package(url: "https://github.com/mattgallagher/CwlPreconditionTesting.git", majorVersion: 1) +> NOTE: even though this git repository includes its dependencies in the Dependencies folder, building via the Swift Package manager fetches and builds these dependencies independently. + ### CocoaPods Add the following lines to your target in your "Podfile": diff --git a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.m b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.m index 8183196..2ab0ea5 100644 --- a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.m +++ b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.m @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -18,33 +18,36 @@ // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // -#if defined(__x86_64__) +#ifdef __APPLE__ +#import "TargetConditionals.h" +#if TARGET_OS_OSX || TARGET_OS_IOS - #import "mach_excServer.h" - #import "CwlMachBadInstructionHandler.h" +#import "mach_excServer.h" +#import "CwlMachBadInstructionHandler.h" + +@protocol BadInstructionReply ++(NSNumber *)receiveReply:(NSValue *)value; +@end + +/// A basic function that receives callbacks from mach_exc_server and relays them to the Swift implemented BadInstructionException.catch_mach_exception_raise_state. +kern_return_t catch_mach_exception_raise_state(mach_port_t exception_port, exception_type_t exception, const mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, const thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { + bad_instruction_exception_reply_t reply = { exception_port, exception, code, codeCnt, flavor, old_state, old_stateCnt, new_state, new_stateCnt }; + Class badInstructionClass = NSClassFromString(@"BadInstructionException"); + NSValue *value = [NSValue valueWithBytes: &reply objCType: @encode(bad_instruction_exception_reply_t)]; + return [[badInstructionClass performSelector: @selector(receiveReply:) withObject: value] intValue]; +} + +// The mach port should be configured so that this function is never used. +kern_return_t catch_mach_exception_raise(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt) { + assert(false); + return KERN_FAILURE; +} + +// The mach port should be configured so that this function is never used. +kern_return_t catch_mach_exception_raise_state_identity(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { + assert(false); + return KERN_FAILURE; +} - @protocol BadInstructionReply - +(NSNumber *)receiveReply:(NSValue *)value; - @end - - /// A basic function that receives callbacks from mach_exc_server and relays them to the Swift implemented BadInstructionException.catch_mach_exception_raise_state. - kern_return_t catch_mach_exception_raise_state(mach_port_t exception_port, exception_type_t exception, const mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, const thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { - bad_instruction_exception_reply_t reply = { exception_port, exception, code, codeCnt, flavor, old_state, old_stateCnt, new_state, new_stateCnt }; - Class badInstructionClass = NSClassFromString(@"BadInstructionException"); - NSValue *value = [NSValue valueWithBytes: &reply objCType: @encode(bad_instruction_exception_reply_t)]; - return [[badInstructionClass performSelector: @selector(receiveReply:) withObject: value] intValue]; - } - - // The mach port should be configured so that this function is never used. - kern_return_t catch_mach_exception_raise(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt) { - assert(false); - return KERN_FAILURE; - } - - // The mach port should be configured so that this function is never used. - kern_return_t catch_mach_exception_raise_state_identity(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { - assert(false); - return KERN_FAILURE; - } - -#endif +#endif /* TARGET_OS_OSX || TARGET_OS_IOS */ +#endif /* __APPLE__ */ diff --git a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h index aef59c2..3fbd5a4 100644 --- a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h +++ b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -19,8 +19,14 @@ // #import + +#if TARGET_OS_OSX || TARGET_OS_IOS + #import +extern bool _swift_disableExclusivityChecking; +extern bool _swift_reportFatalErrorsToDebugger; + NS_ASSUME_NONNULL_BEGIN extern boolean_t mach_exc_server(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); @@ -68,3 +74,5 @@ typedef struct } bad_instruction_exception_reply_t; NS_ASSUME_NONNULL_END + +#endif diff --git a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.c b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.c index 733c564..ccd8f84 100644 --- a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.c +++ b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.c @@ -5,13 +5,12 @@ * OPTIONS: */ -#if defined(__x86_64__) - /* Module mach_exc */ #define __MIG_check__Request__mach_exc_subsystem__ 1 -#include "mach_excServer.h" +#import "mach_excServer.h" +#if TARGET_OS_OSX || TARGET_OS_IOS #ifndef mig_internal #define mig_internal static __inline__ @@ -534,4 +533,4 @@ mig_external mig_routine_t mach_exc_server_routine return catch_mach_exc_subsystem.routine[msgh_id].stub_routine; } -#endif +#endif /* TARGET_OS_OSX || TARGET_OS_IOS */ diff --git a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.h b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.h index 52e53ae..1f03d66 100644 --- a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.h +++ b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.h @@ -1,9 +1,14 @@ +#ifdef __APPLE__ +#import "TargetConditionals.h" +#if TARGET_OS_OSX || TARGET_OS_IOS + #ifndef _mach_exc_server_ #define _mach_exc_server_ /* Module mach_exc */ #include + #include #include #include @@ -319,3 +324,6 @@ __AfterMigServerHeader #endif /* __AfterMigServerHeader */ #endif /* _mach_exc_server_ */ + +#endif /* TARGET_OS_OSX || TARGET_OS_IOS */ +#endif /* __APPLE__ */ diff --git a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift index 91e5d4d..90ee022 100644 --- a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift +++ b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -18,6 +18,8 @@ // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // +#if (os(macOS) || os(iOS)) && arch(x86_64) + import Foundation #if SWIFT_PACKAGE @@ -44,46 +46,44 @@ public class BadInstructionException: NSException { /// An Objective-C callable function, invoked from the `mach_exc_server` callback function `catch_mach_exception_raise_state` to push the `raiseBadInstructionException` function onto the stack. @objc(receiveReply:) public class func receiveReply(_ value: NSValue) -> NSNumber { - #if arch(x86_64) - var reply = bad_instruction_exception_reply_t(exception_port: 0, exception: 0, code: nil, codeCnt: 0, flavor: nil, old_state: nil, old_stateCnt: 0, new_state: nil, new_stateCnt: nil) - withUnsafeMutablePointer(to: &reply) { value.getValue(UnsafeMutableRawPointer($0)) } - - let old_state: UnsafePointer = reply.old_state! - let old_stateCnt: mach_msg_type_number_t = reply.old_stateCnt - let new_state: thread_state_t = reply.new_state! - let new_stateCnt: UnsafeMutablePointer = reply.new_stateCnt! - - // Make sure we've been given enough memory - if old_stateCnt != x86_THREAD_STATE64_COUNT || new_stateCnt.pointee < x86_THREAD_STATE64_COUNT { - return NSNumber(value: KERN_INVALID_ARGUMENT) - } - - // Read the old thread state - var state = old_state.withMemoryRebound(to: x86_thread_state64_t.self, capacity: 1) { return $0.pointee } - - // 1. Decrement the stack pointer - state.__rsp -= __uint64_t(MemoryLayout.size) - - // 2. Save the old Instruction Pointer to the stack. - if let pointer = UnsafeMutablePointer<__uint64_t>(bitPattern: UInt(state.__rsp)) { - pointer.pointee = state.__rip - } else { - return NSNumber(value: KERN_INVALID_ARGUMENT) - } - - // 3. Set the Instruction Pointer to the new function's address - var f: @convention(c) () -> Void = raiseBadInstructionException - withUnsafePointer(to: &f) { - state.__rip = $0.withMemoryRebound(to: __uint64_t.self, capacity: 1) { return $0.pointee } - } - - // Write the new thread state - new_state.withMemoryRebound(to: x86_thread_state64_t.self, capacity: 1) { $0.pointee = state } - new_stateCnt.pointee = x86_THREAD_STATE64_COUNT - - return NSNumber(value: KERN_SUCCESS) - #else - fatalError("Unavailable for this CPU architecture") - #endif + var reply = bad_instruction_exception_reply_t(exception_port: 0, exception: 0, code: nil, codeCnt: 0, flavor: nil, old_state: nil, old_stateCnt: 0, new_state: nil, new_stateCnt: nil) + withUnsafeMutablePointer(to: &reply) { value.getValue(UnsafeMutableRawPointer($0)) } + + let old_state: UnsafePointer = reply.old_state! + let old_stateCnt: mach_msg_type_number_t = reply.old_stateCnt + let new_state: thread_state_t = reply.new_state! + let new_stateCnt: UnsafeMutablePointer = reply.new_stateCnt! + + // Make sure we've been given enough memory + if old_stateCnt != x86_THREAD_STATE64_COUNT || new_stateCnt.pointee < x86_THREAD_STATE64_COUNT { + return NSNumber(value: KERN_INVALID_ARGUMENT) + } + + // Read the old thread state + var state = old_state.withMemoryRebound(to: x86_thread_state64_t.self, capacity: 1) { return $0.pointee } + + // 1. Decrement the stack pointer + state.__rsp -= __uint64_t(MemoryLayout.size) + + // 2. Save the old Instruction Pointer to the stack. + if let pointer = UnsafeMutablePointer<__uint64_t>(bitPattern: UInt(state.__rsp)) { + pointer.pointee = state.__rip + } else { + return NSNumber(value: KERN_INVALID_ARGUMENT) + } + + // 3. Set the Instruction Pointer to the new function's address + var f: @convention(c) () -> Void = raiseBadInstructionException + withUnsafePointer(to: &f) { + state.__rip = $0.withMemoryRebound(to: __uint64_t.self, capacity: 1) { return $0.pointee } + } + + // Write the new thread state + new_state.withMemoryRebound(to: x86_thread_state64_t.self, capacity: 1) { $0.pointee = state } + new_stateCnt.pointee = x86_THREAD_STATE64_COUNT + + return NSNumber(value: KERN_SUCCESS) } } + +#endif diff --git a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift index f96ec63..521b2a1 100644 --- a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift +++ b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -18,180 +18,192 @@ // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // +#if (os(macOS) || os(iOS)) && arch(x86_64) + import Foundation +import Swift #if SWIFT_PACKAGE import CwlMachBadInstructionHandler #endif -#if arch(x86_64) - - private enum PthreadError: Error { case code(Int32) } - private enum MachExcServer: Error { case code(kern_return_t) } - - /// A quick function for converting Mach error results into Swift errors - private func kernCheck(_ f: () -> Int32) throws { - let r = f() - guard r == KERN_SUCCESS else { - throw NSError(domain: NSMachErrorDomain, code: Int(r), userInfo: nil) - } +private enum PthreadError: Error { case code(Int32) } +private enum MachExcServer: Error { case code(kern_return_t) } + +/// A quick function for converting Mach error results into Swift errors +private func kernCheck(_ f: () -> Int32) throws { + let r = f() + guard r == KERN_SUCCESS else { + throw NSError(domain: NSMachErrorDomain, code: Int(r), userInfo: nil) } - - extension request_mach_exception_raise_t { - mutating func withMsgHeaderPointer(in block: (UnsafeMutablePointer) -> R) -> R { - return withUnsafeMutablePointer(to: &self) { p -> R in - return p.withMemoryRebound(to: mach_msg_header_t.self, capacity: 1) { ptr -> R in - return block(ptr) - } +} + +extension request_mach_exception_raise_t { + mutating func withMsgHeaderPointer(in block: (UnsafeMutablePointer) -> R) -> R { + return withUnsafeMutablePointer(to: &self) { p -> R in + return p.withMemoryRebound(to: mach_msg_header_t.self, capacity: 1) { ptr -> R in + return block(ptr) } } } - - extension reply_mach_exception_raise_state_t { - mutating func withMsgHeaderPointer(in block: (UnsafeMutablePointer) -> R) -> R { - return withUnsafeMutablePointer(to: &self) { p -> R in - return p.withMemoryRebound(to: mach_msg_header_t.self, capacity: 1) { ptr -> R in - return block(ptr) - } +} + +extension reply_mach_exception_raise_state_t { + mutating func withMsgHeaderPointer(in block: (UnsafeMutablePointer) -> R) -> R { + return withUnsafeMutablePointer(to: &self) { p -> R in + return p.withMemoryRebound(to: mach_msg_header_t.self, capacity: 1) { ptr -> R in + return block(ptr) } } } +} + +/// A structure used to store context associated with the Mach message port +private struct MachContext { + var masks = execTypesCountTuple() + var count: mach_msg_type_number_t = 0 + var ports = execTypesCountTuple() + var behaviors = execTypesCountTuple() + var flavors = execTypesCountTuple() + var currentExceptionPort: mach_port_t = 0 + var handlerThread: pthread_t? = nil - /// A structure used to store context associated with the Mach message port - private struct MachContext { - var masks = execTypesCountTuple() - var count: mach_msg_type_number_t = 0 - var ports = execTypesCountTuple() - var behaviors = execTypesCountTuple() - var flavors = execTypesCountTuple() - var currentExceptionPort: mach_port_t = 0 - var handlerThread: pthread_t? = nil - - static func internalMutablePointers(_ m: UnsafeMutablePointer>, _ c: UnsafeMutablePointer, _ p: UnsafeMutablePointer>, _ b: UnsafeMutablePointer>, _ f: UnsafeMutablePointer>, _ block: (UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer) -> R) -> R { - return m.withMemoryRebound(to: exception_mask_t.self, capacity: 1) { masksPtr in - return c.withMemoryRebound(to: mach_msg_type_number_t.self, capacity: 1) { countPtr in - return p.withMemoryRebound(to: mach_port_t.self, capacity: 1) { portsPtr in - return b.withMemoryRebound(to: exception_behavior_t.self, capacity: 1) { behaviorsPtr in - return f.withMemoryRebound(to: thread_state_flavor_t.self, capacity: 1) { flavorsPtr in - return block(masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) - } + static func internalMutablePointers(_ m: UnsafeMutablePointer>, _ c: UnsafeMutablePointer, _ p: UnsafeMutablePointer>, _ b: UnsafeMutablePointer>, _ f: UnsafeMutablePointer>, _ block: (UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer) -> R) -> R { + return m.withMemoryRebound(to: exception_mask_t.self, capacity: 1) { masksPtr in + return c.withMemoryRebound(to: mach_msg_type_number_t.self, capacity: 1) { countPtr in + return p.withMemoryRebound(to: mach_port_t.self, capacity: 1) { portsPtr in + return b.withMemoryRebound(to: exception_behavior_t.self, capacity: 1) { behaviorsPtr in + return f.withMemoryRebound(to: thread_state_flavor_t.self, capacity: 1) { flavorsPtr in + return block(masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) } } } } } - - mutating func withUnsafeMutablePointers(in block: @escaping (UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer) -> R) -> R { - return MachContext.internalMutablePointers(&masks, &count, &ports, &behaviors, &flavors, block) - } } - /// A function for receiving mach messages and parsing the first with mach_exc_server (and if any others are received, throwing them away). - private func machMessageHandler(_ arg: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer? { - let context = arg.assumingMemoryBound(to: MachContext.self).pointee - var request = request_mach_exception_raise_t() - var reply = reply_mach_exception_raise_state_t() + mutating func withUnsafeMutablePointers(in block: @escaping (UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer) -> R) -> R { + return MachContext.internalMutablePointers(&masks, &count, &ports, &behaviors, &flavors, block) + } +} + +/// A function for receiving mach messages and parsing the first with mach_exc_server (and if any others are received, throwing them away). +private func machMessageHandler(_ arg: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer? { + let context = arg.assumingMemoryBound(to: MachContext.self).pointee + var request = request_mach_exception_raise_t() + var reply = reply_mach_exception_raise_state_t() + + var handledfirstException = false + repeat { do { + // Request the next mach message from the port + request.Head.msgh_local_port = context.currentExceptionPort + request.Head.msgh_size = UInt32(MemoryLayout.size) + let requestSize = request.Head.msgh_size + try kernCheck { request.withMsgHeaderPointer { requestPtr in + mach_msg(requestPtr, MACH_RCV_MSG | MACH_RCV_INTERRUPT, 0, requestSize, context.currentExceptionPort, 0, UInt32(MACH_PORT_NULL)) + } } - var handledfirstException = false - repeat { do { - // Request the next mach message from the port - request.Head.msgh_local_port = context.currentExceptionPort - request.Head.msgh_size = UInt32(MemoryLayout.size) - let requestSize = request.Head.msgh_size - try kernCheck { request.withMsgHeaderPointer { requestPtr in - mach_msg(requestPtr, MACH_RCV_MSG | MACH_RCV_INTERRUPT, 0, requestSize, context.currentExceptionPort, 0, UInt32(MACH_PORT_NULL)) - } } + // Prepare the reply structure + reply.Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(request.Head.msgh_bits), 0) + reply.Head.msgh_local_port = UInt32(MACH_PORT_NULL) + reply.Head.msgh_remote_port = request.Head.msgh_remote_port + reply.Head.msgh_size = UInt32(MemoryLayout.size) + reply.NDR = NDR_record + + if !handledfirstException { + // Use the MiG generated server to invoke our handler for the request and fill in the rest of the reply structure + guard request.withMsgHeaderPointer(in: { requestPtr in reply.withMsgHeaderPointer { replyPtr in + mach_exc_server(requestPtr, replyPtr) + } }) != 0 else { throw MachExcServer.code(reply.RetCode) } - // Prepare the reply structure - reply.Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(request.Head.msgh_bits), 0) - reply.Head.msgh_local_port = UInt32(MACH_PORT_NULL) - reply.Head.msgh_remote_port = request.Head.msgh_remote_port - reply.Head.msgh_size = UInt32(MemoryLayout.size) - reply.NDR = NDR_record - - if !handledfirstException { - // Use the MiG generated server to invoke our handler for the request and fill in the rest of the reply structure - guard request.withMsgHeaderPointer(in: { requestPtr in reply.withMsgHeaderPointer { replyPtr in - mach_exc_server(requestPtr, replyPtr) - } }) != 0 else { throw MachExcServer.code(reply.RetCode) } - - handledfirstException = true - } else { - // If multiple fatal errors occur, don't handle subsquent errors (let the program crash) - reply.RetCode = KERN_FAILURE - } - - // Send the reply - let replySize = reply.Head.msgh_size - try kernCheck { reply.withMsgHeaderPointer { replyPtr in - mach_msg(replyPtr, MACH_SEND_MSG, replySize, 0, UInt32(MACH_PORT_NULL), 0, UInt32(MACH_PORT_NULL)) - } } - } catch let error as NSError where (error.domain == NSMachErrorDomain && (error.code == Int(MACH_RCV_PORT_CHANGED) || error.code == Int(MACH_RCV_INVALID_NAME))) { - // Port was already closed before we started or closed while we were listening. - // This means the controlling thread shut down. - return nil - } catch { - // Should never be reached but this is testing code, don't try to recover, just abort - fatalError("Mach message error: \(error)") - } } while true + handledfirstException = true + } else { + // If multiple fatal errors occur, don't handle subsquent errors (let the program crash) + reply.RetCode = KERN_FAILURE + } + + // Send the reply + let replySize = reply.Head.msgh_size + try kernCheck { reply.withMsgHeaderPointer { replyPtr in + mach_msg(replyPtr, MACH_SEND_MSG, replySize, 0, UInt32(MACH_PORT_NULL), 0, UInt32(MACH_PORT_NULL)) + } } + } catch let error as NSError where (error.domain == NSMachErrorDomain && (error.code == Int(MACH_RCV_PORT_CHANGED) || error.code == Int(MACH_RCV_INVALID_NAME))) { + // Port was already closed before we started or closed while we were listening. + // This means the controlling thread shut down. + return nil + } catch { + // Should never be reached but this is testing code, don't try to recover, just abort + fatalError("Mach message error: \(error)") + } } while true +} + +/// Run the provided block. If a mach "BAD_INSTRUCTION" exception is raised, catch it and return a BadInstructionException (which captures stack information about the throw site, if desired). Otherwise return nil. +/// NOTE: This function is only intended for use in test harnesses – use in a distributed build is almost certainly a bad choice. If a "BAD_INSTRUCTION" exception is raised, the block will be exited before completion via Objective-C exception. The risks associated with an Objective-C exception apply here: most Swift/Objective-C functions are *not* exception-safe. Memory may be leaked and the program will not necessarily be left in a safe state. +/// - parameter block: a function without parameters that will be run +/// - returns: if an EXC_BAD_INSTRUCTION is raised during the execution of `block` then a BadInstructionException will be returned, otherwise `nil`. +public func catchBadInstruction(in block: @escaping () -> Void) -> BadInstructionException? { + // Suppress Swift runtime's direct triggering of the debugger and exclusivity checking which crashes when we throw past it + let previousExclusivity = _swift_disableExclusivityChecking + let previousReporting = _swift_reportFatalErrorsToDebugger + _swift_disableExclusivityChecking = true + _swift_reportFatalErrorsToDebugger = false + defer { + _swift_reportFatalErrorsToDebugger = previousReporting + _swift_disableExclusivityChecking = previousExclusivity } - /// Run the provided block. If a mach "BAD_INSTRUCTION" exception is raised, catch it and return a BadInstructionException (which captures stack information about the throw site, if desired). Otherwise return nil. - /// NOTE: This function is only intended for use in test harnesses – use in a distributed build is almost certainly a bad choice. If a "BAD_INSTRUCTION" exception is raised, the block will be exited before completion via Objective-C exception. The risks associated with an Objective-C exception apply here: most Swift/Objective-C functions are *not* exception-safe. Memory may be leaked and the program will not necessarily be left in a safe state. - /// - parameter block: a function without parameters that will be run - /// - returns: if an EXC_BAD_INSTRUCTION is raised during the execution of `block` then a BadInstructionException will be returned, otherwise `nil`. - public func catchBadInstruction(in block: () -> Void) -> BadInstructionException? { - var context = MachContext() - var result: BadInstructionException? = nil - do { - var handlerThread: pthread_t? = nil - defer { - // 8. Wait for the thread to terminate *if* we actually made it to the creation point - // The mach port should be destroyed *before* calling pthread_join to avoid a deadlock. - if handlerThread != nil { - pthread_join(handlerThread!, nil) - } + var context = MachContext() + var result: BadInstructionException? = nil + do { + var handlerThread: pthread_t? = nil + defer { + // 8. Wait for the thread to terminate *if* we actually made it to the creation point + // The mach port should be destroyed *before* calling pthread_join to avoid a deadlock. + if handlerThread != nil { + pthread_join(handlerThread!, nil) } - - try kernCheck { - // 1. Create the mach port - mach_port_allocate(mach_task_self_, MACH_PORT_RIGHT_RECEIVE, &context.currentExceptionPort) - } - defer { - // 7. Cleanup the mach port - mach_port_destroy(mach_task_self_, context.currentExceptionPort) - } - - try kernCheck { - // 2. Configure the mach port - mach_port_insert_right(mach_task_self_, context.currentExceptionPort, context.currentExceptionPort, MACH_MSG_TYPE_MAKE_SEND) - } - - let currentExceptionPtr = context.currentExceptionPort - try kernCheck { context.withUnsafeMutablePointers { masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr in - // 3. Apply the mach port as the handler for this thread - thread_swap_exception_ports(mach_thread_self(), EXC_MASK_BAD_INSTRUCTION, currentExceptionPtr, Int32(bitPattern: UInt32(EXCEPTION_STATE) | MACH_EXCEPTION_CODES), x86_THREAD_STATE64, masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) - } } - - defer { context.withUnsafeMutablePointers { masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr in - // 6. Unapply the mach port - _ = thread_swap_exception_ports(mach_thread_self(), EXC_MASK_BAD_INSTRUCTION, 0, EXCEPTION_DEFAULT, THREAD_STATE_NONE, masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) - } } - - try withUnsafeMutablePointer(to: &context) { c throws in - // 4. Create the thread - let e = pthread_create(&handlerThread, nil, machMessageHandler, c) - guard e == 0 else { throw PthreadError.code(e) } - - // 5. Run the block - result = BadInstructionException.catchException(in: block) - } - } catch { - // Should never be reached but this is testing code, don't try to recover, just abort - fatalError("Mach port error: \(error)") } - return result + + try kernCheck { + // 1. Create the mach port + mach_port_allocate(mach_task_self_, MACH_PORT_RIGHT_RECEIVE, &context.currentExceptionPort) + } + defer { + // 7. Cleanup the mach port + mach_port_destroy(mach_task_self_, context.currentExceptionPort) + } + + try kernCheck { + // 2. Configure the mach port + mach_port_insert_right(mach_task_self_, context.currentExceptionPort, context.currentExceptionPort, MACH_MSG_TYPE_MAKE_SEND) + } + + let currentExceptionPtr = context.currentExceptionPort + try kernCheck { context.withUnsafeMutablePointers { masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr in + // 3. Apply the mach port as the handler for this thread + thread_swap_exception_ports(mach_thread_self(), EXC_MASK_BAD_INSTRUCTION, currentExceptionPtr, Int32(bitPattern: UInt32(EXCEPTION_STATE) | MACH_EXCEPTION_CODES), x86_THREAD_STATE64, masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) + } } + + defer { context.withUnsafeMutablePointers { masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr in + // 6. Unapply the mach port + _ = thread_swap_exception_ports(mach_thread_self(), EXC_MASK_BAD_INSTRUCTION, 0, EXCEPTION_DEFAULT, THREAD_STATE_NONE, masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) + } } + + try withUnsafeMutablePointer(to: &context) { c throws in + // 4. Create the thread + let e = pthread_create(&handlerThread, nil, machMessageHandler, c) + guard e == 0 else { throw PthreadError.code(e) } + + // 5. Run the block + result = BadInstructionException.catchException(in: block) + } + } catch { + // Should never be reached but this is testing code, don't try to recover, just abort + fatalError("Mach port error: \(error)") } + + return result +} #endif diff --git a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift index eb9bc19..4fc99fa 100644 --- a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift +++ b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 8/02/2016. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -18,91 +18,91 @@ // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // +#if os(tvOS) && targetEnvironment(simulator) + import Foundation -#if arch(x86_64) +// This file is an alternative implementation to CwlCatchBadInstruction.swift that uses a SIGILL signal action and setenv/longjmp instead of a Mach exception handler and Objective-C exception raising. +// +// WARNING: +// This code is quick and dirty. It's a proof of concept for using a SIGILL handler and setjmp/longjmp where Mach exceptions and the Obj-C runtime aren't available. I ran the automated tests when I first wrote this code but I don't personally use it at all so by the time you're reading this comment, it probably broke and I didn't notice. +// Obvious limitations: +// * It doesn't work when debugging with lldb. +// * It doesn't scope correctly to the thread (it's global) +// * In violation of rules for signal handlers, it writes to the "red zone" on the stack +// * It isn't re-entrant +// * Plus all of the same caveats as the Mach exceptions version (doesn't play well with other handlers, probably leaks ARC memory, etc) +// Treat it like a loaded shotgun. Don't point it at your face. + +// This function is called from the signal handler to shut down the thread and return 1 (indicating a SIGILL was received). +private func callThreadExit() { + pthread_exit(UnsafeMutableRawPointer(bitPattern: 1)) +} + +// When called, this signal handler simulates a function call to `callThreadExit` +private func sigIllHandler(code: Int32, info: UnsafeMutablePointer<__siginfo>?, uap: UnsafeMutableRawPointer?) -> Void { + guard let context = uap?.assumingMemoryBound(to: ucontext64_t.self) else { return } + + // 1. Decrement the stack pointer + context.pointee.uc_mcontext64.pointee.__ss.__rsp -= __uint64_t(MemoryLayout.size) + + // 2. Save the old Instruction Pointer to the stack. + let rsp = context.pointee.uc_mcontext64.pointee.__ss.__rsp + if let ump = UnsafeMutablePointer<__uint64_t>(bitPattern: UInt(rsp)) { + ump.pointee = rsp + } + + // 3. Set the Instruction Pointer to the new function's address + var f: @convention(c) () -> Void = callThreadExit + withUnsafePointer(to: &f) { $0.withMemoryRebound(to: __uint64_t.self, capacity: 1) { ptr in + context.pointee.uc_mcontext64.pointee.__ss.__rip = ptr.pointee + } } +} + +/// Without Mach exceptions or the Objective-C runtime, there's nothing to put in the exception object. It's really just a boolean – either a SIGILL was caught or not. +public class BadInstructionException { +} + +/// Run the provided block. If a POSIX SIGILL is received, handle it and return a BadInstructionException (which is just an empty object in this POSIX signal version). Otherwise return nil. +/// NOTE: This function is only intended for use in test harnesses – use in a distributed build is almost certainly a bad choice. If a SIGILL is received, the block will be interrupted using a C `longjmp`. The risks associated with abrupt jumps apply here: most Swift functions are *not* interrupt-safe. Memory may be leaked and the program will not necessarily be left in a safe state. +/// - parameter block: a function without parameters that will be run +/// - returns: if an SIGILL is raised during the execution of `block` then a BadInstructionException will be returned, otherwise `nil`. +public func catchBadInstruction(block: @escaping () -> Void) -> BadInstructionException? { + // Construct the signal action + var sigActionPrev = sigaction() + let action = __sigaction_u(__sa_sigaction: sigIllHandler) + var sigActionNew = sigaction(__sigaction_u: action, sa_mask: sigset_t(), sa_flags: SA_SIGINFO) - // This file is an alternative implementation to CwlCatchBadInstruction.swift that uses a SIGILL signal action and setenv/longjmp instead of a Mach exception handler and Objective-C exception raising. - // - // WARNING: - // This code is quick and dirty. It's a proof of concept for using a SIGILL handler and setjmp/longjmp where Mach exceptions and the Obj-C runtime aren't available. I ran the automated tests when I first wrote this code but I don't personally use it at all so by the time you're reading this comment, it probably broke and I didn't notice. - // Obvious limitations: - // * It doesn't work when debugging with lldb. - // * It doesn't scope correctly to the thread (it's global) - // * In violation of rules for signal handlers, it writes to the "red zone" on the stack - // * It isn't re-entrant - // * Plus all of the same caveats as the Mach exceptions version (doesn't play well with other handlers, probably leaks ARC memory, etc) - // Treat it like a loaded shotgun. Don't point it at your face. - - // This function is called from the signal handler to shut down the thread and return 1 (indicating a SIGILL was received). - private func callThreadExit() { - pthread_exit(UnsafeMutableRawPointer(bitPattern: 1)) + // Install the signal action + if sigaction(SIGILL, &sigActionNew, &sigActionPrev) != 0 { + fatalError("Sigaction error: \(errno)") } - // When called, this signal handler simulates a function call to `callThreadExit` - private func sigIllHandler(code: Int32, info: UnsafeMutablePointer<__siginfo>?, uap: UnsafeMutableRawPointer?) -> Void { - guard let context = uap?.assumingMemoryBound(to: ucontext64_t.self) else { return } - - // 1. Decrement the stack pointer - context.pointee.uc_mcontext64.pointee.__ss.__rsp -= __uint64_t(MemoryLayout.size) - - // 2. Save the old Instruction Pointer to the stack. - let rsp = context.pointee.uc_mcontext64.pointee.__ss.__rsp - if let ump = UnsafeMutablePointer<__uint64_t>(bitPattern: UInt(rsp)) { - ump.pointee = rsp - } - - // 3. Set the Instruction Pointer to the new function's address - var f: @convention(c) () -> Void = callThreadExit - withUnsafePointer(to: &f) { $0.withMemoryRebound(to: __uint64_t.self, capacity: 1) { ptr in - context.pointee.uc_mcontext64.pointee.__ss.__rip = ptr.pointee - } } - } - - /// Without Mach exceptions or the Objective-C runtime, there's nothing to put in the exception object. It's really just a boolean – either a SIGILL was caught or not. - public class BadInstructionException { - } - - /// Run the provided block. If a POSIX SIGILL is received, handle it and return a BadInstructionException (which is just an empty object in this POSIX signal version). Otherwise return nil. - /// NOTE: This function is only intended for use in test harnesses – use in a distributed build is almost certainly a bad choice. If a SIGILL is received, the block will be interrupted using a C `longjmp`. The risks associated with abrupt jumps apply here: most Swift functions are *not* interrupt-safe. Memory may be leaked and the program will not necessarily be left in a safe state. - /// - parameter block: a function without parameters that will be run - /// - returns: if an SIGILL is raised during the execution of `block` then a BadInstructionException will be returned, otherwise `nil`. - public func catchBadInstruction(block: @escaping () -> Void) -> BadInstructionException? { - // Construct the signal action - var sigActionPrev = sigaction() - let action = __sigaction_u(__sa_sigaction: sigIllHandler) - var sigActionNew = sigaction(__sigaction_u: action, sa_mask: sigset_t(), sa_flags: SA_SIGINFO) - - // Install the signal action - if sigaction(SIGILL, &sigActionNew, &sigActionPrev) != 0 { + defer { + // Restore the previous signal action + if sigaction(SIGILL, &sigActionPrev, nil) != 0 { fatalError("Sigaction error: \(errno)") } - - defer { - // Restore the previous signal action - if sigaction(SIGILL, &sigActionPrev, nil) != 0 { - fatalError("Sigaction error: \(errno)") - } - } + } - var b = block - let caught: Bool = withUnsafeMutablePointer(to: &b) { blockPtr in - // Run the block on its own thread - var handlerThread: pthread_t? = nil - let e = pthread_create(&handlerThread, nil, { arg in - (arg.assumingMemoryBound(to: (() -> Void).self).pointee)() - return nil - }, blockPtr) - precondition(e == 0, "Unable to create thread") + var b = block + let caught: Bool = withUnsafeMutablePointer(to: &b) { blockPtr in + // Run the block on its own thread + var handlerThread: pthread_t? = nil + let e = pthread_create(&handlerThread, nil, { arg in + (arg.assumingMemoryBound(to: (() -> Void).self).pointee)() + return nil + }, blockPtr) + precondition(e == 0, "Unable to create thread") - // Wait for completion and get the result. It will be either `nil` or bitPattern 1 - var rawResult: UnsafeMutableRawPointer? = nil - let e2 = pthread_join(handlerThread!, &rawResult) - precondition(e2 == 0, "Thread join failed") - return Int(bitPattern: rawResult) != 0 - } - - return caught ? BadInstructionException() : nil + // Wait for completion and get the result. It will be either `nil` or bitPattern 1 + var rawResult: UnsafeMutableRawPointer? = nil + let e2 = pthread_join(handlerThread!, &rawResult) + precondition(e2 == 0, "Thread join failed") + return Int(bitPattern: rawResult) != 0 } + return caught ? BadInstructionException() : nil +} + #endif diff --git a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift index 8d99d5e..f22ed1f 100644 --- a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift +++ b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -18,38 +18,38 @@ // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // +#if (os(macOS) || os(iOS)) && arch(x86_64) + import Darwin -#if arch(x86_64) - - // From /usr/include/mach/message.h - // #define MACH_MSG_TYPE_MAKE_SEND 20 /* Must hold receive right */ - // #define MACH_MSGH_BITS_REMOTE(bits) \ - // ((bits) & MACH_MSGH_BITS_REMOTE_MASK) - // #define MACH_MSGH_BITS(remote, local) /* legacy */ \ - // ((remote) | ((local) << 8)) - public let MACH_MSG_TYPE_MAKE_SEND: UInt32 = 20 - public func MACH_MSGH_BITS_REMOTE(_ bits: UInt32) -> UInt32 { return bits & UInt32(MACH_MSGH_BITS_REMOTE_MASK) } - public func MACH_MSGH_BITS(_ remote: UInt32, _ local: UInt32) -> UInt32 { return ((remote) | ((local) << 8)) } - - // From /usr/include/mach/exception_types.h - // #define EXC_BAD_INSTRUCTION 2 /* Instruction failed */ - // #define EXC_MASK_BAD_INSTRUCTION (1 << EXC_BAD_INSTRUCTION) - public let EXC_BAD_INSTRUCTION: UInt32 = 2 - public let EXC_MASK_BAD_INSTRUCTION: UInt32 = 1 << EXC_BAD_INSTRUCTION - - // From /usr/include/mach/i386/thread_status.h - // #define x86_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \ - // ( sizeof (x86_thread_state64_t) / sizeof (int) )) - public let x86_THREAD_STATE64_COUNT = UInt32(MemoryLayout.size / MemoryLayout.size) - - public let EXC_TYPES_COUNT = 14 - public struct execTypesCountTuple { - // From /usr/include/mach/i386/exception.h - // #define EXC_TYPES_COUNT 14 /* incl. illegal exception 0 */ - public var value: (T, T, T, T, T, T, T, T, T, T, T, T, T, T) = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) - public init() { - } +// From /usr/include/mach/message.h +// #define MACH_MSG_TYPE_MAKE_SEND 20 /* Must hold receive right */ +// #define MACH_MSGH_BITS_REMOTE(bits) \ +// ((bits) & MACH_MSGH_BITS_REMOTE_MASK) +// #define MACH_MSGH_BITS(remote, local) /* legacy */ \ +// ((remote) | ((local) << 8)) +public let MACH_MSG_TYPE_MAKE_SEND: UInt32 = 20 +public func MACH_MSGH_BITS_REMOTE(_ bits: UInt32) -> UInt32 { return bits & UInt32(MACH_MSGH_BITS_REMOTE_MASK) } +public func MACH_MSGH_BITS(_ remote: UInt32, _ local: UInt32) -> UInt32 { return ((remote) | ((local) << 8)) } + +// From /usr/include/mach/exception_types.h +// #define EXC_BAD_INSTRUCTION 2 /* Instruction failed */ +// #define EXC_MASK_BAD_INSTRUCTION (1 << EXC_BAD_INSTRUCTION) +public let EXC_BAD_INSTRUCTION: UInt32 = 2 +public let EXC_MASK_BAD_INSTRUCTION: UInt32 = 1 << EXC_BAD_INSTRUCTION + +// From /usr/include/mach/i386/thread_status.h +// #define x86_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \ +// ( sizeof (x86_thread_state64_t) / sizeof (int) )) +public let x86_THREAD_STATE64_COUNT = UInt32(MemoryLayout.size / MemoryLayout.size) + +public let EXC_TYPES_COUNT = 14 +public struct execTypesCountTuple { + // From /usr/include/mach/i386/exception.h + // #define EXC_TYPES_COUNT 14 /* incl. illegal exception 0 */ + public var value: (T, T, T, T, T, T, T, T, T, T, T, T, T, T) = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + public init() { } +} #endif diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/include/CwlPreconditionTesting.h similarity index 81% rename from Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h rename to Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/include/CwlPreconditionTesting.h index 7c50da1..93a0e61 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h +++ b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/include/CwlPreconditionTesting.h @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -20,13 +20,16 @@ #import -extern bool _swift_reportFatalErrorsToDebugger; - //! Project version number for CwlUtils. FOUNDATION_EXPORT double CwlPreconditionTestingVersionNumber; //! Project version string for CwlUtils. FOUNDATION_EXPORT const unsigned char CwlAssertingTestingVersionString[]; -#include "CwlMachBadInstructionHandler.h" -#include "CwlCatchException.h" +#import "CwlMachBadInstructionHandler.h" + +#if TARGET_OS_OSX || TARGET_OS_IOS + #import "CwlCatchException.h" +#elif !TARGET_OS_TV + #error Unsupported platform. +#endif diff --git a/Carthage/Checkouts/Nimble/Gemfile b/Carthage/Checkouts/Nimble/Gemfile index 206f109..adb8306 100644 --- a/Carthage/Checkouts/Nimble/Gemfile +++ b/Carthage/Checkouts/Nimble/Gemfile @@ -1,4 +1,4 @@ # A sample Gemfile source "https://rubygems.org" -gem 'cocoapods', '~> 1.6.0.rc.2' +gem 'cocoapods', '~> 1.7' diff --git a/Carthage/Checkouts/Nimble/Gemfile.lock b/Carthage/Checkouts/Nimble/Gemfile.lock index cc03cbf..6c6f534 100644 --- a/Carthage/Checkouts/Nimble/Gemfile.lock +++ b/Carthage/Checkouts/Nimble/Gemfile.lock @@ -2,18 +2,18 @@ GEM remote: https://rubygems.org/ specs: CFPropertyList (3.0.0) - activesupport (4.2.11) + activesupport (4.2.11.1) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) atomos (0.1.3) claide (1.0.2) - cocoapods (1.6.0.rc.2) + cocoapods (1.7.1) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.6.0.rc.2) - cocoapods-deintegrate (>= 1.0.2, < 2.0) + cocoapods-core (= 1.7.1) + cocoapods-deintegrate (>= 1.0.3, < 2.0) cocoapods-downloader (>= 1.2.2, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) @@ -26,13 +26,13 @@ GEM gh_inspector (~> 1.0) molinillo (~> 0.6.6) nap (~> 1.0) - ruby-macho (~> 1.3, >= 1.3.1) - xcodeproj (>= 1.8.0, < 2.0) - cocoapods-core (1.6.0.rc.2) + ruby-macho (~> 1.4) + xcodeproj (>= 1.8.2, < 2.0) + cocoapods-core (1.7.1) activesupport (>= 4.0.2, < 6) fuzzy_match (~> 2.0.4) nap (~> 1.0) - cocoapods-deintegrate (1.0.2) + cocoapods-deintegrate (1.0.4) cocoapods-downloader (1.2.2) cocoapods-plugins (1.0.0) nap @@ -43,9 +43,9 @@ GEM netrc (~> 0.11) cocoapods-try (1.1.0) colored2 (3.1.2) - concurrent-ruby (1.1.4) + concurrent-ruby (1.1.5) escape (0.0.4) - fourflusher (2.2.0) + fourflusher (2.3.0) fuzzy_match (2.0.4) gh_inspector (1.1.3) i18n (0.9.5) @@ -55,11 +55,11 @@ GEM nanaimo (0.2.6) nap (1.1.0) netrc (0.11.0) - ruby-macho (1.3.1) + ruby-macho (1.4.0) thread_safe (0.3.6) tzinfo (1.2.5) thread_safe (~> 0.1) - xcodeproj (1.8.0) + xcodeproj (1.9.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) @@ -70,7 +70,7 @@ PLATFORMS ruby DEPENDENCIES - cocoapods (~> 1.6.0.rc.2) + cocoapods (~> 1.7) BUNDLED WITH - 1.17.2 + 1.17.3 diff --git a/Carthage/Checkouts/Nimble/Nimble.podspec b/Carthage/Checkouts/Nimble/Nimble.podspec index 69c5d56..754e2c1 100644 --- a/Carthage/Checkouts/Nimble/Nimble.podspec +++ b/Carthage/Checkouts/Nimble/Nimble.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Nimble" - s.version = "8.0.1" + s.version = "8.0.4" s.summary = "A Matcher Framework for Swift and Objective-C" s.description = <<-DESC Use Nimble to express the expected outcomes of Swift or Objective-C expressions. Inspired by Cedar. @@ -16,26 +16,24 @@ Pod::Spec.new do |s| s.source_files = [ "Sources/**/*.{swift,h,m,c}", - "Carthage/Checkouts/CwlCatchException/Sources/**/*.{swift,h,m,c}", + "Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/**/*.{swift,h,m,c}", "Carthage/Checkouts/CwlPreconditionTesting/Sources/**/*.{swift,h,m,c}", ] s.osx.exclude_files = [ "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift", - "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h", ] s.ios.exclude_files = [ "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift", - "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h", ] s.tvos.exclude_files = [ "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h", "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift", "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift", "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift", - "Carthage/Checkouts/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift", - "Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m", - "Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h", + "Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift", + "Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m", + "Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h", ] s.exclude_files = "Sources/Nimble/Adapters/NonObjectiveC/*.swift" @@ -44,6 +42,7 @@ Pod::Spec.new do |s| s.compiler_flags = '-DPRODUCT_NAME=Nimble/Nimble' s.pod_target_xcconfig = { 'APPLICATION_EXTENSION_API_ONLY' => 'YES', + 'DEFINES_MODULE' => 'YES', 'ENABLE_BITCODE' => 'NO', 'OTHER_LDFLAGS' => '$(inherited) -weak-lswiftXCTest -Xlinker -no_application_extension', 'OTHER_SWIFT_FLAGS' => '$(inherited) -suppress-warnings', @@ -51,5 +50,9 @@ Pod::Spec.new do |s| } s.cocoapods_version = '>= 1.4.0' - s.swift_version = '4.2' + if s.respond_to?(:swift_versions) then + s.swift_versions = ['4.2', '5.0'] + else + s.swift_version = '4.2' + end end diff --git a/Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.pbxproj b/Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.pbxproj index 2bf9a6a..5179f22 100644 --- a/Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.pbxproj +++ b/Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.pbxproj @@ -380,6 +380,9 @@ CD79C9B51D2CC848004B6F9A /* ObjCUserDescriptionTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 965B0D081B62B8ED0005AE66 /* ObjCUserDescriptionTest.m */; }; CD79C9B61D2CC848004B6F9A /* ObjCAllPassTest.m in Sources */ = {isa = PBXBuildFile; fileRef = DDEFAEB31A93CBE6005CA37A /* ObjCAllPassTest.m */; }; CD79C9B71D2CC848004B6F9A /* ObjCSatisfyAnyOfTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B5358C11C39155600A23FAA /* ObjCSatisfyAnyOfTest.m */; }; + CD8D21BD2322BFC300C3996F /* CwlPreconditionTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8D21BC2322BFC300C3996F /* CwlPreconditionTesting.h */; settings = {ATTRIBUTES = (Public, ); }; }; + CD8D21BE2322BFC300C3996F /* CwlPreconditionTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8D21BC2322BFC300C3996F /* CwlPreconditionTesting.h */; settings = {ATTRIBUTES = (Public, ); }; }; + CD8D21BF2322BFC300C3996F /* CwlPreconditionTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8D21BC2322BFC300C3996F /* CwlPreconditionTesting.h */; settings = {ATTRIBUTES = (Public, ); }; }; CDD80B831F2030790002CD65 /* MatcherProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1D1968AB07008ED995 /* MatcherProtocols.swift */; }; CDD80B841F20307A0002CD65 /* MatcherProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1D1968AB07008ED995 /* MatcherProtocols.swift */; }; CDD80B851F20307B0002CD65 /* MatcherProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1D1968AB07008ED995 /* MatcherProtocols.swift */; }; @@ -395,8 +398,6 @@ CDFB6A3C1F7E082500AD8CC7 /* CwlCatchBadInstruction.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A2B1F7E082400AD8CC7 /* CwlCatchBadInstruction.swift */; }; CDFB6A3F1F7E082500AD8CC7 /* CwlDarwinDefinitions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A2D1F7E082400AD8CC7 /* CwlDarwinDefinitions.swift */; }; CDFB6A401F7E082500AD8CC7 /* CwlDarwinDefinitions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A2D1F7E082400AD8CC7 /* CwlDarwinDefinitions.swift */; }; - CDFB6A431F7E082500AD8CC7 /* CwlPreconditionTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A301F7E082400AD8CC7 /* CwlPreconditionTesting.h */; settings = {ATTRIBUTES = (Public, ); }; }; - CDFB6A441F7E082500AD8CC7 /* CwlPreconditionTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A301F7E082400AD8CC7 /* CwlPreconditionTesting.h */; settings = {ATTRIBUTES = (Public, ); }; }; CDFB6A471F7E082500AD8CC7 /* CwlMachBadInstructionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A341F7E082400AD8CC7 /* CwlMachBadInstructionHandler.m */; }; CDFB6A481F7E082500AD8CC7 /* CwlMachBadInstructionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A341F7E082400AD8CC7 /* CwlMachBadInstructionHandler.m */; }; CDFB6A491F7E082500AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A361F7E082400AD8CC7 /* CwlMachBadInstructionHandler.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -404,9 +405,8 @@ CDFB6A4B1F7E082500AD8CC7 /* mach_excServer.c in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A371F7E082400AD8CC7 /* mach_excServer.c */; }; CDFB6A4C1F7E082500AD8CC7 /* mach_excServer.c in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A371F7E082400AD8CC7 /* mach_excServer.c */; }; CDFB6A4F1F7E084600AD8CC7 /* CwlMachBadInstructionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A341F7E082400AD8CC7 /* CwlMachBadInstructionHandler.m */; }; - CDFB6A501F7E085600AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A361F7E082400AD8CC7 /* CwlMachBadInstructionHandler.h */; }; + CDFB6A501F7E085600AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A361F7E082400AD8CC7 /* CwlMachBadInstructionHandler.h */; settings = {ATTRIBUTES = (Public, ); }; }; CDFB6A511F7E087500AD8CC7 /* CwlCatchBadInstructionPosix.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A2C1F7E082400AD8CC7 /* CwlCatchBadInstructionPosix.swift */; }; - CDFB6A521F7E089F00AD8CC7 /* CwlPreconditionTesting_POSIX.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A321F7E082400AD8CC7 /* CwlPreconditionTesting_POSIX.h */; settings = {ATTRIBUTES = (Public, ); }; }; DA9E8C821A414BB9002633C2 /* DSL+Wait.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9E8C811A414BB9002633C2 /* DSL+Wait.swift */; }; DA9E8C831A414BB9002633C2 /* DSL+Wait.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9E8C811A414BB9002633C2 /* DSL+Wait.swift */; }; DD72EC641A93874A002F7651 /* AllPassTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD72EC631A93874A002F7651 /* AllPassTest.swift */; }; @@ -622,6 +622,7 @@ B20058C020E92C7500C1264D /* ElementsEqual.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementsEqual.swift; sourceTree = ""; }; B20058C420E92CE400C1264D /* ElementsEqualTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementsEqualTest.swift; sourceTree = ""; }; CD037212207DCC580047AF28 /* XCTestManifests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTestManifests.swift; sourceTree = ""; }; + CD8D21BC2322BFC300C3996F /* CwlPreconditionTesting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlPreconditionTesting.h; sourceTree = ""; }; CDFB6A1E1F7E07C600AD8CC7 /* CwlCatchException.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlCatchException.swift; sourceTree = ""; }; CDFB6A201F7E07C600AD8CC7 /* CwlCatchException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CwlCatchException.m; sourceTree = ""; }; CDFB6A221F7E07C600AD8CC7 /* CwlCatchException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlCatchException.h; sourceTree = ""; }; @@ -629,8 +630,6 @@ CDFB6A2B1F7E082400AD8CC7 /* CwlCatchBadInstruction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlCatchBadInstruction.swift; sourceTree = ""; }; CDFB6A2C1F7E082400AD8CC7 /* CwlCatchBadInstructionPosix.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlCatchBadInstructionPosix.swift; sourceTree = ""; }; CDFB6A2D1F7E082400AD8CC7 /* CwlDarwinDefinitions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlDarwinDefinitions.swift; sourceTree = ""; }; - CDFB6A301F7E082400AD8CC7 /* CwlPreconditionTesting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlPreconditionTesting.h; sourceTree = ""; }; - CDFB6A321F7E082400AD8CC7 /* CwlPreconditionTesting_POSIX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlPreconditionTesting_POSIX.h; sourceTree = ""; }; CDFB6A341F7E082400AD8CC7 /* CwlMachBadInstructionHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CwlMachBadInstructionHandler.m; sourceTree = ""; }; CDFB6A361F7E082400AD8CC7 /* CwlMachBadInstructionHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlMachBadInstructionHandler.h; sourceTree = ""; }; CDFB6A371F7E082400AD8CC7 /* mach_excServer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mach_excServer.c; sourceTree = ""; }; @@ -940,6 +939,14 @@ path = objc; sourceTree = ""; }; + CD8D21BB2322BFC300C3996F /* include */ = { + isa = PBXGroup; + children = ( + CD8D21BC2322BFC300C3996F /* CwlPreconditionTesting.h */, + ); + path = include; + sourceTree = ""; + }; CDFB69521F7E06E600AD8CC7 /* Carthage-Checkouts */ = { isa = PBXGroup; children = ( @@ -957,7 +964,7 @@ CDFB6A1F1F7E07C600AD8CC7 /* CwlCatchExceptionSupport */, ); name = CwlCatchException; - path = CwlCatchException/Sources; + path = CwlPreconditionTesting/Dependencies/CwlCatchException/Sources; sourceTree = ""; }; CDFB69741F7E076F00AD8CC7 /* CwlPreconditionTesting */ = { @@ -998,32 +1005,15 @@ CDFB6A291F7E082400AD8CC7 /* CwlPreconditionTesting */ = { isa = PBXGroup; children = ( + CD8D21BB2322BFC300C3996F /* include */, CDFB6A2A1F7E082400AD8CC7 /* CwlBadInstructionException.swift */, CDFB6A2B1F7E082400AD8CC7 /* CwlCatchBadInstruction.swift */, CDFB6A2C1F7E082400AD8CC7 /* CwlCatchBadInstructionPosix.swift */, CDFB6A2D1F7E082400AD8CC7 /* CwlDarwinDefinitions.swift */, - CDFB6A2F1F7E082400AD8CC7 /* Mach */, - CDFB6A311F7E082400AD8CC7 /* Posix */, ); path = CwlPreconditionTesting; sourceTree = ""; }; - CDFB6A2F1F7E082400AD8CC7 /* Mach */ = { - isa = PBXGroup; - children = ( - CDFB6A301F7E082400AD8CC7 /* CwlPreconditionTesting.h */, - ); - path = Mach; - sourceTree = ""; - }; - CDFB6A311F7E082400AD8CC7 /* Posix */ = { - isa = PBXGroup; - children = ( - CDFB6A321F7E082400AD8CC7 /* CwlPreconditionTesting_POSIX.h */, - ); - path = Posix; - sourceTree = ""; - }; CDFB6A331F7E082400AD8CC7 /* CwlMachBadInstructionHandler */ = { isa = PBXGroup; children = ( @@ -1050,9 +1040,9 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + CD8D21BE2322BFC300C3996F /* CwlPreconditionTesting.h in Headers */, CDFB6A4A1F7E082500AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */, CDFB6A281F7E07C700AD8CC7 /* CwlCatchException.h in Headers */, - CDFB6A441F7E082500AD8CC7 /* CwlPreconditionTesting.h in Headers */, 1F1871C91CA89EDB00A34BF2 /* NMBStringify.h in Headers */, 1F1871C51CA89EDB00A34BF2 /* DSL.h in Headers */, 1F1871C71CA89EDB00A34BF2 /* NMBExceptionCapture.h in Headers */, @@ -1064,8 +1054,8 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - CDFB6A521F7E089F00AD8CC7 /* CwlPreconditionTesting_POSIX.h in Headers */, 1F1871E21CA89EF600A34BF2 /* NMBStringify.h in Headers */, + CD8D21BF2322BFC300C3996F /* CwlPreconditionTesting.h in Headers */, 1F1871E01CA89EF600A34BF2 /* DSL.h in Headers */, 1F1871E11CA89EF600A34BF2 /* NMBExceptionCapture.h in Headers */, CDFB6A501F7E085600AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */, @@ -1077,10 +1067,10 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + CD8D21BD2322BFC300C3996F /* CwlPreconditionTesting.h in Headers */, CDFB6A491F7E082500AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */, CDFB6A271F7E07C700AD8CC7 /* CwlCatchException.h in Headers */, 1F1871DF1CA89EF500A34BF2 /* NMBStringify.h in Headers */, - CDFB6A431F7E082500AD8CC7 /* CwlPreconditionTesting.h in Headers */, 1F1871DD1CA89EF500A34BF2 /* DSL.h in Headers */, 1F1871DE1CA89EF500A34BF2 /* NMBExceptionCapture.h in Headers */, 1F925EC7195C0DD100ED456B /* Nimble.h in Headers */, @@ -1211,7 +1201,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "Jeff Hui"; TargetAttributes = { 1F1A74281940169200FFFC47 = { @@ -1248,10 +1238,11 @@ }; buildConfigurationList = 1F1A74231940169200FFFC47 /* Build configuration list for PBXProject "Nimble" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = 1F1A741F1940169200FFFC47; productRefGroup = 1F1A742A1940169200FFFC47 /* Products */; @@ -1809,6 +1800,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; APPLICATION_EXTENSION_API_ONLY = YES; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -1855,16 +1847,13 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; + SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.2; - TARGETED_DEVICE_FAMILY = "1,2"; - TVOS_DEPLOYMENT_TARGET = 9.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -1875,6 +1864,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; APPLICATION_EXTENSION_API_ONLY = YES; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -1914,15 +1904,13 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; + OTHER_SWIFT_FLAGS = "$(inherited) -suppress-warnings"; + SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.2; - TARGETED_DEVICE_FAMILY = "1,2"; - TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1950,8 +1938,8 @@ GCC_TREAT_WARNINGS_AS_ERRORS = YES; INFOPLIST_FILE = Sources/Nimble/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( "$(inherited)", "-weak_framework", @@ -1963,8 +1951,10 @@ PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Nimble; PRODUCT_NAME = Nimble; + SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; @@ -1988,6 +1978,7 @@ GCC_TREAT_WARNINGS_AS_ERRORS = YES; INFOPLIST_FILE = Sources/Nimble/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; OTHER_LDFLAGS = ( "$(inherited)", @@ -2000,8 +1991,10 @@ PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Nimble; PRODUCT_NAME = Nimble; + SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; }; @@ -2018,11 +2011,13 @@ "$(inherited)", ); INFOPLIST_FILE = Tests/NimbleTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = YES; OTHER_CODE_SIGN_FLAGS = "--verbose"; PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = NimbleTests; + SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -2036,11 +2031,13 @@ "$(inherited)", ); INFOPLIST_FILE = Tests/NimbleTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = NO; OTHER_CODE_SIGN_FLAGS = "--verbose"; PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = NimbleTests; + SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; @@ -2082,6 +2079,7 @@ SDKROOT = appletvos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; }; @@ -2123,6 +2121,7 @@ SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Release; }; @@ -2143,6 +2142,7 @@ PRODUCT_NAME = NimbleTests; SDKROOT = appletvos; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; }; @@ -2165,6 +2165,7 @@ SDKROOT = appletvos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Release; }; @@ -2190,6 +2191,7 @@ INFOPLIST_FILE = Sources/Nimble/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = ( "$(inherited)", @@ -2230,6 +2232,7 @@ INFOPLIST_FILE = Sources/Nimble/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = NO; OTHER_LDFLAGS = ( "$(inherited)", @@ -2264,11 +2267,13 @@ ); INFOPLIST_FILE = Tests/NimbleTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = NimbleTests; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VALID_ARCHS = x86_64; }; name = Debug; }; @@ -2284,11 +2289,13 @@ ); INFOPLIST_FILE = Tests/NimbleTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = NimbleTests; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + VALID_ARCHS = x86_64; }; name = Release; }; diff --git a/Carthage/Checkouts/Nimble/Nimble.xcodeproj/xcshareddata/xcschemes/Nimble-iOS.xcscheme b/Carthage/Checkouts/Nimble/Nimble.xcodeproj/xcshareddata/xcschemes/Nimble-iOS.xcscheme index 80405c9..f9a7a22 100644 --- a/Carthage/Checkouts/Nimble/Nimble.xcodeproj/xcshareddata/xcschemes/Nimble-iOS.xcscheme +++ b/Carthage/Checkouts/Nimble/Nimble.xcodeproj/xcshareddata/xcschemes/Nimble-iOS.xcscheme @@ -1,6 +1,6 @@ @@ -1711,6 +1713,27 @@ end Finally run `pod install`. +## Installing Nimble via Accio + +Add the following to your Package.swift: + +```swift +.package(url: "https://github.com/Quick/Nimble.git", .upToNextMajor(from: "8.0.1")), +``` + +Next, add `Nimble` to your App targets dependencies like so: + +```swift +.testTarget( + name: "AppTests", + dependencies: [ + "Nimble", + ] +), +``` + +Then run `accio update`. + ## Using Nimble without XCTest Nimble is integrated with XCTest to allow it work well when used in Xcode test diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift index b3eb09a..5338a46 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift @@ -54,49 +54,49 @@ public class NMBExpectation: NSObject { } @objc public var withTimeout: (TimeInterval) -> NMBExpectation { - return ({ timeout in self._timeout = timeout + return { timeout in self._timeout = timeout return self - }) + } } @objc public var to: (NMBMatcher) -> Void { - return ({ matcher in + return { matcher in if let pred = matcher as? NMBPredicate { self.expectValue.to(from(objcPredicate: pred)) } else { self.expectValue.to(ObjCMatcherWrapper(matcher: matcher)) } - }) + } } @objc public var toWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in + return { matcher, description in if let pred = matcher as? NMBPredicate { self.expectValue.to(from(objcPredicate: pred), description: description) } else { self.expectValue.to(ObjCMatcherWrapper(matcher: matcher), description: description) } - }) + } } @objc public var toNot: (NMBMatcher) -> Void { - return ({ matcher in + return { matcher in if let pred = matcher as? NMBPredicate { self.expectValue.toNot(from(objcPredicate: pred)) } else { self.expectValue.toNot(ObjCMatcherWrapper(matcher: matcher)) } - }) + } } @objc public var toNotWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in + return { matcher, description in if let pred = matcher as? NMBPredicate { self.expectValue.toNot(from(objcPredicate: pred), description: description) } else { self.expectValue.toNot(ObjCMatcherWrapper(matcher: matcher), description: description) } - }) + } } @objc public var notTo: (NMBMatcher) -> Void { return toNot } @@ -104,7 +104,7 @@ public class NMBExpectation: NSObject { @objc public var notToWithDescription: (NMBMatcher, String) -> Void { return toNotWithDescription } @objc public var toEventually: (NMBMatcher) -> Void { - return ({ matcher in + return { matcher in if let pred = matcher as? NMBPredicate { self.expectValue.toEventually( from(objcPredicate: pred), @@ -118,11 +118,11 @@ public class NMBExpectation: NSObject { description: nil ) } - }) + } } @objc public var toEventuallyWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in + return { matcher, description in if let pred = matcher as? NMBPredicate { self.expectValue.toEventually( from(objcPredicate: pred), @@ -136,11 +136,11 @@ public class NMBExpectation: NSObject { description: description ) } - }) + } } @objc public var toEventuallyNot: (NMBMatcher) -> Void { - return ({ matcher in + return { matcher in if let pred = matcher as? NMBPredicate { self.expectValue.toEventuallyNot( from(objcPredicate: pred), @@ -154,11 +154,11 @@ public class NMBExpectation: NSObject { description: nil ) } - }) + } } @objc public var toEventuallyNotWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in + return { matcher, description in if let pred = matcher as? NMBPredicate { self.expectValue.toEventuallyNot( from(objcPredicate: pred), @@ -172,7 +172,7 @@ public class NMBExpectation: NSObject { description: description ) } - }) + } } @objc public var toNotEventually: (NMBMatcher) -> Void { diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift index 719bf44..cd3b476 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift @@ -45,7 +45,7 @@ class NimbleXCTestUnavailableHandler: AssertionHandler { private var stashed_swift_reportFatalErrorsToDebugger: Bool = false @objc func testCaseWillStart(_ testCase: XCTestCase) { - #if swift(>=3.2) + #if swift(>=3.2) && !os(tvOS) stashed_swift_reportFatalErrorsToDebugger = _swift_reportFatalErrorsToDebugger _swift_reportFatalErrorsToDebugger = false #endif @@ -56,7 +56,7 @@ class NimbleXCTestUnavailableHandler: AssertionHandler { @objc func testCaseDidFinish(_ testCase: XCTestCase) { currentTestCase = nil - #if swift(>=3.2) + #if swift(>=3.2) && !os(tvOS) _swift_reportFatalErrorsToDebugger = stashed_swift_reportFatalErrorsToDebugger #endif } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Expression.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Expression.swift index b6b2ee3..dcc42e4 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Expression.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Expression.swift @@ -4,12 +4,12 @@ import Foundation // closure once; even if repeat calls to the returned closure internal func memoizedClosure(_ closure: @escaping () throws -> T) -> (Bool) throws -> T { var cache: T? - return ({ withoutCaching in + return { withoutCaching in if withoutCaching || cache == nil { cache = try closure() } return cache! - }) + } } /// Expression represents the closure of the value inside expect(...). diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift index d6fd1ee..4396180 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift @@ -51,10 +51,12 @@ public class NMBObjCBeCloseToMatcher: NSObject, NMBMatcher { return actualExpression() as? NMBDoubleConvertible }) let expr = Expression(expression: actualBlock, location: location) - let matcher = beCloseTo(self._expected, within: self._delta) + let predicate = beCloseTo(self._expected, within: self._delta) do { - return try matcher.matches(expr, failureMessage: failureMessage) + let result = try predicate.satisfies(expr) + result.message.update(failureMessage: failureMessage) + return result.toBoolean(expectation: .toMatch) } catch let error { failureMessage.stringValue = "unexpected error thrown: <\(error)>" return false @@ -66,10 +68,12 @@ public class NMBObjCBeCloseToMatcher: NSObject, NMBMatcher { return actualExpression() as? NMBDoubleConvertible }) let expr = Expression(expression: actualBlock, location: location) - let matcher = beCloseTo(self._expected, within: self._delta) + let predicate = beCloseTo(self._expected, within: self._delta) do { - return try matcher.doesNotMatch(expr, failureMessage: failureMessage) + let result = try predicate.satisfies(expr) + result.message.update(failureMessage: failureMessage) + return result.toBoolean(expectation: .toNotMatch) } catch let error { failureMessage.stringValue = "unexpected error thrown: <\(error)>" return false @@ -77,9 +81,9 @@ public class NMBObjCBeCloseToMatcher: NSObject, NMBMatcher { } @objc public var within: (CDouble) -> NMBObjCBeCloseToMatcher { - return ({ delta in + return { delta in return NMBObjCBeCloseToMatcher(expected: self._expected, within: delta) - }) + } } } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift index 4a4cdd2..782c771 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift @@ -11,6 +11,11 @@ public func beGreaterThan(_ expectedValue: T?) -> Predicate { } } +public func >(lhs: Expectation, rhs: T) { + lhs.to(beGreaterThan(rhs)) +} + +#if canImport(Darwin) || !compiler(>=5.1) /// A Nimble matcher that succeeds when the actual value is greater than the expected value. public func beGreaterThan(_ expectedValue: NMBComparable?) -> Predicate { let errorMessage = "be greater than <\(stringify(expectedValue))>" @@ -22,13 +27,10 @@ public func beGreaterThan(_ expectedValue: NMBComparable?) -> Predicate(lhs: Expectation, rhs: T) { - lhs.to(beGreaterThan(rhs)) -} - public func > (lhs: Expectation, rhs: NMBComparable?) { lhs.to(beGreaterThan(rhs)) } +#endif #if canImport(Darwin) extension NMBObjCMatcher { diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift index 39d9e63..c3fc523 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift @@ -13,6 +13,11 @@ public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Predic } } +public func >=(lhs: Expectation, rhs: T) { + lhs.to(beGreaterThanOrEqualTo(rhs)) +} + +#if canImport(Darwin) || !compiler(>=5.1) /// A Nimble matcher that succeeds when the actual value is greater than /// or equal to the expected value. public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Predicate { @@ -24,13 +29,10 @@ public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Pre } } -public func >=(lhs: Expectation, rhs: T) { - lhs.to(beGreaterThanOrEqualTo(rhs)) -} - public func >=(lhs: Expectation, rhs: T) { lhs.to(beGreaterThanOrEqualTo(rhs)) } +#endif #if canImport(Darwin) extension NMBObjCMatcher { diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift index 49e503e..7644b4c 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift @@ -4,18 +4,9 @@ import Foundation /// as the expected instance. public func beIdenticalTo(_ expected: Any?) -> Predicate { return Predicate.define { actualExpression in - #if os(Linux) && !swift(>=4.1.50) - let actual = try actualExpression.evaluate() as? AnyObject - #else - let actual = try actualExpression.evaluate() as AnyObject? - #endif + let actual = try actualExpression.evaluate() as AnyObject? - let bool: Bool - #if os(Linux) && !swift(>=4.1.50) - bool = actual === (expected as? AnyObject) && actual !== nil - #else - bool = actual === (expected as AnyObject?) && actual !== nil - #endif + let bool = actual === (expected as AnyObject?) && actual !== nil return PredicateResult( bool: bool, message: .expectedCustomValueTo( diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThan.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThan.swift index ef0a7d4..12fc9c2 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThan.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThan.swift @@ -11,6 +11,11 @@ public func beLessThan(_ expectedValue: T?) -> Predicate { } } +public func <(lhs: Expectation, rhs: T) { + lhs.to(beLessThan(rhs)) +} + +#if canImport(Darwin) || !compiler(>=5.1) /// A Nimble matcher that succeeds when the actual value is less than the expected value. public func beLessThan(_ expectedValue: NMBComparable?) -> Predicate { let message = "be less than <\(stringify(expectedValue))>" @@ -21,13 +26,10 @@ public func beLessThan(_ expectedValue: NMBComparable?) -> Predicate(lhs: Expectation, rhs: T) { - lhs.to(beLessThan(rhs)) -} - public func < (lhs: Expectation, rhs: NMBComparable?) { lhs.to(beLessThan(rhs)) } +#endif #if canImport(Darwin) extension NMBObjCMatcher { diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift index 30ce043..bf6ba16 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift @@ -11,6 +11,11 @@ public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predicate } } +public func <=(lhs: Expectation, rhs: T) { + lhs.to(beLessThanOrEqualTo(rhs)) +} + +#if canImport(Darwin) || !compiler(>=5.1) /// A Nimble matcher that succeeds when the actual value is less than /// or equal to the expected value. public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predicate { @@ -21,13 +26,10 @@ public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predic } } -public func <=(lhs: Expectation, rhs: T) { - lhs.to(beLessThanOrEqualTo(rhs)) -} - public func <=(lhs: Expectation, rhs: T) { lhs.to(beLessThanOrEqualTo(rhs)) } +#endif #if canImport(Darwin) extension NMBObjCMatcher { diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift index 38bb297..21ffd77 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift @@ -18,13 +18,13 @@ extension Matcher { } var toClosure: (Expression, FailureMessage, Bool) throws -> Bool { - return ({ expr, msg, expectedResult in + return { expr, msg, expectedResult in if expectedResult { return try self.matches(expr, failureMessage: msg) } else { return try self.doesNotMatch(expr, failureMessage: msg) } - }) + } } } @@ -136,13 +136,14 @@ extension NSDate: TestOutputStringConvertible { @objc public protocol NMBComparable { func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult } -#else +#elseif !compiler(>=5.1) // This should become obsolete once Corelibs Foundation adds Comparable conformance to NSNumber public protocol NMBComparable { func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult } #endif +#if canImport(Darwin) || !compiler(>=5.1) extension NSNumber: NMBComparable { public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult { // swiftlint:disable:next force_cast @@ -155,3 +156,4 @@ extension NSString: NMBComparable { return compare(otherObject as! String) } } +#endif diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/PostNotification.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/PostNotification.swift index 7d3e44c..5e8bee3 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/PostNotification.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/PostNotification.swift @@ -3,11 +3,7 @@ import Foundation internal class NotificationCollector { private(set) var observedNotifications: [Notification] private let notificationCenter: NotificationCenter - #if canImport(Darwin) - private var token: AnyObject? - #else private var token: NSObjectProtocol? - #endif required init(notificationCenter: NotificationCenter) { self.notificationCenter = notificationCenter @@ -23,20 +19,53 @@ internal class NotificationCollector { } deinit { - #if canImport(Darwin) - if let token = self.token { - self.notificationCenter.removeObserver(token) - } - #else - if let token = self.token as? AnyObject { - self.notificationCenter.removeObserver(token) - } - #endif + if let token = self.token { + self.notificationCenter.removeObserver(token) + } } } private let mainThread = pthread_self() +public func postNotifications( + _ predicate: Predicate<[Notification]>, + fromNotificationCenter center: NotificationCenter = .default +) -> Predicate { + _ = mainThread // Force lazy-loading of this value + let collector = NotificationCollector(notificationCenter: center) + collector.startObserving() + var once: Bool = false + + return Predicate { actualExpression in + let collectorNotificationsExpression = Expression( + memoizedExpression: { _ in + return collector.observedNotifications + }, + location: actualExpression.location, + withoutCaching: true + ) + + assert(pthread_equal(mainThread, pthread_self()) != 0, "Only expecting closure to be evaluated on main thread.") + if !once { + once = true + _ = try actualExpression.evaluate() + } + + let actualValue: String + if collector.observedNotifications.isEmpty { + actualValue = "no notifications" + } else { + actualValue = "<\(stringify(collector.observedNotifications))>" + } + + var result = try predicate.satisfies(collectorNotificationsExpression) + result.message = result.message.replacedExpectation { message in + return .expectedCustomValueTo(message.expectedMessage, actualValue) + } + return result + } +} + public func postNotifications( _ notificationsMatcher: T, fromNotificationCenter center: NotificationCenter = .default) diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/RaisesException.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/RaisesException.swift index f44c810..4dd9304 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/RaisesException.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/RaisesException.swift @@ -141,12 +141,15 @@ public class NMBObjCRaiseExceptionMatcher: NSObject, NMBMatcher { let expr = Expression(expression: block, location: location) do { - return try raiseException( + let predicate = raiseException( named: _name, reason: _reason, userInfo: _userInfo, closure: _block - ).matches(expr, failureMessage: failureMessage) + ) + let result = try predicate.satisfies(expr) + result.message.update(failureMessage: failureMessage) + return result.toBoolean(expectation: .toMatch) } catch let error { failureMessage.stringValue = "unexpected error thrown: <\(error)>" return false @@ -158,47 +161,47 @@ public class NMBObjCRaiseExceptionMatcher: NSObject, NMBMatcher { } @objc public var named: (_ name: String) -> NMBObjCRaiseExceptionMatcher { - return ({ name in + return { name in return NMBObjCRaiseExceptionMatcher( name: name, reason: self._reason, userInfo: self._userInfo, block: self._block ) - }) + } } @objc public var reason: (_ reason: String?) -> NMBObjCRaiseExceptionMatcher { - return ({ reason in + return { reason in return NMBObjCRaiseExceptionMatcher( name: self._name, reason: reason, userInfo: self._userInfo, block: self._block ) - }) + } } @objc public var userInfo: (_ userInfo: NSDictionary?) -> NMBObjCRaiseExceptionMatcher { - return ({ userInfo in + return { userInfo in return NMBObjCRaiseExceptionMatcher( name: self._name, reason: self._reason, userInfo: userInfo, block: self._block ) - }) + } } @objc public var satisfyingBlock: (_ block: ((NSException) -> Void)?) -> NMBObjCRaiseExceptionMatcher { - return ({ block in + return { block in return NMBObjCRaiseExceptionMatcher( name: self._name, reason: self._reason, userInfo: self._userInfo, block: block ) - }) + } } } diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift index da3ea9a..15de060 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift @@ -1,5 +1,11 @@ import Foundation +/// A Nimble matcher that succeeds when the actual value matches with all of the matchers +/// provided in the variable list of matchers. +public func satisfyAllOf(_ predicates: Predicate...) -> Predicate { + return satisfyAllOf(predicates) +} + /// A Nimble matcher that succeeds when the actual value matches with all of the matchers /// provided in the variable list of matchers. public func satisfyAllOf(_ matchers: U...) -> Predicate diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift index 6724956..e8b379f 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift @@ -1,5 +1,11 @@ import Foundation +/// A Nimble matcher that succeeds when the actual value matches with any of the matchers +/// provided in the variable list of matchers. +public func satisfyAnyOf(_ predicates: Predicate...) -> Predicate { + return satisfyAnyOf(predicates) +} + /// A Nimble matcher that succeeds when the actual value matches with any of the matchers /// provided in the variable list of matchers. public func satisfyAnyOf(_ matchers: U...) -> Predicate diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift index 53d9191..e20f9ea 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift @@ -1,8 +1,12 @@ import Foundation +#if canImport(CwlPreconditionTesting) +import CwlPreconditionTesting +#endif + public func throwAssertion() -> Predicate { return Predicate { actualExpression in - #if arch(x86_64) && canImport(Darwin) && !SWIFT_PACKAGE + #if arch(x86_64) && canImport(Darwin) let message = ExpectationMessage.expectedTo("throw an assertion") var actualError: Error? @@ -38,10 +42,6 @@ public func throwAssertion() -> Predicate { } else { return PredicateResult(bool: caughtException != nil, message: message) } - #elseif SWIFT_PACKAGE - fatalError("The throwAssertion Nimble matcher does not currently support Swift CLI." + - " You can silence this error by placing the test case inside an #if !SWIFT_PACKAGE" + - " conditional statement") #else fatalError("The throwAssertion Nimble matcher can only run on x86_64 platforms with " + "Objective-C (e.g. macOS, iPhone 5s or later simulators). You can silence this error " + diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Nimble.h b/Carthage/Checkouts/Nimble/Sources/Nimble/Nimble.h index 2bbc693..bd45c5d 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Nimble.h +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Nimble.h @@ -3,11 +3,7 @@ #import "NMBStringify.h" #import "DSL.h" -#if TARGET_OS_TV - #import "CwlPreconditionTesting_POSIX.h" -#else - #import "CwlPreconditionTesting.h" -#endif +#import "CwlPreconditionTesting.h" FOUNDATION_EXPORT double NimbleVersionNumber; FOUNDATION_EXPORT const unsigned char NimbleVersionString[]; diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Await.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Await.swift index 276f618..abe1237 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Await.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Await.swift @@ -32,11 +32,7 @@ internal class AssertionWaitLock: WaitLock { func acquireWaitingLock(_ fnName: String, file: FileString, line: UInt) { let info = WaitingInfo(name: fnName, file: file, lineNumber: line) - #if canImport(Darwin) - let isMainThread = Thread.isMainThread - #else - let isMainThread = _CFIsMainThread() - #endif + let isMainThread = Thread.isMainThread nimblePrecondition( isMainThread, "InvalidNimbleAPIUsage", diff --git a/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Stringers.swift b/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Stringers.swift index 4ab18d2..7caea26 100644 --- a/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Stringers.swift +++ b/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Stringers.swift @@ -1,12 +1,7 @@ import Foundation internal func identityAsString(_ value: Any?) -> String { - let anyObject: AnyObject? -#if os(Linux) && !swift(>=4.1.50) - anyObject = value as? AnyObject -#else - anyObject = value as AnyObject? -#endif + let anyObject = value as AnyObject? if let value = anyObject { return NSString(format: "<%p>", unsafeBitCast(value, to: Int.self)).description } else { @@ -121,13 +116,7 @@ extension String: TestOutputStringConvertible { extension Data: TestOutputStringConvertible { public var testDescription: String { - #if os(Linux) - // swiftlint:disable:next todo - // FIXME: Swift on Linux triggers a segfault when calling NSData's hash() (last checked on 03-11-16) - return "Data" - #else - return "Data" - #endif + return "Data" } } diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/AsynchronousTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/AsynchronousTest.swift index bfa34c2..307412e 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/AsynchronousTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/AsynchronousTest.swift @@ -61,12 +61,12 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { } func testWaitUntilWithCustomDefaultsTimeout() { - AsyncDefaults.Timeout = 5 + AsyncDefaults.Timeout = 3 defer { AsyncDefaults.Timeout = 1 } waitUntil { done in - Thread.sleep(forTimeInterval: 4.8) + Thread.sleep(forTimeInterval: 2.8) done() } } @@ -121,7 +121,7 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { let msg = "-waitUntil() timed out but was unable to run the timeout handler because the main thread is unresponsive (0.5 seconds is allow after the wait times out). Conditions that may cause this include processing blocking IO on the main thread, calls to sleep(), deadlocks, and synchronous IPC. Nimble forcefully stopped run loop which may cause future failures in test run." failsWithErrorMessage(msg) { waitUntil(timeout: 1) { done in - Thread.sleep(forTimeInterval: 5.0) + Thread.sleep(forTimeInterval: 3.0) done() } } diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Helpers/utils.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Helpers/utils.swift index c90b72a..785d601 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Helpers/utils.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Helpers/utils.swift @@ -71,7 +71,7 @@ func deferToMainQueue(action: @escaping () -> Void) { } } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE public class NimbleHelper: NSObject { @objc public class func expectFailureMessage(_ message: NSString, block: () -> Void, file: FileString, line: UInt) { failsWithErrorMessage(String(describing: message), file: file, line: line, preferOriginalSourceLocation: true, closure: block) diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift index 64a439b..00a35ff 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift @@ -49,7 +49,7 @@ final class BeAKindOfSwiftTest: XCTestCase, XCTestCaseProvider { final class BeAKindOfObjCTest: XCTestCase, XCTestCaseProvider { func testPositiveMatch() { -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) expect(TestNull()).to(beAKindOf(NSNull.self)) expect(NSObject()).to(beAKindOf(NSObject.self)) expect(NSNumber(value: 1)).toNot(beAKindOf(NSDate.self)) @@ -57,7 +57,7 @@ final class BeAKindOfObjCTest: XCTestCase, XCTestCaseProvider { } func testFailureMessages() { -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) failsWithErrorMessageForNil("expected to not be a kind of NSNull, got ") { expect(nil as NSNull?).toNot(beAKindOf(NSNull.self)) } diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift index df431e6..0d379a2 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift @@ -40,7 +40,7 @@ final class BeAnInstanceOfTest: XCTestCase, XCTestCaseProvider { failsWithErrorMessageForNil("expected to be an instance of NSString, got ") { expect(nil as NSString?).to(beAnInstanceOf(NSString.self)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) let numberTypeName = "__NSCFNumber" #else let numberTypeName = "NSNumber" diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift index aa0300f..fa6f9d7 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift @@ -13,7 +13,7 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect([] as Set).to(beEmpty()) expect([1] as Set).toNot(beEmpty()) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) expect(NSDictionary() as? [Int: Int]).to(beEmpty()) expect(NSDictionary(object: 1, forKey: 1 as NSNumber) as? [Int: Int]).toNot(beEmpty()) #endif @@ -21,7 +21,7 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect([Int: Int]()).to(beEmpty()) expect(["hi": 1]).toNot(beEmpty()) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) expect(NSArray() as? [Int]).to(beEmpty()) expect(NSArray(array: [1]) as? [Int]).toNot(beEmpty()) #endif @@ -57,7 +57,7 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect([1] as Set).to(beEmpty()) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) failsWithErrorMessage("expected to not be empty, got <{()}>") { expect(NSSet()).toNot(beEmpty()) } diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift index 4c91fec..9ac561f 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift @@ -9,9 +9,7 @@ final class BeGreaterThanOrEqualToTest: XCTestCase, XCTestCaseProvider { expect(1).toNot(beGreaterThanOrEqualTo(2)) expect(NSNumber(value: 1)).toNot(beGreaterThanOrEqualTo(2)) expect(NSNumber(value: 2)).to(beGreaterThanOrEqualTo(NSNumber(value: 2))) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) expect(1).to(beGreaterThanOrEqualTo(NSNumber(value: 0))) -#endif failsWithErrorMessage("expected to be greater than or equal to <2>, got <0>") { expect(0).to(beGreaterThanOrEqualTo(2)) diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift index 8830647..80d40e7 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift @@ -41,7 +41,7 @@ final class BeIdenticalToTest: XCTestCase, XCTestCaseProvider { let value = NSDate() expect(value).to(be(value)) expect(NSNumber(value: 1)).toNot(be(NSString(string: "turtles"))) - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) expect([1]).toNot(be([1])) #else expect(NSArray(array: [NSNumber(value: 1)])).toNot(beIdenticalTo(NSArray(array: [NSNumber(value: 1)]))) diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift index f389469..dd8120d 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift @@ -10,10 +10,8 @@ final class BeLessThanOrEqualToTest: XCTestCase, XCTestCaseProvider { expect(NSNumber(value: 2)).to(beLessThanOrEqualTo(10)) expect(NSNumber(value: 2)).toNot(beLessThanOrEqualTo(1)) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) expect(2).to(beLessThanOrEqualTo(NSNumber(value: 10))) expect(2).toNot(beLessThanOrEqualTo(NSNumber(value: 1))) -#endif failsWithErrorMessage("expected to be less than or equal to <0>, got <2>") { expect(2).to(beLessThanOrEqualTo(0)) diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift index 3a5162e..6805d7c 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift @@ -15,10 +15,8 @@ final class BeginWithTest: XCTestCase, XCTestCaseProvider { expect(NSString(string: "foobar").description).to(beginWith("foo")) expect(NSString(string: "foobar").description).toNot(beginWith("oo")) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) expect(NSArray(array: ["a", "b"])).to(beginWith("a")) expect(NSArray(array: ["a", "b"])).toNot(beginWith("b")) -#endif } func testNegativeMatches() { diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift index ab593ad..28f685e 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift @@ -10,7 +10,7 @@ final class ContainTest: XCTestCase, XCTestCaseProvider { expect([1, 2, 3] as [CInt]).toNot(contain(4 as CInt)) expect(["foo", "bar", "baz"]).to(contain("baz")) expect(["foo", "bar", "baz"]).toNot(contain("ba")) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) expect(NSArray(array: ["a"])).to(contain(NSString(string: "a"))) expect(NSArray(array: ["a"])).toNot(contain(NSString(string: "b"))) expect(NSArray(object: 1) as NSArray?).to(contain(1)) diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift index 88005e8..54794c5 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift @@ -16,12 +16,10 @@ final class EndWithTest: XCTestCase, XCTestCaseProvider { expect(NSString(string: "foobar").description).to(endWith("bar")) expect(NSString(string: "foobar").description).toNot(endWith("oo")) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) expect(NSArray(array: ["a", "b"])).to(endWith("b")) expect(NSArray(array: ["a", "b"])).toNot(endWith("a")) expect(NSArray(array: [])).toNot(endWith("a")) expect(NSArray(array: ["a", "b", "a"])).to(endWith("a")) -#endif } func testEndWithNegatives() { diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift index 18b0647..5b1aa49 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift @@ -33,9 +33,7 @@ final class EqualTest: XCTestCase, XCTestCaseProvider { expect(array1).to(equal([1, 2, 3])) expect(array1).toNot(equal([1, 2] as [Int])) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) expect(NSArray(array: [1, 2, 3])).to(equal(NSArray(array: [1, 2, 3]))) -#endif failsWithErrorMessage("expected to equal <[1, 2]>, got <[1, 2, 3]>") { expect([1, 2, 3]).to(equal([1, 2])) @@ -119,10 +117,8 @@ final class EqualTest: XCTestCase, XCTestCaseProvider { expect(actual).to(equal(expected)) expect(actual).toNot(equal(unexpected)) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) expect(NSDictionary(object: "bar", forKey: "foo" as NSString)).to(equal(["foo": "bar"])) expect(NSDictionary(object: "bar", forKey: "foo" as NSString) as? [String: String]).to(equal(expected)) -#endif } func testDataEquality() { @@ -133,14 +129,8 @@ final class EqualTest: XCTestCase, XCTestCaseProvider { expect(actual).to(equal(expected)) expect(actual).toNot(equal(unexpected)) - #if os(Linux) - // swiftlint:disable:next todo - // FIXME: Swift on Linux triggers a segfault when calling NSData's hash() (last checked on 03-11) - let expectedErrorMessage = "expected to equal >, got >" - #else - let expectedErrorMessage = "expected to equal >," + let expectedErrorMessage = "expected to equal >," + " got >" - #endif failsWithErrorMessage(expectedErrorMessage) { expect(actual).to(equal(unexpected)) diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift index 41e5159..bac76e9 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift @@ -19,7 +19,7 @@ final class MatchErrorTest: XCTestCase, XCTestCaseProvider { } func testMatchNSErrorPositive() { -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) let error1 = NSError(domain: "err", code: 0, userInfo: nil) let error2 = NSError(domain: "err", code: 0, userInfo: nil) @@ -45,7 +45,7 @@ final class MatchErrorTest: XCTestCase, XCTestCaseProvider { expect(CustomDebugStringConvertibleError.a).to(matchError(CustomDebugStringConvertibleError.b)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) failsWithErrorMessage("expected to match error , got ") { let error1 = NSError(domain: "err", code: 0, userInfo: nil) let error2 = NSError(domain: "err", code: 1, userInfo: nil) diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift index 32f5100..de6fe5d 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift @@ -64,16 +64,12 @@ final class PostNotificationTest: XCTestCase, XCTestCaseProvider { } func testPassesWhenExpectedNotificationEventuallyIsPosted() { - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - let testNotification = Notification(name: Notification.Name("Foo"), object: nil) - expect { - deferToMainQueue { - self.notificationCenter.post(testNotification) - } - return nil - }.toEventually(postNotifications(equal([testNotification]), fromNotificationCenter: notificationCenter)) - #else - print("\(#function) is missing because toEventually is not implement on this platform") - #endif + let testNotification = Notification(name: Notification.Name("Foo"), object: nil) + expect { + deferToMainQueue { + self.notificationCenter.post(testNotification) + } + return nil + }.toEventually(postNotifications(equal([testNotification]), fromNotificationCenter: notificationCenter)) } } diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift index beca75b..085b3b4 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift @@ -1,7 +1,7 @@ import XCTest import Nimble -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE final class RaisesExceptionTest: XCTestCase { var anException = NSException(name: NSExceptionName("laugh"), reason: "Lulz", userInfo: ["key": "value"]) diff --git a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift index edd9e0e..a1f69cc 100644 --- a/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift +++ b/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) private let error: Error = NSError(domain: "test", code: 0, userInfo: nil) diff --git a/Carthage/Checkouts/Nimble/script/release b/Carthage/Checkouts/Nimble/script/release index f61c0dc..20d15e9 100755 --- a/Carthage/Checkouts/Nimble/script/release +++ b/Carthage/Checkouts/Nimble/script/release @@ -3,7 +3,7 @@ REMOTE_BRANCH=master POD_NAME=Nimble PODSPEC=Nimble.podspec -POD=${COCOAPODS:-pod} +POD=${COCOAPODS:-"bundle exec pod"} function help { echo "Usage: release VERSION RELEASE_NOTES [-f]" @@ -173,7 +173,7 @@ echo echo "Pushing to pod trunk..." # NOTE: remove allow-warnings after v9.0.0 of Nimble -$POD trunk push "$PODSPEC" --allow-warnings +$POD trunk push "$PODSPEC" --allow-warnings --skip-import-validation echo echo "================ Finalizing the Release ================" diff --git a/Carthage/Checkouts/Nimble/test b/Carthage/Checkouts/Nimble/test index c213afe..3c17d81 100755 --- a/Carthage/Checkouts/Nimble/test +++ b/Carthage/Checkouts/Nimble/test @@ -54,20 +54,24 @@ function run { } function test_ios { - run osascript -e 'tell app "Simulator" to quit' - run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -sdk "iphonesimulator$BUILD_IOS_SDK_VERSION" -destination "name=iPad Air,OS=$RUNTIME_IOS_SDK_VERSION" build-for-testing test-without-building + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -destination "generic/platform=iOS" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build | xcpretty run osascript -e 'tell app "Simulator" to quit' - run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -sdk "iphonesimulator$BUILD_IOS_SDK_VERSION" -destination "name=iPhone 5s,OS=$RUNTIME_IOS_SDK_VERSION" build-for-testing test-without-building + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -sdk "iphonesimulator$BUILD_IOS_SDK_VERSION" -destination "name=iPad Pro (11-inch),OS=$RUNTIME_IOS_SDK_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty + + run osascript -e 'tell app "Simulator" to quit' + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -sdk "iphonesimulator$BUILD_IOS_SDK_VERSION" -destination "name=iPhone 8,OS=$RUNTIME_IOS_SDK_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty } function test_tvos { + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-tvOS" -configuration "Debug" -destination "generic/platform=tvOS" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build | xcpretty + run osascript -e 'tell app "Simulator" to quit' - run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-tvOS" -configuration "Debug" -sdk "appletvsimulator$BUILD_TVOS_SDK_VERSION" -destination "name=Apple TV,OS=$RUNTIME_TVOS_SDK_VERSION" build-for-testing test-without-building + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-tvOS" -configuration "Debug" -sdk "appletvsimulator$BUILD_TVOS_SDK_VERSION" -destination "name=Apple TV,OS=$RUNTIME_TVOS_SDK_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty } function test_macos { - run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-macOS" -configuration "Debug" -sdk "macosx$BUILD_MACOS_SDK_VERSION" build-for-testing test-without-building + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-macOS" -configuration "Debug" -sdk "macosx$BUILD_MACOS_SDK_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty } function test_podspec { @@ -86,7 +90,7 @@ function test_swiftpm { if [ -d .build ]; then run swift package clean fi - run swift build && swift test + run swift build -Xswiftc -suppress-warnings && swift test -Xswiftc -suppress-warnings } function test_swiftpm_docker { diff --git a/Carthage/Checkouts/Quick/.github/workflows/ci.yml b/Carthage/Checkouts/Quick/.github/workflows/ci.yml new file mode 100644 index 0000000..128f5af --- /dev/null +++ b/Carthage/Checkouts/Quick/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +name: CI + +on: + push: + branches: + - master + tags: + - '*' + pull_request: + +jobs: + xcode: + name: Xcode ${{ matrix.xcode }} + runs-on: macOS-10.14 + strategy: + matrix: + xcode: [10.1, 10.3, 11] + steps: + - uses: actions/checkout@v1 + with: + submodules: true + - run: sudo xcode-select -s '/Applications/Xcode_${{ matrix.xcode }}.app' + - run: PLATFORM=macos ./script/travis-script-macos + - run: PLATFORM=macos_static ./script/travis-script-macos + - run: PLATFORM=ios ./script/travis-script-macos + - run: PLATFORM=tvos ./script/travis-script-macos + + swiftpm_darwin: + name: SwiftPM, Darwin, Xcode ${{ matrix.xcode }} + runs-on: macOS-10.14 + strategy: + matrix: + xcode: [10.1, 10.3, 11] + steps: + - uses: actions/checkout@v1 + - run: sudo xcode-select -s '/Applications/Xcode_${{ matrix.xcode }}.app' + - run: PLATFORM=swiftpm ./script/travis-script-macos diff --git a/Carthage/Checkouts/Quick/.hound.yml b/Carthage/Checkouts/Quick/.hound.yml index 5a66441..46481c8 100644 --- a/Carthage/Checkouts/Quick/.hound.yml +++ b/Carthage/Checkouts/Quick/.hound.yml @@ -1,4 +1,4 @@ -swift: +swiftlint: config_file: .swiftlint.yml rubocop: enabled: false diff --git a/Carthage/Checkouts/Quick/.travis.yml b/Carthage/Checkouts/Quick/.travis.yml index 960afba..2687e6d 100644 --- a/Carthage/Checkouts/Quick/.travis.yml +++ b/Carthage/Checkouts/Quick/.travis.yml @@ -1,48 +1,34 @@ +branches: + only: + - master + language: generic matrix: include: - name: CocoaPods Lint & Danger os: osx - osx_image: xcode10.1 + osx_image: xcode10.3 language: ruby script: - PODSPEC=1 ./script/travis-script-macos - bundle exec danger - - &xcode - name: Xcode 10.1 / Swift 4.2 - os: osx - env: - - XCODE_ACTION="build-for-testing test-without-building" - osx_image: xcode10.1 - script: - - PLATFORM=macos ./script/travis-script-macos - - PLATFORM=macos_static ./script/travis-script-macos - - PLATFORM=ios ./script/travis-script-macos - - PLATFORM=tvos ./script/travis-script-macos - - <<: *xcode - name: Xcode 10.2 / Swift 5.0 - osx_image: xcode10.2 - - &swiftpm_darwin - name: SwiftPM / Darwin / Swift 4.2 - os: osx - osx_image: xcode10.1 - script: PLATFORM=swiftpm ./script/travis-script-macos - - <<: *swiftpm_darwin - name: SwiftPM / Darwin / Swift 5.0 - osx_image: xcode10.2 - &swiftpm_linux - name: SwiftPM / Linux / Swift 4.2 + name: SwiftPM / Linux / Swift 4.2.4 os: linux sudo: required dist: trusty env: - - SWIFT_VERSION=4.2.1 + - SWIFT_VERSION=4.2.4 install: ./script/travis-install-linux script: ./script/travis-script-linux - <<: *swiftpm_linux - name: SwiftPM / Linux / Swift 5.0 Development + name: SwiftPM / Linux / Swift 5.0.3 env: - - SWIFT_VERSION=5.0-DEVELOPMENT-SNAPSHOT-2019-02-28-a + - SWIFT_VERSION=5.0.3 + - <<: *swiftpm_linux + name: SwiftPM / Linux / Swift 5.1 Development + env: + - SWIFT_VERSION=5.1-DEVELOPMENT-SNAPSHOT-2019-09-09-a notifications: email: false diff --git a/Carthage/Checkouts/Quick/Documentation/en-us/InstallingQuick.md b/Carthage/Checkouts/Quick/Documentation/en-us/InstallingQuick.md index 258956f..5b89509 100644 --- a/Carthage/Checkouts/Quick/Documentation/en-us/InstallingQuick.md +++ b/Carthage/Checkouts/Quick/Documentation/en-us/InstallingQuick.md @@ -11,7 +11,8 @@ There are three recommended ways of linking Quick to your tests: 1. [Git Submodules](#git-submodules) 2. [CocoaPods](#cocoapods) 3. [Carthage](#carthage) -4. [Swift Package Manager (experimental)](#swift-package-manager) +4. [Accio](#accio) +5. [Swift Package Manager (experimental)](#swift-package-manager) Choose one and follow the instructions below. Once you've completed them, you should be able to `import Quick` from within files in your test target. @@ -140,6 +141,27 @@ to copy them to the target's Frameworks destination. This is not "the one and only way" to use Carthage to manage dependencies. For further reference check out the [Carthage documentation](https://github.com/Carthage/Carthage/blob/master/README.md). +## [Accio](https://github.com/JamitLabs/Accio) + +Add the following to your Package.swift: + +```swift +.package(url: "https://github.com/Quick/Quick.git", .upToNextMajor(from: "2.0.0")), +``` + +Next, add `Quick` to your App test targets dependencies like so: + +```swift +.testTarget( + name: "AppTests", + dependencies: [ + "Quick", + ] +), +``` + +Then run `accio update`. + ## [Swift Package Manager](https://github.com/apple/swift-package-manager) With the advent of the [swift.org](https://swift.org) open-source project, Swift now has an official, though nascent, package manager tool. Notably, this provides the possibility of using Quick on non-Apple platforms for the first time. Initial steps have been taken to allow using Quick to test projects using the Swift Package Manager, although frequent breakage is expected at this point since the tool is still under heavy development. diff --git a/Carthage/Checkouts/Quick/Documentation/en-us/SharedExamples.md b/Carthage/Checkouts/Quick/Documentation/en-us/SharedExamples.md index 1f14e64..bd670e1 100644 --- a/Carthage/Checkouts/Quick/Documentation/en-us/SharedExamples.md +++ b/Carthage/Checkouts/Quick/Documentation/en-us/SharedExamples.md @@ -7,6 +7,75 @@ eats something `Edible`, the dolphin becomes happy. `Mackerel` and `Cod` are both edible. Quick allows you to easily test that a dolphin is happy to eat either one. +```swift +protocol Edible { } + +class Dolphin { + private(set) var isHappy: Bool + + init(happy: Bool) { + self.isHappy = happy + } + + /// Makes Doplhin happy + func eat(_ edible: Edible) { + isHappy = true + } +} + +class Mackerel: Edible { } +class Cod: Edible { } +``` + +## Behavior + +The code below defines a `Behavior` object with a set of reusable +examples. It also specifies that both mackerel and cod behave +like `SomethingEdible`: + +```swift +class SomethingEdible: Behavior { + override class func spec(_ context: @escaping () -> Edible) { + var edible: Edible! + beforeEach { + edible = context() + } + + it("makes dolphins happy") { + let dolphin = Dolphin(happy: false) + dolphin.eat(edible) + expect(dolphin.isHappy).to(beTruthy()) + } + } +} + +class MackerelSpec: QuickSpec { + override func spec() { + var mackerel: Mackerel! + beforeEach { + mackerel = Mackerel() + } + + itBehavesLike(SomethingEdible.self) { mackerel } + } +} + +class CodSpec: QuickSpec { + override func spec() { + var cod: Cod! + beforeEach { + cod = Cod() + } + + itBehavesLike(SomethingEdible.self) { cod } + } +} +``` + +Because `Behavior` uses Swift generics, it's not possible to use it from Objective-C. + +## Shared Examples + The example below defines a set of "shared examples" for "something edible", and specifies that both mackerel and cod behave like "something edible": @@ -62,13 +131,13 @@ QuickConfigurationBegin(EdibleSharedExamplesConfiguration) + (void)configure:(Configuration *configuration) { sharedExamples(@"something edible", ^(QCKDSLSharedExampleContext exampleContext) { - it(@"makes dolphins happy") { + it(@"makes dolphins happy", ^{ Dolphin *dolphin = [[Dolphin alloc] init]; dolphin.happy = NO; id edible = exampleContext()[@"edible"]; [dolphin eat:edible]; expect(dolphin.isHappy).to(beTruthy()) - } + }); }); } diff --git a/Carthage/Checkouts/Quick/Documentation/ja/SharedExamples.md b/Carthage/Checkouts/Quick/Documentation/ja/SharedExamples.md index a1670d2..1179ed7 100644 --- a/Carthage/Checkouts/Quick/Documentation/ja/SharedExamples.md +++ b/Carthage/Checkouts/Quick/Documentation/ja/SharedExamples.md @@ -63,13 +63,13 @@ QuickConfigurationBegin(EdibleSharedExamplesConfiguration) + (void)configure:(Configuration *configuration) { sharedExamples(@"something edible", ^(QCKDSLSharedExampleContext exampleContext) { - it(@"makes dolphins happy") { + it(@"makes dolphins happy", ^{ Dolphin *dolphin = [[Dolphin alloc] init]; dolphin.happy = NO; id edible = exampleContext()[@"edible"]; [dolphin eat:edible]; expect(dolphin.isHappy).to(beTruthy()) - } + }); }); } diff --git a/Carthage/Checkouts/Quick/Documentation/ko-kr/SharedExamples.md b/Carthage/Checkouts/Quick/Documentation/ko-kr/SharedExamples.md index ebc1c9a..9ca182b 100644 --- a/Carthage/Checkouts/Quick/Documentation/ko-kr/SharedExamples.md +++ b/Carthage/Checkouts/Quick/Documentation/ko-kr/SharedExamples.md @@ -59,13 +59,13 @@ QuickConfigurationBegin(EdibleSharedExamplesConfiguration) + (void)configure:(Configuration *configuration) { sharedExamples(@"something edible", ^(QCKDSLSharedExampleContext exampleContext) { - it(@"makes dolphins happy") { + it(@"makes dolphins happy", ^{ Dolphin *dolphin = [[Dolphin alloc] init]; dolphin.happy = NO; id edible = exampleContext()[@"edible"]; [dolphin eat:edible]; expect(dolphin.isHappy).to(beTruthy()) - } + }); }); } diff --git a/Carthage/Checkouts/Quick/Documentation/pt-br/SharedExamples.md b/Carthage/Checkouts/Quick/Documentation/pt-br/SharedExamples.md index eabde35..8dd0ecd 100644 --- a/Carthage/Checkouts/Quick/Documentation/pt-br/SharedExamples.md +++ b/Carthage/Checkouts/Quick/Documentation/pt-br/SharedExamples.md @@ -59,13 +59,13 @@ QuickConfigurationBegin(EdibleSharedExamplesConfiguration) + (void)configure:(Configuration *configuration) { sharedExamples(@"something edible", ^(QCKDSLSharedExampleContext exampleContext) { - it(@"makes dolphins happy") { + it(@"makes dolphins happy", ^{ Dolphin *dolphin = [[Dolphin alloc] init]; dolphin.happy = NO; id edible = exampleContext()[@"edible"]; [dolphin eat:edible]; expect(dolphin.isHappy).to(beTruthy()) - } + }); }); } @@ -113,4 +113,4 @@ itBehavesLike("everything under the sea") > Em Objective-C, é necessário passar um bloco que recebe um `QCKDSLSharedExampleContext`, mesmo se esse argumento não for usado. Desculpe, mas é assim que a banda toca! :trumpet: :notes: -Também é possível "focar" exemplos compartilhados usando a função `fitBehavesLike`. \ No newline at end of file +Também é possível "focar" exemplos compartilhados usando a função `fitBehavesLike`. diff --git a/Carthage/Checkouts/Quick/Documentation/zh-cn/SharedExamples.md b/Carthage/Checkouts/Quick/Documentation/zh-cn/SharedExamples.md index ec87138..79c40c9 100644 --- a/Carthage/Checkouts/Quick/Documentation/zh-cn/SharedExamples.md +++ b/Carthage/Checkouts/Quick/Documentation/zh-cn/SharedExamples.md @@ -58,13 +58,13 @@ QuickConfigurationBegin(EdibleSharedExamplesConfiguration) + (void)configure:(Configuration *configuration) { sharedExamples(@"something edible", ^(QCKDSLSharedExampleContext exampleContext) { - it(@"makes dolphins happy") { + it(@"makes dolphins happy", ^{ Dolphin *dolphin = [[Dolphin alloc] init]; dolphin.happy = NO; id edible = exampleContext()[@"edible"]; [dolphin eat:edible]; expect(dolphin.isHappy).to(beTruthy()) - } + }); }); } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/.github/workflows/ci.yml b/Carthage/Checkouts/Quick/Externals/Nimble/.github/workflows/ci.yml new file mode 100644 index 0000000..2c4109d --- /dev/null +++ b/Carthage/Checkouts/Quick/Externals/Nimble/.github/workflows/ci.yml @@ -0,0 +1,46 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - '*' + +jobs: + cocoapods: + name: CocoaPods Lint + runs-on: macOS-10.14 + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-ruby@v1 + with: + ruby-version: '2.x' + - run: sudo xcode-select -s '/Applications/Xcode_10.3.app' + - run: bundle install --jobs=8 + - run: ./test podspec + + xcode: + name: Xcode ${{ matrix.xcode }} + runs-on: macOS-10.14 + strategy: + matrix: + xcode: [10.1, 10.3, 11] + steps: + - uses: actions/checkout@v1 + - run: sudo xcode-select -s '/Applications/Xcode_${{ matrix.xcode }}.app' + - run: ./test macos + - run: ./test ios + - run: ./test tvos + + swiftpm_darwin: + name: SwiftPM, Darwin, Xcode ${{ matrix.xcode }} + runs-on: macOS-10.14 + strategy: + matrix: + xcode: [10.1, 10.3, 11] + steps: + - uses: actions/checkout@v1 + - run: sudo xcode-select -s '/Applications/Xcode_${{ matrix.xcode }}.app' + - run: ./test swiftpm diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/.hound.yml b/Carthage/Checkouts/Quick/Externals/Nimble/.hound.yml index b867fd9..f180504 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/.hound.yml +++ b/Carthage/Checkouts/Quick/Externals/Nimble/.hound.yml @@ -1,2 +1,2 @@ -swift: +swiftlint: config_file: .swiftlint.yml diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/.travis.yml b/Carthage/Checkouts/Quick/Externals/Nimble/.travis.yml index fb72977..7d1047d 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/.travis.yml +++ b/Carthage/Checkouts/Quick/Externals/Nimble/.travis.yml @@ -1,49 +1,29 @@ -osx_image: xcode10.1 +branches: + only: + - master + language: generic matrix: include: - - os: osx - sudo: required - env: TYPE=podspec - install: bundle install - name: CocoaPods Lint - - os: osx - env: TYPE=ios - name: iOS / Swift 4.2.1 - - os: osx - env: TYPE=tvos - name: tvOS / Swift 4.2.1 - - os: osx - env: TYPE=macos - name: macOS / Swift 4.2.1 - - os: osx - env: TYPE=macos - osx_image: xcode10.2 - name: macOS / Swift 5.0 - - os: osx - env: - - TYPE=swiftpm - - os: osx - env: - - TYPE=swiftpm - osx_image: xcode10.2 - - &linux - name: Linux / Swift 4.2.1 + - &swiftpm_linux + name: SwiftPM / Linux / Swift 4.2.4 os: linux dist: trusty sudo: required env: - - TYPE=swiftpm - - SWIFT_VERSION=4.2.1 + - SWIFT_VERSION=4.2.4 install: - - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" - - <<: *linux - name: Linux / Swift 5.0 Development + - eval "$(curl -sL https://swiftenv.fuller.li/install.sh)" + script: + - ./test swiftpm + - <<: *swiftpm_linux + name: SwiftPM / Linux / Swift 5.0.3 env: - - TYPE=swiftpm - - SWIFT_VERSION=5.0-DEVELOPMENT-SNAPSHOT-2019-02-28-a - install: - - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" + - SWIFT_VERSION=5.0.3 + - <<: *swiftpm_linux + name: SwiftPM / Linux / Swift 5.1 Development + env: + - SWIFT_VERSION=5.1-DEVELOPMENT-SNAPSHOT-2019-09-05-a install: true script: - ./test $TYPE diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Cartfile.private b/Carthage/Checkouts/Quick/Externals/Nimble/Cartfile.private index 23d7e11..b5ed77e 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Cartfile.private +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Cartfile.private @@ -1 +1 @@ -github "mattgallagher/CwlPreconditionTesting" "1e62a726d54c743f4585233f08fcaac7307319b5" +github "mattgallagher/CwlPreconditionTesting" == 1.2.0 diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Cartfile.resolved b/Carthage/Checkouts/Quick/Externals/Nimble/Cartfile.resolved index 32a1c25..fbe6949 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Cartfile.resolved +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Cartfile.resolved @@ -1,2 +1 @@ -github "mattgallagher/CwlCatchException" "b14c111e9b33cd142bd4bc75c482cfd5c3490923" -github "mattgallagher/CwlPreconditionTesting" "1e62a726d54c743f4585233f08fcaac7307319b5" +github "mattgallagher/CwlPreconditionTesting" "1.2.0" diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Package.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Package.swift deleted file mode 100644 index c1e2ed8..0000000 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Package.swift +++ /dev/null @@ -1,9 +0,0 @@ -import PackageDescription - -let package = Package( - name: "CwlCatchException", - targets: [ - Target(name: "CwlCatchException", dependencies: ["CwlCatchExceptionSupport"]), - Target(name: "CwlCatchExceptionSupport") - ] -) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/LICENSE.txt b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/LICENSE.txt new file mode 100644 index 0000000..693a2fe --- /dev/null +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/LICENSE.txt @@ -0,0 +1,15 @@ +ISC License + +Copyright © 2017 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Package.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Package.swift new file mode 100644 index 0000000..33689a2 --- /dev/null +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Package.swift @@ -0,0 +1,14 @@ +// swift-tools-version:4.2 +import PackageDescription + +let package = Package( + name: "CwlCatchException", + products: [ + .library(name: "CwlCatchException", targets: ["CwlCatchException"]), + ], + targets: [ + .target(name: "CwlCatchException", dependencies: [.target(name: "CwlCatchExceptionSupport")]), + .target(name: "CwlCatchExceptionSupport"), + .testTarget(name: "CwlCatchExceptionTests", dependencies: [.target(name: "CwlCatchException")]) + ] +) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/README.md b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/README.md new file mode 100644 index 0000000..052d7c0 --- /dev/null +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/README.md @@ -0,0 +1,46 @@ +# CwlCatchException +A simple Swift wrapper around an Objective-C `@try`/`@catch` statement that selectively catches Objective-C exceptions by `NSException` subtype, rethrowing if any caught exception is not the expected subtype. + +Look at [CwlCatchExceptionTests.swift](https://github.com/mattgallagher/CwlCatchException/blob/master/Tests/CwlCatchExceptionTests/CwlCatchExceptionTests.swift) for syntax. + +## Adding to your project + +This project can be used by direct inclusion in your projects or through any of the Swift Package Manager, CocoaPods or Carthage. + +Minimum requirements are iOS 8 or macOS 10.9. + +### Manual inclusion + +1. In a subdirectory of your project's directory, run `git clone https://github.com/mattgallagher/CwlCatchException.git` +2. Drag the "CwlCatchException.xcodeproj" file from the Finder into your own project's file tree in Xcode +3. Add the "CwlCatchException.framework" from the "Products" folder of the CwlCatchException project's file tree to the "Copy Files (Frameworks)" build phases of any target that you want to include this module. + +That third step is a little tricky if you're unfamiliar with Xcode but it involves: + +a. click on your project in the file tree +b. click on the target to whih you want to add this module +c. select the "Build Phases" tab +d. if you don't already have a "Copy File" build phase with a "Destination: Frameworks", add one using the "+" button in the top left of the tab +e. click the "+" within the "Copy File (Frameworks)" phase and from the list that appears, select the "CwlCatchException.framework" (if there are multiple frameworks with the same name, look for the one that appears *above* the corresponding macOS or iOS CwlCatchException testing target). + +### Swift Package Manager + +Add the following to the `dependencies` array in your "Package.swift" file: + + .Package(url: "https://github.com/mattgallagher/CwlCatchException.git", majorVersion: 1), + +Or, if you're using the `swift-tools-version:4.0` package manager, add the following to the `dependencies` array in your "Package.swift" file: + + .package(url: "https://github.com/mattgallagher/CwlCatchException.git", majorVersion: 1) + +### CocoaPods + +Add the following to your target in your "Podfile": + + pod 'CwlCatchException', :git => 'https://github.com/mattgallagher/CwlCatchException.git' + +### Carthage + +Add the following line to your Cartfile: + + git "https://github.com/mattgallagher/CwlCatchException.git" "master" diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift new file mode 100644 index 0000000..2cb9b29 --- /dev/null +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift @@ -0,0 +1,35 @@ +// +// CwlCatchException.swift +// CwlAssertionTesting +// +// Created by Matt Gallagher on 2016/01/10. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// + +import Foundation + +#if SWIFT_PACKAGE +import CwlCatchExceptionSupport +#endif + +private func catchReturnTypeConverter(_ type: T.Type, block: @escaping () -> Void) -> T? { + return catchExceptionOfKind(type, block) as? T +} + +extension NSException { + public static func catchException(in block: @escaping () -> Void) -> Self? { + return catchReturnTypeConverter(self, block: block) + } +} diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m new file mode 100644 index 0000000..ff35465 --- /dev/null +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m @@ -0,0 +1,34 @@ +// +// CwlCatchException.m +// CwlAssertionTesting +// +// Created by Matt Gallagher on 2016/01/10. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// + +#import "CwlCatchException.h" + +NSException* __nullable catchExceptionOfKind(Class __nonnull type, void (^ __nonnull inBlock)(void)) { + @try { + inBlock(); + } @catch (NSException *exception) { + if ([exception isKindOfClass:type]) { + return exception; + } else { + @throw; + } + } + return nil; +} diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h new file mode 100644 index 0000000..47b06bf --- /dev/null +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h @@ -0,0 +1,29 @@ +// +// CwlCatchException.h +// CwlCatchException +// +// Created by Matt Gallagher on 2016/01/10. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// + +#import + +//! Project version number for CwlCatchException. +FOUNDATION_EXPORT double CwlCatchExceptionVersionNumber; + +//! Project version string for CwlCatchException. +FOUNDATION_EXPORT const unsigned char CwlCatchExceptionVersionString[]; + +NSException* __nullable catchExceptionOfKind(Class __nonnull type, void (^ __nonnull inBlock)(void)); diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Package.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Package.swift index 8792aac..12b0c06 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Package.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Package.swift @@ -1,19 +1,28 @@ +// swift-tools-version:4.0 import PackageDescription let package = Package( name: "CwlPreconditionTesting", - targets: [ - Target(name: "CwlPreconditionTesting", dependencies: [ - "CwlMachBadInstructionHandler" - ]), - Target(name: "CwlMachBadInstructionHandler") + products: [ + .library(name: "CwlPreconditionTesting", targets: ["CwlPreconditionTesting", "CwlMachBadInstructionHandler"]) ], dependencies: [ - .Package(url: "https://github.com/mattgallagher/CwlCatchException.git", Version(1, 0, 2, prereleaseIdentifiers: ["beta", "3"])), + .package(url: "https://github.com/mattgallagher/CwlCatchException.git", from: "1.2.0") ], - exclude: [ - "Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h", - "Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting.h", - "Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift", + targets: [ + .target( + name: "CwlPreconditionTesting", + dependencies: [ + .target(name: "CwlMachBadInstructionHandler"), + .product(name: "CwlCatchException") + ], + exclude: [ + "./Mach/CwlPreconditionTesting.h", + "./Posix/CwlPreconditionTesting.h", + "./CwlCatchBadInstructionPosix.swift" + ] + ), + .target(name: "CwlMachBadInstructionHandler"), + .testTarget(name: "CwlPreconditionTestingTests", dependencies: ["CwlPreconditionTesting"]) ] ) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/README.md b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/README.md index a42a5b5..259d1fe 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/README.md +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/README.md @@ -18,31 +18,17 @@ Minimum requirements are iOS 8 (simulator-only) or macOS 10.9. The project inclu 1. In a subdirectory of your project's directory, run `git clone https://github.com/mattgallagher/CwlPreconditionTesting.git` 2. Drag the "CwlPreconditionTesting.xcodeproj" file from the Finder into your own project's file tree in Xcode -3. Add the "CwlPreconditionTesting.framework" from the "Products" folder of the CwlPreconditionTesting project's file tree to the "Copy Files (Frameworks)" build phases of any target that you want to include this module. -4. Drag the "CwlCatchException.framework" from the "Dependencies" group (within the CwlPreconditionTesting project's file tree) onto the same "Copy Files (Frameworks)" build phase (this item may be red but that shouldn't be a problem). - -That third step is a little tricky if you're unfamiliar with Xcode but it involves: - -a. click on your project in the file tree -b. click on the target to whih you want to add this module -c. select the "Build Phases" tab -d. if you don't already have a "Copy File" build phase with a "Destination: Frameworks", add one using the "+" button in the top left of the tab -e. click the "+" within the "Copy File (Frameworks)" phase and from the list that appears, select the "CwlPreconditionTesting.framework" (if there are multiple frameworks with the same name, look for the one that appears *above* the corresponding macOS or iOS CwlPreconditionTesting testing target). - -When building using this approach, the "FetchDependencies" target will use the Swift Package Manager to download the "CwlCatchException" project from github. The download is stored in the "Build intermediates" directory for your project. Normally, you can ignore its existence but if you get any errors from the "FetchDependencies" target, you might need to clean the build folder (Hold "Option" key while selecting "Product" → "Clean Build Folder..." from the Xcode menubar). - -You can use the "Package.swift" to manage the behavior of the Swift Package Manager or if you want to download dependencies manually (instead of using this behind-the-scenes use of the Swift package manager), you should delete the "FetchDependencies" target and replace the "CwlCatchException" targets with alternatives that build the dependencies in accordance with your manual download. +3. Add the "CwlPreconditionTesting.framework" from the "Products" folder of the CwlPreconditionTesting project's file tree to the "Copy Files (Frameworks)" build phases of any targets that you want to include this module. +4. Drag the "CwlCatchException.framework" from the "Dependencies" group (within the CwlPreconditionTesting project's file tree) onto the same "Copy Files (Frameworks)" build phase ### Swift Package Manager -Add the following to the `dependencies` array in your "Package.swift" file: - - .Package(url: "https://github.com/mattgallagher/CwlPreconditionTesting.git", majorVersion: 1), - -Or, if you're using the `swift-tools-version:4.0` package manager, add the following to the `dependencies` array in your "Package.swift" file: +Assuming you're using the `swift-tools-version:4.0` package manager, add the following to the `dependencies` array in your "Package.swift" file: .package(url: "https://github.com/mattgallagher/CwlPreconditionTesting.git", majorVersion: 1) +> NOTE: even though this git repository includes its dependencies in the Dependencies folder, building via the Swift Package manager fetches and builds these dependencies independently. + ### CocoaPods Add the following lines to your target in your "Podfile": diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.m b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.m index 8183196..2ab0ea5 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.m +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.m @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -18,33 +18,36 @@ // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // -#if defined(__x86_64__) +#ifdef __APPLE__ +#import "TargetConditionals.h" +#if TARGET_OS_OSX || TARGET_OS_IOS - #import "mach_excServer.h" - #import "CwlMachBadInstructionHandler.h" +#import "mach_excServer.h" +#import "CwlMachBadInstructionHandler.h" + +@protocol BadInstructionReply ++(NSNumber *)receiveReply:(NSValue *)value; +@end + +/// A basic function that receives callbacks from mach_exc_server and relays them to the Swift implemented BadInstructionException.catch_mach_exception_raise_state. +kern_return_t catch_mach_exception_raise_state(mach_port_t exception_port, exception_type_t exception, const mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, const thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { + bad_instruction_exception_reply_t reply = { exception_port, exception, code, codeCnt, flavor, old_state, old_stateCnt, new_state, new_stateCnt }; + Class badInstructionClass = NSClassFromString(@"BadInstructionException"); + NSValue *value = [NSValue valueWithBytes: &reply objCType: @encode(bad_instruction_exception_reply_t)]; + return [[badInstructionClass performSelector: @selector(receiveReply:) withObject: value] intValue]; +} + +// The mach port should be configured so that this function is never used. +kern_return_t catch_mach_exception_raise(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt) { + assert(false); + return KERN_FAILURE; +} + +// The mach port should be configured so that this function is never used. +kern_return_t catch_mach_exception_raise_state_identity(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { + assert(false); + return KERN_FAILURE; +} - @protocol BadInstructionReply - +(NSNumber *)receiveReply:(NSValue *)value; - @end - - /// A basic function that receives callbacks from mach_exc_server and relays them to the Swift implemented BadInstructionException.catch_mach_exception_raise_state. - kern_return_t catch_mach_exception_raise_state(mach_port_t exception_port, exception_type_t exception, const mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, const thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { - bad_instruction_exception_reply_t reply = { exception_port, exception, code, codeCnt, flavor, old_state, old_stateCnt, new_state, new_stateCnt }; - Class badInstructionClass = NSClassFromString(@"BadInstructionException"); - NSValue *value = [NSValue valueWithBytes: &reply objCType: @encode(bad_instruction_exception_reply_t)]; - return [[badInstructionClass performSelector: @selector(receiveReply:) withObject: value] intValue]; - } - - // The mach port should be configured so that this function is never used. - kern_return_t catch_mach_exception_raise(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt) { - assert(false); - return KERN_FAILURE; - } - - // The mach port should be configured so that this function is never used. - kern_return_t catch_mach_exception_raise_state_identity(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { - assert(false); - return KERN_FAILURE; - } - -#endif +#endif /* TARGET_OS_OSX || TARGET_OS_IOS */ +#endif /* __APPLE__ */ diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h index aef59c2..3fbd5a4 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -19,8 +19,14 @@ // #import + +#if TARGET_OS_OSX || TARGET_OS_IOS + #import +extern bool _swift_disableExclusivityChecking; +extern bool _swift_reportFatalErrorsToDebugger; + NS_ASSUME_NONNULL_BEGIN extern boolean_t mach_exc_server(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); @@ -68,3 +74,5 @@ typedef struct } bad_instruction_exception_reply_t; NS_ASSUME_NONNULL_END + +#endif diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.c b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.c index 733c564..ccd8f84 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.c +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.c @@ -5,13 +5,12 @@ * OPTIONS: */ -#if defined(__x86_64__) - /* Module mach_exc */ #define __MIG_check__Request__mach_exc_subsystem__ 1 -#include "mach_excServer.h" +#import "mach_excServer.h" +#if TARGET_OS_OSX || TARGET_OS_IOS #ifndef mig_internal #define mig_internal static __inline__ @@ -534,4 +533,4 @@ mig_external mig_routine_t mach_exc_server_routine return catch_mach_exc_subsystem.routine[msgh_id].stub_routine; } -#endif +#endif /* TARGET_OS_OSX || TARGET_OS_IOS */ diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.h b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.h index 52e53ae..1f03d66 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.h +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.h @@ -1,9 +1,14 @@ +#ifdef __APPLE__ +#import "TargetConditionals.h" +#if TARGET_OS_OSX || TARGET_OS_IOS + #ifndef _mach_exc_server_ #define _mach_exc_server_ /* Module mach_exc */ #include + #include #include #include @@ -319,3 +324,6 @@ __AfterMigServerHeader #endif /* __AfterMigServerHeader */ #endif /* _mach_exc_server_ */ + +#endif /* TARGET_OS_OSX || TARGET_OS_IOS */ +#endif /* __APPLE__ */ diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift index 91e5d4d..90ee022 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -18,6 +18,8 @@ // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // +#if (os(macOS) || os(iOS)) && arch(x86_64) + import Foundation #if SWIFT_PACKAGE @@ -44,46 +46,44 @@ public class BadInstructionException: NSException { /// An Objective-C callable function, invoked from the `mach_exc_server` callback function `catch_mach_exception_raise_state` to push the `raiseBadInstructionException` function onto the stack. @objc(receiveReply:) public class func receiveReply(_ value: NSValue) -> NSNumber { - #if arch(x86_64) - var reply = bad_instruction_exception_reply_t(exception_port: 0, exception: 0, code: nil, codeCnt: 0, flavor: nil, old_state: nil, old_stateCnt: 0, new_state: nil, new_stateCnt: nil) - withUnsafeMutablePointer(to: &reply) { value.getValue(UnsafeMutableRawPointer($0)) } - - let old_state: UnsafePointer = reply.old_state! - let old_stateCnt: mach_msg_type_number_t = reply.old_stateCnt - let new_state: thread_state_t = reply.new_state! - let new_stateCnt: UnsafeMutablePointer = reply.new_stateCnt! - - // Make sure we've been given enough memory - if old_stateCnt != x86_THREAD_STATE64_COUNT || new_stateCnt.pointee < x86_THREAD_STATE64_COUNT { - return NSNumber(value: KERN_INVALID_ARGUMENT) - } - - // Read the old thread state - var state = old_state.withMemoryRebound(to: x86_thread_state64_t.self, capacity: 1) { return $0.pointee } - - // 1. Decrement the stack pointer - state.__rsp -= __uint64_t(MemoryLayout.size) - - // 2. Save the old Instruction Pointer to the stack. - if let pointer = UnsafeMutablePointer<__uint64_t>(bitPattern: UInt(state.__rsp)) { - pointer.pointee = state.__rip - } else { - return NSNumber(value: KERN_INVALID_ARGUMENT) - } - - // 3. Set the Instruction Pointer to the new function's address - var f: @convention(c) () -> Void = raiseBadInstructionException - withUnsafePointer(to: &f) { - state.__rip = $0.withMemoryRebound(to: __uint64_t.self, capacity: 1) { return $0.pointee } - } - - // Write the new thread state - new_state.withMemoryRebound(to: x86_thread_state64_t.self, capacity: 1) { $0.pointee = state } - new_stateCnt.pointee = x86_THREAD_STATE64_COUNT - - return NSNumber(value: KERN_SUCCESS) - #else - fatalError("Unavailable for this CPU architecture") - #endif + var reply = bad_instruction_exception_reply_t(exception_port: 0, exception: 0, code: nil, codeCnt: 0, flavor: nil, old_state: nil, old_stateCnt: 0, new_state: nil, new_stateCnt: nil) + withUnsafeMutablePointer(to: &reply) { value.getValue(UnsafeMutableRawPointer($0)) } + + let old_state: UnsafePointer = reply.old_state! + let old_stateCnt: mach_msg_type_number_t = reply.old_stateCnt + let new_state: thread_state_t = reply.new_state! + let new_stateCnt: UnsafeMutablePointer = reply.new_stateCnt! + + // Make sure we've been given enough memory + if old_stateCnt != x86_THREAD_STATE64_COUNT || new_stateCnt.pointee < x86_THREAD_STATE64_COUNT { + return NSNumber(value: KERN_INVALID_ARGUMENT) + } + + // Read the old thread state + var state = old_state.withMemoryRebound(to: x86_thread_state64_t.self, capacity: 1) { return $0.pointee } + + // 1. Decrement the stack pointer + state.__rsp -= __uint64_t(MemoryLayout.size) + + // 2. Save the old Instruction Pointer to the stack. + if let pointer = UnsafeMutablePointer<__uint64_t>(bitPattern: UInt(state.__rsp)) { + pointer.pointee = state.__rip + } else { + return NSNumber(value: KERN_INVALID_ARGUMENT) + } + + // 3. Set the Instruction Pointer to the new function's address + var f: @convention(c) () -> Void = raiseBadInstructionException + withUnsafePointer(to: &f) { + state.__rip = $0.withMemoryRebound(to: __uint64_t.self, capacity: 1) { return $0.pointee } + } + + // Write the new thread state + new_state.withMemoryRebound(to: x86_thread_state64_t.self, capacity: 1) { $0.pointee = state } + new_stateCnt.pointee = x86_THREAD_STATE64_COUNT + + return NSNumber(value: KERN_SUCCESS) } } + +#endif diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift index f96ec63..521b2a1 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -18,180 +18,192 @@ // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // +#if (os(macOS) || os(iOS)) && arch(x86_64) + import Foundation +import Swift #if SWIFT_PACKAGE import CwlMachBadInstructionHandler #endif -#if arch(x86_64) - - private enum PthreadError: Error { case code(Int32) } - private enum MachExcServer: Error { case code(kern_return_t) } - - /// A quick function for converting Mach error results into Swift errors - private func kernCheck(_ f: () -> Int32) throws { - let r = f() - guard r == KERN_SUCCESS else { - throw NSError(domain: NSMachErrorDomain, code: Int(r), userInfo: nil) - } +private enum PthreadError: Error { case code(Int32) } +private enum MachExcServer: Error { case code(kern_return_t) } + +/// A quick function for converting Mach error results into Swift errors +private func kernCheck(_ f: () -> Int32) throws { + let r = f() + guard r == KERN_SUCCESS else { + throw NSError(domain: NSMachErrorDomain, code: Int(r), userInfo: nil) } - - extension request_mach_exception_raise_t { - mutating func withMsgHeaderPointer(in block: (UnsafeMutablePointer) -> R) -> R { - return withUnsafeMutablePointer(to: &self) { p -> R in - return p.withMemoryRebound(to: mach_msg_header_t.self, capacity: 1) { ptr -> R in - return block(ptr) - } +} + +extension request_mach_exception_raise_t { + mutating func withMsgHeaderPointer(in block: (UnsafeMutablePointer) -> R) -> R { + return withUnsafeMutablePointer(to: &self) { p -> R in + return p.withMemoryRebound(to: mach_msg_header_t.self, capacity: 1) { ptr -> R in + return block(ptr) } } } - - extension reply_mach_exception_raise_state_t { - mutating func withMsgHeaderPointer(in block: (UnsafeMutablePointer) -> R) -> R { - return withUnsafeMutablePointer(to: &self) { p -> R in - return p.withMemoryRebound(to: mach_msg_header_t.self, capacity: 1) { ptr -> R in - return block(ptr) - } +} + +extension reply_mach_exception_raise_state_t { + mutating func withMsgHeaderPointer(in block: (UnsafeMutablePointer) -> R) -> R { + return withUnsafeMutablePointer(to: &self) { p -> R in + return p.withMemoryRebound(to: mach_msg_header_t.self, capacity: 1) { ptr -> R in + return block(ptr) } } } +} + +/// A structure used to store context associated with the Mach message port +private struct MachContext { + var masks = execTypesCountTuple() + var count: mach_msg_type_number_t = 0 + var ports = execTypesCountTuple() + var behaviors = execTypesCountTuple() + var flavors = execTypesCountTuple() + var currentExceptionPort: mach_port_t = 0 + var handlerThread: pthread_t? = nil - /// A structure used to store context associated with the Mach message port - private struct MachContext { - var masks = execTypesCountTuple() - var count: mach_msg_type_number_t = 0 - var ports = execTypesCountTuple() - var behaviors = execTypesCountTuple() - var flavors = execTypesCountTuple() - var currentExceptionPort: mach_port_t = 0 - var handlerThread: pthread_t? = nil - - static func internalMutablePointers(_ m: UnsafeMutablePointer>, _ c: UnsafeMutablePointer, _ p: UnsafeMutablePointer>, _ b: UnsafeMutablePointer>, _ f: UnsafeMutablePointer>, _ block: (UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer) -> R) -> R { - return m.withMemoryRebound(to: exception_mask_t.self, capacity: 1) { masksPtr in - return c.withMemoryRebound(to: mach_msg_type_number_t.self, capacity: 1) { countPtr in - return p.withMemoryRebound(to: mach_port_t.self, capacity: 1) { portsPtr in - return b.withMemoryRebound(to: exception_behavior_t.self, capacity: 1) { behaviorsPtr in - return f.withMemoryRebound(to: thread_state_flavor_t.self, capacity: 1) { flavorsPtr in - return block(masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) - } + static func internalMutablePointers(_ m: UnsafeMutablePointer>, _ c: UnsafeMutablePointer, _ p: UnsafeMutablePointer>, _ b: UnsafeMutablePointer>, _ f: UnsafeMutablePointer>, _ block: (UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer) -> R) -> R { + return m.withMemoryRebound(to: exception_mask_t.self, capacity: 1) { masksPtr in + return c.withMemoryRebound(to: mach_msg_type_number_t.self, capacity: 1) { countPtr in + return p.withMemoryRebound(to: mach_port_t.self, capacity: 1) { portsPtr in + return b.withMemoryRebound(to: exception_behavior_t.self, capacity: 1) { behaviorsPtr in + return f.withMemoryRebound(to: thread_state_flavor_t.self, capacity: 1) { flavorsPtr in + return block(masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) } } } } } - - mutating func withUnsafeMutablePointers(in block: @escaping (UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer) -> R) -> R { - return MachContext.internalMutablePointers(&masks, &count, &ports, &behaviors, &flavors, block) - } } - /// A function for receiving mach messages and parsing the first with mach_exc_server (and if any others are received, throwing them away). - private func machMessageHandler(_ arg: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer? { - let context = arg.assumingMemoryBound(to: MachContext.self).pointee - var request = request_mach_exception_raise_t() - var reply = reply_mach_exception_raise_state_t() + mutating func withUnsafeMutablePointers(in block: @escaping (UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer) -> R) -> R { + return MachContext.internalMutablePointers(&masks, &count, &ports, &behaviors, &flavors, block) + } +} + +/// A function for receiving mach messages and parsing the first with mach_exc_server (and if any others are received, throwing them away). +private func machMessageHandler(_ arg: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer? { + let context = arg.assumingMemoryBound(to: MachContext.self).pointee + var request = request_mach_exception_raise_t() + var reply = reply_mach_exception_raise_state_t() + + var handledfirstException = false + repeat { do { + // Request the next mach message from the port + request.Head.msgh_local_port = context.currentExceptionPort + request.Head.msgh_size = UInt32(MemoryLayout.size) + let requestSize = request.Head.msgh_size + try kernCheck { request.withMsgHeaderPointer { requestPtr in + mach_msg(requestPtr, MACH_RCV_MSG | MACH_RCV_INTERRUPT, 0, requestSize, context.currentExceptionPort, 0, UInt32(MACH_PORT_NULL)) + } } - var handledfirstException = false - repeat { do { - // Request the next mach message from the port - request.Head.msgh_local_port = context.currentExceptionPort - request.Head.msgh_size = UInt32(MemoryLayout.size) - let requestSize = request.Head.msgh_size - try kernCheck { request.withMsgHeaderPointer { requestPtr in - mach_msg(requestPtr, MACH_RCV_MSG | MACH_RCV_INTERRUPT, 0, requestSize, context.currentExceptionPort, 0, UInt32(MACH_PORT_NULL)) - } } + // Prepare the reply structure + reply.Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(request.Head.msgh_bits), 0) + reply.Head.msgh_local_port = UInt32(MACH_PORT_NULL) + reply.Head.msgh_remote_port = request.Head.msgh_remote_port + reply.Head.msgh_size = UInt32(MemoryLayout.size) + reply.NDR = NDR_record + + if !handledfirstException { + // Use the MiG generated server to invoke our handler for the request and fill in the rest of the reply structure + guard request.withMsgHeaderPointer(in: { requestPtr in reply.withMsgHeaderPointer { replyPtr in + mach_exc_server(requestPtr, replyPtr) + } }) != 0 else { throw MachExcServer.code(reply.RetCode) } - // Prepare the reply structure - reply.Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(request.Head.msgh_bits), 0) - reply.Head.msgh_local_port = UInt32(MACH_PORT_NULL) - reply.Head.msgh_remote_port = request.Head.msgh_remote_port - reply.Head.msgh_size = UInt32(MemoryLayout.size) - reply.NDR = NDR_record - - if !handledfirstException { - // Use the MiG generated server to invoke our handler for the request and fill in the rest of the reply structure - guard request.withMsgHeaderPointer(in: { requestPtr in reply.withMsgHeaderPointer { replyPtr in - mach_exc_server(requestPtr, replyPtr) - } }) != 0 else { throw MachExcServer.code(reply.RetCode) } - - handledfirstException = true - } else { - // If multiple fatal errors occur, don't handle subsquent errors (let the program crash) - reply.RetCode = KERN_FAILURE - } - - // Send the reply - let replySize = reply.Head.msgh_size - try kernCheck { reply.withMsgHeaderPointer { replyPtr in - mach_msg(replyPtr, MACH_SEND_MSG, replySize, 0, UInt32(MACH_PORT_NULL), 0, UInt32(MACH_PORT_NULL)) - } } - } catch let error as NSError where (error.domain == NSMachErrorDomain && (error.code == Int(MACH_RCV_PORT_CHANGED) || error.code == Int(MACH_RCV_INVALID_NAME))) { - // Port was already closed before we started or closed while we were listening. - // This means the controlling thread shut down. - return nil - } catch { - // Should never be reached but this is testing code, don't try to recover, just abort - fatalError("Mach message error: \(error)") - } } while true + handledfirstException = true + } else { + // If multiple fatal errors occur, don't handle subsquent errors (let the program crash) + reply.RetCode = KERN_FAILURE + } + + // Send the reply + let replySize = reply.Head.msgh_size + try kernCheck { reply.withMsgHeaderPointer { replyPtr in + mach_msg(replyPtr, MACH_SEND_MSG, replySize, 0, UInt32(MACH_PORT_NULL), 0, UInt32(MACH_PORT_NULL)) + } } + } catch let error as NSError where (error.domain == NSMachErrorDomain && (error.code == Int(MACH_RCV_PORT_CHANGED) || error.code == Int(MACH_RCV_INVALID_NAME))) { + // Port was already closed before we started or closed while we were listening. + // This means the controlling thread shut down. + return nil + } catch { + // Should never be reached but this is testing code, don't try to recover, just abort + fatalError("Mach message error: \(error)") + } } while true +} + +/// Run the provided block. If a mach "BAD_INSTRUCTION" exception is raised, catch it and return a BadInstructionException (which captures stack information about the throw site, if desired). Otherwise return nil. +/// NOTE: This function is only intended for use in test harnesses – use in a distributed build is almost certainly a bad choice. If a "BAD_INSTRUCTION" exception is raised, the block will be exited before completion via Objective-C exception. The risks associated with an Objective-C exception apply here: most Swift/Objective-C functions are *not* exception-safe. Memory may be leaked and the program will not necessarily be left in a safe state. +/// - parameter block: a function without parameters that will be run +/// - returns: if an EXC_BAD_INSTRUCTION is raised during the execution of `block` then a BadInstructionException will be returned, otherwise `nil`. +public func catchBadInstruction(in block: @escaping () -> Void) -> BadInstructionException? { + // Suppress Swift runtime's direct triggering of the debugger and exclusivity checking which crashes when we throw past it + let previousExclusivity = _swift_disableExclusivityChecking + let previousReporting = _swift_reportFatalErrorsToDebugger + _swift_disableExclusivityChecking = true + _swift_reportFatalErrorsToDebugger = false + defer { + _swift_reportFatalErrorsToDebugger = previousReporting + _swift_disableExclusivityChecking = previousExclusivity } - /// Run the provided block. If a mach "BAD_INSTRUCTION" exception is raised, catch it and return a BadInstructionException (which captures stack information about the throw site, if desired). Otherwise return nil. - /// NOTE: This function is only intended for use in test harnesses – use in a distributed build is almost certainly a bad choice. If a "BAD_INSTRUCTION" exception is raised, the block will be exited before completion via Objective-C exception. The risks associated with an Objective-C exception apply here: most Swift/Objective-C functions are *not* exception-safe. Memory may be leaked and the program will not necessarily be left in a safe state. - /// - parameter block: a function without parameters that will be run - /// - returns: if an EXC_BAD_INSTRUCTION is raised during the execution of `block` then a BadInstructionException will be returned, otherwise `nil`. - public func catchBadInstruction(in block: () -> Void) -> BadInstructionException? { - var context = MachContext() - var result: BadInstructionException? = nil - do { - var handlerThread: pthread_t? = nil - defer { - // 8. Wait for the thread to terminate *if* we actually made it to the creation point - // The mach port should be destroyed *before* calling pthread_join to avoid a deadlock. - if handlerThread != nil { - pthread_join(handlerThread!, nil) - } + var context = MachContext() + var result: BadInstructionException? = nil + do { + var handlerThread: pthread_t? = nil + defer { + // 8. Wait for the thread to terminate *if* we actually made it to the creation point + // The mach port should be destroyed *before* calling pthread_join to avoid a deadlock. + if handlerThread != nil { + pthread_join(handlerThread!, nil) } - - try kernCheck { - // 1. Create the mach port - mach_port_allocate(mach_task_self_, MACH_PORT_RIGHT_RECEIVE, &context.currentExceptionPort) - } - defer { - // 7. Cleanup the mach port - mach_port_destroy(mach_task_self_, context.currentExceptionPort) - } - - try kernCheck { - // 2. Configure the mach port - mach_port_insert_right(mach_task_self_, context.currentExceptionPort, context.currentExceptionPort, MACH_MSG_TYPE_MAKE_SEND) - } - - let currentExceptionPtr = context.currentExceptionPort - try kernCheck { context.withUnsafeMutablePointers { masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr in - // 3. Apply the mach port as the handler for this thread - thread_swap_exception_ports(mach_thread_self(), EXC_MASK_BAD_INSTRUCTION, currentExceptionPtr, Int32(bitPattern: UInt32(EXCEPTION_STATE) | MACH_EXCEPTION_CODES), x86_THREAD_STATE64, masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) - } } - - defer { context.withUnsafeMutablePointers { masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr in - // 6. Unapply the mach port - _ = thread_swap_exception_ports(mach_thread_self(), EXC_MASK_BAD_INSTRUCTION, 0, EXCEPTION_DEFAULT, THREAD_STATE_NONE, masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) - } } - - try withUnsafeMutablePointer(to: &context) { c throws in - // 4. Create the thread - let e = pthread_create(&handlerThread, nil, machMessageHandler, c) - guard e == 0 else { throw PthreadError.code(e) } - - // 5. Run the block - result = BadInstructionException.catchException(in: block) - } - } catch { - // Should never be reached but this is testing code, don't try to recover, just abort - fatalError("Mach port error: \(error)") } - return result + + try kernCheck { + // 1. Create the mach port + mach_port_allocate(mach_task_self_, MACH_PORT_RIGHT_RECEIVE, &context.currentExceptionPort) + } + defer { + // 7. Cleanup the mach port + mach_port_destroy(mach_task_self_, context.currentExceptionPort) + } + + try kernCheck { + // 2. Configure the mach port + mach_port_insert_right(mach_task_self_, context.currentExceptionPort, context.currentExceptionPort, MACH_MSG_TYPE_MAKE_SEND) + } + + let currentExceptionPtr = context.currentExceptionPort + try kernCheck { context.withUnsafeMutablePointers { masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr in + // 3. Apply the mach port as the handler for this thread + thread_swap_exception_ports(mach_thread_self(), EXC_MASK_BAD_INSTRUCTION, currentExceptionPtr, Int32(bitPattern: UInt32(EXCEPTION_STATE) | MACH_EXCEPTION_CODES), x86_THREAD_STATE64, masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) + } } + + defer { context.withUnsafeMutablePointers { masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr in + // 6. Unapply the mach port + _ = thread_swap_exception_ports(mach_thread_self(), EXC_MASK_BAD_INSTRUCTION, 0, EXCEPTION_DEFAULT, THREAD_STATE_NONE, masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) + } } + + try withUnsafeMutablePointer(to: &context) { c throws in + // 4. Create the thread + let e = pthread_create(&handlerThread, nil, machMessageHandler, c) + guard e == 0 else { throw PthreadError.code(e) } + + // 5. Run the block + result = BadInstructionException.catchException(in: block) + } + } catch { + // Should never be reached but this is testing code, don't try to recover, just abort + fatalError("Mach port error: \(error)") } + + return result +} #endif diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift index eb9bc19..4fc99fa 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 8/02/2016. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -18,91 +18,91 @@ // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // +#if os(tvOS) && targetEnvironment(simulator) + import Foundation -#if arch(x86_64) +// This file is an alternative implementation to CwlCatchBadInstruction.swift that uses a SIGILL signal action and setenv/longjmp instead of a Mach exception handler and Objective-C exception raising. +// +// WARNING: +// This code is quick and dirty. It's a proof of concept for using a SIGILL handler and setjmp/longjmp where Mach exceptions and the Obj-C runtime aren't available. I ran the automated tests when I first wrote this code but I don't personally use it at all so by the time you're reading this comment, it probably broke and I didn't notice. +// Obvious limitations: +// * It doesn't work when debugging with lldb. +// * It doesn't scope correctly to the thread (it's global) +// * In violation of rules for signal handlers, it writes to the "red zone" on the stack +// * It isn't re-entrant +// * Plus all of the same caveats as the Mach exceptions version (doesn't play well with other handlers, probably leaks ARC memory, etc) +// Treat it like a loaded shotgun. Don't point it at your face. + +// This function is called from the signal handler to shut down the thread and return 1 (indicating a SIGILL was received). +private func callThreadExit() { + pthread_exit(UnsafeMutableRawPointer(bitPattern: 1)) +} + +// When called, this signal handler simulates a function call to `callThreadExit` +private func sigIllHandler(code: Int32, info: UnsafeMutablePointer<__siginfo>?, uap: UnsafeMutableRawPointer?) -> Void { + guard let context = uap?.assumingMemoryBound(to: ucontext64_t.self) else { return } + + // 1. Decrement the stack pointer + context.pointee.uc_mcontext64.pointee.__ss.__rsp -= __uint64_t(MemoryLayout.size) + + // 2. Save the old Instruction Pointer to the stack. + let rsp = context.pointee.uc_mcontext64.pointee.__ss.__rsp + if let ump = UnsafeMutablePointer<__uint64_t>(bitPattern: UInt(rsp)) { + ump.pointee = rsp + } + + // 3. Set the Instruction Pointer to the new function's address + var f: @convention(c) () -> Void = callThreadExit + withUnsafePointer(to: &f) { $0.withMemoryRebound(to: __uint64_t.self, capacity: 1) { ptr in + context.pointee.uc_mcontext64.pointee.__ss.__rip = ptr.pointee + } } +} + +/// Without Mach exceptions or the Objective-C runtime, there's nothing to put in the exception object. It's really just a boolean – either a SIGILL was caught or not. +public class BadInstructionException { +} + +/// Run the provided block. If a POSIX SIGILL is received, handle it and return a BadInstructionException (which is just an empty object in this POSIX signal version). Otherwise return nil. +/// NOTE: This function is only intended for use in test harnesses – use in a distributed build is almost certainly a bad choice. If a SIGILL is received, the block will be interrupted using a C `longjmp`. The risks associated with abrupt jumps apply here: most Swift functions are *not* interrupt-safe. Memory may be leaked and the program will not necessarily be left in a safe state. +/// - parameter block: a function without parameters that will be run +/// - returns: if an SIGILL is raised during the execution of `block` then a BadInstructionException will be returned, otherwise `nil`. +public func catchBadInstruction(block: @escaping () -> Void) -> BadInstructionException? { + // Construct the signal action + var sigActionPrev = sigaction() + let action = __sigaction_u(__sa_sigaction: sigIllHandler) + var sigActionNew = sigaction(__sigaction_u: action, sa_mask: sigset_t(), sa_flags: SA_SIGINFO) - // This file is an alternative implementation to CwlCatchBadInstruction.swift that uses a SIGILL signal action and setenv/longjmp instead of a Mach exception handler and Objective-C exception raising. - // - // WARNING: - // This code is quick and dirty. It's a proof of concept for using a SIGILL handler and setjmp/longjmp where Mach exceptions and the Obj-C runtime aren't available. I ran the automated tests when I first wrote this code but I don't personally use it at all so by the time you're reading this comment, it probably broke and I didn't notice. - // Obvious limitations: - // * It doesn't work when debugging with lldb. - // * It doesn't scope correctly to the thread (it's global) - // * In violation of rules for signal handlers, it writes to the "red zone" on the stack - // * It isn't re-entrant - // * Plus all of the same caveats as the Mach exceptions version (doesn't play well with other handlers, probably leaks ARC memory, etc) - // Treat it like a loaded shotgun. Don't point it at your face. - - // This function is called from the signal handler to shut down the thread and return 1 (indicating a SIGILL was received). - private func callThreadExit() { - pthread_exit(UnsafeMutableRawPointer(bitPattern: 1)) + // Install the signal action + if sigaction(SIGILL, &sigActionNew, &sigActionPrev) != 0 { + fatalError("Sigaction error: \(errno)") } - // When called, this signal handler simulates a function call to `callThreadExit` - private func sigIllHandler(code: Int32, info: UnsafeMutablePointer<__siginfo>?, uap: UnsafeMutableRawPointer?) -> Void { - guard let context = uap?.assumingMemoryBound(to: ucontext64_t.self) else { return } - - // 1. Decrement the stack pointer - context.pointee.uc_mcontext64.pointee.__ss.__rsp -= __uint64_t(MemoryLayout.size) - - // 2. Save the old Instruction Pointer to the stack. - let rsp = context.pointee.uc_mcontext64.pointee.__ss.__rsp - if let ump = UnsafeMutablePointer<__uint64_t>(bitPattern: UInt(rsp)) { - ump.pointee = rsp - } - - // 3. Set the Instruction Pointer to the new function's address - var f: @convention(c) () -> Void = callThreadExit - withUnsafePointer(to: &f) { $0.withMemoryRebound(to: __uint64_t.self, capacity: 1) { ptr in - context.pointee.uc_mcontext64.pointee.__ss.__rip = ptr.pointee - } } - } - - /// Without Mach exceptions or the Objective-C runtime, there's nothing to put in the exception object. It's really just a boolean – either a SIGILL was caught or not. - public class BadInstructionException { - } - - /// Run the provided block. If a POSIX SIGILL is received, handle it and return a BadInstructionException (which is just an empty object in this POSIX signal version). Otherwise return nil. - /// NOTE: This function is only intended for use in test harnesses – use in a distributed build is almost certainly a bad choice. If a SIGILL is received, the block will be interrupted using a C `longjmp`. The risks associated with abrupt jumps apply here: most Swift functions are *not* interrupt-safe. Memory may be leaked and the program will not necessarily be left in a safe state. - /// - parameter block: a function without parameters that will be run - /// - returns: if an SIGILL is raised during the execution of `block` then a BadInstructionException will be returned, otherwise `nil`. - public func catchBadInstruction(block: @escaping () -> Void) -> BadInstructionException? { - // Construct the signal action - var sigActionPrev = sigaction() - let action = __sigaction_u(__sa_sigaction: sigIllHandler) - var sigActionNew = sigaction(__sigaction_u: action, sa_mask: sigset_t(), sa_flags: SA_SIGINFO) - - // Install the signal action - if sigaction(SIGILL, &sigActionNew, &sigActionPrev) != 0 { + defer { + // Restore the previous signal action + if sigaction(SIGILL, &sigActionPrev, nil) != 0 { fatalError("Sigaction error: \(errno)") } - - defer { - // Restore the previous signal action - if sigaction(SIGILL, &sigActionPrev, nil) != 0 { - fatalError("Sigaction error: \(errno)") - } - } + } - var b = block - let caught: Bool = withUnsafeMutablePointer(to: &b) { blockPtr in - // Run the block on its own thread - var handlerThread: pthread_t? = nil - let e = pthread_create(&handlerThread, nil, { arg in - (arg.assumingMemoryBound(to: (() -> Void).self).pointee)() - return nil - }, blockPtr) - precondition(e == 0, "Unable to create thread") + var b = block + let caught: Bool = withUnsafeMutablePointer(to: &b) { blockPtr in + // Run the block on its own thread + var handlerThread: pthread_t? = nil + let e = pthread_create(&handlerThread, nil, { arg in + (arg.assumingMemoryBound(to: (() -> Void).self).pointee)() + return nil + }, blockPtr) + precondition(e == 0, "Unable to create thread") - // Wait for completion and get the result. It will be either `nil` or bitPattern 1 - var rawResult: UnsafeMutableRawPointer? = nil - let e2 = pthread_join(handlerThread!, &rawResult) - precondition(e2 == 0, "Thread join failed") - return Int(bitPattern: rawResult) != 0 - } - - return caught ? BadInstructionException() : nil + // Wait for completion and get the result. It will be either `nil` or bitPattern 1 + var rawResult: UnsafeMutableRawPointer? = nil + let e2 = pthread_join(handlerThread!, &rawResult) + precondition(e2 == 0, "Thread join failed") + return Int(bitPattern: rawResult) != 0 } + return caught ? BadInstructionException() : nil +} + #endif diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift index 8d99d5e..f22ed1f 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -18,38 +18,38 @@ // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // +#if (os(macOS) || os(iOS)) && arch(x86_64) + import Darwin -#if arch(x86_64) - - // From /usr/include/mach/message.h - // #define MACH_MSG_TYPE_MAKE_SEND 20 /* Must hold receive right */ - // #define MACH_MSGH_BITS_REMOTE(bits) \ - // ((bits) & MACH_MSGH_BITS_REMOTE_MASK) - // #define MACH_MSGH_BITS(remote, local) /* legacy */ \ - // ((remote) | ((local) << 8)) - public let MACH_MSG_TYPE_MAKE_SEND: UInt32 = 20 - public func MACH_MSGH_BITS_REMOTE(_ bits: UInt32) -> UInt32 { return bits & UInt32(MACH_MSGH_BITS_REMOTE_MASK) } - public func MACH_MSGH_BITS(_ remote: UInt32, _ local: UInt32) -> UInt32 { return ((remote) | ((local) << 8)) } - - // From /usr/include/mach/exception_types.h - // #define EXC_BAD_INSTRUCTION 2 /* Instruction failed */ - // #define EXC_MASK_BAD_INSTRUCTION (1 << EXC_BAD_INSTRUCTION) - public let EXC_BAD_INSTRUCTION: UInt32 = 2 - public let EXC_MASK_BAD_INSTRUCTION: UInt32 = 1 << EXC_BAD_INSTRUCTION - - // From /usr/include/mach/i386/thread_status.h - // #define x86_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \ - // ( sizeof (x86_thread_state64_t) / sizeof (int) )) - public let x86_THREAD_STATE64_COUNT = UInt32(MemoryLayout.size / MemoryLayout.size) - - public let EXC_TYPES_COUNT = 14 - public struct execTypesCountTuple { - // From /usr/include/mach/i386/exception.h - // #define EXC_TYPES_COUNT 14 /* incl. illegal exception 0 */ - public var value: (T, T, T, T, T, T, T, T, T, T, T, T, T, T) = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) - public init() { - } +// From /usr/include/mach/message.h +// #define MACH_MSG_TYPE_MAKE_SEND 20 /* Must hold receive right */ +// #define MACH_MSGH_BITS_REMOTE(bits) \ +// ((bits) & MACH_MSGH_BITS_REMOTE_MASK) +// #define MACH_MSGH_BITS(remote, local) /* legacy */ \ +// ((remote) | ((local) << 8)) +public let MACH_MSG_TYPE_MAKE_SEND: UInt32 = 20 +public func MACH_MSGH_BITS_REMOTE(_ bits: UInt32) -> UInt32 { return bits & UInt32(MACH_MSGH_BITS_REMOTE_MASK) } +public func MACH_MSGH_BITS(_ remote: UInt32, _ local: UInt32) -> UInt32 { return ((remote) | ((local) << 8)) } + +// From /usr/include/mach/exception_types.h +// #define EXC_BAD_INSTRUCTION 2 /* Instruction failed */ +// #define EXC_MASK_BAD_INSTRUCTION (1 << EXC_BAD_INSTRUCTION) +public let EXC_BAD_INSTRUCTION: UInt32 = 2 +public let EXC_MASK_BAD_INSTRUCTION: UInt32 = 1 << EXC_BAD_INSTRUCTION + +// From /usr/include/mach/i386/thread_status.h +// #define x86_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \ +// ( sizeof (x86_thread_state64_t) / sizeof (int) )) +public let x86_THREAD_STATE64_COUNT = UInt32(MemoryLayout.size / MemoryLayout.size) + +public let EXC_TYPES_COUNT = 14 +public struct execTypesCountTuple { + // From /usr/include/mach/i386/exception.h + // #define EXC_TYPES_COUNT 14 /* incl. illegal exception 0 */ + public var value: (T, T, T, T, T, T, T, T, T, T, T, T, T, T) = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + public init() { } +} #endif diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/include/CwlPreconditionTesting.h similarity index 71% rename from Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h rename to Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/include/CwlPreconditionTesting.h index 4e28f95..93a0e61 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/include/CwlPreconditionTesting.h @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -20,10 +20,16 @@ #import -extern bool _swift_reportFatalErrorsToDebugger; - //! Project version number for CwlUtils. -FOUNDATION_EXPORT double CwlPreconditionTesting_POSIXVersionNumber; +FOUNDATION_EXPORT double CwlPreconditionTestingVersionNumber; //! Project version string for CwlUtils. -FOUNDATION_EXPORT const unsigned char CwlAssertingTesting_POSIXVersionString[]; +FOUNDATION_EXPORT const unsigned char CwlAssertingTestingVersionString[]; + +#import "CwlMachBadInstructionHandler.h" + +#if TARGET_OS_OSX || TARGET_OS_IOS + #import "CwlCatchException.h" +#elif !TARGET_OS_TV + #error Unsupported platform. +#endif diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile b/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile index 206f109..adb8306 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile @@ -1,4 +1,4 @@ # A sample Gemfile source "https://rubygems.org" -gem 'cocoapods', '~> 1.6.0.rc.2' +gem 'cocoapods', '~> 1.7' diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile.lock b/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile.lock index cc03cbf..6c6f534 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile.lock +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile.lock @@ -2,18 +2,18 @@ GEM remote: https://rubygems.org/ specs: CFPropertyList (3.0.0) - activesupport (4.2.11) + activesupport (4.2.11.1) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) atomos (0.1.3) claide (1.0.2) - cocoapods (1.6.0.rc.2) + cocoapods (1.7.1) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.6.0.rc.2) - cocoapods-deintegrate (>= 1.0.2, < 2.0) + cocoapods-core (= 1.7.1) + cocoapods-deintegrate (>= 1.0.3, < 2.0) cocoapods-downloader (>= 1.2.2, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) @@ -26,13 +26,13 @@ GEM gh_inspector (~> 1.0) molinillo (~> 0.6.6) nap (~> 1.0) - ruby-macho (~> 1.3, >= 1.3.1) - xcodeproj (>= 1.8.0, < 2.0) - cocoapods-core (1.6.0.rc.2) + ruby-macho (~> 1.4) + xcodeproj (>= 1.8.2, < 2.0) + cocoapods-core (1.7.1) activesupport (>= 4.0.2, < 6) fuzzy_match (~> 2.0.4) nap (~> 1.0) - cocoapods-deintegrate (1.0.2) + cocoapods-deintegrate (1.0.4) cocoapods-downloader (1.2.2) cocoapods-plugins (1.0.0) nap @@ -43,9 +43,9 @@ GEM netrc (~> 0.11) cocoapods-try (1.1.0) colored2 (3.1.2) - concurrent-ruby (1.1.4) + concurrent-ruby (1.1.5) escape (0.0.4) - fourflusher (2.2.0) + fourflusher (2.3.0) fuzzy_match (2.0.4) gh_inspector (1.1.3) i18n (0.9.5) @@ -55,11 +55,11 @@ GEM nanaimo (0.2.6) nap (1.1.0) netrc (0.11.0) - ruby-macho (1.3.1) + ruby-macho (1.4.0) thread_safe (0.3.6) tzinfo (1.2.5) thread_safe (~> 0.1) - xcodeproj (1.8.0) + xcodeproj (1.9.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) @@ -70,7 +70,7 @@ PLATFORMS ruby DEPENDENCIES - cocoapods (~> 1.6.0.rc.2) + cocoapods (~> 1.7) BUNDLED WITH - 1.17.2 + 1.17.3 diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.podspec b/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.podspec index d66190b..754e2c1 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.podspec +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Nimble" - s.version = "8.0.0" + s.version = "8.0.4" s.summary = "A Matcher Framework for Swift and Objective-C" s.description = <<-DESC Use Nimble to express the expected outcomes of Swift or Objective-C expressions. Inspired by Cedar. @@ -16,26 +16,24 @@ Pod::Spec.new do |s| s.source_files = [ "Sources/**/*.{swift,h,m,c}", - "Carthage/Checkouts/CwlCatchException/Sources/**/*.{swift,h,m,c}", + "Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/**/*.{swift,h,m,c}", "Carthage/Checkouts/CwlPreconditionTesting/Sources/**/*.{swift,h,m,c}", ] s.osx.exclude_files = [ "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift", - "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h", ] s.ios.exclude_files = [ "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift", - "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h", ] s.tvos.exclude_files = [ "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h", "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift", "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift", "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift", - "Carthage/Checkouts/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift", - "Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m", - "Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h", + "Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift", + "Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m", + "Carthage/Checkouts/CwlPreconditionTesting/Dependencies/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h", ] s.exclude_files = "Sources/Nimble/Adapters/NonObjectiveC/*.swift" @@ -44,6 +42,7 @@ Pod::Spec.new do |s| s.compiler_flags = '-DPRODUCT_NAME=Nimble/Nimble' s.pod_target_xcconfig = { 'APPLICATION_EXTENSION_API_ONLY' => 'YES', + 'DEFINES_MODULE' => 'YES', 'ENABLE_BITCODE' => 'NO', 'OTHER_LDFLAGS' => '$(inherited) -weak-lswiftXCTest -Xlinker -no_application_extension', 'OTHER_SWIFT_FLAGS' => '$(inherited) -suppress-warnings', @@ -51,5 +50,9 @@ Pod::Spec.new do |s| } s.cocoapods_version = '>= 1.4.0' - s.swift_version = '4.2' + if s.respond_to?(:swift_versions) then + s.swift_versions = ['4.2', '5.0'] + else + s.swift_version = '4.2' + end end diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/project.pbxproj b/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/project.pbxproj index 2bf9a6a..5179f22 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/project.pbxproj +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/project.pbxproj @@ -380,6 +380,9 @@ CD79C9B51D2CC848004B6F9A /* ObjCUserDescriptionTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 965B0D081B62B8ED0005AE66 /* ObjCUserDescriptionTest.m */; }; CD79C9B61D2CC848004B6F9A /* ObjCAllPassTest.m in Sources */ = {isa = PBXBuildFile; fileRef = DDEFAEB31A93CBE6005CA37A /* ObjCAllPassTest.m */; }; CD79C9B71D2CC848004B6F9A /* ObjCSatisfyAnyOfTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B5358C11C39155600A23FAA /* ObjCSatisfyAnyOfTest.m */; }; + CD8D21BD2322BFC300C3996F /* CwlPreconditionTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8D21BC2322BFC300C3996F /* CwlPreconditionTesting.h */; settings = {ATTRIBUTES = (Public, ); }; }; + CD8D21BE2322BFC300C3996F /* CwlPreconditionTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8D21BC2322BFC300C3996F /* CwlPreconditionTesting.h */; settings = {ATTRIBUTES = (Public, ); }; }; + CD8D21BF2322BFC300C3996F /* CwlPreconditionTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8D21BC2322BFC300C3996F /* CwlPreconditionTesting.h */; settings = {ATTRIBUTES = (Public, ); }; }; CDD80B831F2030790002CD65 /* MatcherProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1D1968AB07008ED995 /* MatcherProtocols.swift */; }; CDD80B841F20307A0002CD65 /* MatcherProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1D1968AB07008ED995 /* MatcherProtocols.swift */; }; CDD80B851F20307B0002CD65 /* MatcherProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1D1968AB07008ED995 /* MatcherProtocols.swift */; }; @@ -395,8 +398,6 @@ CDFB6A3C1F7E082500AD8CC7 /* CwlCatchBadInstruction.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A2B1F7E082400AD8CC7 /* CwlCatchBadInstruction.swift */; }; CDFB6A3F1F7E082500AD8CC7 /* CwlDarwinDefinitions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A2D1F7E082400AD8CC7 /* CwlDarwinDefinitions.swift */; }; CDFB6A401F7E082500AD8CC7 /* CwlDarwinDefinitions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A2D1F7E082400AD8CC7 /* CwlDarwinDefinitions.swift */; }; - CDFB6A431F7E082500AD8CC7 /* CwlPreconditionTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A301F7E082400AD8CC7 /* CwlPreconditionTesting.h */; settings = {ATTRIBUTES = (Public, ); }; }; - CDFB6A441F7E082500AD8CC7 /* CwlPreconditionTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A301F7E082400AD8CC7 /* CwlPreconditionTesting.h */; settings = {ATTRIBUTES = (Public, ); }; }; CDFB6A471F7E082500AD8CC7 /* CwlMachBadInstructionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A341F7E082400AD8CC7 /* CwlMachBadInstructionHandler.m */; }; CDFB6A481F7E082500AD8CC7 /* CwlMachBadInstructionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A341F7E082400AD8CC7 /* CwlMachBadInstructionHandler.m */; }; CDFB6A491F7E082500AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A361F7E082400AD8CC7 /* CwlMachBadInstructionHandler.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -404,9 +405,8 @@ CDFB6A4B1F7E082500AD8CC7 /* mach_excServer.c in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A371F7E082400AD8CC7 /* mach_excServer.c */; }; CDFB6A4C1F7E082500AD8CC7 /* mach_excServer.c in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A371F7E082400AD8CC7 /* mach_excServer.c */; }; CDFB6A4F1F7E084600AD8CC7 /* CwlMachBadInstructionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A341F7E082400AD8CC7 /* CwlMachBadInstructionHandler.m */; }; - CDFB6A501F7E085600AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A361F7E082400AD8CC7 /* CwlMachBadInstructionHandler.h */; }; + CDFB6A501F7E085600AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A361F7E082400AD8CC7 /* CwlMachBadInstructionHandler.h */; settings = {ATTRIBUTES = (Public, ); }; }; CDFB6A511F7E087500AD8CC7 /* CwlCatchBadInstructionPosix.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A2C1F7E082400AD8CC7 /* CwlCatchBadInstructionPosix.swift */; }; - CDFB6A521F7E089F00AD8CC7 /* CwlPreconditionTesting_POSIX.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A321F7E082400AD8CC7 /* CwlPreconditionTesting_POSIX.h */; settings = {ATTRIBUTES = (Public, ); }; }; DA9E8C821A414BB9002633C2 /* DSL+Wait.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9E8C811A414BB9002633C2 /* DSL+Wait.swift */; }; DA9E8C831A414BB9002633C2 /* DSL+Wait.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9E8C811A414BB9002633C2 /* DSL+Wait.swift */; }; DD72EC641A93874A002F7651 /* AllPassTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD72EC631A93874A002F7651 /* AllPassTest.swift */; }; @@ -622,6 +622,7 @@ B20058C020E92C7500C1264D /* ElementsEqual.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementsEqual.swift; sourceTree = ""; }; B20058C420E92CE400C1264D /* ElementsEqualTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementsEqualTest.swift; sourceTree = ""; }; CD037212207DCC580047AF28 /* XCTestManifests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTestManifests.swift; sourceTree = ""; }; + CD8D21BC2322BFC300C3996F /* CwlPreconditionTesting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlPreconditionTesting.h; sourceTree = ""; }; CDFB6A1E1F7E07C600AD8CC7 /* CwlCatchException.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlCatchException.swift; sourceTree = ""; }; CDFB6A201F7E07C600AD8CC7 /* CwlCatchException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CwlCatchException.m; sourceTree = ""; }; CDFB6A221F7E07C600AD8CC7 /* CwlCatchException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlCatchException.h; sourceTree = ""; }; @@ -629,8 +630,6 @@ CDFB6A2B1F7E082400AD8CC7 /* CwlCatchBadInstruction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlCatchBadInstruction.swift; sourceTree = ""; }; CDFB6A2C1F7E082400AD8CC7 /* CwlCatchBadInstructionPosix.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlCatchBadInstructionPosix.swift; sourceTree = ""; }; CDFB6A2D1F7E082400AD8CC7 /* CwlDarwinDefinitions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlDarwinDefinitions.swift; sourceTree = ""; }; - CDFB6A301F7E082400AD8CC7 /* CwlPreconditionTesting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlPreconditionTesting.h; sourceTree = ""; }; - CDFB6A321F7E082400AD8CC7 /* CwlPreconditionTesting_POSIX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlPreconditionTesting_POSIX.h; sourceTree = ""; }; CDFB6A341F7E082400AD8CC7 /* CwlMachBadInstructionHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CwlMachBadInstructionHandler.m; sourceTree = ""; }; CDFB6A361F7E082400AD8CC7 /* CwlMachBadInstructionHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlMachBadInstructionHandler.h; sourceTree = ""; }; CDFB6A371F7E082400AD8CC7 /* mach_excServer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mach_excServer.c; sourceTree = ""; }; @@ -940,6 +939,14 @@ path = objc; sourceTree = ""; }; + CD8D21BB2322BFC300C3996F /* include */ = { + isa = PBXGroup; + children = ( + CD8D21BC2322BFC300C3996F /* CwlPreconditionTesting.h */, + ); + path = include; + sourceTree = ""; + }; CDFB69521F7E06E600AD8CC7 /* Carthage-Checkouts */ = { isa = PBXGroup; children = ( @@ -957,7 +964,7 @@ CDFB6A1F1F7E07C600AD8CC7 /* CwlCatchExceptionSupport */, ); name = CwlCatchException; - path = CwlCatchException/Sources; + path = CwlPreconditionTesting/Dependencies/CwlCatchException/Sources; sourceTree = ""; }; CDFB69741F7E076F00AD8CC7 /* CwlPreconditionTesting */ = { @@ -998,32 +1005,15 @@ CDFB6A291F7E082400AD8CC7 /* CwlPreconditionTesting */ = { isa = PBXGroup; children = ( + CD8D21BB2322BFC300C3996F /* include */, CDFB6A2A1F7E082400AD8CC7 /* CwlBadInstructionException.swift */, CDFB6A2B1F7E082400AD8CC7 /* CwlCatchBadInstruction.swift */, CDFB6A2C1F7E082400AD8CC7 /* CwlCatchBadInstructionPosix.swift */, CDFB6A2D1F7E082400AD8CC7 /* CwlDarwinDefinitions.swift */, - CDFB6A2F1F7E082400AD8CC7 /* Mach */, - CDFB6A311F7E082400AD8CC7 /* Posix */, ); path = CwlPreconditionTesting; sourceTree = ""; }; - CDFB6A2F1F7E082400AD8CC7 /* Mach */ = { - isa = PBXGroup; - children = ( - CDFB6A301F7E082400AD8CC7 /* CwlPreconditionTesting.h */, - ); - path = Mach; - sourceTree = ""; - }; - CDFB6A311F7E082400AD8CC7 /* Posix */ = { - isa = PBXGroup; - children = ( - CDFB6A321F7E082400AD8CC7 /* CwlPreconditionTesting_POSIX.h */, - ); - path = Posix; - sourceTree = ""; - }; CDFB6A331F7E082400AD8CC7 /* CwlMachBadInstructionHandler */ = { isa = PBXGroup; children = ( @@ -1050,9 +1040,9 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + CD8D21BE2322BFC300C3996F /* CwlPreconditionTesting.h in Headers */, CDFB6A4A1F7E082500AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */, CDFB6A281F7E07C700AD8CC7 /* CwlCatchException.h in Headers */, - CDFB6A441F7E082500AD8CC7 /* CwlPreconditionTesting.h in Headers */, 1F1871C91CA89EDB00A34BF2 /* NMBStringify.h in Headers */, 1F1871C51CA89EDB00A34BF2 /* DSL.h in Headers */, 1F1871C71CA89EDB00A34BF2 /* NMBExceptionCapture.h in Headers */, @@ -1064,8 +1054,8 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - CDFB6A521F7E089F00AD8CC7 /* CwlPreconditionTesting_POSIX.h in Headers */, 1F1871E21CA89EF600A34BF2 /* NMBStringify.h in Headers */, + CD8D21BF2322BFC300C3996F /* CwlPreconditionTesting.h in Headers */, 1F1871E01CA89EF600A34BF2 /* DSL.h in Headers */, 1F1871E11CA89EF600A34BF2 /* NMBExceptionCapture.h in Headers */, CDFB6A501F7E085600AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */, @@ -1077,10 +1067,10 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + CD8D21BD2322BFC300C3996F /* CwlPreconditionTesting.h in Headers */, CDFB6A491F7E082500AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */, CDFB6A271F7E07C700AD8CC7 /* CwlCatchException.h in Headers */, 1F1871DF1CA89EF500A34BF2 /* NMBStringify.h in Headers */, - CDFB6A431F7E082500AD8CC7 /* CwlPreconditionTesting.h in Headers */, 1F1871DD1CA89EF500A34BF2 /* DSL.h in Headers */, 1F1871DE1CA89EF500A34BF2 /* NMBExceptionCapture.h in Headers */, 1F925EC7195C0DD100ED456B /* Nimble.h in Headers */, @@ -1211,7 +1201,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "Jeff Hui"; TargetAttributes = { 1F1A74281940169200FFFC47 = { @@ -1248,10 +1238,11 @@ }; buildConfigurationList = 1F1A74231940169200FFFC47 /* Build configuration list for PBXProject "Nimble" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = 1F1A741F1940169200FFFC47; productRefGroup = 1F1A742A1940169200FFFC47 /* Products */; @@ -1809,6 +1800,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; APPLICATION_EXTENSION_API_ONLY = YES; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -1855,16 +1847,13 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; + SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.2; - TARGETED_DEVICE_FAMILY = "1,2"; - TVOS_DEPLOYMENT_TARGET = 9.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -1875,6 +1864,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; APPLICATION_EXTENSION_API_ONLY = YES; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -1914,15 +1904,13 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; + OTHER_SWIFT_FLAGS = "$(inherited) -suppress-warnings"; + SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.2; - TARGETED_DEVICE_FAMILY = "1,2"; - TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1950,8 +1938,8 @@ GCC_TREAT_WARNINGS_AS_ERRORS = YES; INFOPLIST_FILE = Sources/Nimble/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( "$(inherited)", "-weak_framework", @@ -1963,8 +1951,10 @@ PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Nimble; PRODUCT_NAME = Nimble; + SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; @@ -1988,6 +1978,7 @@ GCC_TREAT_WARNINGS_AS_ERRORS = YES; INFOPLIST_FILE = Sources/Nimble/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; OTHER_LDFLAGS = ( "$(inherited)", @@ -2000,8 +1991,10 @@ PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Nimble; PRODUCT_NAME = Nimble; + SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; }; @@ -2018,11 +2011,13 @@ "$(inherited)", ); INFOPLIST_FILE = Tests/NimbleTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = YES; OTHER_CODE_SIGN_FLAGS = "--verbose"; PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = NimbleTests; + SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -2036,11 +2031,13 @@ "$(inherited)", ); INFOPLIST_FILE = Tests/NimbleTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = NO; OTHER_CODE_SIGN_FLAGS = "--verbose"; PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = NimbleTests; + SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; @@ -2082,6 +2079,7 @@ SDKROOT = appletvos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; }; @@ -2123,6 +2121,7 @@ SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Release; }; @@ -2143,6 +2142,7 @@ PRODUCT_NAME = NimbleTests; SDKROOT = appletvos; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; }; @@ -2165,6 +2165,7 @@ SDKROOT = appletvos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Release; }; @@ -2190,6 +2191,7 @@ INFOPLIST_FILE = Sources/Nimble/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = ( "$(inherited)", @@ -2230,6 +2232,7 @@ INFOPLIST_FILE = Sources/Nimble/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = NO; OTHER_LDFLAGS = ( "$(inherited)", @@ -2264,11 +2267,13 @@ ); INFOPLIST_FILE = Tests/NimbleTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = NimbleTests; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VALID_ARCHS = x86_64; }; name = Debug; }; @@ -2284,11 +2289,13 @@ ); INFOPLIST_FILE = Tests/NimbleTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = NimbleTests; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + VALID_ARCHS = x86_64; }; name = Release; }; diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/xcshareddata/xcschemes/Nimble-iOS.xcscheme b/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/xcshareddata/xcschemes/Nimble-iOS.xcscheme index 80405c9..f9a7a22 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/xcshareddata/xcschemes/Nimble-iOS.xcscheme +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/xcshareddata/xcschemes/Nimble-iOS.xcscheme @@ -1,6 +1,6 @@ @@ -1711,6 +1713,27 @@ end Finally run `pod install`. +## Installing Nimble via Accio + +Add the following to your Package.swift: + +```swift +.package(url: "https://github.com/Quick/Nimble.git", .upToNextMajor(from: "8.0.1")), +``` + +Next, add `Nimble` to your App targets dependencies like so: + +```swift +.testTarget( + name: "AppTests", + dependencies: [ + "Nimble", + ] +), +``` + +Then run `accio update`. + ## Using Nimble without XCTest Nimble is integrated with XCTest to allow it work well when used in Xcode test diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift index b3eb09a..5338a46 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift @@ -54,49 +54,49 @@ public class NMBExpectation: NSObject { } @objc public var withTimeout: (TimeInterval) -> NMBExpectation { - return ({ timeout in self._timeout = timeout + return { timeout in self._timeout = timeout return self - }) + } } @objc public var to: (NMBMatcher) -> Void { - return ({ matcher in + return { matcher in if let pred = matcher as? NMBPredicate { self.expectValue.to(from(objcPredicate: pred)) } else { self.expectValue.to(ObjCMatcherWrapper(matcher: matcher)) } - }) + } } @objc public var toWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in + return { matcher, description in if let pred = matcher as? NMBPredicate { self.expectValue.to(from(objcPredicate: pred), description: description) } else { self.expectValue.to(ObjCMatcherWrapper(matcher: matcher), description: description) } - }) + } } @objc public var toNot: (NMBMatcher) -> Void { - return ({ matcher in + return { matcher in if let pred = matcher as? NMBPredicate { self.expectValue.toNot(from(objcPredicate: pred)) } else { self.expectValue.toNot(ObjCMatcherWrapper(matcher: matcher)) } - }) + } } @objc public var toNotWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in + return { matcher, description in if let pred = matcher as? NMBPredicate { self.expectValue.toNot(from(objcPredicate: pred), description: description) } else { self.expectValue.toNot(ObjCMatcherWrapper(matcher: matcher), description: description) } - }) + } } @objc public var notTo: (NMBMatcher) -> Void { return toNot } @@ -104,7 +104,7 @@ public class NMBExpectation: NSObject { @objc public var notToWithDescription: (NMBMatcher, String) -> Void { return toNotWithDescription } @objc public var toEventually: (NMBMatcher) -> Void { - return ({ matcher in + return { matcher in if let pred = matcher as? NMBPredicate { self.expectValue.toEventually( from(objcPredicate: pred), @@ -118,11 +118,11 @@ public class NMBExpectation: NSObject { description: nil ) } - }) + } } @objc public var toEventuallyWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in + return { matcher, description in if let pred = matcher as? NMBPredicate { self.expectValue.toEventually( from(objcPredicate: pred), @@ -136,11 +136,11 @@ public class NMBExpectation: NSObject { description: description ) } - }) + } } @objc public var toEventuallyNot: (NMBMatcher) -> Void { - return ({ matcher in + return { matcher in if let pred = matcher as? NMBPredicate { self.expectValue.toEventuallyNot( from(objcPredicate: pred), @@ -154,11 +154,11 @@ public class NMBExpectation: NSObject { description: nil ) } - }) + } } @objc public var toEventuallyNotWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in + return { matcher, description in if let pred = matcher as? NMBPredicate { self.expectValue.toEventuallyNot( from(objcPredicate: pred), @@ -172,7 +172,7 @@ public class NMBExpectation: NSObject { description: description ) } - }) + } } @objc public var toNotEventually: (NMBMatcher) -> Void { diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift index 719bf44..cd3b476 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift @@ -45,7 +45,7 @@ class NimbleXCTestUnavailableHandler: AssertionHandler { private var stashed_swift_reportFatalErrorsToDebugger: Bool = false @objc func testCaseWillStart(_ testCase: XCTestCase) { - #if swift(>=3.2) + #if swift(>=3.2) && !os(tvOS) stashed_swift_reportFatalErrorsToDebugger = _swift_reportFatalErrorsToDebugger _swift_reportFatalErrorsToDebugger = false #endif @@ -56,7 +56,7 @@ class NimbleXCTestUnavailableHandler: AssertionHandler { @objc func testCaseDidFinish(_ testCase: XCTestCase) { currentTestCase = nil - #if swift(>=3.2) + #if swift(>=3.2) && !os(tvOS) _swift_reportFatalErrorsToDebugger = stashed_swift_reportFatalErrorsToDebugger #endif } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Expression.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Expression.swift index b6b2ee3..dcc42e4 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Expression.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Expression.swift @@ -4,12 +4,12 @@ import Foundation // closure once; even if repeat calls to the returned closure internal func memoizedClosure(_ closure: @escaping () throws -> T) -> (Bool) throws -> T { var cache: T? - return ({ withoutCaching in + return { withoutCaching in if withoutCaching || cache == nil { cache = try closure() } return cache! - }) + } } /// Expression represents the closure of the value inside expect(...). diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift index d6fd1ee..4396180 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift @@ -51,10 +51,12 @@ public class NMBObjCBeCloseToMatcher: NSObject, NMBMatcher { return actualExpression() as? NMBDoubleConvertible }) let expr = Expression(expression: actualBlock, location: location) - let matcher = beCloseTo(self._expected, within: self._delta) + let predicate = beCloseTo(self._expected, within: self._delta) do { - return try matcher.matches(expr, failureMessage: failureMessage) + let result = try predicate.satisfies(expr) + result.message.update(failureMessage: failureMessage) + return result.toBoolean(expectation: .toMatch) } catch let error { failureMessage.stringValue = "unexpected error thrown: <\(error)>" return false @@ -66,10 +68,12 @@ public class NMBObjCBeCloseToMatcher: NSObject, NMBMatcher { return actualExpression() as? NMBDoubleConvertible }) let expr = Expression(expression: actualBlock, location: location) - let matcher = beCloseTo(self._expected, within: self._delta) + let predicate = beCloseTo(self._expected, within: self._delta) do { - return try matcher.doesNotMatch(expr, failureMessage: failureMessage) + let result = try predicate.satisfies(expr) + result.message.update(failureMessage: failureMessage) + return result.toBoolean(expectation: .toNotMatch) } catch let error { failureMessage.stringValue = "unexpected error thrown: <\(error)>" return false @@ -77,9 +81,9 @@ public class NMBObjCBeCloseToMatcher: NSObject, NMBMatcher { } @objc public var within: (CDouble) -> NMBObjCBeCloseToMatcher { - return ({ delta in + return { delta in return NMBObjCBeCloseToMatcher(expected: self._expected, within: delta) - }) + } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeEmpty.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeEmpty.swift index 79bf923..860287f 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeEmpty.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeEmpty.swift @@ -4,11 +4,10 @@ import Foundation /// means the are no items in that collection. For strings, it is an empty string. public func beEmpty() -> Predicate { return Predicate.simple("be empty") { actualExpression in - let actualSeq = try actualExpression.evaluate() - if actualSeq == nil { + guard let actual = try actualExpression.evaluate() else { return .fail } - var generator = actualSeq!.makeIterator() + var generator = actual.makeIterator() return PredicateStatus(bool: generator.next() == nil) } } @@ -24,6 +23,17 @@ public func beEmpty() -> Predicate { } } +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For strings, it is an empty string. +public func beEmpty() -> Predicate { + return Predicate.simple("be empty") { actualExpression in + guard let actual = try actualExpression.evaluate() else { + return .fail + } + return PredicateStatus(bool: actual.isEmpty) + } +} + /// A Nimble matcher that succeeds when a value is "empty". For collections, this /// means the are no items in that collection. For strings, it is an empty string. public func beEmpty() -> Predicate { diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift index 4a4cdd2..782c771 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift @@ -11,6 +11,11 @@ public func beGreaterThan(_ expectedValue: T?) -> Predicate { } } +public func >(lhs: Expectation, rhs: T) { + lhs.to(beGreaterThan(rhs)) +} + +#if canImport(Darwin) || !compiler(>=5.1) /// A Nimble matcher that succeeds when the actual value is greater than the expected value. public func beGreaterThan(_ expectedValue: NMBComparable?) -> Predicate { let errorMessage = "be greater than <\(stringify(expectedValue))>" @@ -22,13 +27,10 @@ public func beGreaterThan(_ expectedValue: NMBComparable?) -> Predicate(lhs: Expectation, rhs: T) { - lhs.to(beGreaterThan(rhs)) -} - public func > (lhs: Expectation, rhs: NMBComparable?) { lhs.to(beGreaterThan(rhs)) } +#endif #if canImport(Darwin) extension NMBObjCMatcher { diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift index 39d9e63..c3fc523 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift @@ -13,6 +13,11 @@ public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Predic } } +public func >=(lhs: Expectation, rhs: T) { + lhs.to(beGreaterThanOrEqualTo(rhs)) +} + +#if canImport(Darwin) || !compiler(>=5.1) /// A Nimble matcher that succeeds when the actual value is greater than /// or equal to the expected value. public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Predicate { @@ -24,13 +29,10 @@ public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Pre } } -public func >=(lhs: Expectation, rhs: T) { - lhs.to(beGreaterThanOrEqualTo(rhs)) -} - public func >=(lhs: Expectation, rhs: T) { lhs.to(beGreaterThanOrEqualTo(rhs)) } +#endif #if canImport(Darwin) extension NMBObjCMatcher { diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift index 49e503e..7644b4c 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift @@ -4,18 +4,9 @@ import Foundation /// as the expected instance. public func beIdenticalTo(_ expected: Any?) -> Predicate { return Predicate.define { actualExpression in - #if os(Linux) && !swift(>=4.1.50) - let actual = try actualExpression.evaluate() as? AnyObject - #else - let actual = try actualExpression.evaluate() as AnyObject? - #endif + let actual = try actualExpression.evaluate() as AnyObject? - let bool: Bool - #if os(Linux) && !swift(>=4.1.50) - bool = actual === (expected as? AnyObject) && actual !== nil - #else - bool = actual === (expected as AnyObject?) && actual !== nil - #endif + let bool = actual === (expected as AnyObject?) && actual !== nil return PredicateResult( bool: bool, message: .expectedCustomValueTo( diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThan.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThan.swift index ef0a7d4..12fc9c2 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThan.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThan.swift @@ -11,6 +11,11 @@ public func beLessThan(_ expectedValue: T?) -> Predicate { } } +public func <(lhs: Expectation, rhs: T) { + lhs.to(beLessThan(rhs)) +} + +#if canImport(Darwin) || !compiler(>=5.1) /// A Nimble matcher that succeeds when the actual value is less than the expected value. public func beLessThan(_ expectedValue: NMBComparable?) -> Predicate { let message = "be less than <\(stringify(expectedValue))>" @@ -21,13 +26,10 @@ public func beLessThan(_ expectedValue: NMBComparable?) -> Predicate(lhs: Expectation, rhs: T) { - lhs.to(beLessThan(rhs)) -} - public func < (lhs: Expectation, rhs: NMBComparable?) { lhs.to(beLessThan(rhs)) } +#endif #if canImport(Darwin) extension NMBObjCMatcher { diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift index 30ce043..bf6ba16 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift @@ -11,6 +11,11 @@ public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predicate } } +public func <=(lhs: Expectation, rhs: T) { + lhs.to(beLessThanOrEqualTo(rhs)) +} + +#if canImport(Darwin) || !compiler(>=5.1) /// A Nimble matcher that succeeds when the actual value is less than /// or equal to the expected value. public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predicate { @@ -21,13 +26,10 @@ public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predic } } -public func <=(lhs: Expectation, rhs: T) { - lhs.to(beLessThanOrEqualTo(rhs)) -} - public func <=(lhs: Expectation, rhs: T) { lhs.to(beLessThanOrEqualTo(rhs)) } +#endif #if canImport(Darwin) extension NMBObjCMatcher { diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Contain.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Contain.swift index 1d16fb1..6974a4d 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Contain.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Contain.swift @@ -40,6 +40,26 @@ public func contain(_ items: [T]) -> Predicate } } +/// A Nimble matcher that succeeds when the actual set contains the expected values. +public func contain(_ items: T...) -> Predicate + where S.Element == T { + return contain(items) +} + +/// A Nimble matcher that succeeds when the actual set contains the expected values. +public func contain(_ items: [T]) -> Predicate + where S.Element == T { + return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in + if let actual = try actualExpression.evaluate() { + let matches = items.allSatisfy { + return actual.contains($0) + } + return PredicateStatus(bool: matches) + } + return .fail + } +} + /// A Nimble matcher that succeeds when the actual string contains the expected substring. public func contain(_ substrings: String...) -> Predicate { return contain(substrings) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift index 38bb297..21ffd77 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift @@ -18,13 +18,13 @@ extension Matcher { } var toClosure: (Expression, FailureMessage, Bool) throws -> Bool { - return ({ expr, msg, expectedResult in + return { expr, msg, expectedResult in if expectedResult { return try self.matches(expr, failureMessage: msg) } else { return try self.doesNotMatch(expr, failureMessage: msg) } - }) + } } } @@ -136,13 +136,14 @@ extension NSDate: TestOutputStringConvertible { @objc public protocol NMBComparable { func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult } -#else +#elseif !compiler(>=5.1) // This should become obsolete once Corelibs Foundation adds Comparable conformance to NSNumber public protocol NMBComparable { func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult } #endif +#if canImport(Darwin) || !compiler(>=5.1) extension NSNumber: NMBComparable { public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult { // swiftlint:disable:next force_cast @@ -155,3 +156,4 @@ extension NSString: NMBComparable { return compare(otherObject as! String) } } +#endif diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/PostNotification.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/PostNotification.swift index 7d3e44c..5e8bee3 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/PostNotification.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/PostNotification.swift @@ -3,11 +3,7 @@ import Foundation internal class NotificationCollector { private(set) var observedNotifications: [Notification] private let notificationCenter: NotificationCenter - #if canImport(Darwin) - private var token: AnyObject? - #else private var token: NSObjectProtocol? - #endif required init(notificationCenter: NotificationCenter) { self.notificationCenter = notificationCenter @@ -23,20 +19,53 @@ internal class NotificationCollector { } deinit { - #if canImport(Darwin) - if let token = self.token { - self.notificationCenter.removeObserver(token) - } - #else - if let token = self.token as? AnyObject { - self.notificationCenter.removeObserver(token) - } - #endif + if let token = self.token { + self.notificationCenter.removeObserver(token) + } } } private let mainThread = pthread_self() +public func postNotifications( + _ predicate: Predicate<[Notification]>, + fromNotificationCenter center: NotificationCenter = .default +) -> Predicate { + _ = mainThread // Force lazy-loading of this value + let collector = NotificationCollector(notificationCenter: center) + collector.startObserving() + var once: Bool = false + + return Predicate { actualExpression in + let collectorNotificationsExpression = Expression( + memoizedExpression: { _ in + return collector.observedNotifications + }, + location: actualExpression.location, + withoutCaching: true + ) + + assert(pthread_equal(mainThread, pthread_self()) != 0, "Only expecting closure to be evaluated on main thread.") + if !once { + once = true + _ = try actualExpression.evaluate() + } + + let actualValue: String + if collector.observedNotifications.isEmpty { + actualValue = "no notifications" + } else { + actualValue = "<\(stringify(collector.observedNotifications))>" + } + + var result = try predicate.satisfies(collectorNotificationsExpression) + result.message = result.message.replacedExpectation { message in + return .expectedCustomValueTo(message.expectedMessage, actualValue) + } + return result + } +} + public func postNotifications( _ notificationsMatcher: T, fromNotificationCenter center: NotificationCenter = .default) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/RaisesException.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/RaisesException.swift index f44c810..4dd9304 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/RaisesException.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/RaisesException.swift @@ -141,12 +141,15 @@ public class NMBObjCRaiseExceptionMatcher: NSObject, NMBMatcher { let expr = Expression(expression: block, location: location) do { - return try raiseException( + let predicate = raiseException( named: _name, reason: _reason, userInfo: _userInfo, closure: _block - ).matches(expr, failureMessage: failureMessage) + ) + let result = try predicate.satisfies(expr) + result.message.update(failureMessage: failureMessage) + return result.toBoolean(expectation: .toMatch) } catch let error { failureMessage.stringValue = "unexpected error thrown: <\(error)>" return false @@ -158,47 +161,47 @@ public class NMBObjCRaiseExceptionMatcher: NSObject, NMBMatcher { } @objc public var named: (_ name: String) -> NMBObjCRaiseExceptionMatcher { - return ({ name in + return { name in return NMBObjCRaiseExceptionMatcher( name: name, reason: self._reason, userInfo: self._userInfo, block: self._block ) - }) + } } @objc public var reason: (_ reason: String?) -> NMBObjCRaiseExceptionMatcher { - return ({ reason in + return { reason in return NMBObjCRaiseExceptionMatcher( name: self._name, reason: reason, userInfo: self._userInfo, block: self._block ) - }) + } } @objc public var userInfo: (_ userInfo: NSDictionary?) -> NMBObjCRaiseExceptionMatcher { - return ({ userInfo in + return { userInfo in return NMBObjCRaiseExceptionMatcher( name: self._name, reason: self._reason, userInfo: userInfo, block: self._block ) - }) + } } @objc public var satisfyingBlock: (_ block: ((NSException) -> Void)?) -> NMBObjCRaiseExceptionMatcher { - return ({ block in + return { block in return NMBObjCRaiseExceptionMatcher( name: self._name, reason: self._reason, userInfo: self._userInfo, block: block ) - }) + } } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift index da3ea9a..15de060 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift @@ -1,5 +1,11 @@ import Foundation +/// A Nimble matcher that succeeds when the actual value matches with all of the matchers +/// provided in the variable list of matchers. +public func satisfyAllOf(_ predicates: Predicate...) -> Predicate { + return satisfyAllOf(predicates) +} + /// A Nimble matcher that succeeds when the actual value matches with all of the matchers /// provided in the variable list of matchers. public func satisfyAllOf(_ matchers: U...) -> Predicate diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift index 6724956..e8b379f 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift @@ -1,5 +1,11 @@ import Foundation +/// A Nimble matcher that succeeds when the actual value matches with any of the matchers +/// provided in the variable list of matchers. +public func satisfyAnyOf(_ predicates: Predicate...) -> Predicate { + return satisfyAnyOf(predicates) +} + /// A Nimble matcher that succeeds when the actual value matches with any of the matchers /// provided in the variable list of matchers. public func satisfyAnyOf(_ matchers: U...) -> Predicate diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift index 53d9191..e20f9ea 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift @@ -1,8 +1,12 @@ import Foundation +#if canImport(CwlPreconditionTesting) +import CwlPreconditionTesting +#endif + public func throwAssertion() -> Predicate { return Predicate { actualExpression in - #if arch(x86_64) && canImport(Darwin) && !SWIFT_PACKAGE + #if arch(x86_64) && canImport(Darwin) let message = ExpectationMessage.expectedTo("throw an assertion") var actualError: Error? @@ -38,10 +42,6 @@ public func throwAssertion() -> Predicate { } else { return PredicateResult(bool: caughtException != nil, message: message) } - #elseif SWIFT_PACKAGE - fatalError("The throwAssertion Nimble matcher does not currently support Swift CLI." + - " You can silence this error by placing the test case inside an #if !SWIFT_PACKAGE" + - " conditional statement") #else fatalError("The throwAssertion Nimble matcher can only run on x86_64 platforms with " + "Objective-C (e.g. macOS, iPhone 5s or later simulators). You can silence this error " + diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Nimble.h b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Nimble.h index 2bbc693..bd45c5d 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Nimble.h +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Nimble.h @@ -3,11 +3,7 @@ #import "NMBStringify.h" #import "DSL.h" -#if TARGET_OS_TV - #import "CwlPreconditionTesting_POSIX.h" -#else - #import "CwlPreconditionTesting.h" -#endif +#import "CwlPreconditionTesting.h" FOUNDATION_EXPORT double NimbleVersionNumber; FOUNDATION_EXPORT const unsigned char NimbleVersionString[]; diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Await.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Await.swift index 276f618..abe1237 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Await.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Await.swift @@ -32,11 +32,7 @@ internal class AssertionWaitLock: WaitLock { func acquireWaitingLock(_ fnName: String, file: FileString, line: UInt) { let info = WaitingInfo(name: fnName, file: file, lineNumber: line) - #if canImport(Darwin) - let isMainThread = Thread.isMainThread - #else - let isMainThread = _CFIsMainThread() - #endif + let isMainThread = Thread.isMainThread nimblePrecondition( isMainThread, "InvalidNimbleAPIUsage", diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Stringers.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Stringers.swift index 4ab18d2..7caea26 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Stringers.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Stringers.swift @@ -1,12 +1,7 @@ import Foundation internal func identityAsString(_ value: Any?) -> String { - let anyObject: AnyObject? -#if os(Linux) && !swift(>=4.1.50) - anyObject = value as? AnyObject -#else - anyObject = value as AnyObject? -#endif + let anyObject = value as AnyObject? if let value = anyObject { return NSString(format: "<%p>", unsafeBitCast(value, to: Int.self)).description } else { @@ -121,13 +116,7 @@ extension String: TestOutputStringConvertible { extension Data: TestOutputStringConvertible { public var testDescription: String { - #if os(Linux) - // swiftlint:disable:next todo - // FIXME: Swift on Linux triggers a segfault when calling NSData's hash() (last checked on 03-11-16) - return "Data" - #else - return "Data" - #endif + return "Data" } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/AsynchronousTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/AsynchronousTest.swift index bfa34c2..307412e 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/AsynchronousTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/AsynchronousTest.swift @@ -61,12 +61,12 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { } func testWaitUntilWithCustomDefaultsTimeout() { - AsyncDefaults.Timeout = 5 + AsyncDefaults.Timeout = 3 defer { AsyncDefaults.Timeout = 1 } waitUntil { done in - Thread.sleep(forTimeInterval: 4.8) + Thread.sleep(forTimeInterval: 2.8) done() } } @@ -121,7 +121,7 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { let msg = "-waitUntil() timed out but was unable to run the timeout handler because the main thread is unresponsive (0.5 seconds is allow after the wait times out). Conditions that may cause this include processing blocking IO on the main thread, calls to sleep(), deadlocks, and synchronous IPC. Nimble forcefully stopped run loop which may cause future failures in test run." failsWithErrorMessage(msg) { waitUntil(timeout: 1) { done in - Thread.sleep(forTimeInterval: 5.0) + Thread.sleep(forTimeInterval: 3.0) done() } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Helpers/utils.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Helpers/utils.swift index c90b72a..785d601 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Helpers/utils.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Helpers/utils.swift @@ -71,7 +71,7 @@ func deferToMainQueue(action: @escaping () -> Void) { } } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE public class NimbleHelper: NSObject { @objc public class func expectFailureMessage(_ message: NSString, block: () -> Void, file: FileString, line: UInt) { failsWithErrorMessage(String(describing: message), file: file, line: line, preferOriginalSourceLocation: true, closure: block) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift index 64a439b..00a35ff 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAKindOfTest.swift @@ -49,7 +49,7 @@ final class BeAKindOfSwiftTest: XCTestCase, XCTestCaseProvider { final class BeAKindOfObjCTest: XCTestCase, XCTestCaseProvider { func testPositiveMatch() { -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) expect(TestNull()).to(beAKindOf(NSNull.self)) expect(NSObject()).to(beAKindOf(NSObject.self)) expect(NSNumber(value: 1)).toNot(beAKindOf(NSDate.self)) @@ -57,7 +57,7 @@ final class BeAKindOfObjCTest: XCTestCase, XCTestCaseProvider { } func testFailureMessages() { -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) failsWithErrorMessageForNil("expected to not be a kind of NSNull, got ") { expect(nil as NSNull?).toNot(beAKindOf(NSNull.self)) } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift index df431e6..0d379a2 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift @@ -40,7 +40,7 @@ final class BeAnInstanceOfTest: XCTestCase, XCTestCaseProvider { failsWithErrorMessageForNil("expected to be an instance of NSString, got ") { expect(nil as NSString?).to(beAnInstanceOf(NSString.self)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) let numberTypeName = "__NSCFNumber" #else let numberTypeName = "NSNumber" diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift index 637bc7a..fa6f9d7 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeEmptyTest.swift @@ -10,7 +10,10 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect([] as [CInt]).to(beEmpty()) expect([1] as [CInt]).toNot(beEmpty()) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + expect([] as Set).to(beEmpty()) + expect([1] as Set).toNot(beEmpty()) + +#if canImport(Darwin) expect(NSDictionary() as? [Int: Int]).to(beEmpty()) expect(NSDictionary(object: 1, forKey: 1 as NSNumber) as? [Int: Int]).toNot(beEmpty()) #endif @@ -18,7 +21,7 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect([Int: Int]()).to(beEmpty()) expect(["hi": 1]).toNot(beEmpty()) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) expect(NSArray() as? [Int]).to(beEmpty()) expect(NSArray(array: [1]) as? [Int]).toNot(beEmpty()) #endif @@ -47,7 +50,14 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect([1]).to(beEmpty()) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + failsWithErrorMessage("expected to not be empty, got ") { + expect([] as Set).toNot(beEmpty()) + } + failsWithErrorMessage("expected to be empty, got ") { + expect([1] as Set).to(beEmpty()) + } + +#if canImport(Darwin) failsWithErrorMessage("expected to not be empty, got <{()}>") { expect(NSSet()).toNot(beEmpty()) } @@ -93,6 +103,13 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect(nil as [CInt]?).toNot(beEmpty()) } + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as Set?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as Set?).toNot(beEmpty()) + } + failsWithErrorMessageForNil("expected to be empty, got ") { expect(nil as TestOptionSet?).to(beEmpty()) } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift index 4c91fec..9ac561f 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift @@ -9,9 +9,7 @@ final class BeGreaterThanOrEqualToTest: XCTestCase, XCTestCaseProvider { expect(1).toNot(beGreaterThanOrEqualTo(2)) expect(NSNumber(value: 1)).toNot(beGreaterThanOrEqualTo(2)) expect(NSNumber(value: 2)).to(beGreaterThanOrEqualTo(NSNumber(value: 2))) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) expect(1).to(beGreaterThanOrEqualTo(NSNumber(value: 0))) -#endif failsWithErrorMessage("expected to be greater than or equal to <2>, got <0>") { expect(0).to(beGreaterThanOrEqualTo(2)) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift index 8830647..80d40e7 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift @@ -41,7 +41,7 @@ final class BeIdenticalToTest: XCTestCase, XCTestCaseProvider { let value = NSDate() expect(value).to(be(value)) expect(NSNumber(value: 1)).toNot(be(NSString(string: "turtles"))) - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + #if canImport(Darwin) expect([1]).toNot(be([1])) #else expect(NSArray(array: [NSNumber(value: 1)])).toNot(beIdenticalTo(NSArray(array: [NSNumber(value: 1)]))) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift index f389469..dd8120d 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift @@ -10,10 +10,8 @@ final class BeLessThanOrEqualToTest: XCTestCase, XCTestCaseProvider { expect(NSNumber(value: 2)).to(beLessThanOrEqualTo(10)) expect(NSNumber(value: 2)).toNot(beLessThanOrEqualTo(1)) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) expect(2).to(beLessThanOrEqualTo(NSNumber(value: 10))) expect(2).toNot(beLessThanOrEqualTo(NSNumber(value: 1))) -#endif failsWithErrorMessage("expected to be less than or equal to <0>, got <2>") { expect(2).to(beLessThanOrEqualTo(0)) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift index 3a5162e..6805d7c 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeginWithTest.swift @@ -15,10 +15,8 @@ final class BeginWithTest: XCTestCase, XCTestCaseProvider { expect(NSString(string: "foobar").description).to(beginWith("foo")) expect(NSString(string: "foobar").description).toNot(beginWith("oo")) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) expect(NSArray(array: ["a", "b"])).to(beginWith("a")) expect(NSArray(array: ["a", "b"])).toNot(beginWith("b")) -#endif } func testNegativeMatches() { diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift index f69f351..28f685e 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ContainTest.swift @@ -10,7 +10,7 @@ final class ContainTest: XCTestCase, XCTestCaseProvider { expect([1, 2, 3] as [CInt]).toNot(contain(4 as CInt)) expect(["foo", "bar", "baz"]).to(contain("baz")) expect(["foo", "bar", "baz"]).toNot(contain("ba")) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) expect(NSArray(array: ["a"])).to(contain(NSString(string: "a"))) expect(NSArray(array: ["a"])).toNot(contain(NSString(string: "b"))) expect(NSArray(object: 1) as NSArray?).to(contain(1)) @@ -50,6 +50,27 @@ final class ContainTest: XCTestCase, XCTestCaseProvider { } } + func testContainSequenceAndSetAlgebra() { + let set = [1, 2, 3] as Set + + expect(set).to(contain(1)) + expect(set).toNot(contain(4)) + + failsWithErrorMessage("expected to contain <4>, got <\(set.debugDescription)>") { + expect(set).to(contain(4)) + } + failsWithErrorMessage("expected to not contain <2>, got <\(set.debugDescription)>") { + expect(set).toNot(contain(2)) + } + + failsWithErrorMessageForNil("expected to contain <1>, got ") { + expect(nil as Set?).to(contain(1)) + } + failsWithErrorMessageForNil("expected to not contain <1>, got ") { + expect(nil as Set?).toNot(contain(1)) + } + } + func testContainSubstring() { expect("foo").to(contain("o")) expect("foo").to(contain("oo")) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift index 88005e8..54794c5 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EndWithTest.swift @@ -16,12 +16,10 @@ final class EndWithTest: XCTestCase, XCTestCaseProvider { expect(NSString(string: "foobar").description).to(endWith("bar")) expect(NSString(string: "foobar").description).toNot(endWith("oo")) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) expect(NSArray(array: ["a", "b"])).to(endWith("b")) expect(NSArray(array: ["a", "b"])).toNot(endWith("a")) expect(NSArray(array: [])).toNot(endWith("a")) expect(NSArray(array: ["a", "b", "a"])).to(endWith("a")) -#endif } func testEndWithNegatives() { diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift index 18b0647..5b1aa49 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/EqualTest.swift @@ -33,9 +33,7 @@ final class EqualTest: XCTestCase, XCTestCaseProvider { expect(array1).to(equal([1, 2, 3])) expect(array1).toNot(equal([1, 2] as [Int])) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) expect(NSArray(array: [1, 2, 3])).to(equal(NSArray(array: [1, 2, 3]))) -#endif failsWithErrorMessage("expected to equal <[1, 2]>, got <[1, 2, 3]>") { expect([1, 2, 3]).to(equal([1, 2])) @@ -119,10 +117,8 @@ final class EqualTest: XCTestCase, XCTestCaseProvider { expect(actual).to(equal(expected)) expect(actual).toNot(equal(unexpected)) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) expect(NSDictionary(object: "bar", forKey: "foo" as NSString)).to(equal(["foo": "bar"])) expect(NSDictionary(object: "bar", forKey: "foo" as NSString) as? [String: String]).to(equal(expected)) -#endif } func testDataEquality() { @@ -133,14 +129,8 @@ final class EqualTest: XCTestCase, XCTestCaseProvider { expect(actual).to(equal(expected)) expect(actual).toNot(equal(unexpected)) - #if os(Linux) - // swiftlint:disable:next todo - // FIXME: Swift on Linux triggers a segfault when calling NSData's hash() (last checked on 03-11) - let expectedErrorMessage = "expected to equal >, got >" - #else - let expectedErrorMessage = "expected to equal >," + let expectedErrorMessage = "expected to equal >," + " got >" - #endif failsWithErrorMessage(expectedErrorMessage) { expect(actual).to(equal(unexpected)) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift index 41e5159..bac76e9 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/MatchErrorTest.swift @@ -19,7 +19,7 @@ final class MatchErrorTest: XCTestCase, XCTestCaseProvider { } func testMatchNSErrorPositive() { -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) let error1 = NSError(domain: "err", code: 0, userInfo: nil) let error2 = NSError(domain: "err", code: 0, userInfo: nil) @@ -45,7 +45,7 @@ final class MatchErrorTest: XCTestCase, XCTestCaseProvider { expect(CustomDebugStringConvertibleError.a).to(matchError(CustomDebugStringConvertibleError.b)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) +#if canImport(Darwin) failsWithErrorMessage("expected to match error , got ") { let error1 = NSError(domain: "err", code: 0, userInfo: nil) let error2 = NSError(domain: "err", code: 1, userInfo: nil) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift index 32f5100..de6fe5d 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/PostNotificationTest.swift @@ -64,16 +64,12 @@ final class PostNotificationTest: XCTestCase, XCTestCaseProvider { } func testPassesWhenExpectedNotificationEventuallyIsPosted() { - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - let testNotification = Notification(name: Notification.Name("Foo"), object: nil) - expect { - deferToMainQueue { - self.notificationCenter.post(testNotification) - } - return nil - }.toEventually(postNotifications(equal([testNotification]), fromNotificationCenter: notificationCenter)) - #else - print("\(#function) is missing because toEventually is not implement on this platform") - #endif + let testNotification = Notification(name: Notification.Name("Foo"), object: nil) + expect { + deferToMainQueue { + self.notificationCenter.post(testNotification) + } + return nil + }.toEventually(postNotifications(equal([testNotification]), fromNotificationCenter: notificationCenter)) } } diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift index beca75b..085b3b4 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/RaisesExceptionTest.swift @@ -1,7 +1,7 @@ import XCTest import Nimble -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE final class RaisesExceptionTest: XCTestCase { var anException = NSException(name: NSExceptionName("laugh"), reason: "Lulz", userInfo: ["key": "value"]) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift index edd9e0e..a1f69cc 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/ThrowAssertionTest.swift @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) private let error: Error = NSError(domain: "test", code: 0, userInfo: nil) diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/XCTestManifests.swift b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/XCTestManifests.swift index e0fcd0a..2bd1052 100644 --- a/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/XCTestManifests.swift +++ b/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/XCTestManifests.swift @@ -202,6 +202,7 @@ extension ContainTest { ("testCollectionArguments", testCollectionArguments), ("testContainObjCSubstring", testContainObjCSubstring), ("testContainSequence", testContainSequence), + ("testContainSequenceAndSetAlgebra", testContainSequenceAndSetAlgebra), ("testContainSetAlgebra", testContainSetAlgebra), ("testContainSubstring", testContainSubstring), ("testVariadicArguments", testVariadicArguments), diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/script/release b/Carthage/Checkouts/Quick/Externals/Nimble/script/release index f61c0dc..20d15e9 100755 --- a/Carthage/Checkouts/Quick/Externals/Nimble/script/release +++ b/Carthage/Checkouts/Quick/Externals/Nimble/script/release @@ -3,7 +3,7 @@ REMOTE_BRANCH=master POD_NAME=Nimble PODSPEC=Nimble.podspec -POD=${COCOAPODS:-pod} +POD=${COCOAPODS:-"bundle exec pod"} function help { echo "Usage: release VERSION RELEASE_NOTES [-f]" @@ -173,7 +173,7 @@ echo echo "Pushing to pod trunk..." # NOTE: remove allow-warnings after v9.0.0 of Nimble -$POD trunk push "$PODSPEC" --allow-warnings +$POD trunk push "$PODSPEC" --allow-warnings --skip-import-validation echo echo "================ Finalizing the Release ================" diff --git a/Carthage/Checkouts/Quick/Externals/Nimble/test b/Carthage/Checkouts/Quick/Externals/Nimble/test index c213afe..3c17d81 100755 --- a/Carthage/Checkouts/Quick/Externals/Nimble/test +++ b/Carthage/Checkouts/Quick/Externals/Nimble/test @@ -54,20 +54,24 @@ function run { } function test_ios { - run osascript -e 'tell app "Simulator" to quit' - run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -sdk "iphonesimulator$BUILD_IOS_SDK_VERSION" -destination "name=iPad Air,OS=$RUNTIME_IOS_SDK_VERSION" build-for-testing test-without-building + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -destination "generic/platform=iOS" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build | xcpretty run osascript -e 'tell app "Simulator" to quit' - run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -sdk "iphonesimulator$BUILD_IOS_SDK_VERSION" -destination "name=iPhone 5s,OS=$RUNTIME_IOS_SDK_VERSION" build-for-testing test-without-building + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -sdk "iphonesimulator$BUILD_IOS_SDK_VERSION" -destination "name=iPad Pro (11-inch),OS=$RUNTIME_IOS_SDK_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty + + run osascript -e 'tell app "Simulator" to quit' + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -sdk "iphonesimulator$BUILD_IOS_SDK_VERSION" -destination "name=iPhone 8,OS=$RUNTIME_IOS_SDK_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty } function test_tvos { + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-tvOS" -configuration "Debug" -destination "generic/platform=tvOS" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build | xcpretty + run osascript -e 'tell app "Simulator" to quit' - run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-tvOS" -configuration "Debug" -sdk "appletvsimulator$BUILD_TVOS_SDK_VERSION" -destination "name=Apple TV,OS=$RUNTIME_TVOS_SDK_VERSION" build-for-testing test-without-building + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-tvOS" -configuration "Debug" -sdk "appletvsimulator$BUILD_TVOS_SDK_VERSION" -destination "name=Apple TV,OS=$RUNTIME_TVOS_SDK_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty } function test_macos { - run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-macOS" -configuration "Debug" -sdk "macosx$BUILD_MACOS_SDK_VERSION" build-for-testing test-without-building + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-macOS" -configuration "Debug" -sdk "macosx$BUILD_MACOS_SDK_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty } function test_podspec { @@ -86,7 +90,7 @@ function test_swiftpm { if [ -d .build ]; then run swift package clean fi - run swift build && swift test + run swift build -Xswiftc -suppress-warnings && swift test -Xswiftc -suppress-warnings } function test_swiftpm_docker { diff --git a/Carthage/Checkouts/Quick/Gemfile b/Carthage/Checkouts/Quick/Gemfile index 45cf683..22da545 100644 --- a/Carthage/Checkouts/Quick/Gemfile +++ b/Carthage/Checkouts/Quick/Gemfile @@ -1,5 +1,5 @@ source "https://rubygems.org" -gem 'cocoapods', '~> 1.7.0.beta' +gem 'cocoapods', '~> 1.7' gem 'danger' gem 'danger-swiftlint' diff --git a/Carthage/Checkouts/Quick/Gemfile.lock b/Carthage/Checkouts/Quick/Gemfile.lock index ce57b59..9eb0fed 100644 --- a/Carthage/Checkouts/Quick/Gemfile.lock +++ b/Carthage/Checkouts/Quick/Gemfile.lock @@ -1,24 +1,24 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.0) - activesupport (4.2.11) + CFPropertyList (3.0.1) + activesupport (4.2.11.1) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - addressable (2.5.0) - public_suffix (~> 2.0, >= 2.0.2) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) atomos (0.1.3) - claide (1.0.2) + claide (1.0.3) claide-plugins (0.9.2) cork nap open4 (~> 1.3) - cocoapods (1.7.0.beta.1) + cocoapods (1.7.5) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.7.0.beta.1) + cocoapods-core (= 1.7.5) cocoapods-deintegrate (>= 1.0.3, < 2.0) cocoapods-downloader (>= 1.2.2, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) @@ -28,77 +28,81 @@ GEM cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) - fourflusher (>= 2.2.0, < 3.0) + fourflusher (>= 2.3.0, < 3.0) gh_inspector (~> 1.0) molinillo (~> 0.6.6) nap (~> 1.0) ruby-macho (~> 1.4) - xcodeproj (>= 1.8.1, < 2.0) - cocoapods-core (1.7.0.beta.1) + xcodeproj (>= 1.10.0, < 2.0) + cocoapods-core (1.7.5) activesupport (>= 4.0.2, < 6) fuzzy_match (~> 2.0.4) nap (~> 1.0) - cocoapods-deintegrate (1.0.3) + cocoapods-deintegrate (1.0.4) cocoapods-downloader (1.2.2) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) cocoapods-stats (1.1.0) - cocoapods-trunk (1.3.1) + cocoapods-trunk (1.4.0) nap (>= 0.8, < 2.0) netrc (~> 0.11) cocoapods-try (1.1.0) - colored (1.2) colored2 (3.1.2) - concurrent-ruby (1.1.4) - cork (0.2.0) - colored (~> 1.2) - danger (4.0.4) + concurrent-ruby (1.1.5) + cork (0.3.0) + colored2 (~> 3.1) + danger (6.0.3) claide (~> 1.0) claide-plugins (>= 0.9.2) - colored (~> 1.2) + colored2 (~> 3.1) cork (~> 0.1) faraday (~> 0.9) faraday-http-cache (~> 1.0) - git (~> 1) - kramdown (~> 1.5) - octokit (~> 4.2) + git (~> 1.5) + kramdown (~> 2.0) + kramdown-parser-gfm (~> 1.0) + no_proxy_fix + octokit (~> 4.7) terminal-table (~> 1) danger-swiftlint (0.2.1) danger escape (0.0.4) - faraday (0.10.1) + faraday (0.15.4) multipart-post (>= 1.2, < 3) faraday-http-cache (1.3.1) faraday (~> 0.8) - fourflusher (2.2.0) + fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) - git (1.3.0) + git (1.5.0) i18n (0.9.5) concurrent-ruby (~> 1.0) - kramdown (1.13.2) + kramdown (2.1.0) + kramdown-parser-gfm (1.0.1) + kramdown (~> 2.0) minitest (5.11.3) molinillo (0.6.6) multipart-post (2.0.0) nanaimo (0.2.6) nap (1.1.0) netrc (0.11.0) - octokit (4.6.2) + no_proxy_fix (0.1.2) + octokit (4.14.0) sawyer (~> 0.8.0, >= 0.5.3) open4 (1.3.4) - public_suffix (2.0.5) + public_suffix (3.0.3) ruby-macho (1.4.0) sawyer (0.8.1) addressable (>= 2.3.5, < 2.6) faraday (~> 0.8, < 1.0) - terminal-table (1.7.3) - unicode-display_width (~> 1.1.1) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) thread_safe (0.3.6) tzinfo (1.2.5) thread_safe (~> 0.1) - unicode-display_width (1.1.2) - xcodeproj (1.8.1) + unicode-display_width (1.5.0) + xcodeproj (1.12.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) @@ -109,9 +113,9 @@ PLATFORMS ruby DEPENDENCIES - cocoapods (~> 1.7.0.beta) + cocoapods (~> 1.7) danger danger-swiftlint BUNDLED WITH - 1.17.2 + 1.17.3 diff --git a/Carthage/Checkouts/Quick/Package.swift b/Carthage/Checkouts/Quick/Package.swift index 419d663..3677c82 100644 --- a/Carthage/Checkouts/Quick/Package.swift +++ b/Carthage/Checkouts/Quick/Package.swift @@ -1,9 +1,12 @@ -// swift-tools-version:4.2 +// swift-tools-version:5.0 import PackageDescription let package = Package( name: "Quick", + platforms: [ + .macOS(.v10_10), .iOS(.v8), .tvOS(.v9) + ], products: [ .library(name: "Quick", targets: ["Quick"]), ], @@ -19,7 +22,9 @@ let package = Package( "QuickAfterSuiteTests/AfterSuiteTests+ObjC.m", "QuickFocusedTests/FocusedTests+ObjC.m", "QuickTests/FunctionalTests/ObjC", - "QuickTests/Helpers", + "QuickTests/Helpers/QCKSpecRunner.h", + "QuickTests/Helpers/QCKSpecRunner.m", + "QuickTests/Helpers/QuickTestsBridgingHeader.h", "QuickTests/QuickConfigurationTests.m", ] ), @@ -36,5 +41,5 @@ let package = Package( #endif return targets }(), - swiftLanguageVersions: [.v4_2] + swiftLanguageVersions: [.v5] ) diff --git a/Carthage/Checkouts/Quick/Package@swift-4.2.swift b/Carthage/Checkouts/Quick/Package@swift-4.2.swift new file mode 100644 index 0000000..e0b2de5 --- /dev/null +++ b/Carthage/Checkouts/Quick/Package@swift-4.2.swift @@ -0,0 +1,42 @@ +// swift-tools-version:4.2 + +import PackageDescription + +let package = Package( + name: "Quick", + products: [ + .library(name: "Quick", targets: ["Quick"]), + ], + dependencies: [ + .package(url: "https://github.com/Quick/Nimble.git", from: "8.0.0"), + ], + targets: { + var targets: [Target] = [ + .testTarget( + name: "QuickTests", + dependencies: [ "Quick", "Nimble" ], + exclude: [ + "QuickAfterSuiteTests/AfterSuiteTests+ObjC.m", + "QuickFocusedTests/FocusedTests+ObjC.m", + "QuickTests/FunctionalTests/ObjC", + "QuickTests/Helpers/QCKSpecRunner.h", + "QuickTests/Helpers/QCKSpecRunner.m", + "QuickTests/Helpers/QuickTestsBridgingHeader.h", + "QuickTests/QuickConfigurationTests.m", + ] + ), + ] +#if os(macOS) + targets.append(contentsOf: [ + .target(name: "QuickSpecBase", dependencies: []), + .target(name: "Quick", dependencies: [ "QuickSpecBase" ]), + ]) +#else + targets.append(contentsOf: [ + .target(name: "Quick", dependencies: []), + ]) +#endif + return targets + }(), + swiftLanguageVersions: [.v4_2] +) diff --git a/Carthage/Checkouts/Quick/Quick.podspec b/Carthage/Checkouts/Quick/Quick.podspec index 4565831..1d85c7c 100644 --- a/Carthage/Checkouts/Quick/Quick.podspec +++ b/Carthage/Checkouts/Quick/Quick.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Quick" - s.version = "2.0.0" + s.version = "2.2.0" s.summary = "The Swift (and Objective-C) testing framework." s.description = <<-DESC @@ -26,7 +26,6 @@ Pod::Spec.new do |s| ] s.exclude_files = [ - 'Sources/Quick/Configuration/QuickConfiguration.swift', 'Sources/Quick/QuickSpec.swift', 'Sources/Quick/QuickMain.swift', ] @@ -41,5 +40,9 @@ Pod::Spec.new do |s| } s.cocoapods_version = '>= 1.4.0' - s.swift_version = '4.2' + if s.respond_to?(:swift_versions) then + s.swift_versions = ['4.2', '5.0'] + else + s.swift_version = '4.2' + end end diff --git a/Carthage/Checkouts/Quick/Quick.xcodeproj/project.pbxproj b/Carthage/Checkouts/Quick/Quick.xcodeproj/project.pbxproj index 931b615..4dcf57e 100644 --- a/Carthage/Checkouts/Quick/Quick.xcodeproj/project.pbxproj +++ b/Carthage/Checkouts/Quick/Quick.xcodeproj/project.pbxproj @@ -119,6 +119,9 @@ 64076D231D6D7E6B00E2B499 /* AfterSuiteTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64076D1D1D6D7D0B00E2B499 /* AfterSuiteTests.swift */; }; 64076D261D6D80B500E2B499 /* AfterSuiteTests+ObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = 64076D241D6D80B500E2B499 /* AfterSuiteTests+ObjC.m */; }; 64076D271D6D80B500E2B499 /* AfterSuiteTests+ObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = 64076D241D6D80B500E2B499 /* AfterSuiteTests+ObjC.m */; }; + 79FE27DF22DC955400BA013D /* QuickSpec_SelectedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79FE27DE22DC955400BA013D /* QuickSpec_SelectedTests.swift */; }; + 79FE27E022DC955400BA013D /* QuickSpec_SelectedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79FE27DE22DC955400BA013D /* QuickSpec_SelectedTests.swift */; }; + 79FE27E122DC955400BA013D /* QuickSpec_SelectedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79FE27DE22DC955400BA013D /* QuickSpec_SelectedTests.swift */; }; 7B44ADBE1C5444940007AF2E /* HooksPhase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B44ADBD1C5444940007AF2E /* HooksPhase.swift */; }; 7B44ADBF1C5444940007AF2E /* HooksPhase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B44ADBD1C5444940007AF2E /* HooksPhase.swift */; }; 7B44ADC01C5444940007AF2E /* HooksPhase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B44ADBD1C5444940007AF2E /* HooksPhase.swift */; }; @@ -128,19 +131,31 @@ 8D010A571C11726F00633E2B /* DescribeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D010A561C11726F00633E2B /* DescribeTests.swift */; }; 8D010A581C11726F00633E2B /* DescribeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D010A561C11726F00633E2B /* DescribeTests.swift */; }; 8D010A591C11726F00633E2B /* DescribeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D010A561C11726F00633E2B /* DescribeTests.swift */; }; - AE4E58131C73097A00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */ = {isa = PBXBuildFile; fileRef = AEB080BB1C72F028004917D3 /* XCTestObservationCenter+QCKSuspendObservation.m */; }; - AE4E58141C73097A00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */ = {isa = PBXBuildFile; fileRef = AEB080BB1C72F028004917D3 /* XCTestObservationCenter+QCKSuspendObservation.m */; }; - AE4E58151C73097C00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */ = {isa = PBXBuildFile; fileRef = AEB080BB1C72F028004917D3 /* XCTestObservationCenter+QCKSuspendObservation.m */; }; - AE4E58161C73097C00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */ = {isa = PBXBuildFile; fileRef = AEB080BB1C72F028004917D3 /* XCTestObservationCenter+QCKSuspendObservation.m */; }; - AE4E58171C73097E00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */ = {isa = PBXBuildFile; fileRef = AEB080BB1C72F028004917D3 /* XCTestObservationCenter+QCKSuspendObservation.m */; }; - AE4E58181C73097E00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */ = {isa = PBXBuildFile; fileRef = AEB080BB1C72F028004917D3 /* XCTestObservationCenter+QCKSuspendObservation.m */; }; AED9C8631CC8A7BD00432F62 /* CrossReferencingSpecs.swift in Sources */ = {isa = PBXBuildFile; fileRef = AED9C8621CC8A7BD00432F62 /* CrossReferencingSpecs.swift */; }; AED9C8641CC8A7BD00432F62 /* CrossReferencingSpecs.swift in Sources */ = {isa = PBXBuildFile; fileRef = AED9C8621CC8A7BD00432F62 /* CrossReferencingSpecs.swift */; }; AED9C8651CC8A7BD00432F62 /* CrossReferencingSpecs.swift in Sources */ = {isa = PBXBuildFile; fileRef = AED9C8621CC8A7BD00432F62 /* CrossReferencingSpecs.swift */; }; + CD1F6503226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD1F6502226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift */; }; + CD1F6504226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD1F6502226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift */; }; + CD1F6505226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD1F6502226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift */; }; + CD1F6506226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD1F6502226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift */; }; + CD1F6507226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD1F6502226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift */; }; + CD1F6508226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD1F6502226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift */; }; CD264DBD1DDA147A0038B0EB /* AfterSuiteTests+ObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = 64076D241D6D80B500E2B499 /* AfterSuiteTests+ObjC.m */; }; - CD564DA020B5B09C00C15E6B /* QuickSpec+QuickSpec_MethodList.m in Sources */ = {isa = PBXBuildFile; fileRef = 96327C621C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m */; }; - CD564DA120B5B09D00C15E6B /* QuickSpec+QuickSpec_MethodList.m in Sources */ = {isa = PBXBuildFile; fileRef = 96327C621C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m */; }; - CD564DA220B5B09E00C15E6B /* QuickSpec+QuickSpec_MethodList.m in Sources */ = {isa = PBXBuildFile; fileRef = 96327C621C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m */; }; + CD582D6F2264B371008F7CE6 /* QuickSpec+MethodList.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD582D6E2264B371008F7CE6 /* QuickSpec+MethodList.swift */; }; + CD582D702264B371008F7CE6 /* QuickSpec+MethodList.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD582D6E2264B371008F7CE6 /* QuickSpec+MethodList.swift */; }; + CD582D712264B371008F7CE6 /* QuickSpec+MethodList.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD582D6E2264B371008F7CE6 /* QuickSpec+MethodList.swift */; }; + CD582D732264C137008F7CE6 /* QuickSpecRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD582D722264C137008F7CE6 /* QuickSpecRunner.swift */; }; + CD582D742264C137008F7CE6 /* QuickSpecRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD582D722264C137008F7CE6 /* QuickSpecRunner.swift */; }; + CD582D752264C137008F7CE6 /* QuickSpecRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD582D722264C137008F7CE6 /* QuickSpecRunner.swift */; }; + CD582D762264C137008F7CE6 /* QuickSpecRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD582D722264C137008F7CE6 /* QuickSpecRunner.swift */; }; + CD582D772264C137008F7CE6 /* QuickSpecRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD582D722264C137008F7CE6 /* QuickSpecRunner.swift */; }; + CD582D782264C137008F7CE6 /* QuickSpecRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD582D722264C137008F7CE6 /* QuickSpecRunner.swift */; }; + CDB2A957226B714400C0F199 /* SubclassOfSubclassWithStructPropertyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDB2A956226B714400C0F199 /* SubclassOfSubclassWithStructPropertyTests.swift */; }; + CDB2A958226B714400C0F199 /* SubclassOfSubclassWithStructPropertyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDB2A956226B714400C0F199 /* SubclassOfSubclassWithStructPropertyTests.swift */; }; + CDB2A959226B714400C0F199 /* SubclassOfSubclassWithStructPropertyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDB2A956226B714400C0F199 /* SubclassOfSubclassWithStructPropertyTests.swift */; }; + CDE5BDFD2268CE95006E2F66 /* QuickConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD261AC81DEC8B0000A8863C /* QuickConfiguration.swift */; }; + CDE5BDFE2268CE96006E2F66 /* QuickConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD261AC81DEC8B0000A8863C /* QuickConfiguration.swift */; }; + CDE5BDFF2268CE97006E2F66 /* QuickConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD261AC81DEC8B0000A8863C /* QuickConfiguration.swift */; }; CE175D4E1E8D6B4900EB5E84 /* Behavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE175D4D1E8D6B4900EB5E84 /* Behavior.swift */; }; CE175D4F1E8D6B4900EB5E84 /* Behavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE175D4D1E8D6B4900EB5E84 /* Behavior.swift */; }; CE175D501E8D6B4900EB5E84 /* Behavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE175D4D1E8D6B4900EB5E84 /* Behavior.swift */; }; @@ -237,9 +252,9 @@ DAEB6B9A1943873100289F44 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAEB6B8E1943873100289F44 /* Quick.framework */; }; DAF28BC31A4DB8EC00A5D9BF /* FocusedTests+ObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = DAF28BC21A4DB8EC00A5D9BF /* FocusedTests+ObjC.m */; }; DAF28BC41A4DB8EC00A5D9BF /* FocusedTests+ObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = DAF28BC21A4DB8EC00A5D9BF /* FocusedTests+ObjC.m */; }; - DED3036B1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED3036A1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift */; }; - DED3036C1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED3036A1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift */; }; - DED3036D1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED3036A1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift */; }; + DED3036B1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED3036A1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift */; }; + DED3036C1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED3036A1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift */; }; + DED3036D1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED3036A1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift */; }; DED3037D1DF6CF140041394E /* BundleModuleNameTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED3037C1DF6CF140041394E /* BundleModuleNameTests.swift */; }; DED3037E1DF6CF140041394E /* BundleModuleNameTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED3037C1DF6CF140041394E /* BundleModuleNameTests.swift */; }; DED3037F1DF6CF140041394E /* BundleModuleNameTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED3037C1DF6CF140041394E /* BundleModuleNameTests.swift */; }; @@ -493,16 +508,19 @@ 64076D1A1D6D7CEA00E2B499 /* QuickAfterSuite - tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "QuickAfterSuite - tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 64076D1D1D6D7D0B00E2B499 /* AfterSuiteTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AfterSuiteTests.swift; sourceTree = ""; }; 64076D241D6D80B500E2B499 /* AfterSuiteTests+ObjC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "AfterSuiteTests+ObjC.m"; sourceTree = ""; }; + 79FE27DE22DC955400BA013D /* QuickSpec_SelectedTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickSpec_SelectedTests.swift; sourceTree = ""; }; 7B44ADBD1C5444940007AF2E /* HooksPhase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HooksPhase.swift; sourceTree = ""; }; 7B5358CA1C3D4E2A00A23FAA /* ContextTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContextTests.swift; sourceTree = ""; }; 8D010A561C11726F00633E2B /* DescribeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DescribeTests.swift; sourceTree = ""; }; - 96327C611C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "QuickSpec+QuickSpec_MethodList.h"; sourceTree = ""; }; - 96327C621C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "QuickSpec+QuickSpec_MethodList.m"; sourceTree = ""; }; - AEB080BB1C72F028004917D3 /* XCTestObservationCenter+QCKSuspendObservation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "XCTestObservationCenter+QCKSuspendObservation.m"; sourceTree = ""; }; AED9C8621CC8A7BD00432F62 /* CrossReferencingSpecs.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CrossReferencingSpecs.swift; sourceTree = ""; }; + CD1F6502226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "XCTestObservationCenter+QCKSuspendObservation.swift"; sourceTree = ""; }; CD261AC81DEC8B0000A8863C /* QuickConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QuickConfiguration.swift; sourceTree = ""; }; CD3451461E4703D4000C8633 /* QuickMain.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QuickMain.swift; sourceTree = ""; }; CD3451471E4703D4000C8633 /* QuickSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QuickSpec.swift; sourceTree = ""; }; + CD582D6E2264B371008F7CE6 /* QuickSpec+MethodList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "QuickSpec+MethodList.swift"; sourceTree = ""; }; + CD582D722264C137008F7CE6 /* QuickSpecRunner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickSpecRunner.swift; sourceTree = ""; }; + CD665CE0225A5BB9008F0AE6 /* LinuxMain.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LinuxMain.swift; path = Tests/LinuxMain.swift; sourceTree = SOURCE_ROOT; }; + CDB2A956226B714400C0F199 /* SubclassOfSubclassWithStructPropertyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubclassOfSubclassWithStructPropertyTests.swift; sourceTree = ""; }; CE175D4D1E8D6B4900EB5E84 /* Behavior.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Behavior.swift; sourceTree = ""; }; CE4A57891EA5DC270063C0D4 /* BehaviorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BehaviorTests.swift; sourceTree = ""; }; CE4A578D1EA7251C0063C0D4 /* FunctionalTests_BehaviorTests_Behaviors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FunctionalTests_BehaviorTests_Behaviors.swift; sourceTree = ""; }; @@ -531,7 +549,6 @@ DA8F919519F31680006F6675 /* QCKSpecRunner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QCKSpecRunner.h; sourceTree = ""; }; DA8F919619F31680006F6675 /* QCKSpecRunner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QCKSpecRunner.m; sourceTree = ""; }; DA8F919719F31680006F6675 /* QuickTestsBridgingHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuickTestsBridgingHeader.h; sourceTree = ""; }; - DA8F919819F31680006F6675 /* XCTestObservationCenter+QCKSuspendObservation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "XCTestObservationCenter+QCKSuspendObservation.h"; sourceTree = ""; }; DA8F919C19F31921006F6675 /* FailureTests+ObjC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "FailureTests+ObjC.m"; sourceTree = ""; }; DA8F91A419F3208B006F6675 /* BeforeSuiteTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BeforeSuiteTests.swift; sourceTree = ""; }; DA8F91AA19F3299E006F6675 /* SharedExamplesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SharedExamplesTests.swift; sourceTree = ""; }; @@ -553,7 +570,7 @@ DAEB6B991943873100289F44 /* Quick - macOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Quick - macOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; DAEB6B9F1943873100289F44 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; DAF28BC21A4DB8EC00A5D9BF /* FocusedTests+ObjC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "FocusedTests+ObjC.m"; sourceTree = ""; }; - DED3036A1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSString+C99ExtendedIdentifier.swift"; sourceTree = ""; }; + DED3036A1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+C99ExtendedIdentifier.swift"; sourceTree = ""; }; DED3037C1DF6CF140041394E /* BundleModuleNameTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BundleModuleNameTests.swift; sourceTree = ""; }; F8100E901A1E4447007595ED /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -766,11 +783,10 @@ DA8F919719F31680006F6675 /* QuickTestsBridgingHeader.h */, DA8F919519F31680006F6675 /* QCKSpecRunner.h */, DA8F919619F31680006F6675 /* QCKSpecRunner.m */, + CD582D722264C137008F7CE6 /* QuickSpecRunner.swift */, + CD582D6E2264B371008F7CE6 /* QuickSpec+MethodList.swift */, 34ACFB7B1C34859300942064 /* XCTestCaseProvider.swift */, - DA8F919819F31680006F6675 /* XCTestObservationCenter+QCKSuspendObservation.h */, - 96327C611C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.h */, - 96327C621C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m */, - AEB080BB1C72F028004917D3 /* XCTestObservationCenter+QCKSuspendObservation.m */, + CD1F6502226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift */, ); path = Helpers; sourceTree = ""; @@ -793,6 +809,8 @@ DED3037C1DF6CF140041394E /* BundleModuleNameTests.swift */, CE4A57891EA5DC270063C0D4 /* BehaviorTests.swift */, DA5CBB471EAFA55800297C9E /* CurrentSpecTests.swift */, + CDB2A956226B714400C0F199 /* SubclassOfSubclassWithStructPropertyTests.swift */, + 79FE27DE22DC955400BA013D /* QuickSpec_SelectedTests.swift */, ); path = FunctionalTests; sourceTree = ""; @@ -894,7 +912,7 @@ CE57CEDA1C430BD200D63004 /* QuickTestSuite.swift */, CE57CED91C430BD200D63004 /* QuickSelectedTestSuiteBuilder.swift */, CE57CED81C430BD200D63004 /* NSBundle+CurrentTestBundle.swift */, - DED3036A1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift */, + DED3036A1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift */, CE57CEDB1C430BD200D63004 /* URL+FileName.swift */, 34C586071C4AC5E500D4F057 /* ErrorUtility.swift */, DAEB6B911943873100289F44 /* Supporting Files */, @@ -915,6 +933,7 @@ DAEB6B9D1943873100289F44 /* QuickTests */ = { isa = PBXGroup; children = ( + CD665CE0225A5BB9008F0AE6 /* LinuxMain.swift */, DA8C00201A01E4B900CE58A6 /* QuickConfigurationTests.m */, DA8F919419F31680006F6675 /* Helpers */, DAEB6BCD194387D700289F44 /* Fixtures */, @@ -1235,7 +1254,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0810; - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "Brian Ivan Gesiak"; TargetAttributes = { 1F118CD41BDCA4AB005013A2 = { @@ -1284,10 +1303,11 @@ }; buildConfigurationList = DAEB6B881943873100289F44 /* Build configuration list for PBXProject "Quick" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = DAEB6B841943873100289F44; productRefGroup = DAEB6B8F1943873100289F44 /* Products */; @@ -1427,7 +1447,7 @@ 34C5860A1C4AC5E500D4F057 /* ErrorUtility.swift in Sources */, 1F118D041BDCA536005013A2 /* Example.swift in Sources */, 1F118CFF1BDCA536005013A2 /* QCKDSL.m in Sources */, - DED3036D1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift in Sources */, + DED3036D1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift in Sources */, CE590E211C431FE400253D19 /* NSBundle+CurrentTestBundle.swift in Sources */, 1F118D071BDCA536005013A2 /* Callsite.swift in Sources */, CE590E231C431FE400253D19 /* XCTestSuite+QuickTestSuiteBuilder.m in Sources */, @@ -1442,6 +1462,7 @@ CE175D501E8D6B4900EB5E84 /* Behavior.swift in Sources */, CE590E1F1C431FE400253D19 /* QuickTestSuite.swift in Sources */, 1F118D091BDCA536005013A2 /* QuickSpec.m in Sources */, + CDE5BDFF2268CE97006E2F66 /* QuickConfiguration.swift in Sources */, 1F118D011BDCA536005013A2 /* ExampleHooks.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1452,6 +1473,7 @@ files = ( 1F118D381BDCA6E1005013A2 /* Configuration+BeforeEachTests.swift in Sources */, 1F118D121BDCA556005013A2 /* ItTests.swift in Sources */, + 79FE27E122DC955400BA013D /* QuickSpec_SelectedTests.swift in Sources */, 1F118D1C1BDCA556005013A2 /* BeforeSuiteTests.swift in Sources */, 1F118D1D1BDCA556005013A2 /* BeforeSuiteTests+ObjC.m in Sources */, 1F118D0E1BDCA547005013A2 /* QCKSpecRunner.m in Sources */, @@ -1460,6 +1482,8 @@ CE4A57911EA7252E0063C0D4 /* FunctionalTests_BehaviorTests_Behaviors.swift in Sources */, DED3037F1DF6CF140041394E /* BundleModuleNameTests.swift in Sources */, 1F118D0F1BDCA54B005013A2 /* FunctionalTests_SharedExamplesTests_SharedExamples.swift in Sources */, + CDB2A959226B714400C0F199 /* SubclassOfSubclassWithStructPropertyTests.swift in Sources */, + CD1F6507226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */, 1F118D101BDCA556005013A2 /* Configuration+AfterEach.swift in Sources */, 1F118D1A1BDCA556005013A2 /* PendingTests.swift in Sources */, 1F118D171BDCA556005013A2 /* BeforeEachTests+ObjC.m in Sources */, @@ -1468,14 +1492,14 @@ 1F118D131BDCA556005013A2 /* ItTests+ObjC.m in Sources */, 1F118D191BDCA556005013A2 /* AfterEachTests+ObjC.m in Sources */, 1F118D221BDCA556005013A2 /* SharedExamples+BeforeEachTests.swift in Sources */, - AE4E58171C73097E00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */, AED9C8651CC8A7BD00432F62 /* CrossReferencingSpecs.swift in Sources */, 1F118D211BDCA556005013A2 /* SharedExamplesTests+ObjC.m in Sources */, 1F118D201BDCA556005013A2 /* SharedExamplesTests.swift in Sources */, 1F118D0C1BDCA543005013A2 /* QuickConfigurationTests.m in Sources */, + CD582D712264B371008F7CE6 /* QuickSpec+MethodList.swift in Sources */, 1F118D391BDCA6E6005013A2 /* Configuration+BeforeEach.swift in Sources */, - CD564DA220B5B09E00C15E6B /* QuickSpec+QuickSpec_MethodList.m in Sources */, 1F118D181BDCA556005013A2 /* AfterEachTests.swift in Sources */, + CD582D772264C137008F7CE6 /* QuickSpecRunner.swift in Sources */, 1F118D1B1BDCA556005013A2 /* PendingTests+ObjC.m in Sources */, 34C586051C4ABD4100D4F057 /* XCTestCaseProvider.swift in Sources */, 8D010A591C11726F00633E2B /* DescribeTests.swift in Sources */, @@ -1490,11 +1514,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + CD582D782264C137008F7CE6 /* QuickSpecRunner.swift in Sources */, + CD1F6508226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */, 1F118D0D1BDCA547005013A2 /* QCKSpecRunner.m in Sources */, 34C586061C4ABD4100D4F057 /* XCTestCaseProvider.swift in Sources */, 1F118D241BDCA561005013A2 /* FocusedTests.swift in Sources */, 1F118D251BDCA561005013A2 /* FocusedTests+ObjC.m in Sources */, - AE4E58181C73097E00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1509,7 +1534,7 @@ 34C586091C4AC5E500D4F057 /* ErrorUtility.swift in Sources */, DA408BE719FF5599005DF92A /* SuiteHooks.swift in Sources */, 34F375BA19515CA700CE1B99 /* QuickSpec.m in Sources */, - DED3036C1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift in Sources */, + DED3036C1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift in Sources */, CE590E1C1C431FE300253D19 /* NSBundle+CurrentTestBundle.swift in Sources */, DAE7150119FF6A62005905B8 /* QuickConfiguration.m in Sources */, CE590E1E1C431FE300253D19 /* XCTestSuite+QuickTestSuiteBuilder.m in Sources */, @@ -1525,6 +1550,7 @@ CE175D4F1E8D6B4900EB5E84 /* Behavior.swift in Sources */, CE590E1A1C431FE300253D19 /* QuickTestSuite.swift in Sources */, DA3124E719FCAEE8002858A7 /* DSL.swift in Sources */, + CDE5BDFE2268CE96006E2F66 /* QuickConfiguration.swift in Sources */, DA6B30191A4DB0D500FFB148 /* Filter.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1535,6 +1561,7 @@ files = ( DAE714F819FF6812005905B8 /* Configuration+AfterEach.swift in Sources */, DAA7C0D719F777EB0093D1D9 /* BeforeEachTests.swift in Sources */, + 79FE27E022DC955400BA013D /* QuickSpec_SelectedTests.swift in Sources */, DA8F919A19F31680006F6675 /* QCKSpecRunner.m in Sources */, DA8940F11B35B1FA00161061 /* FailureUsingXCTAssertTests+ObjC.m in Sources */, 4728253C1A5EECCE008DC74F /* SharedExamplesTests+ObjC.m in Sources */, @@ -1543,6 +1570,8 @@ DA05D61119F73A3800771050 /* AfterEachTests.swift in Sources */, DAB0137019FC4315006AFBEE /* SharedExamples+BeforeEachTests.swift in Sources */, DA8F91A619F3208B006F6675 /* BeforeSuiteTests.swift in Sources */, + CDB2A958226B714400C0F199 /* SubclassOfSubclassWithStructPropertyTests.swift in Sources */, + CD1F6505226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */, DA8C00221A01E4B900CE58A6 /* QuickConfigurationTests.m in Sources */, CE4A578A1EA5DC270063C0D4 /* BehaviorTests.swift in Sources */, DAA63EA419F7637300CD0A3B /* PendingTests.swift in Sources */, @@ -1552,13 +1581,13 @@ CE4A578E1EA7251C0063C0D4 /* FunctionalTests_BehaviorTests_Behaviors.swift in Sources */, DA8F91AF19F32CE2006F6675 /* FunctionalTests_SharedExamplesTests_SharedExamples.swift in Sources */, DAE714FB19FF682A005905B8 /* Configuration+AfterEachTests.swift in Sources */, - AE4E58151C73097C00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */, AED9C8641CC8A7BD00432F62 /* CrossReferencingSpecs.swift in Sources */, 471590411A488F3F00FBA644 /* PendingTests+ObjC.m in Sources */, DA8F919E19F31921006F6675 /* FailureTests+ObjC.m in Sources */, + CD582D702264B371008F7CE6 /* QuickSpec+MethodList.swift in Sources */, DAE714F419FF65E7005905B8 /* Configuration+BeforeEach.swift in Sources */, - CD564DA120B5B09D00C15E6B /* QuickSpec+QuickSpec_MethodList.m in Sources */, 479C31E41A36172700DA8718 /* ItTests+ObjC.m in Sources */, + CD582D752264C137008F7CE6 /* QuickSpecRunner.swift in Sources */, 34C586031C4ABD4000D4F057 /* XCTestCaseProvider.swift in Sources */, 8D010A581C11726F00633E2B /* DescribeTests.swift in Sources */, 47FAEA371A3F49EB005A1D2F /* BeforeEachTests+ObjC.m in Sources */, @@ -1600,11 +1629,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + CD582D742264C137008F7CE6 /* QuickSpecRunner.swift in Sources */, + CD1F6504226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */, DA07722E1A4E5B7B0098839D /* QCKSpecRunner.m in Sources */, 34C586021C4ABD3F00D4F057 /* XCTestCaseProvider.swift in Sources */, DA5663F41A4C8D9A00193C88 /* FocusedTests.swift in Sources */, DAF28BC31A4DB8EC00A5D9BF /* FocusedTests+ObjC.m in Sources */, - AE4E58141C73097A00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1612,11 +1642,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + CD582D762264C137008F7CE6 /* QuickSpecRunner.swift in Sources */, + CD1F6506226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */, DA07722F1A4E5B7C0098839D /* QCKSpecRunner.m in Sources */, 34C586041C4ABD4000D4F057 /* XCTestCaseProvider.swift in Sources */, DA9876C11A4C87200004AA17 /* FocusedTests.swift in Sources */, DAF28BC41A4DB8EC00A5D9BF /* FocusedTests+ObjC.m in Sources */, - AE4E58161C73097C00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1631,7 +1662,7 @@ DA02C91919A8073100093156 /* ExampleMetadata.swift in Sources */, CE57CEDF1C430BD200D63004 /* QuickTestSuite.swift in Sources */, 34C586081C4AC5E500D4F057 /* ErrorUtility.swift in Sources */, - DED3036B1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift in Sources */, + DED3036B1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift in Sources */, DA408BE619FF5599005DF92A /* SuiteHooks.swift in Sources */, 34F375B919515CA700CE1B99 /* QuickSpec.m in Sources */, CE57CEE11C430BD200D63004 /* XCTestSuite+QuickTestSuiteBuilder.m in Sources */, @@ -1647,6 +1678,7 @@ CE175D4E1E8D6B4900EB5E84 /* Behavior.swift in Sources */, 34F375AB19515CA700CE1B99 /* Example.swift in Sources */, DA3124E619FCAEE8002858A7 /* DSL.swift in Sources */, + CDE5BDFD2268CE95006E2F66 /* QuickConfiguration.swift in Sources */, DA6B30181A4DB0D500FFB148 /* Filter.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1657,6 +1689,7 @@ files = ( DAE714F719FF6812005905B8 /* Configuration+AfterEach.swift in Sources */, DAB067E919F7801C00F970AC /* BeforeEachTests.swift in Sources */, + 79FE27DF22DC955400BA013D /* QuickSpec_SelectedTests.swift in Sources */, DA8F919919F31680006F6675 /* QCKSpecRunner.m in Sources */, DA8940F01B35B1FA00161061 /* FailureUsingXCTAssertTests+ObjC.m in Sources */, 4728253B1A5EECCE008DC74F /* SharedExamplesTests+ObjC.m in Sources */, @@ -1665,6 +1698,8 @@ CE4A57921EA725300063C0D4 /* FunctionalTests_BehaviorTests_Behaviors.swift in Sources */, DED3037D1DF6CF140041394E /* BundleModuleNameTests.swift in Sources */, DA05D61019F73A3800771050 /* AfterEachTests.swift in Sources */, + CDB2A957226B714400C0F199 /* SubclassOfSubclassWithStructPropertyTests.swift in Sources */, + CD1F6503226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */, DAB0136F19FC4315006AFBEE /* SharedExamples+BeforeEachTests.swift in Sources */, DA8F91A519F3208B006F6675 /* BeforeSuiteTests.swift in Sources */, DA8C00211A01E4B900CE58A6 /* QuickConfigurationTests.m in Sources */, @@ -1674,13 +1709,13 @@ 4748E8941A6AEBB3009EC992 /* SharedExamples+BeforeEachTests+ObjC.m in Sources */, DA8F91AE19F32CE2006F6675 /* FunctionalTests_SharedExamplesTests_SharedExamples.swift in Sources */, DAE714FA19FF682A005905B8 /* Configuration+AfterEachTests.swift in Sources */, - AE4E58131C73097A00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */, AED9C8631CC8A7BD00432F62 /* CrossReferencingSpecs.swift in Sources */, 471590401A488F3F00FBA644 /* PendingTests+ObjC.m in Sources */, DA8F919D19F31921006F6675 /* FailureTests+ObjC.m in Sources */, + CD582D6F2264B371008F7CE6 /* QuickSpec+MethodList.swift in Sources */, DAE714F319FF65E7005905B8 /* Configuration+BeforeEach.swift in Sources */, - CD564DA020B5B09C00C15E6B /* QuickSpec+QuickSpec_MethodList.m in Sources */, 479C31E31A36171B00DA8718 /* ItTests+ObjC.m in Sources */, + CD582D732264C137008F7CE6 /* QuickSpecRunner.swift in Sources */, 34C586011C4ABD3F00D4F057 /* XCTestCaseProvider.swift in Sources */, 8D010A571C11726F00633E2B /* DescribeTests.swift in Sources */, 47FAEA361A3F49E6005A1D2F /* BeforeEachTests+ObjC.m in Sources */, @@ -1936,6 +1971,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickTests-Swift.h"; TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; @@ -1956,6 +1992,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; @@ -1978,6 +2015,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickFocusedTests-Swift.h"; TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; @@ -1998,6 +2036,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickFocusedTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; @@ -2026,7 +2065,6 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( "$(inherited)", "-Xlinker", @@ -2037,7 +2075,6 @@ PRODUCT_NAME = Quick; SDKROOT = iphoneos; SKIP_INSTALL = YES; - SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; TARGETED_DEVICE_FAMILY = "1,2"; TVOS_DEPLOYMENT_TARGET = 9.0; }; @@ -2071,7 +2108,6 @@ PRODUCT_NAME = Quick; SDKROOT = iphoneos; SKIP_INSTALL = YES; - SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; TVOS_DEPLOYMENT_TARGET = 9.0; @@ -2095,11 +2131,11 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = "io.quick.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -2116,11 +2152,11 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = NO; - ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = "io.quick.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; VALIDATE_PRODUCT = YES; }; @@ -2146,6 +2182,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "io.quick.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickAfterSuiteTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -2166,6 +2203,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "io.quick.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickAfterSuiteTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; @@ -2186,11 +2224,11 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = "io.quick.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickAfterSuiteTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -2207,11 +2245,11 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; - ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = "io.quick.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickAfterSuiteTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; VALIDATE_PRODUCT = YES; }; @@ -2233,6 +2271,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickAfterSuiteTests-Swift.h"; TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; @@ -2253,6 +2292,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickAfterSuiteTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; @@ -2293,6 +2333,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "io.quick.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickFocusedTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -2313,6 +2354,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "io.quick.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickFocusedTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; @@ -2333,11 +2375,11 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = "io.quick.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickFocusedTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -2354,11 +2396,11 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; - ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = "io.quick.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickFocusedTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; VALIDATE_PRODUCT = YES; }; @@ -2368,6 +2410,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -2429,6 +2472,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -2564,6 +2608,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "io.quick.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -2584,6 +2629,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "io.quick.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; diff --git a/Carthage/Checkouts/Quick/Quick.xcodeproj/xcshareddata/xcschemes/Quick-iOS.xcscheme b/Carthage/Checkouts/Quick/Quick.xcodeproj/xcshareddata/xcschemes/Quick-iOS.xcscheme index 584e319..278b377 100644 --- a/Carthage/Checkouts/Quick/Quick.xcodeproj/xcshareddata/xcschemes/Quick-iOS.xcscheme +++ b/Carthage/Checkouts/Quick/Quick.xcodeproj/xcshareddata/xcschemes/Quick-iOS.xcscheme @@ -1,6 +1,6 @@ { - public static var name: String { return String(describing: self) } /** - override this method in your behavior to define a set of reusable examples. + Override this variable if you want to provide custom name for this example group. + */ + open class var name: String { return String(describing: self) } + + /** + Override this method in your behavior to define a set of reusable examples. This behaves just like an example group defines using `describe` or `context`--it may contain any number of `beforeEach` and `afterEach` closures, as well as any number of examples (defined using `it`). diff --git a/Carthage/Checkouts/Quick/Sources/Quick/Callsite.swift b/Carthage/Checkouts/Quick/Sources/Quick/Callsite.swift index 951cf93..9250a17 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/Callsite.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/Callsite.swift @@ -1,12 +1,23 @@ import Foundation -#if canImport(Darwin) && !SWIFT_PACKAGE +#if canImport(Darwin) @objcMembers public class _CallsiteBase: NSObject {} #else public class _CallsiteBase: NSObject {} #endif +// Ideally we would always use `StaticString` as the type for tracking the file name +// in which an example is defined, for consistency with `assert` etc. from the +// stdlib, and because recent versions of the XCTest overlay require `StaticString` +// when calling `XCTFail`. Under the Objective-C runtime (i.e. building on macOS), we +// have to use `String` instead because StaticString can't be generated from Objective-C +#if SWIFT_PACKAGE +public typealias FileString = StaticString +#else +public typealias FileString = String +#endif + /** An object encapsulating the file and line number at which a particular example is defined. @@ -15,14 +26,14 @@ final public class Callsite: _CallsiteBase { /** The absolute path of the file in which an example is defined. */ - public let file: String + public let file: FileString /** The line number on which an example is defined. */ public let line: UInt - internal init(file: String, line: UInt) { + internal init(file: FileString, line: UInt) { self.file = file self.line = line } @@ -34,6 +45,6 @@ extension Callsite { If two callsites are in the same file and on the same line, they must be equal. */ @nonobjc public static func == (lhs: Callsite, rhs: Callsite) -> Bool { - return lhs.file == rhs.file && lhs.line == rhs.line + return String(describing: lhs.file) == String(describing: rhs.file) && lhs.line == rhs.line } } diff --git a/Carthage/Checkouts/Quick/Sources/Quick/Configuration/QuickConfiguration.swift b/Carthage/Checkouts/Quick/Sources/Quick/Configuration/QuickConfiguration.swift index 0874f64..661df2e 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/Configuration/QuickConfiguration.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/Configuration/QuickConfiguration.swift @@ -1,39 +1,78 @@ import Foundation import XCTest -// NOTE: This file is not intended to be included in the Xcode project or CocoaPods. -// It is picked up by the Swift Package Manager during its build process. - #if SWIFT_PACKAGE open class QuickConfiguration: NSObject { open class func configure(_ configuration: Configuration) {} } -#if canImport(Darwin) +#endif -internal func qck_enumerateSubclasses(_ klass: T.Type, block: (T.Type) -> Void) { - var classesCount = objc_getClassList(nil, 0) +extension QuickConfiguration { + #if !canImport(Darwin) + private static var configurationSubclasses: [QuickConfiguration.Type] = [] + #endif - guard classesCount > 0 else { - return + /// Finds all direct subclasses of QuickConfiguration and passes them to the block provided. + /// The classes are iterated over in the order that objc_getClassList returns them. + /// + /// - parameter block: A block that takes a QuickConfiguration.Type. + /// This block will be executed once for each subclass of QuickConfiguration. + private static func enumerateSubclasses(_ block: (QuickConfiguration.Type) -> Void) { + #if canImport(Darwin) + var classesCount = objc_getClassList(nil, 0) + + guard classesCount > 0 else { + return + } + + let classes = UnsafeMutablePointer.allocate(capacity: Int(classesCount)) + defer { free(classes) } + + classesCount = objc_getClassList(AutoreleasingUnsafeMutablePointer(classes), classesCount) + + var configurationSubclasses: [QuickConfiguration.Type] = [] + for i in 0...allocate(capacity: Int(classesCount)) - classesCount = objc_getClassList(AutoreleasingUnsafeMutablePointer(classes), classesCount) - - var subclass: AnyClass! - for i in 0.. Void) { +public func it(_ description: String, flags: FilterFlags = [:], file: FileString = #file, line: UInt = #line, closure: @escaping () -> Void) { World.sharedWorld.it(description, flags: flags, file: file, line: line, closure: closure) } @@ -143,7 +143,7 @@ public func it(_ description: String, flags: FilterFlags = [:], file: String = # - parameter file: The absolute path to the file containing the current example group. A sensible default is provided. - parameter line: The line containing the current example group. A sensible default is provided. */ -public func itBehavesLike(_ name: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line) { +public func itBehavesLike(_ name: String, flags: FilterFlags = [:], file: FileString = #file, line: UInt = #line) { itBehavesLike(name, flags: flags, file: file, line: line, sharedExampleContext: { return [:] }) } @@ -163,7 +163,7 @@ public func itBehavesLike(_ name: String, flags: FilterFlags = [:], file: String - parameter file: The absolute path to the file containing the current example group. A sensible default is provided. - parameter line: The line containing the current example group. A sensible default is provided. */ -public func itBehavesLike(_ name: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, sharedExampleContext: @escaping SharedExampleContext) { +public func itBehavesLike(_ name: String, flags: FilterFlags = [:], file: FileString = #file, line: UInt = #line, sharedExampleContext: @escaping SharedExampleContext) { World.sharedWorld.itBehavesLike(name, sharedExampleContext: sharedExampleContext, flags: flags, file: file, line: line) } @@ -179,7 +179,7 @@ public func itBehavesLike(_ name: String, flags: FilterFlags = [:], file: String - parameter file: The absolute path to the file containing the current example group. A sensible default is provided. - parameter line: The line containing the current example group. A sensible default is provided. */ -public func itBehavesLike(_ behavior: Behavior.Type, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, context: @escaping () -> C) { +public func itBehavesLike(_ behavior: Behavior.Type, flags: FilterFlags = [:], file: FileString = #file, line: UInt = #line, context: @escaping () -> C) { World.sharedWorld.itBehavesLike(behavior, context: context, flags: flags, file: file, line: line) } @@ -214,7 +214,7 @@ public func xcontext(_ description: String, flags: FilterFlags, closure: () -> V Use this to quickly mark an `it` closure as pending. This disables the example and ensures the code within the closure is never run. */ -public func xit(_ description: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, closure: @escaping () -> Void) { +public func xit(_ description: String, flags: FilterFlags = [:], file: FileString = #file, line: UInt = #line, closure: @escaping () -> Void) { World.sharedWorld.xit(description, flags: flags, file: file, line: line, closure: closure) } @@ -222,7 +222,7 @@ public func xit(_ description: String, flags: FilterFlags = [:], file: String = Use this to quicklu mark an `itBehavesLike` closure as pending. This disables the example group defined by this behavior and ensures the code within is never run. */ -public func xitBehavesLike(_ behavior: Behavior.Type, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, context: @escaping () -> C) { +public func xitBehavesLike(_ behavior: Behavior.Type, flags: FilterFlags = [:], file: FileString = #file, line: UInt = #line, context: @escaping () -> C) { World.sharedWorld.xitBehavesLike(behavior, context: context, flags: flags, file: file, line: line) } /** @@ -245,27 +245,27 @@ public func fcontext(_ description: String, flags: FilterFlags = [:], closure: ( Use this to quickly focus an `it` closure, focusing the example. If any examples in the test suite are focused, only those examples are executed. */ -public func fit(_ description: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, closure: @escaping () -> Void) { +public func fit(_ description: String, flags: FilterFlags = [:], file: FileString = #file, line: UInt = #line, closure: @escaping () -> Void) { World.sharedWorld.fit(description, flags: flags, file: file, line: line, closure: closure) } /** Use this to quickly focus an `itBehavesLike` closure. */ -public func fitBehavesLike(_ name: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line) { +public func fitBehavesLike(_ name: String, flags: FilterFlags = [:], file: FileString = #file, line: UInt = #line) { fitBehavesLike(name, flags: flags, file: file, line: line, sharedExampleContext: { return [:] }) } /** Use this to quickly focus an `itBehavesLike` closure. */ -public func fitBehavesLike(_ name: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, sharedExampleContext: @escaping SharedExampleContext) { +public func fitBehavesLike(_ name: String, flags: FilterFlags = [:], file: FileString = #file, line: UInt = #line, sharedExampleContext: @escaping SharedExampleContext) { World.sharedWorld.fitBehavesLike(name, sharedExampleContext: sharedExampleContext, flags: flags, file: file, line: line) } /** Use this to quickly focus on `itBehavesLike` closure. */ -public func fitBehavesLike(_ behavior: Behavior.Type, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, context: @escaping () -> C) { +public func fitBehavesLike(_ behavior: Behavior.Type, flags: FilterFlags = [:], file: FileString = #file, line: UInt = #line, context: @escaping () -> C) { World.sharedWorld.fitBehavesLike(behavior, context: context, flags: flags, file: file, line: line) } diff --git a/Carthage/Checkouts/Quick/Sources/Quick/DSL/World+DSL.swift b/Carthage/Checkouts/Quick/Sources/Quick/DSL/World+DSL.swift index 14a46d6..14dcdbf 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/DSL/World+DSL.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/DSL/World+DSL.swift @@ -56,7 +56,7 @@ extension World { currentExampleGroup.hooks.appendBefore(closure) } -#if canImport(Darwin) && !SWIFT_PACKAGE +#if canImport(Darwin) @objc(beforeEachWithMetadata:) internal func beforeEach(closure: @escaping BeforeExampleWithMetadataClosure) { currentExampleGroup.hooks.appendBefore(closure) @@ -74,7 +74,7 @@ extension World { currentExampleGroup.hooks.appendAfter(closure) } -#if canImport(Darwin) && !SWIFT_PACKAGE +#if canImport(Darwin) @objc(afterEachWithMetadata:) internal func afterEach(closure: @escaping AfterExampleWithMetadataClosure) { currentExampleGroup.hooks.appendAfter(closure) @@ -86,7 +86,7 @@ extension World { #endif @nonobjc - internal func it(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { + internal func it(_ description: String, flags: FilterFlags, file: FileString, line: UInt, closure: @escaping () -> Void) { if beforesCurrentlyExecuting { raiseError("'it' cannot be used inside 'beforeEach', 'it' may only be used inside 'context' or 'describe'. ") } @@ -102,21 +102,21 @@ extension World { } @nonobjc - internal func fit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { + internal func fit(_ description: String, flags: FilterFlags, file: FileString, line: UInt, closure: @escaping () -> Void) { var focusedFlags = flags focusedFlags[Filter.focused] = true self.it(description, flags: focusedFlags, file: file, line: line, closure: closure) } @nonobjc - internal func xit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { + internal func xit(_ description: String, flags: FilterFlags, file: FileString, line: UInt, closure: @escaping () -> Void) { var pendingFlags = flags pendingFlags[Filter.pending] = true self.it(description, flags: pendingFlags, file: file, line: line, closure: closure) } @nonobjc - internal func itBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, flags: FilterFlags, file: String, line: UInt) { + internal func itBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, flags: FilterFlags, file: FileString, line: UInt) { guard currentExampleMetadata == nil else { raiseError("'itBehavesLike' cannot be used inside '\(currentPhase)', 'itBehavesLike' may only be used inside 'context' or 'describe'. ") } @@ -136,13 +136,13 @@ extension World { } @nonobjc - internal func fitBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, flags: FilterFlags, file: String, line: UInt) { + internal func fitBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, flags: FilterFlags, file: FileString, line: UInt) { var focusedFlags = flags focusedFlags[Filter.focused] = true self.itBehavesLike(name, sharedExampleContext: sharedExampleContext, flags: focusedFlags, file: file, line: line) } - internal func itBehavesLike(_ behavior: Behavior.Type, context: @escaping () -> C, flags: FilterFlags, file: String, line: UInt) { + internal func itBehavesLike(_ behavior: Behavior.Type, context: @escaping () -> C, flags: FilterFlags, file: FileString, line: UInt) { guard currentExampleMetadata == nil else { raiseError("'itBehavesLike' cannot be used inside '\(currentPhase)', 'itBehavesLike' may only be used inside 'context' or 'describe'. ") } @@ -160,13 +160,13 @@ extension World { } } - internal func fitBehavesLike(_ behavior: Behavior.Type, context: @escaping () -> C, flags: FilterFlags, file: String, line: UInt) { + internal func fitBehavesLike(_ behavior: Behavior.Type, context: @escaping () -> C, flags: FilterFlags, file: FileString, line: UInt) { var focusedFlags = flags focusedFlags[Filter.focused] = true self.itBehavesLike(behavior, context: context, flags: focusedFlags, file: file, line: line) } - internal func xitBehavesLike(_ behavior: Behavior.Type, context: @escaping () -> C, flags: FilterFlags, file: String, line: UInt) { + internal func xitBehavesLike(_ behavior: Behavior.Type, context: @escaping () -> C, flags: FilterFlags, file: FileString, line: UInt) { var pendingFlags = flags pendingFlags[Filter.pending] = true self.itBehavesLike(behavior, context: context, flags: pendingFlags, file: file, line: line) @@ -174,22 +174,22 @@ extension World { #if canImport(Darwin) && !SWIFT_PACKAGE @objc(itWithDescription:flags:file:line:closure:) - internal func objc_it(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { + internal func objc_it(_ description: String, flags: FilterFlags, file: FileString, line: UInt, closure: @escaping () -> Void) { it(description, flags: flags, file: file, line: line, closure: closure) } @objc(fitWithDescription:flags:file:line:closure:) - internal func objc_fit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { + internal func objc_fit(_ description: String, flags: FilterFlags, file: FileString, line: UInt, closure: @escaping () -> Void) { fit(description, flags: flags, file: file, line: line, closure: closure) } @objc(xitWithDescription:flags:file:line:closure:) - internal func objc_xit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { + internal func objc_xit(_ description: String, flags: FilterFlags, file: FileString, line: UInt, closure: @escaping () -> Void) { xit(description, flags: flags, file: file, line: line, closure: closure) } @objc(itBehavesLikeSharedExampleNamed:sharedExampleContext:flags:file:line:) - internal func objc_itBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, flags: FilterFlags, file: String, line: UInt) { + internal func objc_itBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, flags: FilterFlags, file: FileString, line: UInt) { itBehavesLike(name, sharedExampleContext: sharedExampleContext, flags: flags, file: file, line: line) } #endif diff --git a/Carthage/Checkouts/Quick/Sources/Quick/Example.swift b/Carthage/Checkouts/Quick/Sources/Quick/Example.swift index 594efa0..036aa3a 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/Example.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/Example.swift @@ -1,9 +1,6 @@ import Foundation -private var numberOfExamplesRun = 0 -private var numberOfIncludedExamples = 0 - -#if canImport(Darwin) && !SWIFT_PACKAGE +#if canImport(Darwin) @objcMembers public class _ExampleBase: NSObject {} #else @@ -65,15 +62,11 @@ final public class Example: _ExampleBase { public func run() { let world = World.sharedWorld - if numberOfIncludedExamples == 0 { - numberOfIncludedExamples = world.includedExampleCount - } - - if numberOfExamplesRun == 0 { + if world.numberOfExamplesRun == 0 { world.suiteHooks.executeBefores() } - let exampleMetadata = ExampleMetadata(example: self, exampleIndex: numberOfExamplesRun) + let exampleMetadata = ExampleMetadata(example: self, exampleIndex: world.numberOfExamplesRun) world.currentExampleMetadata = exampleMetadata defer { world.currentExampleMetadata = nil @@ -95,9 +88,9 @@ final public class Example: _ExampleBase { group!.phase = .aftersFinished world.exampleHooks.executeAfters(exampleMetadata) - numberOfExamplesRun += 1 + world.numberOfExamplesRun += 1 - if !world.isRunningAdditionalSuites && numberOfExamplesRun >= numberOfIncludedExamples { + if !world.isRunningAdditionalSuites && world.numberOfExamplesRun >= world.cachedIncludedExampleCount { world.suiteHooks.executeAfters() } } diff --git a/Carthage/Checkouts/Quick/Sources/Quick/ExampleGroup.swift b/Carthage/Checkouts/Quick/Sources/Quick/ExampleGroup.swift index 129bed0..5fbfadb 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/ExampleGroup.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/ExampleGroup.swift @@ -31,9 +31,16 @@ final public class ExampleGroup: NSObject { Returns a list of examples that belong to this example group, or to any of its descendant example groups. */ + #if canImport(Darwin) + @objc public var examples: [Example] { return childExamples + childGroups.flatMap { $0.examples } } + #else + public var examples: [Example] { + return childExamples + childGroups.flatMap { $0.examples } + } + #endif internal var name: String? { guard let parent = parent else { diff --git a/Carthage/Checkouts/Quick/Sources/Quick/ExampleMetadata.swift b/Carthage/Checkouts/Quick/Sources/Quick/ExampleMetadata.swift index b07b3bd..2cdd10f 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/ExampleMetadata.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/ExampleMetadata.swift @@ -1,6 +1,6 @@ import Foundation -#if canImport(Darwin) && !SWIFT_PACKAGE +#if canImport(Darwin) @objcMembers public class _ExampleMetadataBase: NSObject {} #else diff --git a/Carthage/Checkouts/Quick/Sources/Quick/Filter.swift b/Carthage/Checkouts/Quick/Sources/Quick/Filter.swift index 304f6ec..3382d38 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/Filter.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/Filter.swift @@ -1,6 +1,6 @@ import Foundation -#if canImport(Darwin) && !SWIFT_PACKAGE +#if canImport(Darwin) @objcMembers public class _FilterBase: NSObject {} #else diff --git a/Carthage/Checkouts/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift b/Carthage/Checkouts/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift index ed0cf8e..f5596cc 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift @@ -17,7 +17,7 @@ extension Bundle { Module name has to be a valid "C99 extended identifier". */ internal var moduleName: String { - let fileName = bundleURL.fileName as NSString + let fileName = bundleURL.fileName return fileName.c99ExtendedIdentifier } } diff --git a/Carthage/Checkouts/Quick/Sources/Quick/QuickMain.swift b/Carthage/Checkouts/Quick/Sources/Quick/QuickMain.swift index 63e099f..accd5bf 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/QuickMain.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/QuickMain.swift @@ -22,15 +22,8 @@ import XCTest public func QCKMain(_ specs: [QuickSpec.Type], configurations: [QuickConfiguration.Type] = [], testCases: [XCTestCaseEntry] = []) -> Never { - let world = World.sharedWorld - // Perform all configurations (ensures that shared examples have been discovered) - world.configure { configuration in - for configurationClass in configurations { - configurationClass.configure(configuration) - } - } - world.finalizeConfiguration() + QuickConfiguration.configureSubclassesIfNeeded(configurations, world: World.sharedWorld) XCTMain(specs.compactMap { testCase($0.allTests) } + testCases) } diff --git a/Carthage/Checkouts/Quick/Sources/Quick/QuickSpec.swift b/Carthage/Checkouts/Quick/Sources/Quick/QuickSpec.swift index 62e50d4..b4be76e 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/QuickSpec.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/QuickSpec.swift @@ -5,7 +5,7 @@ import XCTest #if SWIFT_PACKAGE -#if canImport(Darwin) +#if canImport(QuickSpecBase) import QuickSpecBase public typealias QuickSpecBase = _QuickSpecBase @@ -14,6 +14,16 @@ public typealias QuickSpecBase = XCTestCase #endif open class QuickSpec: QuickSpecBase { + /// Returns the currently executing spec. Use in specs that require XCTestCase + /// methods, e.g. expectation(description:). + public private(set) static var current: QuickSpec! + + private var example: Example? { + didSet { + QuickSpec.current = self + } + } + open func spec() {} #if !canImport(Darwin) @@ -38,46 +48,33 @@ open class QuickSpec: QuickSpecBase { /// discovered powered by Objective-C runtime), so we needed the alternative /// way. override open class var defaultTestSuite: XCTestSuite { - configureDefaultTestSuite() + QuickConfiguration.configureSubclassesIfNeeded(world: World.sharedWorld) + + // Let's gather examples for each spec classes. This has the same effect + // as listing spec classes in `LinuxMain.swift` on Linux. + gatherExamplesIfNeeded() return super.defaultTestSuite } - private static func configureDefaultTestSuite() { - let world = World.sharedWorld - - if !world.isConfigurationFinalized { - // Perform all configurations (ensures that shared examples have been discovered) - world.configure { configuration in - qck_enumerateSubclasses(QuickConfiguration.self) { configurationClass in - configurationClass.configure(configuration) - } - } - world.finalizeConfiguration() - } - - // Let's gather examples for each spec classes. This has the same effect - // as listing spec classes in `LinuxMain.swift` on Linux. - _ = allTests - } - - override open class func _qck_testMethodSelectors() -> [_QuickSelectorWrapper] { - let examples = World.sharedWorld.examples(self) + override open class func _qck_testMethodSelectors() -> [String] { + let examples = World.sharedWorld.examples(forSpecClass: self) var selectorNames = Set() return examples.map { example in let selector = addInstanceMethod(for: example, classSelectorNames: &selectorNames) - return _QuickSelectorWrapper(selector: selector) + return NSStringFromSelector(selector) } } private static func addInstanceMethod(for example: Example, classSelectorNames selectorNames : inout Set) -> Selector { - let block: @convention(block) (QuickSpec) -> Void = { _ in + let block: @convention(block) (QuickSpec) -> Void = { spec in + spec.example = example example.run() } let implementation = imp_implementationWithBlock(block as Any) - let originalName = example.name + let originalName = example.name.c99ExtendedIdentifier var selectorName = originalName var i: UInt = 2 @@ -95,30 +92,32 @@ open class QuickSpec: QuickSpecBase { } #endif - static var allTestsCache = [String: [(String, (XCTestCase) -> () throws -> Void)]]() - - public class var allTests: [(String, (XCTestCase) -> () throws -> Void)] { - if let cached = allTestsCache[String(describing: self)] { - return cached - } - +#if !canImport(Darwin) + public class var allTests: [(String, (QuickSpec) -> () throws -> Void)] { gatherExamplesIfNeeded() - let examples = World.sharedWorld.examples(self) - let result = examples.map { example -> (String, (XCTestCase) -> () throws -> Void) in - return (example.name, { _ in { example.run() } }) + let examples = World.sharedWorld.examples(forSpecClass: self) + let result = examples.map { example -> (String, (QuickSpec) -> () throws -> Void) in + return (example.name, { spec in + return { + spec.example = example + example.run() + } + }) } - allTestsCache[String(describing: self)] = result return result } +#endif internal static func gatherExamplesIfNeeded() { let world = World.sharedWorld - let rootExampleGroup = world.rootExampleGroupForSpecClass(self) - if rootExampleGroup.examples.isEmpty { - world.currentExampleGroup = rootExampleGroup + let rootExampleGroup = world.rootExampleGroup(forSpecClass: self) + guard rootExampleGroup.examples.isEmpty else { + return + } + + world.performWithCurrentExampleGroup(rootExampleGroup) { self.init().spec() - world.currentExampleGroup = nil } } } diff --git a/Carthage/Checkouts/Quick/Sources/Quick/String+C99ExtendedIdentifier.swift b/Carthage/Checkouts/Quick/Sources/Quick/String+C99ExtendedIdentifier.swift new file mode 100644 index 0000000..2dcd606 --- /dev/null +++ b/Carthage/Checkouts/Quick/Sources/Quick/String+C99ExtendedIdentifier.swift @@ -0,0 +1,46 @@ +#if canImport(Darwin) +import Foundation + +extension String { + private static var invalidCharacters: CharacterSet = { + var invalidCharacters = CharacterSet() + + let invalidCharacterSets: [CharacterSet] = [ + .whitespacesAndNewlines, + .illegalCharacters, + .controlCharacters, + .punctuationCharacters, + .nonBaseCharacters, + .symbols + ] + + for invalidSet in invalidCharacterSets { + invalidCharacters.formUnion(invalidSet) + } + + return invalidCharacters + }() + + internal var c99ExtendedIdentifier: String { + let validComponents = components(separatedBy: String.invalidCharacters) + let result = validComponents.joined(separator: "_") + + return result.isEmpty ? "_" : result + } +} + +/// Extension methods or properties for NSObject subclasses are invisible from +/// the Objective-C runtime on static linking unless the consumers add `-ObjC` +/// linker flag, so let's make a wrapper class to mitigate that situation. +/// +/// See: https://github.com/Quick/Quick/issues/785 and https://github.com/Quick/Quick/pull/803 +@objc +class QCKObjCStringUtils: NSObject { + override private init() {} + + @objc + static func c99ExtendedIdentifier(from string: String) -> String { + return string.c99ExtendedIdentifier + } +} +#endif diff --git a/Carthage/Checkouts/Quick/Sources/Quick/World.swift b/Carthage/Checkouts/Quick/Sources/Quick/World.swift index e652871..86990ac 100644 --- a/Carthage/Checkouts/Quick/Sources/Quick/World.swift +++ b/Carthage/Checkouts/Quick/Sources/Quick/World.swift @@ -12,7 +12,7 @@ public typealias SharedExampleContext = () -> [String: Any] */ public typealias SharedExampleClosure = (@escaping SharedExampleContext) -> Void -#if canImport(Darwin) && !SWIFT_PACKAGE +#if canImport(Darwin) @objcMembers internal class _WorldBase: NSObject {} #else @@ -46,6 +46,8 @@ final internal class World: _WorldBase { internal var currentExampleMetadata: ExampleMetadata? + internal var numberOfExamplesRun = 0 + /** A flag that indicates whether additional test suites are being run within this test suite. This is only true within the context of Quick @@ -72,7 +74,16 @@ final internal class World: _WorldBase { private override init() {} - static let sharedWorld = World() + static private(set) var sharedWorld = World() + + static func anotherWorld(block: (World) -> T) -> T { + let previous = sharedWorld + defer { sharedWorld = previous } + + let newWorld = World() + sharedWorld = newWorld + return block(newWorld) + } // MARK: Public Interface @@ -113,11 +124,11 @@ final internal class World: _WorldBase { it("is at the top level") {} } - - parameter cls: The QuickSpec class for which to retrieve the root example group. + - parameter specClass: The QuickSpec class for which to retrieve the root example group. - returns: The root example group for the class. */ - internal func rootExampleGroupForSpecClass(_ cls: AnyClass) -> ExampleGroup { - let name = String(describing: cls) + internal func rootExampleGroup(forSpecClass specClass: QuickSpec.Type) -> ExampleGroup { + let name = String(describing: specClass) if let group = specs[name] { return group @@ -141,24 +152,17 @@ final internal class World: _WorldBase { - parameter specClass: The QuickSpec subclass for which examples are to be returned. - returns: A list of examples to be run as test invocations. */ - internal func examples(_ specClass: AnyClass) -> [Example] { + internal func examples(forSpecClass specClass: QuickSpec.Type) -> [Example] { // 1. Grab all included examples. let included = includedExamples // 2. Grab the intersection of (a) examples for this spec, and (b) included examples. - let spec = rootExampleGroupForSpecClass(specClass).examples.filter { included.contains($0) } + let spec = rootExampleGroup(forSpecClass: specClass).examples.filter { included.contains($0) } // 3. Remove all excluded examples. return spec.filter { example in - !self.configuration.exclusionFilters.reduce(false) { $0 || $1(example) } + !self.configuration.exclusionFilters.contains { $0(example) } } } -#if canImport(Darwin) - @objc(examplesForSpecClass:) - internal func objc_examples(_ specClass: AnyClass) -> [Example] { - return examples(specClass) - } -#endif - // MARK: Internal internal func registerSharedExample(_ name: String, closure: @escaping SharedExampleClosure) { @@ -175,6 +179,8 @@ final internal class World: _WorldBase { return includedExamples.count } + internal lazy var cachedIncludedExampleCount: Int = self.includedExampleCount + internal var beforesCurrentlyExecuting: Bool { let suiteBeforesExecuting = suiteHooks.phase == .beforesExecuting let exampleBeforesExecuting = exampleHooks.phase == .beforesExecuting @@ -217,7 +223,7 @@ final internal class World: _WorldBase { private var includedExamples: [Example] { let all = allExamples let included = all.filter { example in - return self.configuration.inclusionFilters.reduce(false) { $0 || $1(example) } + return self.configuration.inclusionFilters.contains { $0(example) } } if included.isEmpty && configuration.runAllWhenEverythingFiltered { diff --git a/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.m b/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.m index 17beaa7..a51a8bd 100644 --- a/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.m +++ b/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.m @@ -7,36 +7,6 @@ #import #endif -typedef void (^QCKClassEnumerationBlock)(Class klass); - -/** - Finds all direct subclasses of the given class and passes them to the block provided. - The classes are iterated over in the order that objc_getClassList returns them. - - @param klass The base class to find subclasses of. - @param block A block that takes a Class. This block will be executed once for each subclass of klass. - */ -void qck_enumerateSubclasses(Class klass, QCKClassEnumerationBlock block) { - Class *classes = NULL; - int classesCount = objc_getClassList(NULL, 0); - - if (classesCount > 0) { - classes = (Class *)calloc(sizeof(Class), classesCount); - classesCount = objc_getClassList(classes, classesCount); - - Class subclass, superclass; - for(int i = 0; i < classesCount; i++) { - subclass = classes[i]; - superclass = class_getSuperclass(subclass); - if (superclass == klass && block) { - block(subclass); - } - } - - free(classes); - } -} - @implementation QuickConfiguration #pragma mark - Object Lifecycle @@ -65,19 +35,8 @@ void qck_enumerateSubclasses(Class klass, QCKClassEnumerationBlock block) { + (void)initialize { // Only enumerate over the subclasses of QuickConfiguration, not any of its subclasses. if ([self class] == [QuickConfiguration class]) { - - // Only enumerate over subclasses once, even if +[QuickConfiguration initialize] - // were to be called several times. This is necessary because +[QuickSpec initialize] - // manually calls +[QuickConfiguration initialize]. - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - qck_enumerateSubclasses([QuickConfiguration class], ^(__unsafe_unretained Class klass) { - [[World sharedWorld] configure:^(Configuration *configuration) { - [klass configure:configuration]; - }]; - }); - [[World sharedWorld] finalizeConfiguration]; - }); + World *world = [World sharedWorld]; + [self configureSubclassesIfNeededWithWorld:world]; } } diff --git a/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/QuickSpec.h b/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/QuickSpec.h index 21bc772..ccf006e 100644 --- a/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/QuickSpec.h +++ b/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/QuickSpec.h @@ -49,7 +49,7 @@ /** Returns the currently executing spec. Use in specs that require XCTestCase - methds, e.g. expectationWithDescription. + methods, e.g. expectationWithDescription. */ @property (class, nonatomic, readonly) QuickSpec *current; diff --git a/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/QuickSpec.m b/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/QuickSpec.m index ed70d35..3e817c7 100644 --- a/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/QuickSpec.m +++ b/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/QuickSpec.m @@ -18,36 +18,23 @@ static QuickSpec *currentSpec = nil; #pragma mark - XCTestCase Overrides /** - The runtime sends initialize to each class in a program just before the class, or any class - that inherits from it, is sent its first message from within the program. QuickSpec hooks into - this event to compile the example groups for this spec subclass. + QuickSpec hooks into this event to compile the example groups for this spec subclass. If an exception occurs when compiling the examples, report it to the user. Chances are they included an expectation outside of a "it", "describe", or "context" block. */ -+ (void)initialize { - [QuickConfiguration initialize]; ++ (XCTestSuite *)defaultTestSuite { + [self buildExamplesIfNeeded]; - World *world = [World sharedWorld]; - [world performWithCurrentExampleGroup:[world rootExampleGroupForSpecClass:self] closure:^{ - QuickSpec *spec = [self new]; + // Add instance methods for this class' examples. + NSArray *examples = [[World sharedWorld] examplesForSpecClass:[self class]]; + NSMutableSet *selectorNames = [NSMutableSet set]; - @try { - [spec spec]; - } - @catch (NSException *exception) { - [NSException raise:NSInternalInconsistencyException - format:@"An exception occurred when building Quick's example groups.\n" - @"Some possible reasons this might happen include:\n\n" - @"- An 'expect(...).to' expectation was evaluated outside of " - @"an 'it', 'context', or 'describe' block\n" - @"- 'sharedExamples' was called twice with the same name\n" - @"- 'itBehavesLike' was called with a name that is not registered as a shared example\n\n" - @"Here's the original exception: '%@', reason: '%@', userInfo: '%@'", - exception.name, exception.reason, exception.userInfo]; - } - [self testInvocations]; - }]; + for (Example *example in examples) { + [self addInstanceMethodForExample:example classSelectorNames:selectorNames]; + } + + return [super defaultTestSuite]; } /** @@ -57,6 +44,8 @@ static QuickSpec *currentSpec = nil; @return An array of invocations that execute the newly defined example methods. */ + (NSArray *)testInvocations { + [self buildExamplesIfNeeded]; + NSArray *examples = [[World sharedWorld] examplesForSpecClass:[self class]]; NSMutableArray *invocations = [NSMutableArray arrayWithCapacity:[examples count]]; @@ -85,6 +74,43 @@ static QuickSpec *currentSpec = nil; #pragma mark - Internal Methods +/** + Runs the `spec` method and builds the examples for this class. + + It's safe to call this method multiple times. If the examples for the class have been built, invocation + of this method has no effect. + */ ++ (void)buildExamplesIfNeeded { + [QuickConfiguration class]; + World *world = [World sharedWorld]; + + ExampleGroup *rootExampleGroup = [world rootExampleGroupForSpecClass:self]; + + if ([rootExampleGroup examples].count > 0) { + // The examples fot this subclass have been already built. Skipping. + return; + } + + [world performWithCurrentExampleGroup:rootExampleGroup closure:^{ + QuickSpec *spec = [self new]; + + @try { + [spec spec]; + } + @catch (NSException *exception) { + [NSException raise:NSInternalInconsistencyException + format:@"An exception occurred when building Quick's example groups.\n" + @"Some possible reasons this might happen include:\n\n" + @"- An 'expect(...).to' expectation was evaluated outside of " + @"an 'it', 'context', or 'describe' block\n" + @"- 'sharedExamples' was called twice with the same name\n" + @"- 'itBehavesLike' was called with a name that is not registered as a shared example\n\n" + @"Here's the original exception: '%@', reason: '%@', userInfo: '%@'", + exception.name, exception.reason, exception.userInfo]; + } + }]; +} + /** QuickSpec uses this method to dynamically define a new instance method for the given example. The instance method runs the example, catching any exceptions. diff --git a/Carthage/Checkouts/Quick/Sources/QuickSpecBase/QuickSpecBase.m b/Carthage/Checkouts/Quick/Sources/QuickSpecBase/QuickSpecBase.m index 10b6f7e..e452e65 100644 --- a/Carthage/Checkouts/Quick/Sources/QuickSpecBase/QuickSpecBase.m +++ b/Carthage/Checkouts/Quick/Sources/QuickSpecBase/QuickSpecBase.m @@ -1,22 +1,5 @@ #import "QuickSpecBase.h" -#pragma mark - _QuickSelectorWrapper - -@interface _QuickSelectorWrapper () -@property(nonatomic, assign) SEL selector; -@end - -@implementation _QuickSelectorWrapper - -- (instancetype)initWithSelector:(SEL)selector { - self = [super init]; - _selector = selector; - return self; -} - -@end - - #pragma mark - _QuickSpecBase @implementation _QuickSpecBase @@ -33,11 +16,11 @@ @return An array of invocations that execute the newly defined example methods. */ + (NSArray *)testInvocations { - NSArray<_QuickSelectorWrapper *> *wrappers = [self _qck_testMethodSelectors]; - NSMutableArray *invocations = [NSMutableArray arrayWithCapacity:wrappers.count]; + NSArray *selectors = [self _qck_testMethodSelectors]; + NSMutableArray *invocations = [NSMutableArray arrayWithCapacity:selectors.count]; - for (_QuickSelectorWrapper *wrapper in wrappers) { - SEL selector = wrapper.selector; + for (NSString *selectorString in selectors) { + SEL selector = NSSelectorFromString(selectorString); NSMethodSignature *signature = [self instanceMethodSignatureForSelector:selector]; NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; invocation.selector = selector; @@ -48,7 +31,7 @@ return invocations; } -+ (NSArray<_QuickSelectorWrapper *> *)_qck_testMethodSelectors { ++ (NSArray *)_qck_testMethodSelectors { return @[]; } diff --git a/Carthage/Checkouts/Quick/Sources/QuickSpecBase/include/QuickSpecBase.h b/Carthage/Checkouts/Quick/Sources/QuickSpecBase/include/QuickSpecBase.h index 8881ca0..2ee00e7 100644 --- a/Carthage/Checkouts/Quick/Sources/QuickSpecBase/include/QuickSpecBase.h +++ b/Carthage/Checkouts/Quick/Sources/QuickSpecBase/include/QuickSpecBase.h @@ -1,11 +1,7 @@ #import #import -@interface _QuickSelectorWrapper : NSObject -- (instancetype)initWithSelector:(SEL)selector; -@end - @interface _QuickSpecBase : XCTestCase -+ (NSArray<_QuickSelectorWrapper *> *)_qck_testMethodSelectors; ++ (NSArray *)_qck_testMethodSelectors; - (instancetype)init NS_DESIGNATED_INITIALIZER; @end diff --git a/Carthage/Checkouts/Quick/Tests/LinuxMain.swift b/Carthage/Checkouts/Quick/Tests/LinuxMain.swift index 2a67c4a..0602812 100644 --- a/Carthage/Checkouts/Quick/Tests/LinuxMain.swift +++ b/Carthage/Checkouts/Quick/Tests/LinuxMain.swift @@ -4,42 +4,45 @@ import Quick @testable import QuickTests Quick.QCKMain([ - FunctionalTests_AfterEachSpec.self, AfterSuiteTests.self, + Configuration_AfterEachSpec.self, + Configuration_BeforeEachSpec.self, + CurrentSpecTests.self, + FunctionalTests_AfterEachSpec.self, FunctionalTests_BeforeEachSpec.self, FunctionalTests_BeforeSuite_BeforeSuiteSpec.self, FunctionalTests_BeforeSuite_Spec.self, FunctionalTests_ItSpec.self, FunctionalTests_PendingSpec.self, - FunctionalTests_SharedExamples_BeforeEachSpec.self, - FunctionalTests_SharedExamples_Spec.self, - FunctionalTests_SharedExamples_ContextSpec.self, - Configuration_AfterEachSpec.self, - Configuration_BeforeEachSpec.self, FunctionalTests_CrossReferencingSpecA.self, FunctionalTests_CrossReferencingSpecB.self, + FunctionalTests_SharedExamples_BeforeEachSpec.self, + FunctionalTests_SharedExamples_ContextSpec.self, + FunctionalTests_SharedExamples_Spec.self, + FunctionalTests_SubclassSpec.self, + FunctionalTests_SubclassOfSubclassWithStructPropertySpec.self, _FunctionalTests_FocusedSpec_Focused.self, _FunctionalTests_FocusedSpec_Unfocused.self ], configurations: [ - FunctionalTests_SharedExamples_BeforeEachTests_SharedExamples.self, - FunctionalTests_SharedExamplesTests_SharedExamples.self, FunctionalTests_Configuration_AfterEach.self, FunctionalTests_Configuration_BeforeEach.self, - FunctionalTests_FocusedSpec_SharedExamplesConfiguration.self + FunctionalTests_FocusedSpec_SharedExamplesConfiguration.self, + FunctionalTests_SharedExamples_BeforeEachTests_SharedExamples.self, + FunctionalTests_SharedExamplesTests_SharedExamples.self ], testCases: [ testCase(AfterEachTests.allTests), testCase(BeforeEachTests.allTests), testCase(BeforeSuiteTests.allTests), + testCase(Configuration_AfterEachTests.allTests), + testCase(Configuration_BeforeEachTests.allTests), // testCase(DescribeTests.allTests), + testCase(FocusedTests.allTests), + testCase(FunctionalTests_CrossReferencingSpecA.allTests), + testCase(FunctionalTests_CrossReferencingSpecB.allTests), testCase(ItTests.allTests), testCase(PendingTests.allTests), testCase(SharedExamples_BeforeEachTests.allTests), - testCase(SharedExamplesTests.allTests), - testCase(Configuration_AfterEachTests.allTests), - testCase(Configuration_BeforeEachTests.allTests), - testCase(FocusedTests.allTests), - testCase(FunctionalTests_CrossReferencingSpecA.allTests), - testCase(FunctionalTests_CrossReferencingSpecB.allTests) + testCase(SharedExamplesTests.allTests) ]) diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickFocusedTests/FocusedTests.swift b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickFocusedTests/FocusedTests.swift index 132b748..e15252f 100644 --- a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickFocusedTests/FocusedTests.swift +++ b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickFocusedTests/FocusedTests.swift @@ -48,6 +48,10 @@ class _FunctionalTests_FocusedSpec_Unfocused: QuickSpec { beforeEach { assert(false) } it("has an example that fails, but is never run") { fail() } } + + sharedExamples("empty shared example") { _ in + // https://github.com/Quick/Quick/pull/901#issuecomment-530816224 + } } } diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/XCTestCaseProvider.swift b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/XCTestCaseProvider.swift index 05b0196..782f457 100644 --- a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/XCTestCaseProvider.swift +++ b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/XCTestCaseProvider.swift @@ -10,19 +10,19 @@ import XCTest // Implementation note: This is broken down into two separate protocols because we need a // protocol with no Self references to which we can cast XCTestCase instances in a non-generic context. -public protocol XCTestCaseProviderStatic { +protocol XCTestCaseProviderStatic { // This should be explicitly implemented by XCTestCase subclasses static var allTests: [(String, (Self) -> () throws -> Void)] { get } } -public protocol XCTestCaseNameProvider { +protocol XCTestCaseNameProvider { // This does not need to be explicitly implemented because of the protocol extension below var allTestNames: [String] { get } } -public protocol XCTestCaseProvider: XCTestCaseProviderStatic, XCTestCaseNameProvider {} +protocol XCTestCaseProvider: XCTestCaseProviderStatic, XCTestCaseNameProvider {} -public extension XCTestCaseProvider where Self: XCTestCaseProviderStatic { +extension XCTestCaseProvider where Self: XCTestCaseProviderStatic { var allTestNames: [String] { return type(of: self).allTests.map { name, _ in return name diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/CurrentSpecTests.swift b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/CurrentSpecTests.swift index 05b37f7..db610c1 100644 --- a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/CurrentSpecTests.swift +++ b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/CurrentSpecTests.swift @@ -1,12 +1,19 @@ import Quick import Nimble - -#if !SWIFT_PACKAGE +import Dispatch class CurrentSpecTests: QuickSpec { override func spec() { it("returns the currently executing spec") { - expect(QuickSpec.current?.name).to(match("currently_executing_spec")) + let name: String = { + let result = QuickSpec.current.name + #if canImport(Darwin) + return result.replacingOccurrences(of: "_", with: " ") + #else + return result + #endif + }() + expect(name).to(match("returns the currently executing spec")) } let currentSpecDuringSpecSetup = QuickSpec.current @@ -16,10 +23,15 @@ class CurrentSpecTests: QuickSpec { it("supports XCTest expectations") { let expectation = QuickSpec.current.expectation(description: "great expectation") - DispatchQueue.main.async(execute: expectation.fulfill) + let fulfill: () -> Void + #if canImport(Darwin) + fulfill = expectation.fulfill + #else + // https://github.com/apple/swift-corelibs-xctest/blob/51afda0bc782b2d6a2f00fbdca58943faf6ccecd/Sources/XCTest/Public/Asynchronous/XCTestExpectation.swift#L233-L253 + fulfill = { expectation.fulfill() } + #endif + DispatchQueue.main.async(execute: fulfill) QuickSpec.current.waitForExpectations(timeout: 1) } } } - -#endif diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ItTests.swift b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ItTests.swift index 3016401..762a45d 100644 --- a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ItTests.swift +++ b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ItTests.swift @@ -16,8 +16,7 @@ class FunctionalTests_ItSpec: QuickSpec { expect(exampleMetadata!.example.name).to(equal(name)) } -#if canImport(Darwin) && !SWIFT_PACKAGE - +#if canImport(Darwin) describe("when an example has a unique name") { it("has a unique name") {} @@ -53,6 +52,7 @@ class FunctionalTests_ItSpec: QuickSpec { } +#if !SWIFT_PACKAGE describe("error handling when misusing ordering") { it("an it") { expect { @@ -102,6 +102,7 @@ class FunctionalTests_ItSpec: QuickSpec { it("should throw an exception with the correct message after this 'it' block executes") { } } } +#endif #endif } } @@ -113,15 +114,16 @@ final class ItTests: XCTestCase, XCTestCaseProvider { ] } -#if canImport(Darwin) && !SWIFT_PACKAGE func testAllExamplesAreExecuted() { let result = qck_runSpec(FunctionalTests_ItSpec.self) + #if canImport(Darwin) + #if SWIFT_PACKAGE + XCTAssertEqual(result?.executionCount, 7) + #else XCTAssertEqual(result?.executionCount, 10) - } -#else - func testAllExamplesAreExecuted() { - let result = qck_runSpec(FunctionalTests_ItSpec.self) + #endif + #else XCTAssertEqual(result?.executionCount, 2) + #endif } -#endif } diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ObjC/ItTests+ObjC.m b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ObjC/ItTests+ObjC.m index 39e0b7d..6b8fdb3 100644 --- a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ObjC/ItTests+ObjC.m +++ b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ObjC/ItTests+ObjC.m @@ -2,8 +2,8 @@ @import Quick; @import Nimble; +#import "QuickTests-Swift.h" #import "QCKSpecRunner.h" -#import "QuickSpec+QuickSpec_MethodList.h" QuickSpecBegin(FunctionalTests_ItSpec_ObjC) diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/QuickSpec_SelectedTests.swift b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/QuickSpec_SelectedTests.swift new file mode 100644 index 0000000..f0e206c --- /dev/null +++ b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/QuickSpec_SelectedTests.swift @@ -0,0 +1,52 @@ +#if canImport(Darwin) && !SWIFT_PACKAGE + +import Nimble +import Quick +import XCTest + +// The regression tests for https://github.com/Quick/Quick/issues/891 + +class SimulateSelectedTests_TestCase: QuickSpec { + override class var defaultTestSuite: QuickTestSuite { + // XCTest doesn't call `defaultTestSuite` when running only selected tests. + // We simulate this behavior by not calling super. + return .init(name: "Selected tests") + } + + override func spec() { + it("example1") { } + it("example2") { } + it("example3") { } + } +} + +class SimulareAllTests_TestCase: QuickSpec { + override func spec() { + it("example1") { } + it("example2") { } + it("example3") { } + } +} + +class QuickSpec_SelectedTests: XCTestCase { + + func testQuickSpecTestInvocationsForAllTests() { + // Simulate running 'All tests' + let invocations = SimulareAllTests_TestCase.testInvocations + expect(invocations).to(haveCount(3)) + + let selectorNames = invocations.map { $0.selector.description } + expect(selectorNames).to(contain(["example1", "example2", "example3"])) + } + + func testQuickSpecTestInvocationsForSelectedTests() { + // Simulate running 'Selected tests' + let invocations = SimulateSelectedTests_TestCase.testInvocations + expect(invocations).to(haveCount(3)) + + let selectorNames = invocations.map { $0.selector.description } + expect(selectorNames).to(contain(["example1", "example2", "example3"])) + } +} + +#endif diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/SubclassOfSubclassWithStructPropertyTests.swift b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/SubclassOfSubclassWithStructPropertyTests.swift new file mode 100644 index 0000000..05ff363 --- /dev/null +++ b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/SubclassOfSubclassWithStructPropertyTests.swift @@ -0,0 +1,11 @@ +import XCTest +import Quick + +// The regression test for https://github.com/Quick/Quick/issues/853 + +class FunctionalTests_SubclassSpec: QuickSpec {} +class FunctionalTests_SubclassOfSubclassWithStructPropertySpec: FunctionalTests_SubclassSpec { + let date = Date() + + override func spec() {} +} diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QCKSpecRunner.m b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QCKSpecRunner.m index a3437a1..127e521 100644 --- a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QCKSpecRunner.m +++ b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QCKSpecRunner.m @@ -1,32 +1,17 @@ @import Quick; +#if __has_include("QuickTests-Swift.h") +#import "QuickTests-Swift.h" +#elif __has_include("QuickFocusedTests-Swift.h") +#import "QuickFocusedTests-Swift.h" +#endif + #import "QCKSpecRunner.h" -#import "XCTestObservationCenter+QCKSuspendObservation.h" - -@interface XCTest (Redeclaration) -- (XCTestRun *)run; -@end - -XCTestRun * _Nullable qck_runSuite(XCTestSuite * _Nonnull suite) { - [World sharedWorld].isRunningAdditionalSuites = YES; - - __block XCTestRun *result = nil; - [[XCTestObservationCenter sharedTestObservationCenter] qck_suspendObservationForBlock:^{ - [suite runTest]; - result = suite.testRun; - }]; - return result; -} XCTestRun *qck_runSpec(Class specClass) { - return qck_runSuite([XCTestSuite testSuiteForTestCaseClass:specClass]); + return [QCKSpecRunner runSpec:specClass]; } XCTestRun * _Nullable qck_runSpecs(NSArray * _Nonnull specClasses) { - XCTestSuite *suite = [XCTestSuite testSuiteWithName:@"MySpecs"]; - for (Class specClass in specClasses) { - [suite addTest:[XCTestSuite testSuiteForTestCaseClass:specClass]]; - } - - return qck_runSuite(suite); + return [QCKSpecRunner runSpecs:specClasses]; } diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+MethodList.swift b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+MethodList.swift new file mode 100644 index 0000000..1acb529 --- /dev/null +++ b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+MethodList.swift @@ -0,0 +1,24 @@ +#if canImport(Darwin) +import Foundation +import Quick + +extension QuickSpec { + @objc static func allSelectors() -> Set { + var allSelectors = Set() + + var methodCount: UInt32 = 0 + guard let methodList = class_copyMethodList(self, &methodCount) else { + return [] + } + defer { free(methodList) } + + for i in 0.. XCTestRun? { + return qck_runSpecs([specClass]) +} + +/** + Runs an XCTestSuite instance containing the given QuickSpec subclasses, in the order provided. + See the documentation for `qck_runSpec` for more details. + + @param specClasses An array of QuickSpec classes, in the order they should be run. + @return An XCTestRun instance that contains information such as the number of failures, etc. + */ +@discardableResult +func qck_runSpecs(_ specClasses: [QuickSpec.Type]) -> XCTestRun? { + return World.anotherWorld { world -> XCTestRun? in + QuickConfiguration.configureSubclassesIfNeeded(world: world) + + world.isRunningAdditionalSuites = true + defer { world.isRunningAdditionalSuites = false } + + let suite = XCTestSuite(name: "MySpecs") + for specClass in specClasses { + #if canImport(Darwin) + let test = specClass.defaultTestSuite + #else + let test = TestCaseSuite(specClass: specClass) + #endif + suite.addTest(test) + } + + let result: XCTestRun? = XCTestObservationCenter.shared.qck_suspendObservation { + suite.run() + return suite.testRun + } + return result + } +} + +#if canImport(Darwin) && !SWIFT_PACKAGE +@objc(QCKSpecRunner) +@objcMembers +class QuickSpecRunner: NSObject { + static func runSpec(_ specClass: QuickSpec.Type) -> XCTestRun? { + return qck_runSpec(specClass) + } + + static func runSpecs(_ specClasses: [QuickSpec.Type]) -> XCTestRun? { + return qck_runSpecs(specClasses) + } +} +#endif diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h index 301c5d5..8b13789 100644 --- a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h +++ b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h @@ -1,2 +1 @@ -#import "QCKSpecRunner.h" -#import "QuickSpec+QuickSpec_MethodList.h" + diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.swift b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.swift new file mode 100644 index 0000000..48bcbeb --- /dev/null +++ b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.swift @@ -0,0 +1,64 @@ +import Foundation +import XCTest + +/// This allows us to only suspend observation for observers by provided by Apple +/// as a part of the XCTest framework. In particular it is important that we not +/// suspend the observer added by Nimble, otherwise it is unable to properly +/// report assertion failures. +private func isFromApple(observer: XCTestObservation) -> Bool { + #if canImport(Darwin) + guard let bundleIdentifier = Bundle(for: type(of: observer)).bundleIdentifier else { + return false + } + return bundleIdentifier.contains("com.apple.dt.XCTest") + #else + // https://github.com/apple/swift-corelibs-xctest/blob/swift-5.0.1-RELEASE/Sources/XCTest/Public/XCTestMain.swift#L91-L93 + return String(describing: observer) == "XCTest.PrintObserver" + || String(describing: type(of: observer)) == "PrintObserver" + #endif +} + +/** + Add the ability to temporarily disable internal XCTest execution observation in + order to run isolated XCTestSuite instances while the QuickTests test suite is running. + */ +extension XCTestObservationCenter { + /** + Suspends test suite observation for XCTest-provided observers for the duration that + the block is executing. Any test suites that are executed within the block do not + generate any log output. Failures are still reported. + + Use this method to run XCTestSuite objects while another XCTestSuite is running. + Without this method, tests fail with the message: "Timed out waiting for IDE + barrier message to complete" or "Unexpected TestSuiteDidStart". + */ + func qck_suspendObservation(forBlock block: () -> T) -> T { + #if canImport(Darwin) + let originalObservers = value(forKey: "observers") as? [XCTestObservation] ?? [] + #else + let originalObservers: [XCTestObservation] = { + // https://github.com/apple/swift-corelibs-xctest/blob/swift-5.0.1-RELEASE/Sources/XCTest/Public/XCTestObservationCenter.swift#L20-L22 + let mirror = Mirror(reflecting: self) + let observers = mirror.descendant("observers") as? Set ?? [] + return observers.compactMap { hashable in + // https://github.com/apple/swift-corelibs-xctest/blob/swift-5.0.1-RELEASE/Sources/XCTest/Private/ObjectWrapper.swift#L16-L17 + let wrapperMirror = Mirror(reflecting: hashable.base) + return wrapperMirror.descendant("object") as? XCTestObservation + } + }() + #endif + var suspendedObservers = [XCTestObservation]() + + for observer in originalObservers where isFromApple(observer: observer) { + suspendedObservers.append(observer) + removeTestObserver(observer) + } + defer { + for observer in suspendedObservers { + addTestObserver(observer) + } + } + + return block() + } +} From fe528500a5ca4ad172708542135b8c25effb72cb Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Fri, 13 Dec 2019 17:38:28 -0700 Subject: [PATCH 16/25] =?UTF-8?q?=F0=9F=92=A5=20Fix=20build=20error=20by?= =?UTF-8?q?=20enabling=20code=20coverage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/Swinject/Swinject/issues/296 Undefined symbols for architecture x86_64: "___llvm_profile_runtime", referenced from: ___llvm_profile_runtime_user in CKSoftwareProduct+SoftwareProduct.o ___llvm_profile_runtime_user in NetworkSession.o ___llvm_profile_runtime_user in SoftwareProduct.o ___llvm_profile_runtime_user in StoreAccount.o (maybe you meant: ___llvm_profile_runtime_user) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) --- .../xcshareddata/xcschemes/MasKit.xcscheme | 20 ++++++++++++++++++- .../xcschemes/mas-cli Debug.xcscheme | 19 +++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/mas-cli.xcodeproj/xcshareddata/xcschemes/MasKit.xcscheme b/mas-cli.xcodeproj/xcshareddata/xcschemes/MasKit.xcscheme index bc3eec2..552fc76 100644 --- a/mas-cli.xcodeproj/xcshareddata/xcschemes/MasKit.xcscheme +++ b/mas-cli.xcodeproj/xcshareddata/xcschemes/MasKit.xcscheme @@ -26,7 +26,9 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> + shouldUseLaunchSchemeArgsEnv = "YES" + codeCoverageEnabled = "YES" + onlyGenerateCoverageForSpecifiedTargets = "YES"> + + + + + + diff --git a/mas-cli.xcodeproj/xcshareddata/xcschemes/mas-cli Debug.xcscheme b/mas-cli.xcodeproj/xcshareddata/xcschemes/mas-cli Debug.xcscheme index bb251b6..ab4b3db 100644 --- a/mas-cli.xcodeproj/xcshareddata/xcschemes/mas-cli Debug.xcscheme +++ b/mas-cli.xcodeproj/xcshareddata/xcschemes/mas-cli Debug.xcscheme @@ -27,7 +27,8 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES" - codeCoverageEnabled = "YES"> + codeCoverageEnabled = "YES" + onlyGenerateCoverageForSpecifiedTargets = "YES"> + + + + + + From f28355374e55ef39c0a1b22cdd295747a94b4077 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Fri, 13 Dec 2019 17:47:44 -0700 Subject: [PATCH 17/25] =?UTF-8?q?=F0=9F=94=A5=20Remove=20obsolete=20Result?= =?UTF-8?q?=20sources?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Carthage/Checkouts/Commandant/Cartfile | 1 - .../Carthage/Checkouts/Result/.gitignore | 9 - .../Carthage/Checkouts/Result/.swift-version | 1 - .../Carthage/Checkouts/Result/.travis.yml | 94 -- .../Carthage/Checkouts/Result/CONTRIBUTING.md | 23 - .../Carthage/Checkouts/Result/LICENSE | 21 - .../Carthage/Checkouts/Result/Package.swift | 14 - .../Checkouts/Result/Package@swift-5.swift | 14 - .../Carthage/Checkouts/Result/README.md | 112 -- .../Carthage/Checkouts/Result/Result.podspec | 19 - .../Result/Result.xcodeproj/project.pbxproj | 1066 ----------------- .../contents.xcworkspacedata | 7 - .../xcshareddata/IDEWorkspaceChecks.plist | 8 - .../xcschemes/Result-Mac.xcscheme | 113 -- .../xcschemes/Result-iOS.xcscheme | 113 -- .../xcschemes/Result-tvOS.xcscheme | 99 -- .../xcschemes/Result-watchOS.xcscheme | 99 -- .../Checkouts/Result/Result/AnyError.swift | 46 - .../Checkouts/Result/Result/Info.plist | 28 - .../Checkouts/Result/Result/NoError.swift | 10 - .../Carthage/Checkouts/Result/Result/Result.h | 8 - .../Checkouts/Result/Result/Result.swift | 229 ---- .../Result/Result/ResultProtocol.swift | 152 --- .../Checkouts/Result/Tests/LinuxMain.swift | 8 - .../Tests/ResultTests/AnyErrorTests.swift | 12 - .../Result/Tests/ResultTests/Info.plist | 24 - .../Tests/ResultTests/NoErrorTests.swift | 11 - .../Tests/ResultTests/ResultTests.swift | 256 ---- .../Tests/ResultTests/XCTestManifests.swift | 57 - .../Checkouts/CwlCatchException/LICENSE.txt | 13 - .../Checkouts/CwlCatchException/Package.swift | 9 - .../Checkouts/CwlCatchException/README.md | 46 - .../CwlCatchException/CwlCatchException.swift | 35 - .../CwlCatchException.m | 37 - .../include/CwlCatchException.h | 32 - .../Mach/CwlPreconditionTesting.h | 32 - .../Posix/CwlPreconditionTesting_POSIX.h | 29 - .../NSString+C99ExtendedIdentifier.swift | 49 - .../QuickTestHelpers/SpecRunner.swift | 30 - .../QuickTests/QuickTestHelpers/TestRun.swift | 9 - .../Helpers/QuickSpec+QuickSpec_MethodList.h | 17 - .../Helpers/QuickSpec+QuickSpec_MethodList.m | 23 - ...tObservationCenter+QCKSuspendObservation.h | 20 - ...tObservationCenter+QCKSuspendObservation.m | 54 - Carthage/Checkouts/Result/.gitignore | 9 - Carthage/Checkouts/Result/.swift-version | 1 - Carthage/Checkouts/Result/.travis.yml | 94 -- Carthage/Checkouts/Result/CONTRIBUTING.md | 23 - Carthage/Checkouts/Result/LICENSE | 21 - Carthage/Checkouts/Result/Package.swift | 14 - .../Checkouts/Result/Package@swift-5.swift | 14 - Carthage/Checkouts/Result/README.md | 112 -- Carthage/Checkouts/Result/Result.podspec | 19 - .../Result/Result.xcodeproj/project.pbxproj | 1066 ----------------- .../contents.xcworkspacedata | 7 - .../xcshareddata/IDEWorkspaceChecks.plist | 8 - .../xcschemes/Result-Mac.xcscheme | 113 -- .../xcschemes/Result-iOS.xcscheme | 113 -- .../xcschemes/Result-tvOS.xcscheme | 99 -- .../xcschemes/Result-watchOS.xcscheme | 99 -- .../Checkouts/Result/Result/AnyError.swift | 46 - Carthage/Checkouts/Result/Result/Info.plist | 28 - .../Checkouts/Result/Result/NoError.swift | 10 - Carthage/Checkouts/Result/Result/Result.h | 8 - Carthage/Checkouts/Result/Result/Result.swift | 229 ---- .../Result/Result/ResultProtocol.swift | 152 --- .../Checkouts/Result/Tests/LinuxMain.swift | 8 - .../Tests/ResultTests/AnyErrorTests.swift | 12 - .../Result/Tests/ResultTests/Info.plist | 24 - .../Tests/ResultTests/NoErrorTests.swift | 11 - .../Tests/ResultTests/ResultTests.swift | 256 ---- .../Tests/ResultTests/XCTestManifests.swift | 57 - 72 files changed, 5742 deletions(-) delete mode 100644 Carthage/Checkouts/Commandant/Cartfile delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/.gitignore delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/.swift-version delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/.travis.yml delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/CONTRIBUTING.md delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/LICENSE delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Package.swift delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Package@swift-5.swift delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/README.md delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.podspec delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/project.pbxproj delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-Mac.xcscheme delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-iOS.xcscheme delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-tvOS.xcscheme delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-watchOS.xcscheme delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/AnyError.swift delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/Info.plist delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/NoError.swift delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/Result.h delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/Result.swift delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/ResultProtocol.swift delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/LinuxMain.swift delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/AnyErrorTests.swift delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/Info.plist delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/NoErrorTests.swift delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/ResultTests.swift delete mode 100644 Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/XCTestManifests.swift delete mode 100644 Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/LICENSE.txt delete mode 100644 Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Package.swift delete mode 100644 Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/README.md delete mode 100644 Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift delete mode 100644 Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m delete mode 100644 Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h delete mode 100644 Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h delete mode 100644 Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h delete mode 100644 Carthage/Checkouts/Quick/Sources/Quick/NSString+C99ExtendedIdentifier.swift delete mode 100644 Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/SpecRunner.swift delete mode 100644 Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/TestRun.swift delete mode 100644 Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+QuickSpec_MethodList.h delete mode 100644 Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+QuickSpec_MethodList.m delete mode 100644 Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.h delete mode 100644 Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.m delete mode 100644 Carthage/Checkouts/Result/.gitignore delete mode 100644 Carthage/Checkouts/Result/.swift-version delete mode 100644 Carthage/Checkouts/Result/.travis.yml delete mode 100644 Carthage/Checkouts/Result/CONTRIBUTING.md delete mode 100644 Carthage/Checkouts/Result/LICENSE delete mode 100644 Carthage/Checkouts/Result/Package.swift delete mode 100644 Carthage/Checkouts/Result/Package@swift-5.swift delete mode 100644 Carthage/Checkouts/Result/README.md delete mode 100644 Carthage/Checkouts/Result/Result.podspec delete mode 100644 Carthage/Checkouts/Result/Result.xcodeproj/project.pbxproj delete mode 100644 Carthage/Checkouts/Result/Result.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 Carthage/Checkouts/Result/Result.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-Mac.xcscheme delete mode 100644 Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-iOS.xcscheme delete mode 100644 Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-tvOS.xcscheme delete mode 100644 Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-watchOS.xcscheme delete mode 100644 Carthage/Checkouts/Result/Result/AnyError.swift delete mode 100644 Carthage/Checkouts/Result/Result/Info.plist delete mode 100644 Carthage/Checkouts/Result/Result/NoError.swift delete mode 100644 Carthage/Checkouts/Result/Result/Result.h delete mode 100644 Carthage/Checkouts/Result/Result/Result.swift delete mode 100644 Carthage/Checkouts/Result/Result/ResultProtocol.swift delete mode 100644 Carthage/Checkouts/Result/Tests/LinuxMain.swift delete mode 100644 Carthage/Checkouts/Result/Tests/ResultTests/AnyErrorTests.swift delete mode 100644 Carthage/Checkouts/Result/Tests/ResultTests/Info.plist delete mode 100644 Carthage/Checkouts/Result/Tests/ResultTests/NoErrorTests.swift delete mode 100644 Carthage/Checkouts/Result/Tests/ResultTests/ResultTests.swift delete mode 100644 Carthage/Checkouts/Result/Tests/ResultTests/XCTestManifests.swift diff --git a/Carthage/Checkouts/Commandant/Cartfile b/Carthage/Checkouts/Commandant/Cartfile deleted file mode 100644 index e9bc3ad..0000000 --- a/Carthage/Checkouts/Commandant/Cartfile +++ /dev/null @@ -1 +0,0 @@ -github "antitypical/Result" ~> 4.0 diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/.gitignore b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/.gitignore deleted file mode 100644 index 29471cb..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -.DS_Store -xcuserdata -*.xcuserdatad -*.xccheckout -*.mode* -*.pbxuser - -Carthage/Build -.build diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/.swift-version b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/.swift-version deleted file mode 100644 index bf77d54..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/.swift-version +++ /dev/null @@ -1 +0,0 @@ -4.2 diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/.travis.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/.travis.yml deleted file mode 100644 index 6e9fbf1..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/.travis.yml +++ /dev/null @@ -1,94 +0,0 @@ -branches: - only: - - master - -matrix: - include: - - script: - - set -o pipefail - - xcodebuild $XCODE_ACTION -scheme Result-Mac | xcpretty - - xcodebuild $XCODE_ACTION -scheme Result-iOS -sdk iphonesimulator -destination "name=iPhone SE" | xcpretty - - xcodebuild $XCODE_ACTION -scheme Result-tvOS -sdk appletvsimulator -destination "name=Apple TV" | xcpretty - - xcodebuild build -scheme Result-watchOS -sdk watchsimulator | xcpretty - - gem update cocoapods && rm .swift-version && pod lib lint - env: - - JOB=Xcode - - XCODE_ACTION="build-for-testing test-without-building" - os: osx - osx_image: xcode9.2 - language: objective-c - - script: - - set -o pipefail - - xcodebuild $XCODE_ACTION -scheme Result-Mac | xcpretty - - xcodebuild $XCODE_ACTION -scheme Result-iOS -sdk iphonesimulator -destination "name=iPhone SE" | xcpretty - - xcodebuild $XCODE_ACTION -scheme Result-tvOS -sdk appletvsimulator -destination "name=Apple TV" | xcpretty - - xcodebuild build -scheme Result-watchOS -sdk watchsimulator | xcpretty - - rm .swift-version && pod lib lint - env: - - JOB=Xcode - - XCODE_ACTION="build-for-testing test-without-building" - os: osx - osx_image: xcode9.3 - language: objective-c - - script: - - set -o pipefail - - xcodebuild $XCODE_ACTION -scheme Result-Mac | xcpretty - - xcodebuild $XCODE_ACTION -scheme Result-iOS -sdk iphonesimulator -destination "name=iPhone SE" | xcpretty - - xcodebuild $XCODE_ACTION -scheme Result-tvOS -sdk appletvsimulator -destination "name=Apple TV" | xcpretty - - xcodebuild build -scheme Result-watchOS -sdk watchsimulator | xcpretty - env: - - JOB=Xcode - - XCODE_ACTION="build-for-testing test-without-building" - os: osx - osx_image: xcode10 - language: objective-c - - script: - - swift --version - - swift build - - swift test - env: JOB=SPM - os: osx - osx_image: xcode9.2 - language: objective-c - - script: - - swift --version - - swift build - - swift test - env: JOB=SPM - os: osx - osx_image: xcode9.3 - language: objective-c - - script: - - swift --version - - swift build - - swift test - env: JOB=SPM - os: osx - osx_image: xcode10 - language: objective-c - - script: - - swift --version - - swift build - - swift test - env: - - JOB=Linux - sudo: required - dist: trusty - language: generic - install: - - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" - - script: - - swift --version - - swift build - - swift test - env: - - JOB=Linux - - SWIFT_VERSION=5.0-DEVELOPMENT-SNAPSHOT-2018-12-28-a - sudo: required - dist: trusty - language: generic - install: - - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" - -notifications: - email: false diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/CONTRIBUTING.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/CONTRIBUTING.md deleted file mode 100644 index f58c3fa..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/CONTRIBUTING.md +++ /dev/null @@ -1,23 +0,0 @@ -We love that you're interested in contributing to this project! - -To make the process as painless as possible, we have just a couple of guidelines -that should make life easier for everyone involved. - -## Prefer Pull Requests - -If you know exactly how to implement the feature being suggested or fix the bug -being reported, please open a pull request instead of an issue. Pull requests are easier than -patches or inline code blocks for discussing and merging the changes. - -If you can't make the change yourself, please open an issue after making sure -that one isn't already logged. - -## Contributing Code - -Fork this repository, make it awesomer (preferably in a branch named for the -topic), send a pull request! - -All code contributions should match our [coding -conventions](https://github.com/github/swift-style-guide). - -Thanks for contributing! :boom::camel: diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/LICENSE b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/LICENSE deleted file mode 100644 index 3026ee1..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Rob Rix - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Package.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Package.swift deleted file mode 100644 index c93a688..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Package.swift +++ /dev/null @@ -1,14 +0,0 @@ -// swift-tools-version:4.0 -import PackageDescription - -let package = Package( - name: "Result", - products: [ - .library(name: "Result", targets: ["Result"]), - ], - targets: [ - .target(name: "Result", dependencies: [], path: "Result"), - .testTarget(name: "ResultTests", dependencies: ["Result"]), - ], - swiftLanguageVersions: [4] -) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Package@swift-5.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Package@swift-5.swift deleted file mode 100644 index 6059b85..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Package@swift-5.swift +++ /dev/null @@ -1,14 +0,0 @@ -// swift-tools-version:5.0 -import PackageDescription - -let package = Package( - name: "Result", - products: [ - .library(name: "Result", targets: ["Result"]), - ], - targets: [ - .target(name: "Result", dependencies: [], path: "Result"), - .testTarget(name: "ResultTests", dependencies: ["Result"]), - ], - swiftLanguageVersions: [.v4, .v4_2, .v5] -) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/README.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/README.md deleted file mode 100644 index c030316..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/README.md +++ /dev/null @@ -1,112 +0,0 @@ -# Result - -[![Build Status](https://travis-ci.org/antitypical/Result.svg?branch=master)](https://travis-ci.org/antitypical/Result) -[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) -[![CocoaPods](https://img.shields.io/cocoapods/v/Result.svg)](https://cocoapods.org/) -[![Reference Status](https://www.versioneye.com/objective-c/result/reference_badge.svg?style=flat)](https://www.versioneye.com/objective-c/result/references) - -This is a Swift µframework providing `Result`. - -`Result` values are either successful (wrapping `Value`) or failed (wrapping `Error`). This is similar to Swift’s native `Optional` type: `success` is like `some`, and `failure` is like `none` except with an associated `Error` value. The addition of an associated `Error` allows errors to be passed along for logging or displaying to the user. - -Using this µframework instead of rolling your own `Result` type allows you to easily interface with other frameworks that also use `Result`. - -## Use - -Use `Result` whenever an operation has the possibility of failure. Consider the following example of a function that tries to extract a `String` for a given key from a JSON `Dictionary`. - -```swift -typealias JSONObject = [String: Any] - -enum JSONError: Error { - case noSuchKey(String) - case typeMismatch -} - -func stringForKey(json: JSONObject, key: String) -> Result { - guard let value = json[key] else { - return .failure(.noSuchKey(key)) - } - - guard let value = value as? String else { - return .failure(.typeMismatch) - } - - return .success(value) -} -``` - -This function provides a more robust wrapper around the default subscripting provided by `Dictionary`. Rather than return `Any?`, it returns a `Result` that either contains the `String` value for the given key, or an `ErrorType` detailing what went wrong. - -One simple way to handle a `Result` is to deconstruct it using a `switch` statement. - -```swift -switch stringForKey(json, key: "email") { - -case let .success(email): - print("The email is \(email)") - -case let .failure(.noSuchKey(key)): - print("\(key) is not a valid key") - -case .failure(.typeMismatch): - print("Didn't have the right type") -} -``` - -Using a `switch` statement allows powerful pattern matching, and ensures all possible results are covered. Swift 2.0 offers new ways to deconstruct enums like the `if-case` statement, but be wary as such methods do not ensure errors are handled. - -Other methods available for processing `Result` are detailed in the [API documentation](http://cocoadocs.org/docsets/Result/). - -## Result vs. Throws - -Swift 2.0 introduces error handling via throwing and catching `Error`. `Result` accomplishes the same goal by encapsulating the result instead of hijacking control flow. The `Result` abstraction enables powerful functionality such as `map` and `flatMap`, making `Result` more composable than `throw`. - -Since dealing with APIs that throw is common, you can convert such functions into a `Result` by using the `materialize` method. Conversely, a `Result` can be used to throw an error by calling `dematerialize`. - -## Higher Order Functions - -`map` and `flatMap` operate the same as `Optional.map` and `Optional.flatMap` except they apply to `Result`. - -`map` transforms a `Result` into a `Result` of a new type. It does this by taking a function that transforms the `Value` type into a new value. This transformation is only applied in the case of a `success`. In the case of a `failure`, the associated error is re-wrapped in the new `Result`. - -```swift -// transforms a Result to a Result -let idResult = intForKey(json, key:"id").map { id in String(id) } -``` - -Here, the final result is either the id as a `String`, or carries over the `failure` from the previous result. - -`flatMap` is similar to `map` in that it transforms the `Result` into another `Result`. However, the function passed into `flatMap` must return a `Result`. - -An in depth discussion of `map` and `flatMap` is beyond the scope of this documentation. If you would like a deeper understanding, read about functors and monads. This article is a good place to [start](http://www.javiersoto.me/post/106875422394). - -## Integration - -### Carthage - -1. Add this repository as a submodule and/or [add it to your Cartfile](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile) if you’re using [carthage](https://github.com/Carthage/Carthage/) to manage your dependencies. -2. Drag `Result.xcodeproj` into your project or workspace. -3. Link your target against `Result.framework`. -4. Application targets should ensure that the framework gets copied into their application bundle. (Framework targets should instead require the application linking them to include Result.) - -### Cocoapods - -```ruby -pod 'Result', '~> 4.0.0' -``` - -### Swift Package Manager - -```swift -import PackageDescription - -let package = Package( - name: "MyProject", - targets: [], - dependencies: [ - .Package(url: "https://github.com/antitypical/Result.git", - majorVersion: 4) - ] -) -``` diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.podspec b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.podspec deleted file mode 100644 index ff0742f..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.podspec +++ /dev/null @@ -1,19 +0,0 @@ -Pod::Spec.new do |s| - s.name = 'Result' - s.version = '4.1.0' - s.summary = 'Swift type modelling the success/failure of arbitrary operations' - - s.homepage = 'https://github.com/antitypical/Result' - s.license = { :type => 'MIT', :file => 'LICENSE' } - s.author = { 'Rob Rix' => 'rob.rix@github.com' } - s.source = { :git => 'https://github.com/antitypical/Result.git', :tag => s.version } - s.source_files = 'Result/*.swift' - s.requires_arc = true - s.ios.deployment_target = '8.0' - s.osx.deployment_target = '10.9' - s.watchos.deployment_target = '2.0' - s.tvos.deployment_target = '9.0' - - s.cocoapods_version = '>= 1.4.0' - s.swift_version = '4.2' -end diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/project.pbxproj b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/project.pbxproj deleted file mode 100644 index 6c4bc0a..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/project.pbxproj +++ /dev/null @@ -1,1066 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 45AE89E61B3A6564007B99D7 /* ResultProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E93621451B35596200948F2A /* ResultProtocol.swift */; }; - 57FCDE3E1BA280DC00130C48 /* ResultProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E93621451B35596200948F2A /* ResultProtocol.swift */; }; - 57FCDE3F1BA280DC00130C48 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = D45480961A957465009D7229 /* Result.swift */; }; - 57FCDE421BA280DC00130C48 /* Result.h in Headers */ = {isa = PBXBuildFile; fileRef = D454805C1A9572F5009D7229 /* Result.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 57FCDE4D1BA280E000130C48 /* ResultTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D454806E1A9572F5009D7229 /* ResultTests.swift */; }; - 57FCDE561BA2814300130C48 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57FCDE471BA280DC00130C48 /* Result.framework */; }; - CD333EF21ED50550004D9C5D /* NoError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF11ED50550004D9C5D /* NoError.swift */; }; - CD333EF31ED50550004D9C5D /* NoError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF11ED50550004D9C5D /* NoError.swift */; }; - CD333EF41ED50550004D9C5D /* NoError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF11ED50550004D9C5D /* NoError.swift */; }; - CD333EF51ED50550004D9C5D /* NoError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF11ED50550004D9C5D /* NoError.swift */; }; - CD333EF71ED505D7004D9C5D /* AnyError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF61ED505D7004D9C5D /* AnyError.swift */; }; - CD333EF81ED505D7004D9C5D /* AnyError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF61ED505D7004D9C5D /* AnyError.swift */; }; - CD333EF91ED505D7004D9C5D /* AnyError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF61ED505D7004D9C5D /* AnyError.swift */; }; - CD333EFA1ED505D7004D9C5D /* AnyError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF61ED505D7004D9C5D /* AnyError.swift */; }; - CD333EFC1ED50699004D9C5D /* NoErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EFB1ED50699004D9C5D /* NoErrorTests.swift */; }; - CD333EFD1ED50699004D9C5D /* NoErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EFB1ED50699004D9C5D /* NoErrorTests.swift */; }; - CD333EFE1ED50699004D9C5D /* NoErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EFB1ED50699004D9C5D /* NoErrorTests.swift */; }; - CD333F001ED5074F004D9C5D /* AnyErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EFF1ED5074F004D9C5D /* AnyErrorTests.swift */; }; - CD333F011ED5074F004D9C5D /* AnyErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EFF1ED5074F004D9C5D /* AnyErrorTests.swift */; }; - CD333F021ED5074F004D9C5D /* AnyErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EFF1ED5074F004D9C5D /* AnyErrorTests.swift */; }; - D035799B1B2B788F005D26AE /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = D45480961A957465009D7229 /* Result.swift */; }; - D035799E1B2B788F005D26AE /* Result.h in Headers */ = {isa = PBXBuildFile; fileRef = D454805C1A9572F5009D7229 /* Result.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D454805D1A9572F5009D7229 /* Result.h in Headers */ = {isa = PBXBuildFile; fileRef = D454805C1A9572F5009D7229 /* Result.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D45480681A9572F5009D7229 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D45480571A9572F5009D7229 /* Result.framework */; }; - D454806F1A9572F5009D7229 /* ResultTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D454806E1A9572F5009D7229 /* ResultTests.swift */; }; - D45480881A957362009D7229 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D454807D1A957361009D7229 /* Result.framework */; }; - D45480971A957465009D7229 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = D45480961A957465009D7229 /* Result.swift */; }; - D45480981A957465009D7229 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = D45480961A957465009D7229 /* Result.swift */; }; - D45480991A9574B8009D7229 /* ResultTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D454806E1A9572F5009D7229 /* ResultTests.swift */; }; - D454809A1A9574BB009D7229 /* Result.h in Headers */ = {isa = PBXBuildFile; fileRef = D454805C1A9572F5009D7229 /* Result.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E93621461B35596200948F2A /* ResultProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E93621451B35596200948F2A /* ResultProtocol.swift */; }; - E93621471B35596200948F2A /* ResultProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E93621451B35596200948F2A /* ResultProtocol.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 57FCDE571BA2814A00130C48 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D454804E1A9572F5009D7229 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 57FCDE3C1BA280DC00130C48; - remoteInfo = "Result-tvOS"; - }; - D45480691A9572F5009D7229 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D454804E1A9572F5009D7229 /* Project object */; - proxyType = 1; - remoteGlobalIDString = D45480561A9572F5009D7229; - remoteInfo = Result; - }; - D45480891A957362009D7229 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D454804E1A9572F5009D7229 /* Project object */; - proxyType = 1; - remoteGlobalIDString = D454807C1A957361009D7229; - remoteInfo = "Result-iOS"; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 57FCDE471BA280DC00130C48 /* Result.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 57FCDE541BA280E000130C48 /* Result-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Result-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - CD261ACF1DECFE3400A8863C /* LinuxMain.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LinuxMain.swift; path = ../LinuxMain.swift; sourceTree = ""; }; - CD333EF11ED50550004D9C5D /* NoError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NoError.swift; sourceTree = ""; }; - CD333EF61ED505D7004D9C5D /* AnyError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnyError.swift; sourceTree = ""; }; - CD333EFB1ED50699004D9C5D /* NoErrorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NoErrorTests.swift; sourceTree = ""; }; - CD333EFF1ED5074F004D9C5D /* AnyErrorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnyErrorTests.swift; sourceTree = ""; }; - D03579A31B2B788F005D26AE /* Result.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - D45480571A9572F5009D7229 /* Result.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - D454805B1A9572F5009D7229 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - D454805C1A9572F5009D7229 /* Result.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Result.h; sourceTree = ""; }; - D45480671A9572F5009D7229 /* Result-MacTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Result-MacTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - D454806D1A9572F5009D7229 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - D454806E1A9572F5009D7229 /* ResultTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResultTests.swift; sourceTree = ""; }; - D454807D1A957361009D7229 /* Result.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - D45480871A957362009D7229 /* Result-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Result-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - D45480961A957465009D7229 /* Result.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Result.swift; sourceTree = ""; }; - E93621451B35596200948F2A /* ResultProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResultProtocol.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 57FCDE401BA280DC00130C48 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 57FCDE4E1BA280E000130C48 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 57FCDE561BA2814300130C48 /* Result.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D035799C1B2B788F005D26AE /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480531A9572F5009D7229 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480641A9572F5009D7229 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - D45480681A9572F5009D7229 /* Result.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480791A957361009D7229 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480841A957362009D7229 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - D45480881A957362009D7229 /* Result.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - D454804D1A9572F5009D7229 = { - isa = PBXGroup; - children = ( - D45480591A9572F5009D7229 /* Result */, - D454806B1A9572F5009D7229 /* ResultTests */, - D45480581A9572F5009D7229 /* Products */, - ); - sourceTree = ""; - usesTabs = 1; - }; - D45480581A9572F5009D7229 /* Products */ = { - isa = PBXGroup; - children = ( - D45480571A9572F5009D7229 /* Result.framework */, - D45480671A9572F5009D7229 /* Result-MacTests.xctest */, - D454807D1A957361009D7229 /* Result.framework */, - D45480871A957362009D7229 /* Result-iOSTests.xctest */, - D03579A31B2B788F005D26AE /* Result.framework */, - 57FCDE471BA280DC00130C48 /* Result.framework */, - 57FCDE541BA280E000130C48 /* Result-tvOSTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - D45480591A9572F5009D7229 /* Result */ = { - isa = PBXGroup; - children = ( - CD333EF61ED505D7004D9C5D /* AnyError.swift */, - CD333EF11ED50550004D9C5D /* NoError.swift */, - D454805C1A9572F5009D7229 /* Result.h */, - D45480961A957465009D7229 /* Result.swift */, - E93621451B35596200948F2A /* ResultProtocol.swift */, - D454805A1A9572F5009D7229 /* Supporting Files */, - ); - path = Result; - sourceTree = ""; - }; - D454805A1A9572F5009D7229 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - D454805B1A9572F5009D7229 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - D454806B1A9572F5009D7229 /* ResultTests */ = { - isa = PBXGroup; - children = ( - CD333EFF1ED5074F004D9C5D /* AnyErrorTests.swift */, - CD333EFB1ED50699004D9C5D /* NoErrorTests.swift */, - D454806E1A9572F5009D7229 /* ResultTests.swift */, - D454806C1A9572F5009D7229 /* Supporting Files */, - ); - name = ResultTests; - path = Tests/ResultTests; - sourceTree = ""; - }; - D454806C1A9572F5009D7229 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - D454806D1A9572F5009D7229 /* Info.plist */, - CD261ACF1DECFE3400A8863C /* LinuxMain.swift */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 57FCDE411BA280DC00130C48 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 57FCDE421BA280DC00130C48 /* Result.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D035799D1B2B788F005D26AE /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - D035799E1B2B788F005D26AE /* Result.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480541A9572F5009D7229 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - D454805D1A9572F5009D7229 /* Result.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D454807A1A957361009D7229 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - D454809A1A9574BB009D7229 /* Result.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 57FCDE3C1BA280DC00130C48 /* Result-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 57FCDE441BA280DC00130C48 /* Build configuration list for PBXNativeTarget "Result-tvOS" */; - buildPhases = ( - 57FCDE411BA280DC00130C48 /* Headers */, - 57FCDE3D1BA280DC00130C48 /* Sources */, - 57FCDE401BA280DC00130C48 /* Frameworks */, - 57FCDE431BA280DC00130C48 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "Result-tvOS"; - productName = "Result-iOS"; - productReference = 57FCDE471BA280DC00130C48 /* Result.framework */; - productType = "com.apple.product-type.framework"; - }; - 57FCDE491BA280E000130C48 /* Result-tvOSTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 57FCDE511BA280E000130C48 /* Build configuration list for PBXNativeTarget "Result-tvOSTests" */; - buildPhases = ( - 57FCDE4C1BA280E000130C48 /* Sources */, - 57FCDE4E1BA280E000130C48 /* Frameworks */, - 57FCDE501BA280E000130C48 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 57FCDE581BA2814A00130C48 /* PBXTargetDependency */, - ); - name = "Result-tvOSTests"; - productName = "Result-iOSTests"; - productReference = 57FCDE541BA280E000130C48 /* Result-tvOSTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - D03579991B2B788F005D26AE /* Result-watchOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = D03579A01B2B788F005D26AE /* Build configuration list for PBXNativeTarget "Result-watchOS" */; - buildPhases = ( - D035799D1B2B788F005D26AE /* Headers */, - D035799A1B2B788F005D26AE /* Sources */, - D035799C1B2B788F005D26AE /* Frameworks */, - D035799F1B2B788F005D26AE /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "Result-watchOS"; - productName = Result; - productReference = D03579A31B2B788F005D26AE /* Result.framework */; - productType = "com.apple.product-type.framework"; - }; - D45480561A9572F5009D7229 /* Result-Mac */ = { - isa = PBXNativeTarget; - buildConfigurationList = D45480721A9572F5009D7229 /* Build configuration list for PBXNativeTarget "Result-Mac" */; - buildPhases = ( - D45480541A9572F5009D7229 /* Headers */, - D45480521A9572F5009D7229 /* Sources */, - D45480531A9572F5009D7229 /* Frameworks */, - D45480551A9572F5009D7229 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "Result-Mac"; - productName = Result; - productReference = D45480571A9572F5009D7229 /* Result.framework */; - productType = "com.apple.product-type.framework"; - }; - D45480661A9572F5009D7229 /* Result-MacTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = D45480751A9572F5009D7229 /* Build configuration list for PBXNativeTarget "Result-MacTests" */; - buildPhases = ( - D45480631A9572F5009D7229 /* Sources */, - D45480641A9572F5009D7229 /* Frameworks */, - D45480651A9572F5009D7229 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - D454806A1A9572F5009D7229 /* PBXTargetDependency */, - ); - name = "Result-MacTests"; - productName = ResultTests; - productReference = D45480671A9572F5009D7229 /* Result-MacTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - D454807C1A957361009D7229 /* Result-iOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = D45480941A957362009D7229 /* Build configuration list for PBXNativeTarget "Result-iOS" */; - buildPhases = ( - D454807A1A957361009D7229 /* Headers */, - D45480781A957361009D7229 /* Sources */, - D45480791A957361009D7229 /* Frameworks */, - D454807B1A957361009D7229 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "Result-iOS"; - productName = "Result-iOS"; - productReference = D454807D1A957361009D7229 /* Result.framework */; - productType = "com.apple.product-type.framework"; - }; - D45480861A957362009D7229 /* Result-iOSTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = D45480951A957362009D7229 /* Build configuration list for PBXNativeTarget "Result-iOSTests" */; - buildPhases = ( - D45480831A957362009D7229 /* Sources */, - D45480841A957362009D7229 /* Frameworks */, - D45480851A957362009D7229 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - D454808A1A957362009D7229 /* PBXTargetDependency */, - ); - name = "Result-iOSTests"; - productName = "Result-iOSTests"; - productReference = D45480871A957362009D7229 /* Result-iOSTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - D454804E1A9572F5009D7229 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0930; - ORGANIZATIONNAME = "Rob Rix"; - TargetAttributes = { - 57FCDE3C1BA280DC00130C48 = { - LastSwiftMigration = 0920; - }; - 57FCDE491BA280E000130C48 = { - LastSwiftMigration = 0920; - }; - D03579991B2B788F005D26AE = { - LastSwiftMigration = 0920; - }; - D45480561A9572F5009D7229 = { - CreatedOnToolsVersion = 6.3; - LastSwiftMigration = 0900; - }; - D45480661A9572F5009D7229 = { - CreatedOnToolsVersion = 6.3; - LastSwiftMigration = 0900; - }; - D454807C1A957361009D7229 = { - CreatedOnToolsVersion = 6.3; - LastSwiftMigration = 1000; - }; - D45480861A957362009D7229 = { - CreatedOnToolsVersion = 6.3; - LastSwiftMigration = 1000; - }; - }; - }; - buildConfigurationList = D45480511A9572F5009D7229 /* Build configuration list for PBXProject "Result" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = D454804D1A9572F5009D7229; - productRefGroup = D45480581A9572F5009D7229 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - D45480561A9572F5009D7229 /* Result-Mac */, - D45480661A9572F5009D7229 /* Result-MacTests */, - D454807C1A957361009D7229 /* Result-iOS */, - D45480861A957362009D7229 /* Result-iOSTests */, - 57FCDE3C1BA280DC00130C48 /* Result-tvOS */, - 57FCDE491BA280E000130C48 /* Result-tvOSTests */, - D03579991B2B788F005D26AE /* Result-watchOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 57FCDE431BA280DC00130C48 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 57FCDE501BA280E000130C48 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D035799F1B2B788F005D26AE /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480551A9572F5009D7229 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480651A9572F5009D7229 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D454807B1A957361009D7229 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480851A957362009D7229 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 57FCDE3D1BA280DC00130C48 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - CD333EF41ED50550004D9C5D /* NoError.swift in Sources */, - 57FCDE3E1BA280DC00130C48 /* ResultProtocol.swift in Sources */, - 57FCDE3F1BA280DC00130C48 /* Result.swift in Sources */, - CD333EF91ED505D7004D9C5D /* AnyError.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 57FCDE4C1BA280E000130C48 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 57FCDE4D1BA280E000130C48 /* ResultTests.swift in Sources */, - CD333F021ED5074F004D9C5D /* AnyErrorTests.swift in Sources */, - CD333EFE1ED50699004D9C5D /* NoErrorTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D035799A1B2B788F005D26AE /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - CD333EF51ED50550004D9C5D /* NoError.swift in Sources */, - 45AE89E61B3A6564007B99D7 /* ResultProtocol.swift in Sources */, - D035799B1B2B788F005D26AE /* Result.swift in Sources */, - CD333EFA1ED505D7004D9C5D /* AnyError.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480521A9572F5009D7229 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - CD333EF21ED50550004D9C5D /* NoError.swift in Sources */, - E93621461B35596200948F2A /* ResultProtocol.swift in Sources */, - D45480971A957465009D7229 /* Result.swift in Sources */, - CD333EF71ED505D7004D9C5D /* AnyError.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480631A9572F5009D7229 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - D454806F1A9572F5009D7229 /* ResultTests.swift in Sources */, - CD333F001ED5074F004D9C5D /* AnyErrorTests.swift in Sources */, - CD333EFC1ED50699004D9C5D /* NoErrorTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480781A957361009D7229 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - CD333EF31ED50550004D9C5D /* NoError.swift in Sources */, - E93621471B35596200948F2A /* ResultProtocol.swift in Sources */, - D45480981A957465009D7229 /* Result.swift in Sources */, - CD333EF81ED505D7004D9C5D /* AnyError.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480831A957362009D7229 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - D45480991A9574B8009D7229 /* ResultTests.swift in Sources */, - CD333F011ED5074F004D9C5D /* AnyErrorTests.swift in Sources */, - CD333EFD1ED50699004D9C5D /* NoErrorTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 57FCDE581BA2814A00130C48 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 57FCDE3C1BA280DC00130C48 /* Result-tvOS */; - targetProxy = 57FCDE571BA2814A00130C48 /* PBXContainerItemProxy */; - }; - D454806A1A9572F5009D7229 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = D45480561A9572F5009D7229 /* Result-Mac */; - targetProxy = D45480691A9572F5009D7229 /* PBXContainerItemProxy */; - }; - D454808A1A957362009D7229 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = D454807C1A957361009D7229 /* Result-iOS */; - targetProxy = D45480891A957362009D7229 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 57FCDE451BA280DC00130C48 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BITCODE_GENERATION_MODE = bitcode; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=appletvsimulator*]" = ""; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = Result/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = Result; - SDKROOT = appletvos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = 3; - }; - name = Debug; - }; - 57FCDE461BA280DC00130C48 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BITCODE_GENERATION_MODE = bitcode; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=appletvsimulator*]" = ""; - COPY_PHASE_STRIP = NO; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Result/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = Result; - SDKROOT = appletvos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = 3; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 57FCDE521BA280E000130C48 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = NO; - CODE_SIGN_IDENTITY = "iPhone Developer"; - FRAMEWORK_SEARCH_PATHS = "$(inherited)"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = Tests/ResultTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - }; - name = Debug; - }; - 57FCDE531BA280E000130C48 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = NO; - CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = "$(inherited)"; - INFOPLIST_FILE = Tests/ResultTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - D03579A11B2B788F005D26AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BITCODE_GENERATION_MODE = bitcode; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchsimulator*]" = ""; - COMBINE_HIDPI_IMAGES = YES; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_VERSION = A; - INFOPLIST_FILE = Result/Info.plist; - INSTALL_PATH = "@rpath"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = Result; - SDKROOT = watchos; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - D03579A21B2B788F005D26AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BITCODE_GENERATION_MODE = bitcode; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchsimulator*]" = ""; - COMBINE_HIDPI_IMAGES = YES; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_VERSION = A; - INFOPLIST_FILE = Result/Info.plist; - INSTALL_PATH = "@rpath"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = Result; - SDKROOT = watchos; - SKIP_INSTALL = YES; - }; - name = Release; - }; - D45480701A9572F5009D7229 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - APPLICATION_EXTENSION_API_ONLY = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = 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; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - PRODUCT_BUNDLE_IDENTIFIER = "com.antitypical.$(PRODUCT_NAME:rfc1034identifier)"; - SDKROOT = macosx; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; - TVOS_DEPLOYMENT_TARGET = 9.0; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - WATCHOS_DEPLOYMENT_TARGET = 2.0; - }; - name = Debug; - }; - D45480711A9572F5009D7229 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - APPLICATION_EXTENSION_API_ONLY = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = 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; - COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - 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; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_BUNDLE_IDENTIFIER = "com.antitypical.$(PRODUCT_NAME:rfc1034identifier)"; - SDKROOT = macosx; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; - TVOS_DEPLOYMENT_TARGET = 9.0; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - WATCHOS_DEPLOYMENT_TARGET = 2.0; - }; - name = Release; - }; - D45480731A9572F5009D7229 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_MODULES = YES; - COMBINE_HIDPI_IMAGES = YES; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_VERSION = A; - INFOPLIST_FILE = Result/Info.plist; - INSTALL_PATH = "@rpath"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = Result; - SKIP_INSTALL = YES; - VALID_ARCHS = x86_64; - }; - name = Debug; - }; - D45480741A9572F5009D7229 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_MODULES = YES; - COMBINE_HIDPI_IMAGES = YES; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_VERSION = A; - INFOPLIST_FILE = Result/Info.plist; - INSTALL_PATH = "@rpath"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = Result; - SKIP_INSTALL = YES; - VALID_ARCHS = x86_64; - }; - name = Release; - }; - D45480761A9572F5009D7229 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = NO; - COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(DEVELOPER_FRAMEWORKS_DIR)", - "$(inherited)", - ); - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = Tests/ResultTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - D45480771A9572F5009D7229 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = NO; - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(DEVELOPER_FRAMEWORKS_DIR)", - "$(inherited)", - ); - INFOPLIST_FILE = Tests/ResultTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - D45480901A957362009D7229 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BITCODE_GENERATION_MODE = bitcode; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphonesimulator*]" = ""; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_BITCODE = YES; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = Result/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = Result; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - D45480911A957362009D7229 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BITCODE_GENERATION_MODE = bitcode; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphonesimulator*]" = ""; - COPY_PHASE_STRIP = NO; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_BITCODE = YES; - INFOPLIST_FILE = Result/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = Result; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - D45480921A957362009D7229 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = NO; - CODE_SIGN_IDENTITY = "iPhone Developer"; - FRAMEWORK_SEARCH_PATHS = "$(inherited)"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = Tests/ResultTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; - }; - name = Debug; - }; - D45480931A957362009D7229 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = NO; - CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = "$(inherited)"; - INFOPLIST_FILE = Tests/ResultTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 57FCDE441BA280DC00130C48 /* Build configuration list for PBXNativeTarget "Result-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 57FCDE451BA280DC00130C48 /* Debug */, - 57FCDE461BA280DC00130C48 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 57FCDE511BA280E000130C48 /* Build configuration list for PBXNativeTarget "Result-tvOSTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 57FCDE521BA280E000130C48 /* Debug */, - 57FCDE531BA280E000130C48 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - D03579A01B2B788F005D26AE /* Build configuration list for PBXNativeTarget "Result-watchOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D03579A11B2B788F005D26AE /* Debug */, - D03579A21B2B788F005D26AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - D45480511A9572F5009D7229 /* Build configuration list for PBXProject "Result" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D45480701A9572F5009D7229 /* Debug */, - D45480711A9572F5009D7229 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - D45480721A9572F5009D7229 /* Build configuration list for PBXNativeTarget "Result-Mac" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D45480731A9572F5009D7229 /* Debug */, - D45480741A9572F5009D7229 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - D45480751A9572F5009D7229 /* Build configuration list for PBXNativeTarget "Result-MacTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D45480761A9572F5009D7229 /* Debug */, - D45480771A9572F5009D7229 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - D45480941A957362009D7229 /* Build configuration list for PBXNativeTarget "Result-iOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D45480901A957362009D7229 /* Debug */, - D45480911A957362009D7229 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - D45480951A957362009D7229 /* Build configuration list for PBXNativeTarget "Result-iOSTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D45480921A957362009D7229 /* Debug */, - D45480931A957362009D7229 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = D454804E1A9572F5009D7229 /* Project object */; -} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 10cf711..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d9810..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-Mac.xcscheme b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-Mac.xcscheme deleted file mode 100644 index eee4090..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-Mac.xcscheme +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-iOS.xcscheme b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-iOS.xcscheme deleted file mode 100644 index d669e9b..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-iOS.xcscheme +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-tvOS.xcscheme b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-tvOS.xcscheme deleted file mode 100644 index e337798..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-tvOS.xcscheme +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-watchOS.xcscheme b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-watchOS.xcscheme deleted file mode 100644 index 59371bc..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-watchOS.xcscheme +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/AnyError.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/AnyError.swift deleted file mode 100644 index ee018d2..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/AnyError.swift +++ /dev/null @@ -1,46 +0,0 @@ -import Foundation - -/// A type-erased error which wraps an arbitrary error instance. This should be -/// useful for generic contexts. -public struct AnyError: Swift.Error { - /// The underlying error. - public let error: Swift.Error - - public init(_ error: Swift.Error) { - if let anyError = error as? AnyError { - self = anyError - } else { - self.error = error - } - } -} - -extension AnyError: ErrorConvertible { - public static func error(from error: Error) -> AnyError { - return AnyError(error) - } -} - -extension AnyError: CustomStringConvertible { - public var description: String { - return String(describing: error) - } -} - -extension AnyError: LocalizedError { - public var errorDescription: String? { - return error.localizedDescription - } - - public var failureReason: String? { - return (error as? LocalizedError)?.failureReason - } - - public var helpAnchor: String? { - return (error as? LocalizedError)?.helpAnchor - } - - public var recoverySuggestion: String? { - return (error as? LocalizedError)?.recoverySuggestion - } -} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/Info.plist b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/Info.plist deleted file mode 100644 index 91eaae8..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/Info.plist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 4.1.0 - CFBundleSignature - ???? - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSHumanReadableCopyright - Copyright © 2015 Rob Rix. All rights reserved. - NSPrincipalClass - - - diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/NoError.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/NoError.swift deleted file mode 100644 index a919f51..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/NoError.swift +++ /dev/null @@ -1,10 +0,0 @@ -/// An “error” that is impossible to construct. -/// -/// This can be used to describe `Result`s where failures will never -/// be generated. For example, `Result` describes a result that -/// contains an `Int`eger and is guaranteed never to be a `failure`. -public enum NoError: Swift.Error, Equatable { - public static func ==(lhs: NoError, rhs: NoError) -> Bool { - return true - } -} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/Result.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/Result.h deleted file mode 100644 index 4742701..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/Result.h +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2015 Rob Rix. All rights reserved. - -/// Project version number for Result. -extern double ResultVersionNumber; - -/// Project version string for Result. -extern const unsigned char ResultVersionString[]; - diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/Result.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/Result.swift deleted file mode 100644 index 7576838..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/Result.swift +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright (c) 2015 Rob Rix. All rights reserved. - -/// An enum representing either a failure with an explanatory error, or a success with a result value. -public enum Result: ResultProtocol, CustomStringConvertible, CustomDebugStringConvertible { - case success(Value) - case failure(Error) - - /// The compatibility alias for the Swift 5's `Result` in the standard library. - /// - /// See https://github.com/apple/swift-evolution/blob/master/proposals/0235-add-result.md - /// and https://forums.swift.org/t/accepted-with-modifications-se-0235-add-result-to-the-standard-library/18603 - /// for the details. - public typealias Success = Value - /// The compatibility alias for the Swift 5's `Result` in the standard library. - /// - /// See https://github.com/apple/swift-evolution/blob/master/proposals/0235-add-result.md - /// and https://forums.swift.org/t/accepted-with-modifications-se-0235-add-result-to-the-standard-library/18603 - /// for the details. - public typealias Failure = Error - - // MARK: Constructors - - /// Constructs a success wrapping a `value`. - public init(value: Value) { - self = .success(value) - } - - /// Constructs a failure wrapping an `error`. - public init(error: Error) { - self = .failure(error) - } - - /// Constructs a result from an `Optional`, failing with `Error` if `nil`. - public init(_ value: Value?, failWith: @autoclosure () -> Error) { - self = value.map(Result.success) ?? .failure(failWith()) - } - - /// Constructs a result from a function that uses `throw`, failing with `Error` if throws. - public init(_ f: @autoclosure () throws -> Value) { - self.init(catching: f) - } - - /// Constructs a result from a function that uses `throw`, failing with `Error` if throws. - @available(*, deprecated, renamed: "init(catching:)") - public init(attempt f: () throws -> Value) { - self.init(catching: f) - } - - /// The same as `init(attempt:)` aiming for the compatibility with the Swift 5's `Result` in the standard library. - /// - /// See https://github.com/apple/swift-evolution/blob/master/proposals/0235-add-result.md - /// and https://forums.swift.org/t/accepted-with-modifications-se-0235-add-result-to-the-standard-library/18603 - /// for the details. - public init(catching body: () throws -> Success) { - do { - self = .success(try body()) - } catch var error { - if Error.self == AnyError.self { - error = AnyError(error) - } - self = .failure(error as! Error) - } - } - - // MARK: Deconstruction - - /// Returns the value from `success` Results or `throw`s the error. - @available(*, deprecated, renamed: "get()") - public func dematerialize() throws -> Value { - return try get() - } - - /// The same as `dematerialize()` aiming for the compatibility with the Swift 5's `Result` in the standard library. - /// - /// See https://github.com/apple/swift-evolution/blob/master/proposals/0235-add-result.md - /// and https://forums.swift.org/t/accepted-with-modifications-se-0235-add-result-to-the-standard-library/18603 - /// for the details. - public func get() throws -> Success { - switch self { - case let .success(value): - return value - case let .failure(error): - throw error - } - } - - /// Case analysis for Result. - /// - /// Returns the value produced by applying `ifFailure` to `failure` Results, or `ifSuccess` to `success` Results. - public func analysis(ifSuccess: (Value) -> Result, ifFailure: (Error) -> Result) -> Result { - switch self { - case let .success(value): - return ifSuccess(value) - case let .failure(value): - return ifFailure(value) - } - } - - // MARK: Errors - - /// The domain for errors constructed by Result. - public static var errorDomain: String { return "com.antitypical.Result" } - - /// The userInfo key for source functions in errors constructed by Result. - public static var functionKey: String { return "\(errorDomain).function" } - - /// The userInfo key for source file paths in errors constructed by Result. - public static var fileKey: String { return "\(errorDomain).file" } - - /// The userInfo key for source file line numbers in errors constructed by Result. - public static var lineKey: String { return "\(errorDomain).line" } - - /// Constructs an error. - public static func error(_ message: String? = nil, function: String = #function, file: String = #file, line: Int = #line) -> NSError { - var userInfo: [String: Any] = [ - functionKey: function, - fileKey: file, - lineKey: line, - ] - - if let message = message { - userInfo[NSLocalizedDescriptionKey] = message - } - - return NSError(domain: errorDomain, code: 0, userInfo: userInfo) - } - - - // MARK: CustomStringConvertible - - public var description: String { - switch self { - case let .success(value): return ".success(\(value))" - case let .failure(error): return ".failure(\(error))" - } - } - - - // MARK: CustomDebugStringConvertible - - public var debugDescription: String { - return description - } - - // MARK: ResultProtocol - public var result: Result { - return self - } -} - -extension Result where Result.Failure == AnyError { - /// Constructs a result from an expression that uses `throw`, failing with `AnyError` if throws. - public init(_ f: @autoclosure () throws -> Value) { - self.init(attempt: f) - } - - /// Constructs a result from a closure that uses `throw`, failing with `AnyError` if throws. - public init(attempt f: () throws -> Value) { - do { - self = .success(try f()) - } catch { - self = .failure(AnyError(error)) - } - } -} - -// MARK: - Derive result from failable closure - -@available(*, deprecated, renamed: "Result.init(attempt:)") -public func materialize(_ f: () throws -> T) -> Result { - return Result(attempt: f) -} - -@available(*, deprecated, renamed: "Result.init(_:)") -public func materialize(_ f: @autoclosure () throws -> T) -> Result { - return Result(try f()) -} - -// MARK: - ErrorConvertible conformance - -extension NSError: ErrorConvertible { - public static func error(from error: Swift.Error) -> Self { - func cast(_ error: Swift.Error) -> T { - return error as! T - } - - return cast(error) - } -} - -// MARK: - migration support - -@available(*, unavailable, message: "Use the overload which returns `Result` instead") -public func materialize(_ f: () throws -> T) -> Result { - fatalError() -} - -@available(*, unavailable, message: "Use the overload which returns `Result` instead") -public func materialize(_ f: @autoclosure () throws -> T) -> Result { - fatalError() -} - -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - -/// Constructs a `Result` with the result of calling `try` with an error pointer. -/// -/// This is convenient for wrapping Cocoa API which returns an object or `nil` + an error, by reference. e.g.: -/// -/// Result.try { NSData(contentsOfURL: URL, options: .dataReadingMapped, error: $0) } -@available(*, unavailable, message: "This has been removed. Use `Result.init(attempt:)` instead. See https://github.com/antitypical/Result/issues/85 for the details.") -public func `try`(_ function: String = #function, file: String = #file, line: Int = #line, `try`: (NSErrorPointer) -> T?) -> Result { - fatalError() -} - -/// Constructs a `Result` with the result of calling `try` with an error pointer. -/// -/// This is convenient for wrapping Cocoa API which returns a `Bool` + an error, by reference. e.g.: -/// -/// Result.try { NSFileManager.defaultManager().removeItemAtURL(URL, error: $0) } -@available(*, unavailable, message: "This has been removed. Use `Result.init(attempt:)` instead. See https://github.com/antitypical/Result/issues/85 for the details.") -public func `try`(_ function: String = #function, file: String = #file, line: Int = #line, `try`: (NSErrorPointer) -> Bool) -> Result<(), NSError> { - fatalError() -} - -#endif - -// MARK: - - -import Foundation diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/ResultProtocol.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/ResultProtocol.swift deleted file mode 100644 index e3ad022..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Result/ResultProtocol.swift +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) 2015 Rob Rix. All rights reserved. - -/// A protocol that can be used to constrain associated types as `Result`. -public protocol ResultProtocol { - associatedtype Value - associatedtype Error: Swift.Error - - init(value: Value) - init(error: Error) - - var result: Result { get } -} - -extension Result { - /// Returns the value if self represents a success, `nil` otherwise. - public var value: Value? { - switch self { - case let .success(value): return value - case .failure: return nil - } - } - - /// Returns the error if self represents a failure, `nil` otherwise. - public var error: Error? { - switch self { - case .success: return nil - case let .failure(error): return error - } - } - - /// Returns a new Result by mapping `Success`es’ values using `transform`, or re-wrapping `Failure`s’ errors. - public func map(_ transform: (Value) -> U) -> Result { - return flatMap { .success(transform($0)) } - } - - /// Returns the result of applying `transform` to `Success`es’ values, or re-wrapping `Failure`’s errors. - public func flatMap(_ transform: (Value) -> Result) -> Result { - switch self { - case let .success(value): return transform(value) - case let .failure(error): return .failure(error) - } - } - - /// Returns a Result with a tuple of the receiver and `other` values if both - /// are `Success`es, or re-wrapping the error of the earlier `Failure`. - public func fanout(_ other: @autoclosure () -> Result) -> Result<(Value, U), Error> { - return self.flatMap { left in other().map { right in (left, right) } } - } - - /// Returns a new Result by mapping `Failure`'s values using `transform`, or re-wrapping `Success`es’ values. - public func mapError(_ transform: (Error) -> Error2) -> Result { - return flatMapError { .failure(transform($0)) } - } - - /// Returns the result of applying `transform` to `Failure`’s errors, or re-wrapping `Success`es’ values. - public func flatMapError(_ transform: (Error) -> Result) -> Result { - switch self { - case let .success(value): return .success(value) - case let .failure(error): return transform(error) - } - } - - /// Returns a new Result by mapping `Success`es’ values using `success`, and by mapping `Failure`'s values using `failure`. - public func bimap(success: (Value) -> U, failure: (Error) -> Error2) -> Result { - switch self { - case let .success(value): return .success(success(value)) - case let .failure(error): return .failure(failure(error)) - } - } -} - -extension Result { - - // MARK: Higher-order functions - - /// Returns `self.value` if this result is a .Success, or the given value otherwise. Equivalent with `??` - public func recover(_ value: @autoclosure () -> Value) -> Value { - return self.value ?? value() - } - - /// Returns this result if it is a .Success, or the given result otherwise. Equivalent with `??` - public func recover(with result: @autoclosure () -> Result) -> Result { - switch self { - case .success: return self - case .failure: return result() - } - } -} - -/// Protocol used to constrain `tryMap` to `Result`s with compatible `Error`s. -public protocol ErrorConvertible: Swift.Error { - static func error(from error: Swift.Error) -> Self -} - -extension Result where Result.Failure: ErrorConvertible { - - /// Returns the result of applying `transform` to `Success`es’ values, or wrapping thrown errors. - public func tryMap(_ transform: (Value) throws -> U) -> Result { - return flatMap { value in - do { - return .success(try transform(value)) - } - catch { - let convertedError = Error.error(from: error) - // Revisit this in a future version of Swift. https://twitter.com/jckarter/status/672931114944696321 - return .failure(convertedError) - } - } - } -} - -// MARK: - Operators - -extension Result where Result.Success: Equatable, Result.Failure: Equatable { - /// Returns `true` if `left` and `right` are both `Success`es and their values are equal, or if `left` and `right` are both `Failure`s and their errors are equal. - public static func ==(left: Result, right: Result) -> Bool { - if let left = left.value, let right = right.value { - return left == right - } else if let left = left.error, let right = right.error { - return left == right - } - return false - } -} - -#if swift(>=4.1) - extension Result: Equatable where Result.Success: Equatable, Result.Failure: Equatable { } -#else - extension Result where Result.Success: Equatable, Result.Failure: Equatable { - /// Returns `true` if `left` and `right` represent different cases, or if they represent the same case but different values. - public static func !=(left: Result, right: Result) -> Bool { - return !(left == right) - } - } -#endif - -extension Result { - /// Returns the value of `left` if it is a `Success`, or `right` otherwise. Short-circuits. - public static func ??(left: Result, right: @autoclosure () -> Value) -> Value { - return left.recover(right()) - } - - /// Returns `left` if it is a `Success`es, or `right` otherwise. Short-circuits. - public static func ??(left: Result, right: @autoclosure () -> Result) -> Result { - return left.recover(with: right()) - } -} - -// MARK: - migration support - -@available(*, unavailable, renamed: "ErrorConvertible") -public protocol ErrorProtocolConvertible: ErrorConvertible {} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/LinuxMain.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/LinuxMain.swift deleted file mode 100644 index ec2c509..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/LinuxMain.swift +++ /dev/null @@ -1,8 +0,0 @@ -import XCTest - -import ResultTests - -var tests = [XCTestCaseEntry]() -tests += ResultTests.__allTests() - -XCTMain(tests) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/AnyErrorTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/AnyErrorTests.swift deleted file mode 100644 index 65a2661..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/AnyErrorTests.swift +++ /dev/null @@ -1,12 +0,0 @@ -import Foundation -import XCTest -import Result - -final class AnyErrorTests: XCTestCase { - func testAnyError() { - let error = Error.a - let anyErrorFromError = AnyError(error) - let anyErrorFromAnyError = AnyError(anyErrorFromError) - XCTAssertTrue(anyErrorFromError == anyErrorFromAnyError) - } -} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/Info.plist b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/Info.plist deleted file mode 100644 index 7861e6f..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 4.1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/NoErrorTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/NoErrorTests.swift deleted file mode 100644 index 61bc107..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/NoErrorTests.swift +++ /dev/null @@ -1,11 +0,0 @@ -import Foundation -import XCTest -import Result - -final class NoErrorTests: XCTestCase { - func testEquatable() { - let foo = Result(1) - let bar = Result(1) - XCTAssertTrue(foo == bar) - } -} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/ResultTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/ResultTests.swift deleted file mode 100644 index f7fb38c..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/ResultTests.swift +++ /dev/null @@ -1,256 +0,0 @@ -// Copyright (c) 2015 Rob Rix. All rights reserved. - -final class ResultTests: XCTestCase { - func testMapTransformsSuccesses() { - XCTAssertEqual(success.map { $0.count } ?? 0, 7) - } - - func testMapRewrapsFailures() { - XCTAssertEqual(failure.map { $0.count } ?? 0, 0) - } - - func testInitOptionalSuccess() { - XCTAssert(Result("success" as String?, failWith: error) == success) - } - - func testInitOptionalFailure() { - XCTAssert(Result(nil, failWith: error) == failure) - } - - func testFanout() { - let resultSuccess = success.fanout(success) - if let (x, y) = resultSuccess.value { - XCTAssertTrue(x == "success" && y == "success") - } else { - XCTFail() - } - - let resultFailureBoth = failure.fanout(failure2) - XCTAssert(resultFailureBoth.error == error) - - let resultFailureLeft = failure.fanout(success) - XCTAssert(resultFailureLeft.error == error) - - let resultFailureRight = success.fanout(failure2) - XCTAssert(resultFailureRight.error == error2) - } - - func testBimapTransformsSuccesses() { - XCTAssertEqual(success.bimap( - success: { $0.count }, - failure: { $0 } - ) ?? 0, 7) - } - - func testBimapTransformsFailures() { - XCTAssert(failure.bimap( - success: { $0 }, - failure: { _ in error2 } - ) == failure2) - } - - // MARK: Errors - - func testErrorsIncludeTheSourceFile() { - let file = #file - XCTAssert(Result<(), NSError>.error().file == file) - } - - func testErrorsIncludeTheSourceLine() { - let (line, error) = (#line, Result<(), NSError>.error()) - XCTAssertEqual(error.line ?? -1, line) - } - - func testErrorsIncludeTheCallingFunction() { - let function = #function - XCTAssert(Result<(), NSError>.error().function == function) - } - - func testAnyErrorDelegatesLocalizedDescriptionToUnderlyingError() { - XCTAssertEqual(error.errorDescription, "localized description") - XCTAssertEqual(error.localizedDescription, "localized description") - XCTAssertEqual(error3.errorDescription, "localized description") - XCTAssertEqual(error3.localizedDescription, "localized description") - } - - func testAnyErrorDelegatesLocalizedFailureReasonToUnderlyingError() { - XCTAssertEqual(error.failureReason, "failure reason") - } - - func testAnyErrorDelegatesLocalizedRecoverySuggestionToUnderlyingError() { - XCTAssertEqual(error.recoverySuggestion, "recovery suggestion") - } - - func testAnyErrorDelegatesLocalizedHelpAnchorToUnderlyingError() { - XCTAssertEqual(error.helpAnchor, "help anchor") - } - - // MARK: Try - Catch - - func testTryCatchProducesSuccesses() { - let result: Result = Result(try tryIsSuccess("success")) - XCTAssert(result == success) - } - - func testTryCatchProducesFailures() { - let result: Result = Result(try tryIsSuccess(nil)) - XCTAssert(result.error == error) - } - - func testTryCatchWithFunctionProducesSuccesses() { - let function = { try tryIsSuccess("success") } - - let result: Result = Result(attempt: function) - XCTAssert(result == success) - } - - func testTryCatchWithFunctionCatchProducesFailures() { - let function = { try tryIsSuccess(nil) } - - let result: Result = Result(attempt: function) - XCTAssert(result.error == error) - } - - func testTryCatchWithFunctionThrowingNonAnyErrorCanProducesAnyErrorFailures() { - let nsError = NSError(domain: "", code: 0) - let function: () throws -> String = { throw nsError } - - let result: Result = Result(attempt: function) - XCTAssert(result.error == AnyError(nsError)) - } - - func testMaterializeProducesSuccesses() { - let result1: Result = Result(try tryIsSuccess("success")) - XCTAssert(result1 == success) - - let result2: Result = Result(attempt: { try tryIsSuccess("success") }) - XCTAssert(result2 == success) - } - - func testMaterializeProducesFailures() { - let result1: Result = Result(try tryIsSuccess(nil)) - XCTAssert(result1.error == error) - - let result2: Result = Result(attempt: { try tryIsSuccess(nil) }) - XCTAssert(result2.error == error) - } - - func testMaterializeInferrence() { - let result = Result(attempt: { try tryIsSuccess(nil) }) - XCTAssert((type(of: result) as Any.Type) is Result.Type) - } - - // MARK: Recover - - func testRecoverProducesLeftForLeftSuccess() { - let left = Result.success("left") - XCTAssertEqual(left.recover("right"), "left") - } - - func testRecoverProducesRightForLeftFailure() { - let left = Result.failure(Error.a) - XCTAssertEqual(left.recover("right"), "right") - } - - // MARK: Recover With - - func testRecoverWithProducesLeftForLeftSuccess() { - let left = Result.success("left") - let right = Result.success("right") - - XCTAssertEqual(left.recover(with: right).value, "left") - } - - func testRecoverWithProducesRightSuccessForLeftFailureAndRightSuccess() { - struct Error: Swift.Error {} - - let left = Result.failure(Error()) - let right = Result.success("right") - - XCTAssertEqual(left.recover(with: right).value, "right") - } - - func testRecoverWithProducesRightFailureForLeftFailureAndRightFailure() { - enum Error: Swift.Error { case left, right } - - let left = Result.failure(.left) - let right = Result.failure(.right) - - XCTAssertEqual(left.recover(with: right).error, .right) - } - - func testTryMapProducesSuccess() { - let result = success.tryMap(tryIsSuccess) - XCTAssert(result == success) - } - - func testTryMapProducesFailure() { - let result = Result.success("fail").tryMap(tryIsSuccess) - XCTAssert(result == failure) - } -} - - -// MARK: - Fixtures - -enum Error: Swift.Error, LocalizedError { - case a, b - - var errorDescription: String? { - return "localized description" - } - - var failureReason: String? { - return "failure reason" - } - - var helpAnchor: String? { - return "help anchor" - } - - var recoverySuggestion: String? { - return "recovery suggestion" - } -} - -let success = Result.success("success") -let error = AnyError(Error.a) -let error2 = AnyError(Error.b) -let error3 = AnyError(NSError(domain: "Result", code: 42, userInfo: [NSLocalizedDescriptionKey: "localized description"])) -let failure = Result.failure(error) -let failure2 = Result.failure(error2) - -// MARK: - Helpers - -extension AnyError: Equatable { - public static func ==(lhs: AnyError, rhs: AnyError) -> Bool { - return lhs.error._code == rhs.error._code - && lhs.error._domain == rhs.error._domain - } -} - -func tryIsSuccess(_ text: String?) throws -> String { - guard let text = text, text == "success" else { - throw error - } - - return text -} - -extension NSError { - var function: String? { - return userInfo[Result<(), NSError>.functionKey] as? String - } - - var file: String? { - return userInfo[Result<(), NSError>.fileKey] as? String - } - - var line: Int? { - return userInfo[Result<(), NSError>.lineKey] as? Int - } -} - -import Foundation -import Result -import XCTest diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/XCTestManifests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/XCTestManifests.swift deleted file mode 100644 index 7366acf..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Result/Tests/ResultTests/XCTestManifests.swift +++ /dev/null @@ -1,57 +0,0 @@ -import XCTest - -extension AnyErrorTests { - static let __allTests = [ - ("testAnyError", testAnyError), - ] -} - -extension NoErrorTests { - static let __allTests = [ - ("testEquatable", testEquatable), - ] -} - -extension ResultTests { - static let __allTests = [ - ("testAnyErrorDelegatesLocalizedDescriptionToUnderlyingError", testAnyErrorDelegatesLocalizedDescriptionToUnderlyingError), - ("testAnyErrorDelegatesLocalizedFailureReasonToUnderlyingError", testAnyErrorDelegatesLocalizedFailureReasonToUnderlyingError), - ("testAnyErrorDelegatesLocalizedHelpAnchorToUnderlyingError", testAnyErrorDelegatesLocalizedHelpAnchorToUnderlyingError), - ("testAnyErrorDelegatesLocalizedRecoverySuggestionToUnderlyingError", testAnyErrorDelegatesLocalizedRecoverySuggestionToUnderlyingError), - ("testBimapTransformsFailures", testBimapTransformsFailures), - ("testBimapTransformsSuccesses", testBimapTransformsSuccesses), - ("testErrorsIncludeTheCallingFunction", testErrorsIncludeTheCallingFunction), - ("testErrorsIncludeTheSourceFile", testErrorsIncludeTheSourceFile), - ("testErrorsIncludeTheSourceLine", testErrorsIncludeTheSourceLine), - ("testFanout", testFanout), - ("testInitOptionalFailure", testInitOptionalFailure), - ("testInitOptionalSuccess", testInitOptionalSuccess), - ("testMapRewrapsFailures", testMapRewrapsFailures), - ("testMapTransformsSuccesses", testMapTransformsSuccesses), - ("testMaterializeInferrence", testMaterializeInferrence), - ("testMaterializeProducesFailures", testMaterializeProducesFailures), - ("testMaterializeProducesSuccesses", testMaterializeProducesSuccesses), - ("testRecoverProducesLeftForLeftSuccess", testRecoverProducesLeftForLeftSuccess), - ("testRecoverProducesRightForLeftFailure", testRecoverProducesRightForLeftFailure), - ("testRecoverWithProducesLeftForLeftSuccess", testRecoverWithProducesLeftForLeftSuccess), - ("testRecoverWithProducesRightFailureForLeftFailureAndRightFailure", testRecoverWithProducesRightFailureForLeftFailureAndRightFailure), - ("testRecoverWithProducesRightSuccessForLeftFailureAndRightSuccess", testRecoverWithProducesRightSuccessForLeftFailureAndRightSuccess), - ("testTryCatchProducesFailures", testTryCatchProducesFailures), - ("testTryCatchProducesSuccesses", testTryCatchProducesSuccesses), - ("testTryCatchWithFunctionCatchProducesFailures", testTryCatchWithFunctionCatchProducesFailures), - ("testTryCatchWithFunctionProducesSuccesses", testTryCatchWithFunctionProducesSuccesses), - ("testTryCatchWithFunctionThrowingNonAnyErrorCanProducesAnyErrorFailures", testTryCatchWithFunctionThrowingNonAnyErrorCanProducesAnyErrorFailures), - ("testTryMapProducesFailure", testTryMapProducesFailure), - ("testTryMapProducesSuccess", testTryMapProducesSuccess), - ] -} - -#if !os(macOS) -public func __allTests() -> [XCTestCaseEntry] { - return [ - testCase(AnyErrorTests.__allTests), - testCase(NoErrorTests.__allTests), - testCase(ResultTests.__allTests), - ] -} -#endif diff --git a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/LICENSE.txt b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/LICENSE.txt deleted file mode 100644 index ca8f5b8..0000000 --- a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/LICENSE.txt +++ /dev/null @@ -1,13 +0,0 @@ -Copyright © 2017 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Package.swift b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Package.swift deleted file mode 100644 index c1e2ed8..0000000 --- a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Package.swift +++ /dev/null @@ -1,9 +0,0 @@ -import PackageDescription - -let package = Package( - name: "CwlCatchException", - targets: [ - Target(name: "CwlCatchException", dependencies: ["CwlCatchExceptionSupport"]), - Target(name: "CwlCatchExceptionSupport") - ] -) diff --git a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/README.md b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/README.md deleted file mode 100644 index 0f97b03..0000000 --- a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# CwlCatchException -A simple Swift wrapper around an Objective-C `@try`/`@catch` statement that selectively catches Objective-C exceptions by `NSException` subtype, rethrowing if any caught exception is not the expected subtype. - -Look at [CwlCatchExceptionTests.swift](https://github.com/mattgallagher/CwlCatchException/blob/master/CwlCatchExceptionTests/CwlCatchExceptionTests.swift?ts=4) for syntax. - -## Adding to your project - -This project can be used by direct inclusion in your projects or through any of the Swift Package Manager, CocoaPods or Carthage. - -Minimum requirements are iOS 8 or macOS 10.9. - -### Manual inclusion - -1. In a subdirectory of your project's directory, run `git clone https://github.com/mattgallagher/CwlCatchException.git` -2. Drag the "CwlCatchException.xcodeproj" file from the Finder into your own project's file tree in Xcode -3. Add the "CwlCatchException.framework" from the "Products" folder of the CwlCatchException project's file tree to the "Copy Files (Frameworks)" build phases of any target that you want to include this module. - -That third step is a little tricky if you're unfamiliar with Xcode but it involves: - -a. click on your project in the file tree -b. click on the target to whih you want to add this module -c. select the "Build Phases" tab -d. if you don't already have a "Copy File" build phase with a "Destination: Frameworks", add one using the "+" button in the top left of the tab -e. click the "+" within the "Copy File (Frameworks)" phase and from the list that appears, select the "CwlCatchException.framework" (if there are multiple frameworks with the same name, look for the one that appears *above* the corresponding macOS or iOS CwlCatchException testing target). - -### Swift Package Manager - -Add the following to the `dependencies` array in your "Package.swift" file: - - .Package(url: "https://github.com/mattgallagher/CwlCatchException.git", majorVersion: 1), - -Or, if you're using the `swift-tools-version:4.0` package manager, add the following to the `dependencies` array in your "Package.swift" file: - - .package(url: "https://github.com/mattgallagher/CwlCatchException.git", majorVersion: 1) - -### CocoaPods - -Add the following to your target in your "Podfile": - - pod 'CwlCatchException', :git => 'https://github.com/mattgallagher/CwlCatchException.git' - -### Carthage - -Add the following line to your Cartfile: - - git "https://github.com/mattgallagher/CwlCatchException.git" "master" diff --git a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift deleted file mode 100644 index 3e89e23..0000000 --- a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift +++ /dev/null @@ -1,35 +0,0 @@ -// -// CwlCatchException.swift -// CwlAssertionTesting -// -// Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// - -import Foundation - -#if SWIFT_PACKAGE -import CwlCatchExceptionSupport -#endif - -private func catchReturnTypeConverter(_ type: T.Type, block: () -> Void) -> T? { - return catchExceptionOfKind(type, block) as? T -} - -extension NSException { - public static func catchException(in block: () -> Void) -> Self? { - return catchReturnTypeConverter(self, block: block) - } -} diff --git a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m deleted file mode 100644 index 8cf414f..0000000 --- a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m +++ /dev/null @@ -1,37 +0,0 @@ -// -// CwlCatchException.m -// CwlAssertionTesting -// -// Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// - -#import "CwlCatchException.h" - -#if !SWIFT_PACKAGE && NON_SWIFT_PACKAGE -__attribute__((visibility("hidden"))) -#endif -NSException* catchExceptionOfKind(Class __nonnull type, __attribute__((noescape)) void (^ __nonnull inBlock)(void)) { - @try { - inBlock(); - } @catch (NSException *exception) { - if ([exception isKindOfClass:type]) { - return exception; - } else { - @throw; - } - } - return nil; -} diff --git a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h deleted file mode 100644 index 0c8dd87..0000000 --- a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// CwlCatchException.h -// CwlCatchException -// -// Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// - -#import - -//! Project version number for CwlCatchException. -FOUNDATION_EXPORT double CwlCatchExceptionVersionNumber; - -//! Project version string for CwlCatchException. -FOUNDATION_EXPORT const unsigned char CwlCatchExceptionVersionString[]; - -#if !SWIFT_PACKAGE && NON_SWIFT_PACKAGE -__attribute__((visibility("hidden"))) -#endif -NSException* __nullable catchExceptionOfKind(Class __nonnull type, __attribute__((noescape)) void (^ __nonnull inBlock)(void)); diff --git a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h deleted file mode 100644 index 7c50da1..0000000 --- a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// CwlPreconditionTesting.h -// CwlPreconditionTesting -// -// Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// - -#import - -extern bool _swift_reportFatalErrorsToDebugger; - -//! Project version number for CwlUtils. -FOUNDATION_EXPORT double CwlPreconditionTestingVersionNumber; - -//! Project version string for CwlUtils. -FOUNDATION_EXPORT const unsigned char CwlAssertingTestingVersionString[]; - -#include "CwlMachBadInstructionHandler.h" -#include "CwlCatchException.h" diff --git a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h b/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h deleted file mode 100644 index 4e28f95..0000000 --- a/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// CwlPreconditionTesting.h -// CwlPreconditionTesting -// -// Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// - -#import - -extern bool _swift_reportFatalErrorsToDebugger; - -//! Project version number for CwlUtils. -FOUNDATION_EXPORT double CwlPreconditionTesting_POSIXVersionNumber; - -//! Project version string for CwlUtils. -FOUNDATION_EXPORT const unsigned char CwlAssertingTesting_POSIXVersionString[]; diff --git a/Carthage/Checkouts/Quick/Sources/Quick/NSString+C99ExtendedIdentifier.swift b/Carthage/Checkouts/Quick/Sources/Quick/NSString+C99ExtendedIdentifier.swift deleted file mode 100644 index acb650b..0000000 --- a/Carthage/Checkouts/Quick/Sources/Quick/NSString+C99ExtendedIdentifier.swift +++ /dev/null @@ -1,49 +0,0 @@ -#if canImport(Darwin) -import Foundation - -extension NSString { - private static var invalidCharacters: CharacterSet = { - var invalidCharacters = CharacterSet() - - let invalidCharacterSets: [CharacterSet] = [ - .whitespacesAndNewlines, - .illegalCharacters, - .controlCharacters, - .punctuationCharacters, - .nonBaseCharacters, - .symbols - ] - - for invalidSet in invalidCharacterSets { - invalidCharacters.formUnion(invalidSet) - } - - return invalidCharacters - }() - - /// This API is not meant to be used outside Quick, so will be unavailable in - /// a next major version. - @objc(qck_c99ExtendedIdentifier) - public var c99ExtendedIdentifier: String { - let validComponents = components(separatedBy: NSString.invalidCharacters) - let result = validComponents.joined(separator: "_") - - return result.isEmpty ? "_" : result - } -} - -/// Extension methods or properties for NSObject subclasses are invisible from -/// the Objective-C runtime on static linking unless the consumers add `-ObjC` -/// linker flag, so let's make a wrapper class to mitigate that situation. -/// -/// See: https://github.com/Quick/Quick/issues/785 and https://github.com/Quick/Quick/pull/803 -@objc -class QCKObjCStringUtils: NSObject { - override private init() {} - - @objc - static func c99ExtendedIdentifier(from string: String) -> String { - return string.c99ExtendedIdentifier - } -} -#endif diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/SpecRunner.swift b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/SpecRunner.swift deleted file mode 100644 index 66dec1b..0000000 --- a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/SpecRunner.swift +++ /dev/null @@ -1,30 +0,0 @@ -@testable import Quick -import Nimble - -@discardableResult -public func qck_runSpec(_ specClass: QuickSpec.Type) -> TestRun? { - return qck_runSpecs([specClass]) -} - -@discardableResult -public func qck_runSpecs(_ specClasses: [QuickSpec.Type]) -> TestRun? { - Quick.World.sharedWorld.isRunningAdditionalSuites = true - - var executionCount: UInt = 0 - var hadUnexpectedFailure = false - - let fails = gatherFailingExpectations(silently: true) { - for specClass in specClasses { - for (_, test) in specClass.allTests { - do { - try test(specClass.init())() - } catch { - hadUnexpectedFailure = true - } - executionCount += 1 - } - } - } - - return TestRun(executionCount: executionCount, hasSucceeded: fails.isEmpty && !hadUnexpectedFailure) -} diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/TestRun.swift b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/TestRun.swift deleted file mode 100644 index 3ef0d6c..0000000 --- a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/TestRun.swift +++ /dev/null @@ -1,9 +0,0 @@ -public struct TestRun { - public var executionCount: UInt - public var hasSucceeded: Bool - - public init(executionCount: UInt, hasSucceeded: Bool) { - self.executionCount = executionCount - self.hasSucceeded = hasSucceeded - } -} diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+QuickSpec_MethodList.h b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+QuickSpec_MethodList.h deleted file mode 100644 index 5e5c447..0000000 --- a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+QuickSpec_MethodList.h +++ /dev/null @@ -1,17 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface QuickSpec (QuickSpec_MethodList) - -/** - * This method will instantiate an instance of the class on which it is called, - * returning a list of selector names for it. - * - * @return a set of NSStrings representing the list of selectors it contains - */ -+ (NSSet *)allSelectors; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+QuickSpec_MethodList.m b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+QuickSpec_MethodList.m deleted file mode 100644 index 5a403f2..0000000 --- a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+QuickSpec_MethodList.m +++ /dev/null @@ -1,23 +0,0 @@ -#import "QuickSpec+QuickSpec_MethodList.h" -#import - - -@implementation QuickSpec (QuickSpec_MethodList) - -+ (NSSet *)allSelectors { - QuickSpec *specInstance = [[[self class] alloc] init]; - NSMutableSet *allSelectors = [NSMutableSet set]; - - unsigned int methodCount = 0; - Method *methodList = class_copyMethodList(object_getClass(specInstance), &methodCount); - - for (unsigned int i = 0; i < methodCount; i++) { - SEL selector = method_getName(methodList[i]); - [allSelectors addObject:NSStringFromSelector(selector)]; - } - - free(methodList); - return [allSelectors copy]; -} - -@end diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.h b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.h deleted file mode 100644 index d69f808..0000000 --- a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.h +++ /dev/null @@ -1,20 +0,0 @@ -#import - -/** - Add the ability to temporarily disable internal XCTest execution observation in - order to run isolated XCTestSuite instances while the QuickTests test suite is running. - */ -@interface XCTestObservationCenter (QCKSuspendObservation) - -/** - Suspends test suite observation for XCTest-provided observers for the duration that - the block is executing. Any test suites that are executed within the block do not - generate any log output. Failures are still reported. - - Use this method to run XCTestSuite objects while another XCTestSuite is running. - Without this method, tests fail with the message: "Timed out waiting for IDE - barrier message to complete" or "Unexpected TestSuiteDidStart". - */ -- (void)qck_suspendObservationForBlock:(void (^)(void))block; - -@end diff --git a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.m b/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.m deleted file mode 100644 index 1a32e10..0000000 --- a/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.m +++ /dev/null @@ -1,54 +0,0 @@ -@import XCTest; -#import - -@interface XCTestObservationCenter (Redeclaration) -- (id)observers; -- (void)removeTestObserver:(id)testObserver; -@end - -@implementation XCTestObservationCenter (QCKSuspendObservation) - -/// This allows us to only suspend observation for observers by provided by Apple -/// as a part of the XCTest framework. In particular it is important that we not -/// suspend the observer added by Nimble, otherwise it is unable to properly -/// report assertion failures. -static BOOL (^isFromApple)(id) = ^BOOL(id observer){ - return [[NSBundle bundleForClass:[observer class]].bundleIdentifier containsString:@"com.apple.dt.XCTest"]; -}; - -- (void)qck_suspendObservationForBlock:(void (^)(void))block { - id originalObservers = [[self observers] copy]; - NSMutableArray *suspendedObservers = [NSMutableArray new]; - - for (id observer in originalObservers) { - if (isFromApple(observer)) { - [suspendedObservers addObject:observer]; - - if ([self respondsToSelector:@selector(removeTestObserver:)]) { - [self removeTestObserver:observer]; - } - else if ([[self observers] respondsToSelector:@selector(removeObject:)]) { - [[self observers] removeObject:observer]; - } - else { - NSAssert(NO, @"unexpected type: unable to remove observers: %@", originalObservers); - } - } - } - - @try { - block(); - } - @finally { - for (id observer in suspendedObservers) { - if ([[self observers] respondsToSelector:@selector(addObject:)]) { - [[self observers] addObject:observer]; - } - else if ([self respondsToSelector:@selector(addTestObserver:)]) { - [self addTestObserver:observer]; - } - } - } -} - -@end diff --git a/Carthage/Checkouts/Result/.gitignore b/Carthage/Checkouts/Result/.gitignore deleted file mode 100644 index 29471cb..0000000 --- a/Carthage/Checkouts/Result/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -.DS_Store -xcuserdata -*.xcuserdatad -*.xccheckout -*.mode* -*.pbxuser - -Carthage/Build -.build diff --git a/Carthage/Checkouts/Result/.swift-version b/Carthage/Checkouts/Result/.swift-version deleted file mode 100644 index bf77d54..0000000 --- a/Carthage/Checkouts/Result/.swift-version +++ /dev/null @@ -1 +0,0 @@ -4.2 diff --git a/Carthage/Checkouts/Result/.travis.yml b/Carthage/Checkouts/Result/.travis.yml deleted file mode 100644 index 6e9fbf1..0000000 --- a/Carthage/Checkouts/Result/.travis.yml +++ /dev/null @@ -1,94 +0,0 @@ -branches: - only: - - master - -matrix: - include: - - script: - - set -o pipefail - - xcodebuild $XCODE_ACTION -scheme Result-Mac | xcpretty - - xcodebuild $XCODE_ACTION -scheme Result-iOS -sdk iphonesimulator -destination "name=iPhone SE" | xcpretty - - xcodebuild $XCODE_ACTION -scheme Result-tvOS -sdk appletvsimulator -destination "name=Apple TV" | xcpretty - - xcodebuild build -scheme Result-watchOS -sdk watchsimulator | xcpretty - - gem update cocoapods && rm .swift-version && pod lib lint - env: - - JOB=Xcode - - XCODE_ACTION="build-for-testing test-without-building" - os: osx - osx_image: xcode9.2 - language: objective-c - - script: - - set -o pipefail - - xcodebuild $XCODE_ACTION -scheme Result-Mac | xcpretty - - xcodebuild $XCODE_ACTION -scheme Result-iOS -sdk iphonesimulator -destination "name=iPhone SE" | xcpretty - - xcodebuild $XCODE_ACTION -scheme Result-tvOS -sdk appletvsimulator -destination "name=Apple TV" | xcpretty - - xcodebuild build -scheme Result-watchOS -sdk watchsimulator | xcpretty - - rm .swift-version && pod lib lint - env: - - JOB=Xcode - - XCODE_ACTION="build-for-testing test-without-building" - os: osx - osx_image: xcode9.3 - language: objective-c - - script: - - set -o pipefail - - xcodebuild $XCODE_ACTION -scheme Result-Mac | xcpretty - - xcodebuild $XCODE_ACTION -scheme Result-iOS -sdk iphonesimulator -destination "name=iPhone SE" | xcpretty - - xcodebuild $XCODE_ACTION -scheme Result-tvOS -sdk appletvsimulator -destination "name=Apple TV" | xcpretty - - xcodebuild build -scheme Result-watchOS -sdk watchsimulator | xcpretty - env: - - JOB=Xcode - - XCODE_ACTION="build-for-testing test-without-building" - os: osx - osx_image: xcode10 - language: objective-c - - script: - - swift --version - - swift build - - swift test - env: JOB=SPM - os: osx - osx_image: xcode9.2 - language: objective-c - - script: - - swift --version - - swift build - - swift test - env: JOB=SPM - os: osx - osx_image: xcode9.3 - language: objective-c - - script: - - swift --version - - swift build - - swift test - env: JOB=SPM - os: osx - osx_image: xcode10 - language: objective-c - - script: - - swift --version - - swift build - - swift test - env: - - JOB=Linux - sudo: required - dist: trusty - language: generic - install: - - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" - - script: - - swift --version - - swift build - - swift test - env: - - JOB=Linux - - SWIFT_VERSION=5.0-DEVELOPMENT-SNAPSHOT-2018-12-28-a - sudo: required - dist: trusty - language: generic - install: - - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" - -notifications: - email: false diff --git a/Carthage/Checkouts/Result/CONTRIBUTING.md b/Carthage/Checkouts/Result/CONTRIBUTING.md deleted file mode 100644 index f58c3fa..0000000 --- a/Carthage/Checkouts/Result/CONTRIBUTING.md +++ /dev/null @@ -1,23 +0,0 @@ -We love that you're interested in contributing to this project! - -To make the process as painless as possible, we have just a couple of guidelines -that should make life easier for everyone involved. - -## Prefer Pull Requests - -If you know exactly how to implement the feature being suggested or fix the bug -being reported, please open a pull request instead of an issue. Pull requests are easier than -patches or inline code blocks for discussing and merging the changes. - -If you can't make the change yourself, please open an issue after making sure -that one isn't already logged. - -## Contributing Code - -Fork this repository, make it awesomer (preferably in a branch named for the -topic), send a pull request! - -All code contributions should match our [coding -conventions](https://github.com/github/swift-style-guide). - -Thanks for contributing! :boom::camel: diff --git a/Carthage/Checkouts/Result/LICENSE b/Carthage/Checkouts/Result/LICENSE deleted file mode 100644 index 3026ee1..0000000 --- a/Carthage/Checkouts/Result/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Rob Rix - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/Carthage/Checkouts/Result/Package.swift b/Carthage/Checkouts/Result/Package.swift deleted file mode 100644 index c93a688..0000000 --- a/Carthage/Checkouts/Result/Package.swift +++ /dev/null @@ -1,14 +0,0 @@ -// swift-tools-version:4.0 -import PackageDescription - -let package = Package( - name: "Result", - products: [ - .library(name: "Result", targets: ["Result"]), - ], - targets: [ - .target(name: "Result", dependencies: [], path: "Result"), - .testTarget(name: "ResultTests", dependencies: ["Result"]), - ], - swiftLanguageVersions: [4] -) diff --git a/Carthage/Checkouts/Result/Package@swift-5.swift b/Carthage/Checkouts/Result/Package@swift-5.swift deleted file mode 100644 index 6059b85..0000000 --- a/Carthage/Checkouts/Result/Package@swift-5.swift +++ /dev/null @@ -1,14 +0,0 @@ -// swift-tools-version:5.0 -import PackageDescription - -let package = Package( - name: "Result", - products: [ - .library(name: "Result", targets: ["Result"]), - ], - targets: [ - .target(name: "Result", dependencies: [], path: "Result"), - .testTarget(name: "ResultTests", dependencies: ["Result"]), - ], - swiftLanguageVersions: [.v4, .v4_2, .v5] -) diff --git a/Carthage/Checkouts/Result/README.md b/Carthage/Checkouts/Result/README.md deleted file mode 100644 index c030316..0000000 --- a/Carthage/Checkouts/Result/README.md +++ /dev/null @@ -1,112 +0,0 @@ -# Result - -[![Build Status](https://travis-ci.org/antitypical/Result.svg?branch=master)](https://travis-ci.org/antitypical/Result) -[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) -[![CocoaPods](https://img.shields.io/cocoapods/v/Result.svg)](https://cocoapods.org/) -[![Reference Status](https://www.versioneye.com/objective-c/result/reference_badge.svg?style=flat)](https://www.versioneye.com/objective-c/result/references) - -This is a Swift µframework providing `Result`. - -`Result` values are either successful (wrapping `Value`) or failed (wrapping `Error`). This is similar to Swift’s native `Optional` type: `success` is like `some`, and `failure` is like `none` except with an associated `Error` value. The addition of an associated `Error` allows errors to be passed along for logging or displaying to the user. - -Using this µframework instead of rolling your own `Result` type allows you to easily interface with other frameworks that also use `Result`. - -## Use - -Use `Result` whenever an operation has the possibility of failure. Consider the following example of a function that tries to extract a `String` for a given key from a JSON `Dictionary`. - -```swift -typealias JSONObject = [String: Any] - -enum JSONError: Error { - case noSuchKey(String) - case typeMismatch -} - -func stringForKey(json: JSONObject, key: String) -> Result { - guard let value = json[key] else { - return .failure(.noSuchKey(key)) - } - - guard let value = value as? String else { - return .failure(.typeMismatch) - } - - return .success(value) -} -``` - -This function provides a more robust wrapper around the default subscripting provided by `Dictionary`. Rather than return `Any?`, it returns a `Result` that either contains the `String` value for the given key, or an `ErrorType` detailing what went wrong. - -One simple way to handle a `Result` is to deconstruct it using a `switch` statement. - -```swift -switch stringForKey(json, key: "email") { - -case let .success(email): - print("The email is \(email)") - -case let .failure(.noSuchKey(key)): - print("\(key) is not a valid key") - -case .failure(.typeMismatch): - print("Didn't have the right type") -} -``` - -Using a `switch` statement allows powerful pattern matching, and ensures all possible results are covered. Swift 2.0 offers new ways to deconstruct enums like the `if-case` statement, but be wary as such methods do not ensure errors are handled. - -Other methods available for processing `Result` are detailed in the [API documentation](http://cocoadocs.org/docsets/Result/). - -## Result vs. Throws - -Swift 2.0 introduces error handling via throwing and catching `Error`. `Result` accomplishes the same goal by encapsulating the result instead of hijacking control flow. The `Result` abstraction enables powerful functionality such as `map` and `flatMap`, making `Result` more composable than `throw`. - -Since dealing with APIs that throw is common, you can convert such functions into a `Result` by using the `materialize` method. Conversely, a `Result` can be used to throw an error by calling `dematerialize`. - -## Higher Order Functions - -`map` and `flatMap` operate the same as `Optional.map` and `Optional.flatMap` except they apply to `Result`. - -`map` transforms a `Result` into a `Result` of a new type. It does this by taking a function that transforms the `Value` type into a new value. This transformation is only applied in the case of a `success`. In the case of a `failure`, the associated error is re-wrapped in the new `Result`. - -```swift -// transforms a Result to a Result -let idResult = intForKey(json, key:"id").map { id in String(id) } -``` - -Here, the final result is either the id as a `String`, or carries over the `failure` from the previous result. - -`flatMap` is similar to `map` in that it transforms the `Result` into another `Result`. However, the function passed into `flatMap` must return a `Result`. - -An in depth discussion of `map` and `flatMap` is beyond the scope of this documentation. If you would like a deeper understanding, read about functors and monads. This article is a good place to [start](http://www.javiersoto.me/post/106875422394). - -## Integration - -### Carthage - -1. Add this repository as a submodule and/or [add it to your Cartfile](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile) if you’re using [carthage](https://github.com/Carthage/Carthage/) to manage your dependencies. -2. Drag `Result.xcodeproj` into your project or workspace. -3. Link your target against `Result.framework`. -4. Application targets should ensure that the framework gets copied into their application bundle. (Framework targets should instead require the application linking them to include Result.) - -### Cocoapods - -```ruby -pod 'Result', '~> 4.0.0' -``` - -### Swift Package Manager - -```swift -import PackageDescription - -let package = Package( - name: "MyProject", - targets: [], - dependencies: [ - .Package(url: "https://github.com/antitypical/Result.git", - majorVersion: 4) - ] -) -``` diff --git a/Carthage/Checkouts/Result/Result.podspec b/Carthage/Checkouts/Result/Result.podspec deleted file mode 100644 index ff0742f..0000000 --- a/Carthage/Checkouts/Result/Result.podspec +++ /dev/null @@ -1,19 +0,0 @@ -Pod::Spec.new do |s| - s.name = 'Result' - s.version = '4.1.0' - s.summary = 'Swift type modelling the success/failure of arbitrary operations' - - s.homepage = 'https://github.com/antitypical/Result' - s.license = { :type => 'MIT', :file => 'LICENSE' } - s.author = { 'Rob Rix' => 'rob.rix@github.com' } - s.source = { :git => 'https://github.com/antitypical/Result.git', :tag => s.version } - s.source_files = 'Result/*.swift' - s.requires_arc = true - s.ios.deployment_target = '8.0' - s.osx.deployment_target = '10.9' - s.watchos.deployment_target = '2.0' - s.tvos.deployment_target = '9.0' - - s.cocoapods_version = '>= 1.4.0' - s.swift_version = '4.2' -end diff --git a/Carthage/Checkouts/Result/Result.xcodeproj/project.pbxproj b/Carthage/Checkouts/Result/Result.xcodeproj/project.pbxproj deleted file mode 100644 index 6c4bc0a..0000000 --- a/Carthage/Checkouts/Result/Result.xcodeproj/project.pbxproj +++ /dev/null @@ -1,1066 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 45AE89E61B3A6564007B99D7 /* ResultProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E93621451B35596200948F2A /* ResultProtocol.swift */; }; - 57FCDE3E1BA280DC00130C48 /* ResultProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E93621451B35596200948F2A /* ResultProtocol.swift */; }; - 57FCDE3F1BA280DC00130C48 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = D45480961A957465009D7229 /* Result.swift */; }; - 57FCDE421BA280DC00130C48 /* Result.h in Headers */ = {isa = PBXBuildFile; fileRef = D454805C1A9572F5009D7229 /* Result.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 57FCDE4D1BA280E000130C48 /* ResultTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D454806E1A9572F5009D7229 /* ResultTests.swift */; }; - 57FCDE561BA2814300130C48 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57FCDE471BA280DC00130C48 /* Result.framework */; }; - CD333EF21ED50550004D9C5D /* NoError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF11ED50550004D9C5D /* NoError.swift */; }; - CD333EF31ED50550004D9C5D /* NoError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF11ED50550004D9C5D /* NoError.swift */; }; - CD333EF41ED50550004D9C5D /* NoError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF11ED50550004D9C5D /* NoError.swift */; }; - CD333EF51ED50550004D9C5D /* NoError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF11ED50550004D9C5D /* NoError.swift */; }; - CD333EF71ED505D7004D9C5D /* AnyError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF61ED505D7004D9C5D /* AnyError.swift */; }; - CD333EF81ED505D7004D9C5D /* AnyError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF61ED505D7004D9C5D /* AnyError.swift */; }; - CD333EF91ED505D7004D9C5D /* AnyError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF61ED505D7004D9C5D /* AnyError.swift */; }; - CD333EFA1ED505D7004D9C5D /* AnyError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF61ED505D7004D9C5D /* AnyError.swift */; }; - CD333EFC1ED50699004D9C5D /* NoErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EFB1ED50699004D9C5D /* NoErrorTests.swift */; }; - CD333EFD1ED50699004D9C5D /* NoErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EFB1ED50699004D9C5D /* NoErrorTests.swift */; }; - CD333EFE1ED50699004D9C5D /* NoErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EFB1ED50699004D9C5D /* NoErrorTests.swift */; }; - CD333F001ED5074F004D9C5D /* AnyErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EFF1ED5074F004D9C5D /* AnyErrorTests.swift */; }; - CD333F011ED5074F004D9C5D /* AnyErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EFF1ED5074F004D9C5D /* AnyErrorTests.swift */; }; - CD333F021ED5074F004D9C5D /* AnyErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EFF1ED5074F004D9C5D /* AnyErrorTests.swift */; }; - D035799B1B2B788F005D26AE /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = D45480961A957465009D7229 /* Result.swift */; }; - D035799E1B2B788F005D26AE /* Result.h in Headers */ = {isa = PBXBuildFile; fileRef = D454805C1A9572F5009D7229 /* Result.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D454805D1A9572F5009D7229 /* Result.h in Headers */ = {isa = PBXBuildFile; fileRef = D454805C1A9572F5009D7229 /* Result.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D45480681A9572F5009D7229 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D45480571A9572F5009D7229 /* Result.framework */; }; - D454806F1A9572F5009D7229 /* ResultTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D454806E1A9572F5009D7229 /* ResultTests.swift */; }; - D45480881A957362009D7229 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D454807D1A957361009D7229 /* Result.framework */; }; - D45480971A957465009D7229 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = D45480961A957465009D7229 /* Result.swift */; }; - D45480981A957465009D7229 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = D45480961A957465009D7229 /* Result.swift */; }; - D45480991A9574B8009D7229 /* ResultTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D454806E1A9572F5009D7229 /* ResultTests.swift */; }; - D454809A1A9574BB009D7229 /* Result.h in Headers */ = {isa = PBXBuildFile; fileRef = D454805C1A9572F5009D7229 /* Result.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E93621461B35596200948F2A /* ResultProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E93621451B35596200948F2A /* ResultProtocol.swift */; }; - E93621471B35596200948F2A /* ResultProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E93621451B35596200948F2A /* ResultProtocol.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 57FCDE571BA2814A00130C48 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D454804E1A9572F5009D7229 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 57FCDE3C1BA280DC00130C48; - remoteInfo = "Result-tvOS"; - }; - D45480691A9572F5009D7229 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D454804E1A9572F5009D7229 /* Project object */; - proxyType = 1; - remoteGlobalIDString = D45480561A9572F5009D7229; - remoteInfo = Result; - }; - D45480891A957362009D7229 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D454804E1A9572F5009D7229 /* Project object */; - proxyType = 1; - remoteGlobalIDString = D454807C1A957361009D7229; - remoteInfo = "Result-iOS"; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 57FCDE471BA280DC00130C48 /* Result.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 57FCDE541BA280E000130C48 /* Result-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Result-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - CD261ACF1DECFE3400A8863C /* LinuxMain.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LinuxMain.swift; path = ../LinuxMain.swift; sourceTree = ""; }; - CD333EF11ED50550004D9C5D /* NoError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NoError.swift; sourceTree = ""; }; - CD333EF61ED505D7004D9C5D /* AnyError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnyError.swift; sourceTree = ""; }; - CD333EFB1ED50699004D9C5D /* NoErrorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NoErrorTests.swift; sourceTree = ""; }; - CD333EFF1ED5074F004D9C5D /* AnyErrorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnyErrorTests.swift; sourceTree = ""; }; - D03579A31B2B788F005D26AE /* Result.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - D45480571A9572F5009D7229 /* Result.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - D454805B1A9572F5009D7229 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - D454805C1A9572F5009D7229 /* Result.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Result.h; sourceTree = ""; }; - D45480671A9572F5009D7229 /* Result-MacTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Result-MacTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - D454806D1A9572F5009D7229 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - D454806E1A9572F5009D7229 /* ResultTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResultTests.swift; sourceTree = ""; }; - D454807D1A957361009D7229 /* Result.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - D45480871A957362009D7229 /* Result-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Result-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - D45480961A957465009D7229 /* Result.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Result.swift; sourceTree = ""; }; - E93621451B35596200948F2A /* ResultProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResultProtocol.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 57FCDE401BA280DC00130C48 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 57FCDE4E1BA280E000130C48 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 57FCDE561BA2814300130C48 /* Result.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D035799C1B2B788F005D26AE /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480531A9572F5009D7229 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480641A9572F5009D7229 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - D45480681A9572F5009D7229 /* Result.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480791A957361009D7229 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480841A957362009D7229 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - D45480881A957362009D7229 /* Result.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - D454804D1A9572F5009D7229 = { - isa = PBXGroup; - children = ( - D45480591A9572F5009D7229 /* Result */, - D454806B1A9572F5009D7229 /* ResultTests */, - D45480581A9572F5009D7229 /* Products */, - ); - sourceTree = ""; - usesTabs = 1; - }; - D45480581A9572F5009D7229 /* Products */ = { - isa = PBXGroup; - children = ( - D45480571A9572F5009D7229 /* Result.framework */, - D45480671A9572F5009D7229 /* Result-MacTests.xctest */, - D454807D1A957361009D7229 /* Result.framework */, - D45480871A957362009D7229 /* Result-iOSTests.xctest */, - D03579A31B2B788F005D26AE /* Result.framework */, - 57FCDE471BA280DC00130C48 /* Result.framework */, - 57FCDE541BA280E000130C48 /* Result-tvOSTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - D45480591A9572F5009D7229 /* Result */ = { - isa = PBXGroup; - children = ( - CD333EF61ED505D7004D9C5D /* AnyError.swift */, - CD333EF11ED50550004D9C5D /* NoError.swift */, - D454805C1A9572F5009D7229 /* Result.h */, - D45480961A957465009D7229 /* Result.swift */, - E93621451B35596200948F2A /* ResultProtocol.swift */, - D454805A1A9572F5009D7229 /* Supporting Files */, - ); - path = Result; - sourceTree = ""; - }; - D454805A1A9572F5009D7229 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - D454805B1A9572F5009D7229 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - D454806B1A9572F5009D7229 /* ResultTests */ = { - isa = PBXGroup; - children = ( - CD333EFF1ED5074F004D9C5D /* AnyErrorTests.swift */, - CD333EFB1ED50699004D9C5D /* NoErrorTests.swift */, - D454806E1A9572F5009D7229 /* ResultTests.swift */, - D454806C1A9572F5009D7229 /* Supporting Files */, - ); - name = ResultTests; - path = Tests/ResultTests; - sourceTree = ""; - }; - D454806C1A9572F5009D7229 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - D454806D1A9572F5009D7229 /* Info.plist */, - CD261ACF1DECFE3400A8863C /* LinuxMain.swift */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 57FCDE411BA280DC00130C48 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 57FCDE421BA280DC00130C48 /* Result.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D035799D1B2B788F005D26AE /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - D035799E1B2B788F005D26AE /* Result.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480541A9572F5009D7229 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - D454805D1A9572F5009D7229 /* Result.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D454807A1A957361009D7229 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - D454809A1A9574BB009D7229 /* Result.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 57FCDE3C1BA280DC00130C48 /* Result-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 57FCDE441BA280DC00130C48 /* Build configuration list for PBXNativeTarget "Result-tvOS" */; - buildPhases = ( - 57FCDE411BA280DC00130C48 /* Headers */, - 57FCDE3D1BA280DC00130C48 /* Sources */, - 57FCDE401BA280DC00130C48 /* Frameworks */, - 57FCDE431BA280DC00130C48 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "Result-tvOS"; - productName = "Result-iOS"; - productReference = 57FCDE471BA280DC00130C48 /* Result.framework */; - productType = "com.apple.product-type.framework"; - }; - 57FCDE491BA280E000130C48 /* Result-tvOSTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 57FCDE511BA280E000130C48 /* Build configuration list for PBXNativeTarget "Result-tvOSTests" */; - buildPhases = ( - 57FCDE4C1BA280E000130C48 /* Sources */, - 57FCDE4E1BA280E000130C48 /* Frameworks */, - 57FCDE501BA280E000130C48 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 57FCDE581BA2814A00130C48 /* PBXTargetDependency */, - ); - name = "Result-tvOSTests"; - productName = "Result-iOSTests"; - productReference = 57FCDE541BA280E000130C48 /* Result-tvOSTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - D03579991B2B788F005D26AE /* Result-watchOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = D03579A01B2B788F005D26AE /* Build configuration list for PBXNativeTarget "Result-watchOS" */; - buildPhases = ( - D035799D1B2B788F005D26AE /* Headers */, - D035799A1B2B788F005D26AE /* Sources */, - D035799C1B2B788F005D26AE /* Frameworks */, - D035799F1B2B788F005D26AE /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "Result-watchOS"; - productName = Result; - productReference = D03579A31B2B788F005D26AE /* Result.framework */; - productType = "com.apple.product-type.framework"; - }; - D45480561A9572F5009D7229 /* Result-Mac */ = { - isa = PBXNativeTarget; - buildConfigurationList = D45480721A9572F5009D7229 /* Build configuration list for PBXNativeTarget "Result-Mac" */; - buildPhases = ( - D45480541A9572F5009D7229 /* Headers */, - D45480521A9572F5009D7229 /* Sources */, - D45480531A9572F5009D7229 /* Frameworks */, - D45480551A9572F5009D7229 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "Result-Mac"; - productName = Result; - productReference = D45480571A9572F5009D7229 /* Result.framework */; - productType = "com.apple.product-type.framework"; - }; - D45480661A9572F5009D7229 /* Result-MacTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = D45480751A9572F5009D7229 /* Build configuration list for PBXNativeTarget "Result-MacTests" */; - buildPhases = ( - D45480631A9572F5009D7229 /* Sources */, - D45480641A9572F5009D7229 /* Frameworks */, - D45480651A9572F5009D7229 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - D454806A1A9572F5009D7229 /* PBXTargetDependency */, - ); - name = "Result-MacTests"; - productName = ResultTests; - productReference = D45480671A9572F5009D7229 /* Result-MacTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - D454807C1A957361009D7229 /* Result-iOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = D45480941A957362009D7229 /* Build configuration list for PBXNativeTarget "Result-iOS" */; - buildPhases = ( - D454807A1A957361009D7229 /* Headers */, - D45480781A957361009D7229 /* Sources */, - D45480791A957361009D7229 /* Frameworks */, - D454807B1A957361009D7229 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "Result-iOS"; - productName = "Result-iOS"; - productReference = D454807D1A957361009D7229 /* Result.framework */; - productType = "com.apple.product-type.framework"; - }; - D45480861A957362009D7229 /* Result-iOSTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = D45480951A957362009D7229 /* Build configuration list for PBXNativeTarget "Result-iOSTests" */; - buildPhases = ( - D45480831A957362009D7229 /* Sources */, - D45480841A957362009D7229 /* Frameworks */, - D45480851A957362009D7229 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - D454808A1A957362009D7229 /* PBXTargetDependency */, - ); - name = "Result-iOSTests"; - productName = "Result-iOSTests"; - productReference = D45480871A957362009D7229 /* Result-iOSTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - D454804E1A9572F5009D7229 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0930; - ORGANIZATIONNAME = "Rob Rix"; - TargetAttributes = { - 57FCDE3C1BA280DC00130C48 = { - LastSwiftMigration = 0920; - }; - 57FCDE491BA280E000130C48 = { - LastSwiftMigration = 0920; - }; - D03579991B2B788F005D26AE = { - LastSwiftMigration = 0920; - }; - D45480561A9572F5009D7229 = { - CreatedOnToolsVersion = 6.3; - LastSwiftMigration = 0900; - }; - D45480661A9572F5009D7229 = { - CreatedOnToolsVersion = 6.3; - LastSwiftMigration = 0900; - }; - D454807C1A957361009D7229 = { - CreatedOnToolsVersion = 6.3; - LastSwiftMigration = 1000; - }; - D45480861A957362009D7229 = { - CreatedOnToolsVersion = 6.3; - LastSwiftMigration = 1000; - }; - }; - }; - buildConfigurationList = D45480511A9572F5009D7229 /* Build configuration list for PBXProject "Result" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = D454804D1A9572F5009D7229; - productRefGroup = D45480581A9572F5009D7229 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - D45480561A9572F5009D7229 /* Result-Mac */, - D45480661A9572F5009D7229 /* Result-MacTests */, - D454807C1A957361009D7229 /* Result-iOS */, - D45480861A957362009D7229 /* Result-iOSTests */, - 57FCDE3C1BA280DC00130C48 /* Result-tvOS */, - 57FCDE491BA280E000130C48 /* Result-tvOSTests */, - D03579991B2B788F005D26AE /* Result-watchOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 57FCDE431BA280DC00130C48 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 57FCDE501BA280E000130C48 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D035799F1B2B788F005D26AE /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480551A9572F5009D7229 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480651A9572F5009D7229 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D454807B1A957361009D7229 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480851A957362009D7229 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 57FCDE3D1BA280DC00130C48 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - CD333EF41ED50550004D9C5D /* NoError.swift in Sources */, - 57FCDE3E1BA280DC00130C48 /* ResultProtocol.swift in Sources */, - 57FCDE3F1BA280DC00130C48 /* Result.swift in Sources */, - CD333EF91ED505D7004D9C5D /* AnyError.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 57FCDE4C1BA280E000130C48 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 57FCDE4D1BA280E000130C48 /* ResultTests.swift in Sources */, - CD333F021ED5074F004D9C5D /* AnyErrorTests.swift in Sources */, - CD333EFE1ED50699004D9C5D /* NoErrorTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D035799A1B2B788F005D26AE /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - CD333EF51ED50550004D9C5D /* NoError.swift in Sources */, - 45AE89E61B3A6564007B99D7 /* ResultProtocol.swift in Sources */, - D035799B1B2B788F005D26AE /* Result.swift in Sources */, - CD333EFA1ED505D7004D9C5D /* AnyError.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480521A9572F5009D7229 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - CD333EF21ED50550004D9C5D /* NoError.swift in Sources */, - E93621461B35596200948F2A /* ResultProtocol.swift in Sources */, - D45480971A957465009D7229 /* Result.swift in Sources */, - CD333EF71ED505D7004D9C5D /* AnyError.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480631A9572F5009D7229 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - D454806F1A9572F5009D7229 /* ResultTests.swift in Sources */, - CD333F001ED5074F004D9C5D /* AnyErrorTests.swift in Sources */, - CD333EFC1ED50699004D9C5D /* NoErrorTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480781A957361009D7229 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - CD333EF31ED50550004D9C5D /* NoError.swift in Sources */, - E93621471B35596200948F2A /* ResultProtocol.swift in Sources */, - D45480981A957465009D7229 /* Result.swift in Sources */, - CD333EF81ED505D7004D9C5D /* AnyError.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D45480831A957362009D7229 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - D45480991A9574B8009D7229 /* ResultTests.swift in Sources */, - CD333F011ED5074F004D9C5D /* AnyErrorTests.swift in Sources */, - CD333EFD1ED50699004D9C5D /* NoErrorTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 57FCDE581BA2814A00130C48 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 57FCDE3C1BA280DC00130C48 /* Result-tvOS */; - targetProxy = 57FCDE571BA2814A00130C48 /* PBXContainerItemProxy */; - }; - D454806A1A9572F5009D7229 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = D45480561A9572F5009D7229 /* Result-Mac */; - targetProxy = D45480691A9572F5009D7229 /* PBXContainerItemProxy */; - }; - D454808A1A957362009D7229 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = D454807C1A957361009D7229 /* Result-iOS */; - targetProxy = D45480891A957362009D7229 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 57FCDE451BA280DC00130C48 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BITCODE_GENERATION_MODE = bitcode; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=appletvsimulator*]" = ""; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = Result/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = Result; - SDKROOT = appletvos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = 3; - }; - name = Debug; - }; - 57FCDE461BA280DC00130C48 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BITCODE_GENERATION_MODE = bitcode; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=appletvsimulator*]" = ""; - COPY_PHASE_STRIP = NO; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Result/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = Result; - SDKROOT = appletvos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = 3; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 57FCDE521BA280E000130C48 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = NO; - CODE_SIGN_IDENTITY = "iPhone Developer"; - FRAMEWORK_SEARCH_PATHS = "$(inherited)"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = Tests/ResultTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - }; - name = Debug; - }; - 57FCDE531BA280E000130C48 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = NO; - CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = "$(inherited)"; - INFOPLIST_FILE = Tests/ResultTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - D03579A11B2B788F005D26AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BITCODE_GENERATION_MODE = bitcode; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchsimulator*]" = ""; - COMBINE_HIDPI_IMAGES = YES; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_VERSION = A; - INFOPLIST_FILE = Result/Info.plist; - INSTALL_PATH = "@rpath"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = Result; - SDKROOT = watchos; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - D03579A21B2B788F005D26AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BITCODE_GENERATION_MODE = bitcode; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchsimulator*]" = ""; - COMBINE_HIDPI_IMAGES = YES; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_VERSION = A; - INFOPLIST_FILE = Result/Info.plist; - INSTALL_PATH = "@rpath"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = Result; - SDKROOT = watchos; - SKIP_INSTALL = YES; - }; - name = Release; - }; - D45480701A9572F5009D7229 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - APPLICATION_EXTENSION_API_ONLY = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = 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; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - PRODUCT_BUNDLE_IDENTIFIER = "com.antitypical.$(PRODUCT_NAME:rfc1034identifier)"; - SDKROOT = macosx; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; - TVOS_DEPLOYMENT_TARGET = 9.0; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - WATCHOS_DEPLOYMENT_TARGET = 2.0; - }; - name = Debug; - }; - D45480711A9572F5009D7229 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - APPLICATION_EXTENSION_API_ONLY = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = 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; - COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - 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; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_BUNDLE_IDENTIFIER = "com.antitypical.$(PRODUCT_NAME:rfc1034identifier)"; - SDKROOT = macosx; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; - TVOS_DEPLOYMENT_TARGET = 9.0; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - WATCHOS_DEPLOYMENT_TARGET = 2.0; - }; - name = Release; - }; - D45480731A9572F5009D7229 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_MODULES = YES; - COMBINE_HIDPI_IMAGES = YES; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_VERSION = A; - INFOPLIST_FILE = Result/Info.plist; - INSTALL_PATH = "@rpath"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = Result; - SKIP_INSTALL = YES; - VALID_ARCHS = x86_64; - }; - name = Debug; - }; - D45480741A9572F5009D7229 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_MODULES = YES; - COMBINE_HIDPI_IMAGES = YES; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_VERSION = A; - INFOPLIST_FILE = Result/Info.plist; - INSTALL_PATH = "@rpath"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = Result; - SKIP_INSTALL = YES; - VALID_ARCHS = x86_64; - }; - name = Release; - }; - D45480761A9572F5009D7229 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = NO; - COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(DEVELOPER_FRAMEWORKS_DIR)", - "$(inherited)", - ); - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = Tests/ResultTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - D45480771A9572F5009D7229 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = NO; - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(DEVELOPER_FRAMEWORKS_DIR)", - "$(inherited)", - ); - INFOPLIST_FILE = Tests/ResultTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - D45480901A957362009D7229 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BITCODE_GENERATION_MODE = bitcode; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphonesimulator*]" = ""; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_BITCODE = YES; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = Result/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = Result; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - D45480911A957362009D7229 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BITCODE_GENERATION_MODE = bitcode; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphonesimulator*]" = ""; - COPY_PHASE_STRIP = NO; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_BITCODE = YES; - INFOPLIST_FILE = Result/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = Result; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - D45480921A957362009D7229 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = NO; - CODE_SIGN_IDENTITY = "iPhone Developer"; - FRAMEWORK_SEARCH_PATHS = "$(inherited)"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = Tests/ResultTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; - }; - name = Debug; - }; - D45480931A957362009D7229 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = NO; - CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = "$(inherited)"; - INFOPLIST_FILE = Tests/ResultTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 57FCDE441BA280DC00130C48 /* Build configuration list for PBXNativeTarget "Result-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 57FCDE451BA280DC00130C48 /* Debug */, - 57FCDE461BA280DC00130C48 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 57FCDE511BA280E000130C48 /* Build configuration list for PBXNativeTarget "Result-tvOSTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 57FCDE521BA280E000130C48 /* Debug */, - 57FCDE531BA280E000130C48 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - D03579A01B2B788F005D26AE /* Build configuration list for PBXNativeTarget "Result-watchOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D03579A11B2B788F005D26AE /* Debug */, - D03579A21B2B788F005D26AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - D45480511A9572F5009D7229 /* Build configuration list for PBXProject "Result" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D45480701A9572F5009D7229 /* Debug */, - D45480711A9572F5009D7229 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - D45480721A9572F5009D7229 /* Build configuration list for PBXNativeTarget "Result-Mac" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D45480731A9572F5009D7229 /* Debug */, - D45480741A9572F5009D7229 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - D45480751A9572F5009D7229 /* Build configuration list for PBXNativeTarget "Result-MacTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D45480761A9572F5009D7229 /* Debug */, - D45480771A9572F5009D7229 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - D45480941A957362009D7229 /* Build configuration list for PBXNativeTarget "Result-iOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D45480901A957362009D7229 /* Debug */, - D45480911A957362009D7229 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - D45480951A957362009D7229 /* Build configuration list for PBXNativeTarget "Result-iOSTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D45480921A957362009D7229 /* Debug */, - D45480931A957362009D7229 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = D454804E1A9572F5009D7229 /* Project object */; -} diff --git a/Carthage/Checkouts/Result/Result.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Carthage/Checkouts/Result/Result.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 10cf711..0000000 --- a/Carthage/Checkouts/Result/Result.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Carthage/Checkouts/Result/Result.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Carthage/Checkouts/Result/Result.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d9810..0000000 --- a/Carthage/Checkouts/Result/Result.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-Mac.xcscheme b/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-Mac.xcscheme deleted file mode 100644 index eee4090..0000000 --- a/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-Mac.xcscheme +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-iOS.xcscheme b/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-iOS.xcscheme deleted file mode 100644 index d669e9b..0000000 --- a/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-iOS.xcscheme +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-tvOS.xcscheme b/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-tvOS.xcscheme deleted file mode 100644 index e337798..0000000 --- a/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-tvOS.xcscheme +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-watchOS.xcscheme b/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-watchOS.xcscheme deleted file mode 100644 index 59371bc..0000000 --- a/Carthage/Checkouts/Result/Result.xcodeproj/xcshareddata/xcschemes/Result-watchOS.xcscheme +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Carthage/Checkouts/Result/Result/AnyError.swift b/Carthage/Checkouts/Result/Result/AnyError.swift deleted file mode 100644 index ee018d2..0000000 --- a/Carthage/Checkouts/Result/Result/AnyError.swift +++ /dev/null @@ -1,46 +0,0 @@ -import Foundation - -/// A type-erased error which wraps an arbitrary error instance. This should be -/// useful for generic contexts. -public struct AnyError: Swift.Error { - /// The underlying error. - public let error: Swift.Error - - public init(_ error: Swift.Error) { - if let anyError = error as? AnyError { - self = anyError - } else { - self.error = error - } - } -} - -extension AnyError: ErrorConvertible { - public static func error(from error: Error) -> AnyError { - return AnyError(error) - } -} - -extension AnyError: CustomStringConvertible { - public var description: String { - return String(describing: error) - } -} - -extension AnyError: LocalizedError { - public var errorDescription: String? { - return error.localizedDescription - } - - public var failureReason: String? { - return (error as? LocalizedError)?.failureReason - } - - public var helpAnchor: String? { - return (error as? LocalizedError)?.helpAnchor - } - - public var recoverySuggestion: String? { - return (error as? LocalizedError)?.recoverySuggestion - } -} diff --git a/Carthage/Checkouts/Result/Result/Info.plist b/Carthage/Checkouts/Result/Result/Info.plist deleted file mode 100644 index 91eaae8..0000000 --- a/Carthage/Checkouts/Result/Result/Info.plist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 4.1.0 - CFBundleSignature - ???? - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSHumanReadableCopyright - Copyright © 2015 Rob Rix. All rights reserved. - NSPrincipalClass - - - diff --git a/Carthage/Checkouts/Result/Result/NoError.swift b/Carthage/Checkouts/Result/Result/NoError.swift deleted file mode 100644 index a919f51..0000000 --- a/Carthage/Checkouts/Result/Result/NoError.swift +++ /dev/null @@ -1,10 +0,0 @@ -/// An “error” that is impossible to construct. -/// -/// This can be used to describe `Result`s where failures will never -/// be generated. For example, `Result` describes a result that -/// contains an `Int`eger and is guaranteed never to be a `failure`. -public enum NoError: Swift.Error, Equatable { - public static func ==(lhs: NoError, rhs: NoError) -> Bool { - return true - } -} diff --git a/Carthage/Checkouts/Result/Result/Result.h b/Carthage/Checkouts/Result/Result/Result.h deleted file mode 100644 index 4742701..0000000 --- a/Carthage/Checkouts/Result/Result/Result.h +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2015 Rob Rix. All rights reserved. - -/// Project version number for Result. -extern double ResultVersionNumber; - -/// Project version string for Result. -extern const unsigned char ResultVersionString[]; - diff --git a/Carthage/Checkouts/Result/Result/Result.swift b/Carthage/Checkouts/Result/Result/Result.swift deleted file mode 100644 index 7576838..0000000 --- a/Carthage/Checkouts/Result/Result/Result.swift +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright (c) 2015 Rob Rix. All rights reserved. - -/// An enum representing either a failure with an explanatory error, or a success with a result value. -public enum Result: ResultProtocol, CustomStringConvertible, CustomDebugStringConvertible { - case success(Value) - case failure(Error) - - /// The compatibility alias for the Swift 5's `Result` in the standard library. - /// - /// See https://github.com/apple/swift-evolution/blob/master/proposals/0235-add-result.md - /// and https://forums.swift.org/t/accepted-with-modifications-se-0235-add-result-to-the-standard-library/18603 - /// for the details. - public typealias Success = Value - /// The compatibility alias for the Swift 5's `Result` in the standard library. - /// - /// See https://github.com/apple/swift-evolution/blob/master/proposals/0235-add-result.md - /// and https://forums.swift.org/t/accepted-with-modifications-se-0235-add-result-to-the-standard-library/18603 - /// for the details. - public typealias Failure = Error - - // MARK: Constructors - - /// Constructs a success wrapping a `value`. - public init(value: Value) { - self = .success(value) - } - - /// Constructs a failure wrapping an `error`. - public init(error: Error) { - self = .failure(error) - } - - /// Constructs a result from an `Optional`, failing with `Error` if `nil`. - public init(_ value: Value?, failWith: @autoclosure () -> Error) { - self = value.map(Result.success) ?? .failure(failWith()) - } - - /// Constructs a result from a function that uses `throw`, failing with `Error` if throws. - public init(_ f: @autoclosure () throws -> Value) { - self.init(catching: f) - } - - /// Constructs a result from a function that uses `throw`, failing with `Error` if throws. - @available(*, deprecated, renamed: "init(catching:)") - public init(attempt f: () throws -> Value) { - self.init(catching: f) - } - - /// The same as `init(attempt:)` aiming for the compatibility with the Swift 5's `Result` in the standard library. - /// - /// See https://github.com/apple/swift-evolution/blob/master/proposals/0235-add-result.md - /// and https://forums.swift.org/t/accepted-with-modifications-se-0235-add-result-to-the-standard-library/18603 - /// for the details. - public init(catching body: () throws -> Success) { - do { - self = .success(try body()) - } catch var error { - if Error.self == AnyError.self { - error = AnyError(error) - } - self = .failure(error as! Error) - } - } - - // MARK: Deconstruction - - /// Returns the value from `success` Results or `throw`s the error. - @available(*, deprecated, renamed: "get()") - public func dematerialize() throws -> Value { - return try get() - } - - /// The same as `dematerialize()` aiming for the compatibility with the Swift 5's `Result` in the standard library. - /// - /// See https://github.com/apple/swift-evolution/blob/master/proposals/0235-add-result.md - /// and https://forums.swift.org/t/accepted-with-modifications-se-0235-add-result-to-the-standard-library/18603 - /// for the details. - public func get() throws -> Success { - switch self { - case let .success(value): - return value - case let .failure(error): - throw error - } - } - - /// Case analysis for Result. - /// - /// Returns the value produced by applying `ifFailure` to `failure` Results, or `ifSuccess` to `success` Results. - public func analysis(ifSuccess: (Value) -> Result, ifFailure: (Error) -> Result) -> Result { - switch self { - case let .success(value): - return ifSuccess(value) - case let .failure(value): - return ifFailure(value) - } - } - - // MARK: Errors - - /// The domain for errors constructed by Result. - public static var errorDomain: String { return "com.antitypical.Result" } - - /// The userInfo key for source functions in errors constructed by Result. - public static var functionKey: String { return "\(errorDomain).function" } - - /// The userInfo key for source file paths in errors constructed by Result. - public static var fileKey: String { return "\(errorDomain).file" } - - /// The userInfo key for source file line numbers in errors constructed by Result. - public static var lineKey: String { return "\(errorDomain).line" } - - /// Constructs an error. - public static func error(_ message: String? = nil, function: String = #function, file: String = #file, line: Int = #line) -> NSError { - var userInfo: [String: Any] = [ - functionKey: function, - fileKey: file, - lineKey: line, - ] - - if let message = message { - userInfo[NSLocalizedDescriptionKey] = message - } - - return NSError(domain: errorDomain, code: 0, userInfo: userInfo) - } - - - // MARK: CustomStringConvertible - - public var description: String { - switch self { - case let .success(value): return ".success(\(value))" - case let .failure(error): return ".failure(\(error))" - } - } - - - // MARK: CustomDebugStringConvertible - - public var debugDescription: String { - return description - } - - // MARK: ResultProtocol - public var result: Result { - return self - } -} - -extension Result where Result.Failure == AnyError { - /// Constructs a result from an expression that uses `throw`, failing with `AnyError` if throws. - public init(_ f: @autoclosure () throws -> Value) { - self.init(attempt: f) - } - - /// Constructs a result from a closure that uses `throw`, failing with `AnyError` if throws. - public init(attempt f: () throws -> Value) { - do { - self = .success(try f()) - } catch { - self = .failure(AnyError(error)) - } - } -} - -// MARK: - Derive result from failable closure - -@available(*, deprecated, renamed: "Result.init(attempt:)") -public func materialize(_ f: () throws -> T) -> Result { - return Result(attempt: f) -} - -@available(*, deprecated, renamed: "Result.init(_:)") -public func materialize(_ f: @autoclosure () throws -> T) -> Result { - return Result(try f()) -} - -// MARK: - ErrorConvertible conformance - -extension NSError: ErrorConvertible { - public static func error(from error: Swift.Error) -> Self { - func cast(_ error: Swift.Error) -> T { - return error as! T - } - - return cast(error) - } -} - -// MARK: - migration support - -@available(*, unavailable, message: "Use the overload which returns `Result` instead") -public func materialize(_ f: () throws -> T) -> Result { - fatalError() -} - -@available(*, unavailable, message: "Use the overload which returns `Result` instead") -public func materialize(_ f: @autoclosure () throws -> T) -> Result { - fatalError() -} - -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - -/// Constructs a `Result` with the result of calling `try` with an error pointer. -/// -/// This is convenient for wrapping Cocoa API which returns an object or `nil` + an error, by reference. e.g.: -/// -/// Result.try { NSData(contentsOfURL: URL, options: .dataReadingMapped, error: $0) } -@available(*, unavailable, message: "This has been removed. Use `Result.init(attempt:)` instead. See https://github.com/antitypical/Result/issues/85 for the details.") -public func `try`(_ function: String = #function, file: String = #file, line: Int = #line, `try`: (NSErrorPointer) -> T?) -> Result { - fatalError() -} - -/// Constructs a `Result` with the result of calling `try` with an error pointer. -/// -/// This is convenient for wrapping Cocoa API which returns a `Bool` + an error, by reference. e.g.: -/// -/// Result.try { NSFileManager.defaultManager().removeItemAtURL(URL, error: $0) } -@available(*, unavailable, message: "This has been removed. Use `Result.init(attempt:)` instead. See https://github.com/antitypical/Result/issues/85 for the details.") -public func `try`(_ function: String = #function, file: String = #file, line: Int = #line, `try`: (NSErrorPointer) -> Bool) -> Result<(), NSError> { - fatalError() -} - -#endif - -// MARK: - - -import Foundation diff --git a/Carthage/Checkouts/Result/Result/ResultProtocol.swift b/Carthage/Checkouts/Result/Result/ResultProtocol.swift deleted file mode 100644 index e3ad022..0000000 --- a/Carthage/Checkouts/Result/Result/ResultProtocol.swift +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) 2015 Rob Rix. All rights reserved. - -/// A protocol that can be used to constrain associated types as `Result`. -public protocol ResultProtocol { - associatedtype Value - associatedtype Error: Swift.Error - - init(value: Value) - init(error: Error) - - var result: Result { get } -} - -extension Result { - /// Returns the value if self represents a success, `nil` otherwise. - public var value: Value? { - switch self { - case let .success(value): return value - case .failure: return nil - } - } - - /// Returns the error if self represents a failure, `nil` otherwise. - public var error: Error? { - switch self { - case .success: return nil - case let .failure(error): return error - } - } - - /// Returns a new Result by mapping `Success`es’ values using `transform`, or re-wrapping `Failure`s’ errors. - public func map(_ transform: (Value) -> U) -> Result { - return flatMap { .success(transform($0)) } - } - - /// Returns the result of applying `transform` to `Success`es’ values, or re-wrapping `Failure`’s errors. - public func flatMap(_ transform: (Value) -> Result) -> Result { - switch self { - case let .success(value): return transform(value) - case let .failure(error): return .failure(error) - } - } - - /// Returns a Result with a tuple of the receiver and `other` values if both - /// are `Success`es, or re-wrapping the error of the earlier `Failure`. - public func fanout(_ other: @autoclosure () -> Result) -> Result<(Value, U), Error> { - return self.flatMap { left in other().map { right in (left, right) } } - } - - /// Returns a new Result by mapping `Failure`'s values using `transform`, or re-wrapping `Success`es’ values. - public func mapError(_ transform: (Error) -> Error2) -> Result { - return flatMapError { .failure(transform($0)) } - } - - /// Returns the result of applying `transform` to `Failure`’s errors, or re-wrapping `Success`es’ values. - public func flatMapError(_ transform: (Error) -> Result) -> Result { - switch self { - case let .success(value): return .success(value) - case let .failure(error): return transform(error) - } - } - - /// Returns a new Result by mapping `Success`es’ values using `success`, and by mapping `Failure`'s values using `failure`. - public func bimap(success: (Value) -> U, failure: (Error) -> Error2) -> Result { - switch self { - case let .success(value): return .success(success(value)) - case let .failure(error): return .failure(failure(error)) - } - } -} - -extension Result { - - // MARK: Higher-order functions - - /// Returns `self.value` if this result is a .Success, or the given value otherwise. Equivalent with `??` - public func recover(_ value: @autoclosure () -> Value) -> Value { - return self.value ?? value() - } - - /// Returns this result if it is a .Success, or the given result otherwise. Equivalent with `??` - public func recover(with result: @autoclosure () -> Result) -> Result { - switch self { - case .success: return self - case .failure: return result() - } - } -} - -/// Protocol used to constrain `tryMap` to `Result`s with compatible `Error`s. -public protocol ErrorConvertible: Swift.Error { - static func error(from error: Swift.Error) -> Self -} - -extension Result where Result.Failure: ErrorConvertible { - - /// Returns the result of applying `transform` to `Success`es’ values, or wrapping thrown errors. - public func tryMap(_ transform: (Value) throws -> U) -> Result { - return flatMap { value in - do { - return .success(try transform(value)) - } - catch { - let convertedError = Error.error(from: error) - // Revisit this in a future version of Swift. https://twitter.com/jckarter/status/672931114944696321 - return .failure(convertedError) - } - } - } -} - -// MARK: - Operators - -extension Result where Result.Success: Equatable, Result.Failure: Equatable { - /// Returns `true` if `left` and `right` are both `Success`es and their values are equal, or if `left` and `right` are both `Failure`s and their errors are equal. - public static func ==(left: Result, right: Result) -> Bool { - if let left = left.value, let right = right.value { - return left == right - } else if let left = left.error, let right = right.error { - return left == right - } - return false - } -} - -#if swift(>=4.1) - extension Result: Equatable where Result.Success: Equatable, Result.Failure: Equatable { } -#else - extension Result where Result.Success: Equatable, Result.Failure: Equatable { - /// Returns `true` if `left` and `right` represent different cases, or if they represent the same case but different values. - public static func !=(left: Result, right: Result) -> Bool { - return !(left == right) - } - } -#endif - -extension Result { - /// Returns the value of `left` if it is a `Success`, or `right` otherwise. Short-circuits. - public static func ??(left: Result, right: @autoclosure () -> Value) -> Value { - return left.recover(right()) - } - - /// Returns `left` if it is a `Success`es, or `right` otherwise. Short-circuits. - public static func ??(left: Result, right: @autoclosure () -> Result) -> Result { - return left.recover(with: right()) - } -} - -// MARK: - migration support - -@available(*, unavailable, renamed: "ErrorConvertible") -public protocol ErrorProtocolConvertible: ErrorConvertible {} diff --git a/Carthage/Checkouts/Result/Tests/LinuxMain.swift b/Carthage/Checkouts/Result/Tests/LinuxMain.swift deleted file mode 100644 index ec2c509..0000000 --- a/Carthage/Checkouts/Result/Tests/LinuxMain.swift +++ /dev/null @@ -1,8 +0,0 @@ -import XCTest - -import ResultTests - -var tests = [XCTestCaseEntry]() -tests += ResultTests.__allTests() - -XCTMain(tests) diff --git a/Carthage/Checkouts/Result/Tests/ResultTests/AnyErrorTests.swift b/Carthage/Checkouts/Result/Tests/ResultTests/AnyErrorTests.swift deleted file mode 100644 index 65a2661..0000000 --- a/Carthage/Checkouts/Result/Tests/ResultTests/AnyErrorTests.swift +++ /dev/null @@ -1,12 +0,0 @@ -import Foundation -import XCTest -import Result - -final class AnyErrorTests: XCTestCase { - func testAnyError() { - let error = Error.a - let anyErrorFromError = AnyError(error) - let anyErrorFromAnyError = AnyError(anyErrorFromError) - XCTAssertTrue(anyErrorFromError == anyErrorFromAnyError) - } -} diff --git a/Carthage/Checkouts/Result/Tests/ResultTests/Info.plist b/Carthage/Checkouts/Result/Tests/ResultTests/Info.plist deleted file mode 100644 index 7861e6f..0000000 --- a/Carthage/Checkouts/Result/Tests/ResultTests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 4.1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/Carthage/Checkouts/Result/Tests/ResultTests/NoErrorTests.swift b/Carthage/Checkouts/Result/Tests/ResultTests/NoErrorTests.swift deleted file mode 100644 index 61bc107..0000000 --- a/Carthage/Checkouts/Result/Tests/ResultTests/NoErrorTests.swift +++ /dev/null @@ -1,11 +0,0 @@ -import Foundation -import XCTest -import Result - -final class NoErrorTests: XCTestCase { - func testEquatable() { - let foo = Result(1) - let bar = Result(1) - XCTAssertTrue(foo == bar) - } -} diff --git a/Carthage/Checkouts/Result/Tests/ResultTests/ResultTests.swift b/Carthage/Checkouts/Result/Tests/ResultTests/ResultTests.swift deleted file mode 100644 index f7fb38c..0000000 --- a/Carthage/Checkouts/Result/Tests/ResultTests/ResultTests.swift +++ /dev/null @@ -1,256 +0,0 @@ -// Copyright (c) 2015 Rob Rix. All rights reserved. - -final class ResultTests: XCTestCase { - func testMapTransformsSuccesses() { - XCTAssertEqual(success.map { $0.count } ?? 0, 7) - } - - func testMapRewrapsFailures() { - XCTAssertEqual(failure.map { $0.count } ?? 0, 0) - } - - func testInitOptionalSuccess() { - XCTAssert(Result("success" as String?, failWith: error) == success) - } - - func testInitOptionalFailure() { - XCTAssert(Result(nil, failWith: error) == failure) - } - - func testFanout() { - let resultSuccess = success.fanout(success) - if let (x, y) = resultSuccess.value { - XCTAssertTrue(x == "success" && y == "success") - } else { - XCTFail() - } - - let resultFailureBoth = failure.fanout(failure2) - XCTAssert(resultFailureBoth.error == error) - - let resultFailureLeft = failure.fanout(success) - XCTAssert(resultFailureLeft.error == error) - - let resultFailureRight = success.fanout(failure2) - XCTAssert(resultFailureRight.error == error2) - } - - func testBimapTransformsSuccesses() { - XCTAssertEqual(success.bimap( - success: { $0.count }, - failure: { $0 } - ) ?? 0, 7) - } - - func testBimapTransformsFailures() { - XCTAssert(failure.bimap( - success: { $0 }, - failure: { _ in error2 } - ) == failure2) - } - - // MARK: Errors - - func testErrorsIncludeTheSourceFile() { - let file = #file - XCTAssert(Result<(), NSError>.error().file == file) - } - - func testErrorsIncludeTheSourceLine() { - let (line, error) = (#line, Result<(), NSError>.error()) - XCTAssertEqual(error.line ?? -1, line) - } - - func testErrorsIncludeTheCallingFunction() { - let function = #function - XCTAssert(Result<(), NSError>.error().function == function) - } - - func testAnyErrorDelegatesLocalizedDescriptionToUnderlyingError() { - XCTAssertEqual(error.errorDescription, "localized description") - XCTAssertEqual(error.localizedDescription, "localized description") - XCTAssertEqual(error3.errorDescription, "localized description") - XCTAssertEqual(error3.localizedDescription, "localized description") - } - - func testAnyErrorDelegatesLocalizedFailureReasonToUnderlyingError() { - XCTAssertEqual(error.failureReason, "failure reason") - } - - func testAnyErrorDelegatesLocalizedRecoverySuggestionToUnderlyingError() { - XCTAssertEqual(error.recoverySuggestion, "recovery suggestion") - } - - func testAnyErrorDelegatesLocalizedHelpAnchorToUnderlyingError() { - XCTAssertEqual(error.helpAnchor, "help anchor") - } - - // MARK: Try - Catch - - func testTryCatchProducesSuccesses() { - let result: Result = Result(try tryIsSuccess("success")) - XCTAssert(result == success) - } - - func testTryCatchProducesFailures() { - let result: Result = Result(try tryIsSuccess(nil)) - XCTAssert(result.error == error) - } - - func testTryCatchWithFunctionProducesSuccesses() { - let function = { try tryIsSuccess("success") } - - let result: Result = Result(attempt: function) - XCTAssert(result == success) - } - - func testTryCatchWithFunctionCatchProducesFailures() { - let function = { try tryIsSuccess(nil) } - - let result: Result = Result(attempt: function) - XCTAssert(result.error == error) - } - - func testTryCatchWithFunctionThrowingNonAnyErrorCanProducesAnyErrorFailures() { - let nsError = NSError(domain: "", code: 0) - let function: () throws -> String = { throw nsError } - - let result: Result = Result(attempt: function) - XCTAssert(result.error == AnyError(nsError)) - } - - func testMaterializeProducesSuccesses() { - let result1: Result = Result(try tryIsSuccess("success")) - XCTAssert(result1 == success) - - let result2: Result = Result(attempt: { try tryIsSuccess("success") }) - XCTAssert(result2 == success) - } - - func testMaterializeProducesFailures() { - let result1: Result = Result(try tryIsSuccess(nil)) - XCTAssert(result1.error == error) - - let result2: Result = Result(attempt: { try tryIsSuccess(nil) }) - XCTAssert(result2.error == error) - } - - func testMaterializeInferrence() { - let result = Result(attempt: { try tryIsSuccess(nil) }) - XCTAssert((type(of: result) as Any.Type) is Result.Type) - } - - // MARK: Recover - - func testRecoverProducesLeftForLeftSuccess() { - let left = Result.success("left") - XCTAssertEqual(left.recover("right"), "left") - } - - func testRecoverProducesRightForLeftFailure() { - let left = Result.failure(Error.a) - XCTAssertEqual(left.recover("right"), "right") - } - - // MARK: Recover With - - func testRecoverWithProducesLeftForLeftSuccess() { - let left = Result.success("left") - let right = Result.success("right") - - XCTAssertEqual(left.recover(with: right).value, "left") - } - - func testRecoverWithProducesRightSuccessForLeftFailureAndRightSuccess() { - struct Error: Swift.Error {} - - let left = Result.failure(Error()) - let right = Result.success("right") - - XCTAssertEqual(left.recover(with: right).value, "right") - } - - func testRecoverWithProducesRightFailureForLeftFailureAndRightFailure() { - enum Error: Swift.Error { case left, right } - - let left = Result.failure(.left) - let right = Result.failure(.right) - - XCTAssertEqual(left.recover(with: right).error, .right) - } - - func testTryMapProducesSuccess() { - let result = success.tryMap(tryIsSuccess) - XCTAssert(result == success) - } - - func testTryMapProducesFailure() { - let result = Result.success("fail").tryMap(tryIsSuccess) - XCTAssert(result == failure) - } -} - - -// MARK: - Fixtures - -enum Error: Swift.Error, LocalizedError { - case a, b - - var errorDescription: String? { - return "localized description" - } - - var failureReason: String? { - return "failure reason" - } - - var helpAnchor: String? { - return "help anchor" - } - - var recoverySuggestion: String? { - return "recovery suggestion" - } -} - -let success = Result.success("success") -let error = AnyError(Error.a) -let error2 = AnyError(Error.b) -let error3 = AnyError(NSError(domain: "Result", code: 42, userInfo: [NSLocalizedDescriptionKey: "localized description"])) -let failure = Result.failure(error) -let failure2 = Result.failure(error2) - -// MARK: - Helpers - -extension AnyError: Equatable { - public static func ==(lhs: AnyError, rhs: AnyError) -> Bool { - return lhs.error._code == rhs.error._code - && lhs.error._domain == rhs.error._domain - } -} - -func tryIsSuccess(_ text: String?) throws -> String { - guard let text = text, text == "success" else { - throw error - } - - return text -} - -extension NSError { - var function: String? { - return userInfo[Result<(), NSError>.functionKey] as? String - } - - var file: String? { - return userInfo[Result<(), NSError>.fileKey] as? String - } - - var line: Int? { - return userInfo[Result<(), NSError>.lineKey] as? Int - } -} - -import Foundation -import Result -import XCTest diff --git a/Carthage/Checkouts/Result/Tests/ResultTests/XCTestManifests.swift b/Carthage/Checkouts/Result/Tests/ResultTests/XCTestManifests.swift deleted file mode 100644 index 7366acf..0000000 --- a/Carthage/Checkouts/Result/Tests/ResultTests/XCTestManifests.swift +++ /dev/null @@ -1,57 +0,0 @@ -import XCTest - -extension AnyErrorTests { - static let __allTests = [ - ("testAnyError", testAnyError), - ] -} - -extension NoErrorTests { - static let __allTests = [ - ("testEquatable", testEquatable), - ] -} - -extension ResultTests { - static let __allTests = [ - ("testAnyErrorDelegatesLocalizedDescriptionToUnderlyingError", testAnyErrorDelegatesLocalizedDescriptionToUnderlyingError), - ("testAnyErrorDelegatesLocalizedFailureReasonToUnderlyingError", testAnyErrorDelegatesLocalizedFailureReasonToUnderlyingError), - ("testAnyErrorDelegatesLocalizedHelpAnchorToUnderlyingError", testAnyErrorDelegatesLocalizedHelpAnchorToUnderlyingError), - ("testAnyErrorDelegatesLocalizedRecoverySuggestionToUnderlyingError", testAnyErrorDelegatesLocalizedRecoverySuggestionToUnderlyingError), - ("testBimapTransformsFailures", testBimapTransformsFailures), - ("testBimapTransformsSuccesses", testBimapTransformsSuccesses), - ("testErrorsIncludeTheCallingFunction", testErrorsIncludeTheCallingFunction), - ("testErrorsIncludeTheSourceFile", testErrorsIncludeTheSourceFile), - ("testErrorsIncludeTheSourceLine", testErrorsIncludeTheSourceLine), - ("testFanout", testFanout), - ("testInitOptionalFailure", testInitOptionalFailure), - ("testInitOptionalSuccess", testInitOptionalSuccess), - ("testMapRewrapsFailures", testMapRewrapsFailures), - ("testMapTransformsSuccesses", testMapTransformsSuccesses), - ("testMaterializeInferrence", testMaterializeInferrence), - ("testMaterializeProducesFailures", testMaterializeProducesFailures), - ("testMaterializeProducesSuccesses", testMaterializeProducesSuccesses), - ("testRecoverProducesLeftForLeftSuccess", testRecoverProducesLeftForLeftSuccess), - ("testRecoverProducesRightForLeftFailure", testRecoverProducesRightForLeftFailure), - ("testRecoverWithProducesLeftForLeftSuccess", testRecoverWithProducesLeftForLeftSuccess), - ("testRecoverWithProducesRightFailureForLeftFailureAndRightFailure", testRecoverWithProducesRightFailureForLeftFailureAndRightFailure), - ("testRecoverWithProducesRightSuccessForLeftFailureAndRightSuccess", testRecoverWithProducesRightSuccessForLeftFailureAndRightSuccess), - ("testTryCatchProducesFailures", testTryCatchProducesFailures), - ("testTryCatchProducesSuccesses", testTryCatchProducesSuccesses), - ("testTryCatchWithFunctionCatchProducesFailures", testTryCatchWithFunctionCatchProducesFailures), - ("testTryCatchWithFunctionProducesSuccesses", testTryCatchWithFunctionProducesSuccesses), - ("testTryCatchWithFunctionThrowingNonAnyErrorCanProducesAnyErrorFailures", testTryCatchWithFunctionThrowingNonAnyErrorCanProducesAnyErrorFailures), - ("testTryMapProducesFailure", testTryMapProducesFailure), - ("testTryMapProducesSuccess", testTryMapProducesSuccess), - ] -} - -#if !os(macOS) -public func __allTests() -> [XCTestCaseEntry] { - return [ - testCase(AnyErrorTests.__allTests), - testCase(NoErrorTests.__allTests), - testCase(ResultTests.__allTests), - ] -} -#endif From 37d18877ee4d5f699ce2cb6419a019ef6038fb9d Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Fri, 13 Dec 2019 17:47:57 -0700 Subject: [PATCH 18/25] =?UTF-8?q?=F0=9F=8D=BA=20Add=20Brewfile.lock.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Brewfile.lock.json | 98 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 Brewfile.lock.json diff --git a/Brewfile.lock.json b/Brewfile.lock.json new file mode 100644 index 0000000..b7a8efc --- /dev/null +++ b/Brewfile.lock.json @@ -0,0 +1,98 @@ +{ + "entries": { + "brew": { + "carthage": { + "version": "0.34.0", + "bottle": { + "cellar": ":any_skip_relocation", + "prefix": "/usr/local", + "files": { + "catalina": { + "url": "https://homebrew.bintray.com/bottles/carthage-0.34.0.catalina.bottle.tar.gz", + "sha256": "e3498577798d41c08522e1478e125c2c07fb1c1d1b9aadc447f9d028ec6b3e83" + }, + "mojave": { + "url": "https://homebrew.bintray.com/bottles/carthage-0.34.0.mojave.bottle.tar.gz", + "sha256": "42ec7f8f09fa1701634ba5f8f162778102db7d03a114320296d3b58df8495a6a" + }, + "high_sierra": { + "url": "https://homebrew.bintray.com/bottles/carthage-0.34.0.high_sierra.bottle.tar.gz", + "sha256": "948811ce4d294c0deee78142c5606a6277b2436afe31f502fc4681acc62428ee" + } + } + } + }, + "shellcheck": { + "version": "0.7.0", + "bottle": { + "cellar": ":any_skip_relocation", + "prefix": "/usr/local", + "files": { + "mojave": { + "url": "https://homebrew.bintray.com/bottles/shellcheck-0.7.0.mojave.bottle.tar.gz", + "sha256": "be8e084d55379a4b5a8bfba78ad298f966f0888e6c3eb7e5202527d3938f3501" + }, + "high_sierra": { + "url": "https://homebrew.bintray.com/bottles/shellcheck-0.7.0.high_sierra.bottle.tar.gz", + "sha256": "a4e12db223139c82649fdc16a2d04184cbaf5fc413c1135b0a1100a16e33290b" + }, + "sierra": { + "url": "https://homebrew.bintray.com/bottles/shellcheck-0.7.0.sierra.bottle.tar.gz", + "sha256": "770a22a491ae6316f7b6e56d8039d30693d857336ccc608de865750798480899" + } + } + } + }, + "swiftlint": { + "version": "0.38.0", + "bottle": { + "cellar": ":any_skip_relocation", + "prefix": "/usr/local", + "files": { + "catalina": { + "url": "https://homebrew.bintray.com/bottles/swiftlint-0.38.0.catalina.bottle.tar.gz", + "sha256": "a2b39e51661fc24d201788391ce4f9c68007c818857f423161b37bc51f7fcb0b" + }, + "mojave": { + "url": "https://homebrew.bintray.com/bottles/swiftlint-0.38.0.mojave.bottle.tar.gz", + "sha256": "f8ae3a1cb06e0ff8034047a1a5e552ba36d475c6995ca11cd5449da84b98319f" + } + } + } + }, + "swiftformat": { + "version": "0.42.0", + "bottle": { + "cellar": ":any_skip_relocation", + "prefix": "/usr/local", + "files": { + "catalina": { + "url": "https://homebrew.bintray.com/bottles/swiftformat-0.42.0.catalina.bottle.tar.gz", + "sha256": "3620b9c2c0a769d9256cacaba49cdd11122f0d0f22161dacb57a6b95f77ad066" + }, + "mojave": { + "url": "https://homebrew.bintray.com/bottles/swiftformat-0.42.0.mojave.bottle.tar.gz", + "sha256": "f51a6e95e61172ee390a66b1d79faac79e22508ed13b9162e75a65a1763f1f8a" + }, + "high_sierra": { + "url": "https://homebrew.bintray.com/bottles/swiftformat-0.42.0.high_sierra.bottle.tar.gz", + "sha256": "b65ec9c24f46a0e786030367f1ac112ac5b498c8ef93ccf3b63e827be3fc80a7" + } + } + } + } + } + }, + "system": { + "macos": { + "catalina": { + "HOMEBREW_VERSION": "2.2.1", + "HOMEBREW_PREFIX": "/usr/local", + "Homebrew/homebrew-core": "1385a56191c2bdd65093a31c477216736b0761e7", + "CLT": "11.3.0.0.1.1574140115", + "Xcode": "11.3", + "macOS": "10.15.2" + } + } + } +} \ No newline at end of file From 40b73b051b991d58c6578aee4e38a2587c615530 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Fri, 13 Dec 2019 17:56:00 -0700 Subject: [PATCH 19/25] =?UTF-8?q?=F0=9F=94=A5=20Remove=20Result=20imports?= =?UTF-8?q?=20and=20project=20references?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MasKit/Commands/Account.swift | 1 - MasKit/Commands/Home.swift | 1 - MasKit/Commands/Info.swift | 1 - MasKit/Commands/Install.swift | 1 - MasKit/Commands/List.swift | 1 - MasKit/Commands/Lucky.swift | 1 - MasKit/Commands/Open.swift | 1 - MasKit/Commands/Outdated.swift | 1 - MasKit/Commands/Reset.swift | 1 - MasKit/Commands/Search.swift | 1 - MasKit/Commands/SignIn.swift | 1 - MasKit/Commands/SignOut.swift | 1 - MasKit/Commands/Uninstall.swift | 1 - MasKit/Commands/Upgrade.swift | 1 - MasKit/Commands/Vendor.swift | 1 - MasKit/Commands/Version.swift | 1 - MasKitTests/Commands/AccountCommandSpec.swift | 1 - MasKitTests/Commands/HomeCommandSpec.swift | 1 - MasKitTests/Commands/InfoCommandSpec.swift | 1 - MasKitTests/Commands/InstallCommandSpec.swift | 1 - MasKitTests/Commands/ListCommandSpec.swift | 1 - MasKitTests/Commands/LuckyCommandSpec.swift | 1 - MasKitTests/Commands/OpenCommandSpec.swift | 1 - MasKitTests/Commands/OutdatedCommandSpec.swift | 1 - MasKitTests/Commands/ResetCommandSpec.swift | 1 - MasKitTests/Commands/SearchCommandSpec.swift | 1 - MasKitTests/Commands/SignInCommandSpec.swift | 1 - MasKitTests/Commands/SignOutCommandSpec.swift | 1 - MasKitTests/Commands/UninstallCommandSpec.swift | 1 - MasKitTests/Commands/UpgradeCommandSpec.swift | 1 - MasKitTests/Commands/VendorCommandSpec.swift | 1 - MasKitTests/Commands/VersionCommandSpec.swift | 1 - MasKitTests/Controllers/MasStoreSearchSpec.swift | 1 - MasKitTests/Controllers/StoreSearchSpec.swift | 1 - MasKitTests/Formatters/SearchResultFormatterSpec.swift | 1 - MasKitTests/Nimble/ResultPredicates.swift | 1 - mas-cli.xcodeproj/project.pbxproj | 8 -------- 37 files changed, 44 deletions(-) diff --git a/MasKit/Commands/Account.swift b/MasKit/Commands/Account.swift index d02993b..5891076 100644 --- a/MasKit/Commands/Account.swift +++ b/MasKit/Commands/Account.swift @@ -7,7 +7,6 @@ // import Commandant -import Result import StoreFoundation public struct AccountCommand: CommandProtocol { diff --git a/MasKit/Commands/Home.swift b/MasKit/Commands/Home.swift index 11a1dc7..8f309ca 100644 --- a/MasKit/Commands/Home.swift +++ b/MasKit/Commands/Home.swift @@ -7,7 +7,6 @@ // import Commandant -import Result /// Opens app page on MAS Preview. Uses the iTunes Lookup API: /// https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/#lookup diff --git a/MasKit/Commands/Info.swift b/MasKit/Commands/Info.swift index 17daae6..3da70f5 100644 --- a/MasKit/Commands/Info.swift +++ b/MasKit/Commands/Info.swift @@ -8,7 +8,6 @@ import Commandant import Foundation -import Result /// Displays app details. Uses the iTunes Lookup API: /// https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/#lookup diff --git a/MasKit/Commands/Install.swift b/MasKit/Commands/Install.swift index 7284e41..8a8aaf0 100644 --- a/MasKit/Commands/Install.swift +++ b/MasKit/Commands/Install.swift @@ -8,7 +8,6 @@ import Commandant import CommerceKit -import Result /// Installs previously purchased apps from the Mac App Store. public struct InstallCommand: CommandProtocol { diff --git a/MasKit/Commands/List.swift b/MasKit/Commands/List.swift index 595f0f6..22365fa 100644 --- a/MasKit/Commands/List.swift +++ b/MasKit/Commands/List.swift @@ -7,7 +7,6 @@ // import Commandant -import Result /// Command which lists all installed apps. public struct ListCommand: CommandProtocol { diff --git a/MasKit/Commands/Lucky.swift b/MasKit/Commands/Lucky.swift index 88265ab..364e3d9 100644 --- a/MasKit/Commands/Lucky.swift +++ b/MasKit/Commands/Lucky.swift @@ -8,7 +8,6 @@ import Commandant import CommerceKit -import Result /// Command which installs the first search result. This is handy as many MAS titles /// can be long with embedded keywords. diff --git a/MasKit/Commands/Open.swift b/MasKit/Commands/Open.swift index 3768387..3ce66f3 100644 --- a/MasKit/Commands/Open.swift +++ b/MasKit/Commands/Open.swift @@ -7,7 +7,6 @@ // import Commandant -import Result private let markerValue = "appstore" private let masScheme = "macappstore" diff --git a/MasKit/Commands/Outdated.swift b/MasKit/Commands/Outdated.swift index fe1a3f5..0f37b8c 100644 --- a/MasKit/Commands/Outdated.swift +++ b/MasKit/Commands/Outdated.swift @@ -8,7 +8,6 @@ import Commandant import CommerceKit -import Result /// Command which displays a list of installed apps which have available updates /// ready to be installed from the Mac App Store. diff --git a/MasKit/Commands/Reset.swift b/MasKit/Commands/Reset.swift index 9ebc3da..7c905d4 100644 --- a/MasKit/Commands/Reset.swift +++ b/MasKit/Commands/Reset.swift @@ -8,7 +8,6 @@ import Commandant import CommerceKit -import Result /// Kills several macOS processes as a means to reset the app store. public struct ResetCommand: CommandProtocol { diff --git a/MasKit/Commands/Search.swift b/MasKit/Commands/Search.swift index eafc51c..94f8556 100644 --- a/MasKit/Commands/Search.swift +++ b/MasKit/Commands/Search.swift @@ -7,7 +7,6 @@ // import Commandant -import Result /// Search the Mac App Store using the iTunes Search API: /// https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/ diff --git a/MasKit/Commands/SignIn.swift b/MasKit/Commands/SignIn.swift index f1c1878..22173d8 100644 --- a/MasKit/Commands/SignIn.swift +++ b/MasKit/Commands/SignIn.swift @@ -7,7 +7,6 @@ // import Commandant -import Result import StoreFoundation public struct SignInCommand: CommandProtocol { diff --git a/MasKit/Commands/SignOut.swift b/MasKit/Commands/SignOut.swift index 501803c..40e9822 100644 --- a/MasKit/Commands/SignOut.swift +++ b/MasKit/Commands/SignOut.swift @@ -8,7 +8,6 @@ import Commandant import CommerceKit -import Result public struct SignOutCommand: CommandProtocol { public typealias Options = NoOptions diff --git a/MasKit/Commands/Uninstall.swift b/MasKit/Commands/Uninstall.swift index af63268..e555eed 100644 --- a/MasKit/Commands/Uninstall.swift +++ b/MasKit/Commands/Uninstall.swift @@ -8,7 +8,6 @@ import Commandant import CommerceKit -import Result import StoreFoundation /// Command which uninstalls apps managed by the Mac App Store. diff --git a/MasKit/Commands/Upgrade.swift b/MasKit/Commands/Upgrade.swift index fb993d1..64d070c 100644 --- a/MasKit/Commands/Upgrade.swift +++ b/MasKit/Commands/Upgrade.swift @@ -8,7 +8,6 @@ import Commandant import CommerceKit -import Result /// Command which upgrades apps with new versions available in the Mac App Store. public struct UpgradeCommand: CommandProtocol { diff --git a/MasKit/Commands/Vendor.swift b/MasKit/Commands/Vendor.swift index 74f7c53..c598d96 100644 --- a/MasKit/Commands/Vendor.swift +++ b/MasKit/Commands/Vendor.swift @@ -7,7 +7,6 @@ // import Commandant -import Result /// Opens vendor's app page in a browser. Uses the iTunes Lookup API: /// https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/#lookup diff --git a/MasKit/Commands/Version.swift b/MasKit/Commands/Version.swift index 64c2e33..d468436 100644 --- a/MasKit/Commands/Version.swift +++ b/MasKit/Commands/Version.swift @@ -7,7 +7,6 @@ // import Commandant -import Result /// Command which displays the version of the mas tool. public struct VersionCommand: CommandProtocol { diff --git a/MasKitTests/Commands/AccountCommandSpec.swift b/MasKitTests/Commands/AccountCommandSpec.swift index 135b588..04cedb1 100644 --- a/MasKitTests/Commands/AccountCommandSpec.swift +++ b/MasKitTests/Commands/AccountCommandSpec.swift @@ -9,7 +9,6 @@ @testable import MasKit import Nimble import Quick -import Result class AccountCommandSpec: QuickSpec { override func spec() { diff --git a/MasKitTests/Commands/HomeCommandSpec.swift b/MasKitTests/Commands/HomeCommandSpec.swift index 7a97be0..50ce298 100644 --- a/MasKitTests/Commands/HomeCommandSpec.swift +++ b/MasKitTests/Commands/HomeCommandSpec.swift @@ -9,7 +9,6 @@ @testable import MasKit import Nimble import Quick -import Result class HomeCommandSpec: QuickSpec { override func spec() { diff --git a/MasKitTests/Commands/InfoCommandSpec.swift b/MasKitTests/Commands/InfoCommandSpec.swift index d6b06fd..ea98095 100644 --- a/MasKitTests/Commands/InfoCommandSpec.swift +++ b/MasKitTests/Commands/InfoCommandSpec.swift @@ -9,7 +9,6 @@ @testable import MasKit import Nimble import Quick -import Result class InfoCommandSpec: QuickSpec { override func spec() { diff --git a/MasKitTests/Commands/InstallCommandSpec.swift b/MasKitTests/Commands/InstallCommandSpec.swift index 861da86..fe036d8 100644 --- a/MasKitTests/Commands/InstallCommandSpec.swift +++ b/MasKitTests/Commands/InstallCommandSpec.swift @@ -9,7 +9,6 @@ @testable import MasKit import Nimble import Quick -import Result class InstallCommandSpec: QuickSpec { override func spec() { diff --git a/MasKitTests/Commands/ListCommandSpec.swift b/MasKitTests/Commands/ListCommandSpec.swift index 967dcf5..ab6f2b2 100644 --- a/MasKitTests/Commands/ListCommandSpec.swift +++ b/MasKitTests/Commands/ListCommandSpec.swift @@ -9,7 +9,6 @@ @testable import MasKit import Nimble import Quick -import Result class ListCommandSpec: QuickSpec { override func spec() { diff --git a/MasKitTests/Commands/LuckyCommandSpec.swift b/MasKitTests/Commands/LuckyCommandSpec.swift index 0008055..302fabf 100644 --- a/MasKitTests/Commands/LuckyCommandSpec.swift +++ b/MasKitTests/Commands/LuckyCommandSpec.swift @@ -9,7 +9,6 @@ @testable import MasKit import Nimble import Quick -import Result class LuckyCommandSpec: QuickSpec { override func spec() { diff --git a/MasKitTests/Commands/OpenCommandSpec.swift b/MasKitTests/Commands/OpenCommandSpec.swift index d358881..647d71d 100644 --- a/MasKitTests/Commands/OpenCommandSpec.swift +++ b/MasKitTests/Commands/OpenCommandSpec.swift @@ -9,7 +9,6 @@ @testable import MasKit import Nimble import Quick -import Result class OpenCommandSpec: QuickSpec { override func spec() { diff --git a/MasKitTests/Commands/OutdatedCommandSpec.swift b/MasKitTests/Commands/OutdatedCommandSpec.swift index 808f246..c296a14 100644 --- a/MasKitTests/Commands/OutdatedCommandSpec.swift +++ b/MasKitTests/Commands/OutdatedCommandSpec.swift @@ -9,7 +9,6 @@ @testable import MasKit import Nimble import Quick -import Result class OutdatedCommandSpec: QuickSpec { override func spec() { diff --git a/MasKitTests/Commands/ResetCommandSpec.swift b/MasKitTests/Commands/ResetCommandSpec.swift index fd9d2c2..fec828f 100644 --- a/MasKitTests/Commands/ResetCommandSpec.swift +++ b/MasKitTests/Commands/ResetCommandSpec.swift @@ -9,7 +9,6 @@ @testable import MasKit import Nimble import Quick -import Result class ResetCommandSpec: QuickSpec { override func spec() { diff --git a/MasKitTests/Commands/SearchCommandSpec.swift b/MasKitTests/Commands/SearchCommandSpec.swift index 89db580..617c0b4 100644 --- a/MasKitTests/Commands/SearchCommandSpec.swift +++ b/MasKitTests/Commands/SearchCommandSpec.swift @@ -9,7 +9,6 @@ @testable import MasKit import Nimble import Quick -import Result class SearchCommandSpec: QuickSpec { override func spec() { diff --git a/MasKitTests/Commands/SignInCommandSpec.swift b/MasKitTests/Commands/SignInCommandSpec.swift index 991f69a..d525fbd 100644 --- a/MasKitTests/Commands/SignInCommandSpec.swift +++ b/MasKitTests/Commands/SignInCommandSpec.swift @@ -9,7 +9,6 @@ @testable import MasKit import Nimble import Quick -import Result class SignInCommandSpec: QuickSpec { override func spec() { diff --git a/MasKitTests/Commands/SignOutCommandSpec.swift b/MasKitTests/Commands/SignOutCommandSpec.swift index b0dbc8c..9f33f98 100644 --- a/MasKitTests/Commands/SignOutCommandSpec.swift +++ b/MasKitTests/Commands/SignOutCommandSpec.swift @@ -9,7 +9,6 @@ @testable import MasKit import Nimble import Quick -import Result class SignOutCommandSpec: QuickSpec { override func spec() { diff --git a/MasKitTests/Commands/UninstallCommandSpec.swift b/MasKitTests/Commands/UninstallCommandSpec.swift index 1382d1f..e18a896 100644 --- a/MasKitTests/Commands/UninstallCommandSpec.swift +++ b/MasKitTests/Commands/UninstallCommandSpec.swift @@ -9,7 +9,6 @@ @testable import MasKit import Nimble import Quick -import Result class UninstallCommandSpec: QuickSpec { override func spec() { diff --git a/MasKitTests/Commands/UpgradeCommandSpec.swift b/MasKitTests/Commands/UpgradeCommandSpec.swift index b92513f..620c02b 100644 --- a/MasKitTests/Commands/UpgradeCommandSpec.swift +++ b/MasKitTests/Commands/UpgradeCommandSpec.swift @@ -9,7 +9,6 @@ @testable import MasKit import Nimble import Quick -import Result class UpgradeCommandSpec: QuickSpec { override func spec() { diff --git a/MasKitTests/Commands/VendorCommandSpec.swift b/MasKitTests/Commands/VendorCommandSpec.swift index e1ad009..7f1e7bb 100644 --- a/MasKitTests/Commands/VendorCommandSpec.swift +++ b/MasKitTests/Commands/VendorCommandSpec.swift @@ -9,7 +9,6 @@ @testable import MasKit import Nimble import Quick -import Result class VendorCommandSpec: QuickSpec { override func spec() { diff --git a/MasKitTests/Commands/VersionCommandSpec.swift b/MasKitTests/Commands/VersionCommandSpec.swift index acfb363..304a8a5 100644 --- a/MasKitTests/Commands/VersionCommandSpec.swift +++ b/MasKitTests/Commands/VersionCommandSpec.swift @@ -9,7 +9,6 @@ @testable import MasKit import Nimble import Quick -import Result class VersionCommandSpec: QuickSpec { override func spec() { diff --git a/MasKitTests/Controllers/MasStoreSearchSpec.swift b/MasKitTests/Controllers/MasStoreSearchSpec.swift index 7280dc8..280b9da 100644 --- a/MasKitTests/Controllers/MasStoreSearchSpec.swift +++ b/MasKitTests/Controllers/MasStoreSearchSpec.swift @@ -9,7 +9,6 @@ @testable import MasKit import Nimble import Quick -import Result class MasStoreSearchSpec: QuickSpec { override func spec() { diff --git a/MasKitTests/Controllers/StoreSearchSpec.swift b/MasKitTests/Controllers/StoreSearchSpec.swift index ae22517..699592b 100644 --- a/MasKitTests/Controllers/StoreSearchSpec.swift +++ b/MasKitTests/Controllers/StoreSearchSpec.swift @@ -8,7 +8,6 @@ @testable import MasKit import Nimble import Quick -import Result /// Protocol minimal implementation struct StoreSearchForTesting: StoreSearch { diff --git a/MasKitTests/Formatters/SearchResultFormatterSpec.swift b/MasKitTests/Formatters/SearchResultFormatterSpec.swift index 0da40a0..3052ea2 100644 --- a/MasKitTests/Formatters/SearchResultFormatterSpec.swift +++ b/MasKitTests/Formatters/SearchResultFormatterSpec.swift @@ -9,7 +9,6 @@ @testable import MasKit import Nimble import Quick -import Result class SearchResultsFormatterSpec: QuickSpec { override func spec() { diff --git a/MasKitTests/Nimble/ResultPredicates.swift b/MasKitTests/Nimble/ResultPredicates.swift index e6384cb..5944de6 100644 --- a/MasKitTests/Nimble/ResultPredicates.swift +++ b/MasKitTests/Nimble/ResultPredicates.swift @@ -8,7 +8,6 @@ @testable import MasKit import Nimble -import Result /// Nimble predicate for result enum success case, no associated value func beSuccess() -> Predicate> { diff --git a/mas-cli.xcodeproj/project.pbxproj b/mas-cli.xcodeproj/project.pbxproj index 3a22441..a0c0cdb 100644 --- a/mas-cli.xcodeproj/project.pbxproj +++ b/mas-cli.xcodeproj/project.pbxproj @@ -7,9 +7,7 @@ objects = { /* Begin PBXBuildFile section */ - B537017321A0F85700538F78 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 90CB4069213F4DDD0044E445 /* Result.framework */; }; B537017421A0F85B00538F78 /* Commandant.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 90CB406B213F4DDD0044E445 /* Commandant.framework */; }; - B537017521A0F94000538F78 /* Result.framework in Copy Carthage Frameworks */ = {isa = PBXBuildFile; fileRef = 90CB4069213F4DDD0044E445 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; B537017621A0F94200538F78 /* Commandant.framework in Copy Carthage Frameworks */ = {isa = PBXBuildFile; fileRef = 90CB406B213F4DDD0044E445 /* Commandant.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; B5552928219A1BB900ACB4CA /* CommerceKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F83213A62173EF75008BA8A0 /* CommerceKit.framework */; }; B5552929219A1BC700ACB4CA /* StoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F83213A52173EF75008BA8A0 /* StoreFoundation.framework */; }; @@ -104,10 +102,8 @@ F83213A02173D5B2008BA8A0 /* SSPurchase.h in Headers */ = {isa = PBXBuildFile; fileRef = F8FB71B120F2EC4500F56FDC /* SSPurchase.h */; }; F83213A12173D5B2008BA8A0 /* SSPurchaseResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = F8FB71B220F2EC4500F56FDC /* SSPurchaseResponse.h */; }; F83213A22173DC13008BA8A0 /* Commandant.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 90CB406B213F4DDD0044E445 /* Commandant.framework */; }; - F83213A32173DC18008BA8A0 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 90CB4069213F4DDD0044E445 /* Result.framework */; }; F83213A82173F5A7008BA8A0 /* MasKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8FB715220F2B41400F56FDC /* MasKit.framework */; }; F83213A92173F5D0008BA8A0 /* Commandant.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 90CB406B213F4DDD0044E445 /* Commandant.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - F83213AA2173F5D0008BA8A0 /* Result.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 90CB4069213F4DDD0044E445 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; F8FB715B20F2B41400F56FDC /* MasKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8FB715220F2B41400F56FDC /* MasKit.framework */; }; F8FB716220F2B41400F56FDC /* MasKit.h in Headers */ = {isa = PBXBuildFile; fileRef = F8FB715420F2B41400F56FDC /* MasKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; F8FB716A20F2B4DD00F56FDC /* Downloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED0F238A1B87569C00AE40CD /* Downloader.swift */; }; @@ -168,7 +164,6 @@ B537017621A0F94200538F78 /* Commandant.framework in Copy Carthage Frameworks */, B5552936219A23FF00ACB4CA /* Nimble.framework in Copy Carthage Frameworks */, B5552937219A23FF00ACB4CA /* Quick.framework in Copy Carthage Frameworks */, - B537017521A0F94000538F78 /* Result.framework in Copy Carthage Frameworks */, ); name = "Copy Carthage Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -189,7 +184,6 @@ dstSubfolderSpec = 10; files = ( F83213A92173F5D0008BA8A0 /* Commandant.framework in Copy Frameworks */, - F83213AA2173F5D0008BA8A0 /* Result.framework in Copy Frameworks */, ); name = "Copy Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -369,7 +363,6 @@ files = ( F83213A22173DC13008BA8A0 /* Commandant.framework in Frameworks */, B5552928219A1BB900ACB4CA /* CommerceKit.framework in Frameworks */, - F83213A32173DC18008BA8A0 /* Result.framework in Frameworks */, B5552929219A1BC700ACB4CA /* StoreFoundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -382,7 +375,6 @@ F8FB715B20F2B41400F56FDC /* MasKit.framework in Frameworks */, B555292F219A219100ACB4CA /* Nimble.framework in Frameworks */, B555292E219A218E00ACB4CA /* Quick.framework in Frameworks */, - B537017321A0F85700538F78 /* Result.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; From d9b98b8e40384b8c00eb2092bf9ec0cacaa780da Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Fri, 13 Dec 2019 18:02:23 -0700 Subject: [PATCH 20/25] =?UTF-8?q?=F0=9F=8D=BC=20Remove=20Result=20from=20f?= =?UTF-8?q?ormula?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Homebrew/mas--1.4.2.high_sierra.bottle.json | 24 --------------------- Homebrew/mas-tap.rb | 2 +- Homebrew/mas.rb | 2 +- 3 files changed, 2 insertions(+), 26 deletions(-) delete mode 100644 Homebrew/mas--1.4.2.high_sierra.bottle.json diff --git a/Homebrew/mas--1.4.2.high_sierra.bottle.json b/Homebrew/mas--1.4.2.high_sierra.bottle.json deleted file mode 100644 index 0f57e06..0000000 --- a/Homebrew/mas--1.4.2.high_sierra.bottle.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "mas": { - "formula": { - "pkg_version": "1.4.2", - "path": "Library/Taps/homebrew/homebrew-core/Formula/mas.rb" - }, - "bottle": { - "root_url": "https://homebrew.bintray.com/bottles", - "prefix": "/usr/local", - "cellar": "any_skip_relocation", - "rebuild": 0, - "tags": { - "high_sierra": { - "filename": "mas-1.4.2.high_sierra.bottle.tar.gz", - "sha256": "caaea8c47a2507a9fcd2d070f5b74822d9ce2903aa39fd7adafaab0bea9a7f8e" - } - } - }, - "bintray": { - "package": "mas", - "repository": "bottles" - } - } -} diff --git a/Homebrew/mas-tap.rb b/Homebrew/mas-tap.rb index 1a3caab..72c9dac 100644 --- a/Homebrew/mas-tap.rb +++ b/Homebrew/mas-tap.rb @@ -30,7 +30,7 @@ class Mas < Formula ENV["XCODE_XCCONFIG_FILE"] = xcconfig # Only build necessary dependencies (Commandant, Result) - system "carthage", "bootstrap", "--platform", "macOS", "Commandant", "Result" + system "carthage", "bootstrap", "--platform", "macOS", "Commandant" system "script/install", prefix bash_completion.install "contrib/completion/mas-completion.bash" => "mas" diff --git a/Homebrew/mas.rb b/Homebrew/mas.rb index 57b8474..3b16aee 100644 --- a/Homebrew/mas.rb +++ b/Homebrew/mas.rb @@ -27,7 +27,7 @@ class Mas < Formula ENV["XCODE_XCCONFIG_FILE"] = xcconfig # Only build necessary dependencies (Commandant, Result) - system "carthage", "bootstrap", "--platform", "macOS", "Commandant", "Result" + system "carthage", "bootstrap", "--platform", "macOS", "Commandant" system "script/install", prefix bash_completion.install "contrib/completion/mas-completion.bash" => "mas" From f416be015a9790ea6071d6e3130fb7df66f43369 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Fri, 13 Dec 2019 18:32:13 -0700 Subject: [PATCH 21/25] =?UTF-8?q?=F0=9F=8D=BC=20Xcode=2010.2=20and=20macOS?= =?UTF-8?q?=2010.14=20required=20to=20build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Homebrew/mas-tap.rb | 2 +- Homebrew/mas.rb | 2 +- README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Homebrew/mas-tap.rb b/Homebrew/mas-tap.rb index 72c9dac..ea615bf 100644 --- a/Homebrew/mas-tap.rb +++ b/Homebrew/mas-tap.rb @@ -16,7 +16,7 @@ class Mas < Formula end depends_on "carthage" => :build - depends_on :xcode => ["10.1", :build] + depends_on :xcode => ["10.2", :build] def install # Working around build issues in dependencies diff --git a/Homebrew/mas.rb b/Homebrew/mas.rb index 3b16aee..3b34436 100644 --- a/Homebrew/mas.rb +++ b/Homebrew/mas.rb @@ -13,7 +13,7 @@ class Mas < Formula end depends_on "carthage" => :build - depends_on :xcode => ["10.1", :build] + depends_on :xcode => ["10.2", :build] def install # Working around build issues in dependencies diff --git a/README.md b/README.md index 49ba7ae..37c2d9e 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ A simple command line interface for the Mac App Store. Designed for scripting an brew install mas ``` -⚠️ Note that macOS 10.13 (High Sierra) is required to install mas from the core Homebrew formula. +⚠️ Note that macOS 10.14 (Mojave) is required to install mas from the core Homebrew formula. ### ☎️ Older macOS Versions From 664405077d810ff66d21176879ac5d6e4f0b950e Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Fri, 13 Dec 2019 18:32:24 -0700 Subject: [PATCH 22/25] =?UTF-8?q?=F0=9F=93=9D=20Update=20changelog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7007c4..8085bbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +- 🕊 Swift 5 #255 + - ⚒️ Xcode 10.2 and macOS 10.14 required to build +- ⬆️ Commandant (0.17.0) #255 +- ⬆️ Nimble (8.0.4) #255 +- ⬆️ Quick (2.2.0) #255 +- ➖ Result #255 + ## [v1.6.3] 🗒️ List Fix - 2019-03-31 - 🐛 Fix for list command on macOS 10.14.4 #228 From 15c988b2167556c8458ce9b9f3d9b22032d81215 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Mon, 10 Feb 2020 05:46:58 -0700 Subject: [PATCH 23/25] =?UTF-8?q?=E2=AC=86=EF=B8=8F=F0=9F=93=A6=20Update?= =?UTF-8?q?=20brew=20tools?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - swiftlint (0.38.2) - swiftformat (0.44.2) --- Brewfile.lock.json | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Brewfile.lock.json b/Brewfile.lock.json index b7a8efc..6b7e776 100644 --- a/Brewfile.lock.json +++ b/Brewfile.lock.json @@ -44,39 +44,39 @@ } }, "swiftlint": { - "version": "0.38.0", + "version": "0.38.2", "bottle": { "cellar": ":any_skip_relocation", "prefix": "/usr/local", "files": { "catalina": { - "url": "https://homebrew.bintray.com/bottles/swiftlint-0.38.0.catalina.bottle.tar.gz", - "sha256": "a2b39e51661fc24d201788391ce4f9c68007c818857f423161b37bc51f7fcb0b" + "url": "https://homebrew.bintray.com/bottles/swiftlint-0.38.2.catalina.bottle.tar.gz", + "sha256": "17825c973c9bff40f16a37e9500e3bcea295bc5f490979d3eec73c17b1eb11f4" }, "mojave": { - "url": "https://homebrew.bintray.com/bottles/swiftlint-0.38.0.mojave.bottle.tar.gz", - "sha256": "f8ae3a1cb06e0ff8034047a1a5e552ba36d475c6995ca11cd5449da84b98319f" + "url": "https://homebrew.bintray.com/bottles/swiftlint-0.38.2.mojave.bottle.tar.gz", + "sha256": "26a3db64ed222c5a3b58a920919bbcd06feb371c9d4241f00623935670f588d4" } } } }, "swiftformat": { - "version": "0.42.0", + "version": "0.44.2", "bottle": { "cellar": ":any_skip_relocation", "prefix": "/usr/local", "files": { "catalina": { - "url": "https://homebrew.bintray.com/bottles/swiftformat-0.42.0.catalina.bottle.tar.gz", - "sha256": "3620b9c2c0a769d9256cacaba49cdd11122f0d0f22161dacb57a6b95f77ad066" + "url": "https://homebrew.bintray.com/bottles/swiftformat-0.44.2.catalina.bottle.tar.gz", + "sha256": "bf4e73e35b35f6bbaedd0009a26781634c2c22a145de80adf3c69e9caf8fcc6d" }, "mojave": { - "url": "https://homebrew.bintray.com/bottles/swiftformat-0.42.0.mojave.bottle.tar.gz", - "sha256": "f51a6e95e61172ee390a66b1d79faac79e22508ed13b9162e75a65a1763f1f8a" + "url": "https://homebrew.bintray.com/bottles/swiftformat-0.44.2.mojave.bottle.tar.gz", + "sha256": "1b17615950195914196f9c91259a6ae90d15e0b6cbba30f238ef6bd47078ce91" }, "high_sierra": { - "url": "https://homebrew.bintray.com/bottles/swiftformat-0.42.0.high_sierra.bottle.tar.gz", - "sha256": "b65ec9c24f46a0e786030367f1ac112ac5b498c8ef93ccf3b63e827be3fc80a7" + "url": "https://homebrew.bintray.com/bottles/swiftformat-0.44.2.high_sierra.bottle.tar.gz", + "sha256": "bc9e8cdf3c1b9a2295d75b065f1b8be81725a95fdbed7869e5ff56a8c02c36da" } } } @@ -86,12 +86,12 @@ "system": { "macos": { "catalina": { - "HOMEBREW_VERSION": "2.2.1", + "HOMEBREW_VERSION": "2.2.5-28-gb8c2e96", "HOMEBREW_PREFIX": "/usr/local", - "Homebrew/homebrew-core": "1385a56191c2bdd65093a31c477216736b0761e7", - "CLT": "11.3.0.0.1.1574140115", + "Homebrew/homebrew-core": "e6c5f7c9e296f7b749e2d18369315e660de3428f", + "CLT": "", "Xcode": "11.3", - "macOS": "10.15.2" + "macOS": "10.15.3" } } } From bfb5629bb0afeb8c604f538a3ff7fb3b1b54859c Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Mon, 10 Feb 2020 05:52:18 -0700 Subject: [PATCH 24/25] =?UTF-8?q?=E2=9E=96Remote=20Result=20from=20Compone?= =?UTF-8?q?nts.plist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Package/Components.plist | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Package/Components.plist b/Package/Components.plist index c66ef7f..e331dda 100644 --- a/Package/Components.plist +++ b/Package/Components.plist @@ -9,12 +9,6 @@ upgrade ChildBundles - - BundleOverwriteAction - - RootRelativeBundlePath - Frameworks/MasKit.framework/Versions/A/Frameworks/Result.framework - BundleOverwriteAction From 94e8d62443dc54dfecb34aa186bbe8e25b958963 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Wed, 12 Feb 2020 08:09:09 -0700 Subject: [PATCH 25/25] =?UTF-8?q?=F0=9F=91=B7=F0=9F=8F=BB=E2=80=8D?= =?UTF-8?q?=E2=99=80=EF=B8=8F=20Update=20travis=20image=20to=20xcode11.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ec007d6..3b499e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,9 @@ # https://docs.travis-ci.com/user/build-config-validation version: ~> 1.0 +# https://docs.travis-ci.com/user/reference/osx/#macos-version os: osx -osx_image: xcode11.2 # macOS 10.14 +osx_image: xcode11.3 # macOS 10.14 env: global: