From 2937238c78cf793b3a87729d1bedf58fbaa48bb6 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Sun, 17 Mar 2019 11:30:48 -0600 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Commandant=20(0.15.0+)?= 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]