diff --git a/CHANGELOG.md b/CHANGELOG.md index 45d9c51..e71ac1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - 🐛 Fix alignment of 2nd column of list command output #298 - ✨ `Makefile` #277 - 🐛 Specify desired LD_RUNPATH_SEARCH_PATHS at link-time #310 -- ⬆️ Commandant (0.17.0) #310 +- ⬆️ Commandant (0.18.0) #310 - ⬆️ Nimble (9.0.0) #310 - ⬆️ Quick (3.1.0) #310 - 🕊 Swift 5.2 #310 diff --git a/Cartfile.resolved b/Cartfile.resolved index 2586571..ae68334 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,3 +1,3 @@ -github "Carthage/Commandant" "0.17.0" +github "Carthage/Commandant" "0.18.0" github "Quick/Nimble" "v9.0.0" github "Quick/Quick" "v3.1.0" diff --git a/Carthage/Checkouts/Commandant/.gitignore b/Carthage/Checkouts/Commandant/.gitignore index 415ffcb..58ce9b0 100644 --- a/Carthage/Checkouts/Commandant/.gitignore +++ b/Carthage/Checkouts/Commandant/.gitignore @@ -1,24 +1,22 @@ -# Xcode -# -.DS_Store -build/ -*.pbxuser -!default.pbxuser -*.mode1v3 !default.mode1v3 -*.mode2v3 !default.mode2v3 -*.perspectivev3 +!default.pbxuser !default.perspectivev3 -xcuserdata -*.xccheckout -*.moved-aside -DerivedData *.hmap *.ipa -*.xcuserstate +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +*.xccheckout *.xcscmblueprint - -Carthage/Build -Packages/ +*.xcuserstate +.DS_Store .build/ +.swiftpm/ +Carthage/Build +DerivedData +Packages/ +build/ +xcuserdata diff --git a/Carthage/Checkouts/Commandant/.swift-version b/Carthage/Checkouts/Commandant/.swift-version index 819e07a..ef425ca 100644 --- a/Carthage/Checkouts/Commandant/.swift-version +++ b/Carthage/Checkouts/Commandant/.swift-version @@ -1 +1 @@ -5.0 +5.2 diff --git a/Carthage/Checkouts/Commandant/.travis.yml b/Carthage/Checkouts/Commandant/.travis.yml index 19b717b..8782bc7 100644 --- a/Carthage/Checkouts/Commandant/.travis.yml +++ b/Carthage/Checkouts/Commandant/.travis.yml @@ -9,7 +9,7 @@ aliases: script: - rm .swift-version - gem update cocoapods - - pod repo update master + - pod setup - pod lib lint --verbose os: osx language: objective-c @@ -29,7 +29,7 @@ aliases: - &swiftpm_linux <<: *swiftpm sudo: required - dist: trusty + dist: xenial language: generic install: - eval "$(curl -sL https://swiftenv.fuller.li/install.sh)" @@ -41,20 +41,20 @@ branches: matrix: include: - <<: *xcode - name: Xcode 10.2 / Swift 5.0 - osx_image: xcode10.2 - env: JOB=Xcode10.2 + name: Xcode 11.4 / Swift 5.2 + osx_image: xcode11.4 + env: JOB=Xcode11.4 - <<: *cocoapods name: CocoaPods Lint - osx_image: xcode10.2 + osx_image: xcode11.4 - <<: *swiftpm_darwin - name: SwiftPM / Swift 5.0 - osx_image: xcode10.2 + name: SwiftPM / Swift 5.2 + osx_image: xcode11.4 - <<: *swiftpm_linux - name: Linux / Swift 5.0 + name: Linux / Swift 5.2 env: - JOB=Linux - - SWIFT_VERSION=5.0 + - SWIFT_VERSION=5.2 notifications: email: false diff --git a/Carthage/Checkouts/Commandant/Cartfile.private b/Carthage/Checkouts/Commandant/Cartfile.private index 6da26fd..61cab70 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" ~> 2.0 -github "Quick/Nimble" ~> 8.0 +github "jspahrsummers/xcconfigs" ~> 1.1 +github "Quick/Quick" ~> 3.1.0 +github "Quick/Nimble" ~> 9.0 diff --git a/Carthage/Checkouts/Commandant/Cartfile.resolved b/Carthage/Checkouts/Commandant/Cartfile.resolved index 8c30baf..2983c56 100644 --- a/Carthage/Checkouts/Commandant/Cartfile.resolved +++ b/Carthage/Checkouts/Commandant/Cartfile.resolved @@ -1,3 +1,3 @@ -github "Quick/Nimble" "v8.0.0" -github "Quick/Quick" "v2.0.0" -github "jspahrsummers/xcconfigs" "0.9" +github "Quick/Nimble" "v9.0.0" +github "Quick/Quick" "v3.1.0" +github "jspahrsummers/xcconfigs" "1.1" diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.github/ISSUE_TEMPLATE b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.github/ISSUE_TEMPLATE index 85e591e..1273aff 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.github/ISSUE_TEMPLATE +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.github/ISSUE_TEMPLATE @@ -16,17 +16,17 @@ Please replace this with what happened instead. List the software versions you're using: - - Quick: *?.?.?* - - Nimble: *?.?.?* - - Xcode Version: *?.? (????)* (Open Xcode; In menubar: Xcode > About Xcode) - - Swift Version: *?.?* (Open Xcode Preferences; Components > Toolchains. If none, use `Xcode Default`.) +- Quick: *?.?.?* +- Nimble: *?.?.?* +- Xcode Version: *?.? (????)* (Open Xcode; In menubar: Xcode > About Xcode) +- Swift Version: *?.?* (Open Xcode Preferences; Components > Toolchains. If none, use `Xcode Default`.) Please also mention which package manager you used and its version. Delete the other package managers in this list: - - Cocoapods: *?.?.?* (Use `pod --version` in Terminal) - - Carthage: *?.?* (Use `carthage version` in Terminal) - - Swift Package Manager *?.?.? (swiftpm-???)* (Use `swift build --version` in Terminal) +- Cocoapods: *?.?.?* (Use `pod --version` in Terminal) +- Carthage: *?.?* (Use `carthage version` in Terminal) +- Swift Package Manager *?.?.? (swiftpm-???)* (Use `swift build --version` in Terminal) ### Project that demonstrates the issue diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.github/PULL_REQUEST_TEMPLATE b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.github/PULL_REQUEST_TEMPLATE index 20e40c8..0e3395a 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.github/PULL_REQUEST_TEMPLATE +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.github/PULL_REQUEST_TEMPLATE @@ -1,14 +1,13 @@ The PR should summarize what was changed and why. Here are some questions to help you if you're not sure: - - What behavior was changed? - - What code was refactored / updated to support this change? - - What issues are related to this PR? Or why was this change introduced? +- What behavior was changed? +- What code was refactored / updated to support this change? +- What issues are related to this PR? Or why was this change introduced? Checklist - While not every PR needs it, new features should consider this list: - - [ ] Does this have tests? - - [ ] Does this have documentation? - - [ ] Does this break the public API (Requires major version bump)? - - [ ] Is this a new feature (Requires minor version bump)? - +- [ ] Does this have tests? +- [ ] Does this have documentation? +- [ ] Does this break the public API (Requires major version bump)? +- [ ] Is this a new feature (Requires minor version bump)? diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.github/dependabot.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.github/dependabot.yml new file mode 100644 index 0000000..92e8783 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.github/dependabot.yml @@ -0,0 +1,15 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "bundler" + directory: "/" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.github/workflows/ci.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.github/workflows/ci.yml new file mode 100644 index 0000000..bf604fd --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - "*" + +jobs: + cocoapods: + name: CocoaPods Lint + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - run: bundle install + - run: ./test podspec + + xcode: + name: Xcode ${{ matrix.xcode }} - ${{ matrix.platform }} + runs-on: macos-latest + strategy: + matrix: + xcode: [11.7, 12] + platform: [macos, ios, tvos] + fail-fast: false + env: + DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app + steps: + - uses: actions/checkout@v2 + - run: ./test ${{ matrix.platform }} + - run: ./test ${{ matrix.platform }}_xcodespm + + swiftpm_darwin: + name: SwiftPM, Darwin, Xcode ${{ matrix.xcode }} + runs-on: macos-latest + strategy: + matrix: + xcode: [11.7, 12] + env: + DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app + steps: + - uses: actions/checkout@v2 + - run: ./test swiftpm diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.github/workflows/swiftlint.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.github/workflows/swiftlint.yml new file mode 100644 index 0000000..c10adfe --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.github/workflows/swiftlint.yml @@ -0,0 +1,15 @@ +name: SwiftLint + +on: + pull_request: + paths: + - '.github/workflows/swiftlint.yml' + - '.swiftlint.yml' + - '**/*.swift' + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: norio-nomura/action-swiftlint@3.1.0 diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.hound.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.hound.yml deleted file mode 100644 index b867fd9..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.hound.yml +++ /dev/null @@ -1,2 +0,0 @@ -swift: - config_file: .swiftlint.yml diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.swift-version b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.swift-version deleted file mode 100644 index bf77d54..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.swift-version +++ /dev/null @@ -1 +0,0 @@ -4.2 diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.swiftlint.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.swiftlint.yml index 146ea6a..47543c6 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.swiftlint.yml +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.swiftlint.yml @@ -6,6 +6,7 @@ included: - Tests excluded: + - Package.swift - Carthage/Checkouts - Tests/NimbleTests/XCTestManifests.swift - Tests/NimbleTests/Helpers/XCTestCaseProvider.swift diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.travis.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.travis.yml index fb72977..810e5d3 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.travis.yml +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/.travis.yml @@ -1,49 +1,40 @@ -osx_image: xcode10.1 +branches: + only: + - master + language: generic -matrix: +jobs: include: - - os: osx - sudo: required - env: TYPE=podspec - install: bundle install - name: CocoaPods Lint - - os: osx - env: TYPE=ios - name: iOS / Swift 4.2.1 - - os: osx - env: TYPE=tvos - name: tvOS / Swift 4.2.1 - - os: osx - env: TYPE=macos - name: macOS / Swift 4.2.1 - - os: osx - env: TYPE=macos - osx_image: xcode10.2 - name: macOS / Swift 5.0 - - os: osx - env: - - TYPE=swiftpm - - os: osx - env: - - TYPE=swiftpm - osx_image: xcode10.2 - - &linux - name: Linux / Swift 4.2.1 + # - &xcode + # name: Xcode 10.3 / Swift 5.0 + # os: osx + # osx_image: xcode10.3 + # script: + # - ./test macos + # - ./test ios + # - ./test tvos + # - &swiftpm_darwin + # name: SwiftPM / Darwin / Swift 5.0 + # os: osx + # osx_image: xcode10.3 + # script: ./test swiftpm + - &swiftpm_linux + name: SwiftPM / Linux / Swift 5.2.5 os: linux - dist: trusty - sudo: required env: - - TYPE=swiftpm - - SWIFT_VERSION=4.2.1 + - SWIFT_VERSION=5.2.5 install: - - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" - - <<: *linux - name: Linux / Swift 5.0 Development + - eval "$(curl -sL https://swiftenv.fuller.li/install.sh)" + script: + - ./test swiftpm + - <<: *swiftpm_linux + name: SwiftPM / Linux / Swift 5.3 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)" + - SWIFT_VERSION=5.3-DEVELOPMENT-SNAPSHOT-2020-09-04-a + - <<: *swiftpm_linux + name: SwiftPM / Linux / Swift Development + env: + - SWIFT_VERSION=DEVELOPMENT-SNAPSHOT-2020-08-31-a install: true script: - ./test $TYPE diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Cartfile.private b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Cartfile.private index 23d7e11..a04db39 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Cartfile.private +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Cartfile.private @@ -1 +1,2 @@ -github "mattgallagher/CwlPreconditionTesting" "1e62a726d54c743f4585233f08fcaac7307319b5" +github "mattgallagher/CwlCatchException" ~> 2.0 +github "mattgallagher/CwlPreconditionTesting" ~> 2.0 diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Cartfile.resolved b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Cartfile.resolved index 32a1c25..2ba0b9e 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" "1e62a726d54c743f4585233f08fcaac7307319b5" +github "mattgallagher/CwlCatchException" "2.0.0" +github "mattgallagher/CwlPreconditionTesting" "2.0.0" diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/LICENSE.txt b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/LICENSE.txt index ca8f5b8..693a2fe 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/LICENSE.txt +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/LICENSE.txt @@ -1,3 +1,5 @@ +ISC License + Copyright © 2017 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. Permission to use, copy, modify, and/or distribute this software for any diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Package.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Package.swift index c1e2ed8..acee395 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Package.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Package.swift @@ -1,9 +1,14 @@ +// swift-tools-version:5.0 import PackageDescription let package = Package( name: "CwlCatchException", + products: [ + .library(name: "CwlCatchException", targets: ["CwlCatchException"]), + ], targets: [ - Target(name: "CwlCatchException", dependencies: ["CwlCatchExceptionSupport"]), - Target(name: "CwlCatchExceptionSupport") + .target(name: "CwlCatchException", dependencies: [.target(name: "CwlCatchExceptionSupport")]), + .target(name: "CwlCatchExceptionSupport"), + .testTarget(name: "CwlCatchExceptionTests", dependencies: [.target(name: "CwlCatchException")]) ] ) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/README.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/README.md index 0f97b03..1e8a6ec 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/README.md +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/README.md @@ -1,46 +1,18 @@ # CwlCatchException A simple Swift wrapper around an Objective-C `@try`/`@catch` statement that selectively catches Objective-C exceptions by `NSException` subtype, rethrowing if any caught exception is not the expected subtype. -Look at [CwlCatchExceptionTests.swift](https://github.com/mattgallagher/CwlCatchException/blob/master/CwlCatchExceptionTests/CwlCatchExceptionTests.swift?ts=4) for syntax. +Look at [CwlCatchExceptionTests.swift](https://github.com/mattgallagher/CwlCatchException/blob/master/Tests/CwlCatchExceptionTests/CwlCatchExceptionTests.swift) for syntax. + +## Requirements + +From version 2.0.0-beta.1, building CwlCatchException requires Swift 5 or newer and the Swift Package Manager. + +For use with older versions of Swift or other package managers, [use version 1.2.0 or older](https://github.com/mattgallagher/CwlCatchException/tree/1.2.0). ## Adding to your project -This project can be used by direct inclusion in your projects or through any of the Swift Package Manager, CocoaPods or Carthage. - -Minimum requirements are iOS 8 or macOS 10.9. - -### Manual inclusion - -1. In a subdirectory of your project's directory, run `git clone https://github.com/mattgallagher/CwlCatchException.git` -2. Drag the "CwlCatchException.xcodeproj" file from the Finder into your own project's file tree in Xcode -3. Add the "CwlCatchException.framework" from the "Products" folder of the CwlCatchException project's file tree to the "Copy Files (Frameworks)" build phases of any target that you want to include this module. - -That third step is a little tricky if you're unfamiliar with Xcode but it involves: - -a. click on your project in the file tree -b. click on the target to whih you want to add this module -c. select the "Build Phases" tab -d. if you don't already have a "Copy File" build phase with a "Destination: Frameworks", add one using the "+" button in the top left of the tab -e. click the "+" within the "Copy File (Frameworks)" phase and from the list that appears, select the "CwlCatchException.framework" (if there are multiple frameworks with the same name, look for the one that appears *above* the corresponding macOS or iOS CwlCatchException testing target). - -### Swift Package Manager - Add the following to the `dependencies` array in your "Package.swift" file: - .Package(url: "https://github.com/mattgallagher/CwlCatchException.git", majorVersion: 1), + .package(url: "https://github.com/mattgallagher/CwlCatchException.git", from: Version("2.0.0-beta.1")) -Or, if you're using the `swift-tools-version:4.0` package manager, add the following to the `dependencies` array in your "Package.swift" file: - - .package(url: "https://github.com/mattgallagher/CwlCatchException.git", majorVersion: 1) - -### CocoaPods - -Add the following to your target in your "Podfile": - - pod 'CwlCatchException', :git => 'https://github.com/mattgallagher/CwlCatchException.git' - -### Carthage - -Add the following line to your Cartfile: - - git "https://github.com/mattgallagher/CwlCatchException.git" "master" +Or by adding `https://github.com/mattgallagher/CwlCatchException.git`, version 2.0.0-beta.1 or later, to the list of Swift packages for any project in Xcode. diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift index 3e89e23..2cb9b29 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift @@ -3,7 +3,7 @@ // CwlAssertionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -24,12 +24,12 @@ import Foundation import CwlCatchExceptionSupport #endif -private func catchReturnTypeConverter(_ type: T.Type, block: () -> Void) -> T? { +private func catchReturnTypeConverter(_ type: T.Type, block: @escaping () -> Void) -> T? { return catchExceptionOfKind(type, block) as? T } extension NSException { - public static func catchException(in block: () -> Void) -> Self? { + public static func catchException(in block: @escaping () -> Void) -> Self? { return catchReturnTypeConverter(self, block: block) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m index 8cf414f..ff35465 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m @@ -3,7 +3,7 @@ // CwlAssertionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -20,10 +20,7 @@ #import "CwlCatchException.h" -#if !SWIFT_PACKAGE && NON_SWIFT_PACKAGE -__attribute__((visibility("hidden"))) -#endif -NSException* catchExceptionOfKind(Class __nonnull type, __attribute__((noescape)) void (^ __nonnull inBlock)(void)) { +NSException* __nullable catchExceptionOfKind(Class __nonnull type, void (^ __nonnull inBlock)(void)) { @try { inBlock(); } @catch (NSException *exception) { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h index 0c8dd87..eb42378 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h @@ -3,7 +3,7 @@ // CwlCatchException // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -20,13 +20,4 @@ #import -//! Project version number for CwlCatchException. -FOUNDATION_EXPORT double CwlCatchExceptionVersionNumber; - -//! Project version string for CwlCatchException. -FOUNDATION_EXPORT const unsigned char CwlCatchExceptionVersionString[]; - -#if !SWIFT_PACKAGE && NON_SWIFT_PACKAGE -__attribute__((visibility("hidden"))) -#endif -NSException* __nullable catchExceptionOfKind(Class __nonnull type, __attribute__((noescape)) void (^ __nonnull inBlock)(void)); +NSException* __nullable catchExceptionOfKind(Class __nonnull type, void (^ __nonnull inBlock)(void)); diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Package.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Package.swift index 8792aac..d6d183d 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Package.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Package.swift @@ -1,19 +1,27 @@ +// swift-tools-version:5.0 import PackageDescription let package = Package( name: "CwlPreconditionTesting", - targets: [ - Target(name: "CwlPreconditionTesting", dependencies: [ - "CwlMachBadInstructionHandler" - ]), - Target(name: "CwlMachBadInstructionHandler") + products: [ + .library(name: "CwlPreconditionTesting", targets: ["CwlPreconditionTesting", "CwlMachBadInstructionHandler"]), + .library(name: "CwlPosixPreconditionTesting", targets: ["CwlPosixPreconditionTesting"]) ], dependencies: [ - .Package(url: "https://github.com/mattgallagher/CwlCatchException.git", Version(1, 0, 2, prereleaseIdentifiers: ["beta", "3"])), + .package(url: "https://github.com/mattgallagher/CwlCatchException.git", from: "2.0.0") ], - exclude: [ - "Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h", - "Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting.h", - "Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift", + targets: [ + .target( + name: "CwlPreconditionTesting", + dependencies: [ + .target(name: "CwlMachBadInstructionHandler"), + .product(name: "CwlCatchException") + ] + ), + .target( + name: "CwlPosixPreconditionTesting" + ), + .target(name: "CwlMachBadInstructionHandler"), + .testTarget(name: "CwlPreconditionTestingTests", dependencies: ["CwlPreconditionTesting", "CwlPosixPreconditionTesting"]) ] ) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/README.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/README.md index a42a5b5..9af31c7 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/README.md +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/README.md @@ -8,66 +8,40 @@ For an extended discussion of this code, please see the Cocoa with Love article: [Partial functions in Swift, Part 2: Catching precondition failures](http://cocoawithlove.com/blog/2016/02/02/partial-functions-part-two-catching-precondition-failures.html) +## Requirements + +From version 2.0.0-beta.1, building CwlPreconditionTesting requires Swift 5 or newer and the Swift Package Manager. + +For use with older versions of Swift or other package managers, [use version 1.2.0 or older](https://github.com/mattgallagher/CwlPreconditionTesting/tree/1.2.0). + ## Adding to your project -This project can be used by manual inclusion in your projects or through any of the Swift Package Manager, CocoaPods or Carthage. - -Minimum requirements are iOS 8 (simulator-only) or macOS 10.9. The project includes tvOS 9 and POSIX targets but these aren't regularly tested. - -### Manual inclusion - -1. In a subdirectory of your project's directory, run `git clone https://github.com/mattgallagher/CwlPreconditionTesting.git` -2. Drag the "CwlPreconditionTesting.xcodeproj" file from the Finder into your own project's file tree in Xcode -3. Add the "CwlPreconditionTesting.framework" from the "Products" folder of the CwlPreconditionTesting project's file tree to the "Copy Files (Frameworks)" build phases of any target that you want to include this module. -4. Drag the "CwlCatchException.framework" from the "Dependencies" group (within the CwlPreconditionTesting project's file tree) onto the same "Copy Files (Frameworks)" build phase (this item may be red but that shouldn't be a problem). - -That third step is a little tricky if you're unfamiliar with Xcode but it involves: - -a. click on your project in the file tree -b. click on the target to whih you want to add this module -c. select the "Build Phases" tab -d. if you don't already have a "Copy File" build phase with a "Destination: Frameworks", add one using the "+" button in the top left of the tab -e. click the "+" within the "Copy File (Frameworks)" phase and from the list that appears, select the "CwlPreconditionTesting.framework" (if there are multiple frameworks with the same name, look for the one that appears *above* the corresponding macOS or iOS CwlPreconditionTesting testing target). - -When building using this approach, the "FetchDependencies" target will use the Swift Package Manager to download the "CwlCatchException" project from github. The download is stored in the "Build intermediates" directory for your project. Normally, you can ignore its existence but if you get any errors from the "FetchDependencies" target, you might need to clean the build folder (Hold "Option" key while selecting "Product" → "Clean Build Folder..." from the Xcode menubar). - -You can use the "Package.swift" to manage the behavior of the Swift Package Manager or if you want to download dependencies manually (instead of using this behind-the-scenes use of the Swift package manager), you should delete the "FetchDependencies" target and replace the "CwlCatchException" targets with alternatives that build the dependencies in accordance with your manual download. - -### Swift Package Manager - Add the following to the `dependencies` array in your "Package.swift" file: - .Package(url: "https://github.com/mattgallagher/CwlPreconditionTesting.git", majorVersion: 1), + .package(url: "https://github.com/mattgallagher/CwlPreconditionTesting.git", from: Version("2.0.0-beta.1")) -Or, if you're using the `swift-tools-version:4.0` package manager, add the following to the `dependencies` array in your "Package.swift" file: +Or by adding `https://github.com/mattgallagher/CwlPreconditionTesting.git`, version 2.0.0-beta.1 or later, to the list of Swift packages for any project in Xcode. - .package(url: "https://github.com/mattgallagher/CwlPreconditionTesting.git", majorVersion: 1) +## Usage -### CocoaPods +On macOS and iOS you can use the regular version: -Add the following lines to your target in your "Podfile": +```swift +import CwlPreconditionTesting - pod 'CwlPreconditionTesting', :git => 'https://github.com/mattgallagher/CwlPreconditionTesting.git' - pod 'CwlCatchException', :git => 'https://github.com/mattgallagher/CwlCatchException.git' +let e = catchBadInstruction { + precondition(false, "THIS PRECONDITION FAILURE IS EXPECTED") +} +``` -### Carthage +on tvOS, Linux and other platforms, you can use the POSIX version: -Add the following line to your Cartfile: +```swift +import CwlPosixPreconditionTesting - git "https://github.com/mattgallagher/CwlPreconditionTesting.git" "master" +let e = catchBadInstruction { + precondition(false, "THIS PRECONDITION FAILURE IS EXPECTED") +} +``` -## Using POSIX signals and setjmp/longjmp - -For comparison or for anyone running this code on a platform without Mach exceptions or the Objective-C runtime, I've added a proof-of-concept implementation of `catchBadInstruction` that uses a POSIX SIGILL `sigaction` and `setjmp`/`longjmp` to perform the throw. - -In Xcode, you can simply select the CwlPreconditionTesting_POSIX target (instead of the OSX or iOS targets). If you're building without Xcode: all you need is the CwlCatchBadInstructionPOSIX.swift file (compared to the Mach exception handler, the code is tiny doesn't have any weird Objective-C/MiG file dependencies). - -**Warning No. 1**: on OS X, this approach can't be used when lldb is attached since lldb's Mach exception handler blocks the SIGILL from ever occurring (I've disabled the "Debug Executable" setting for the tests in Xcode - re-enable it to witness the problem). - -**Warning No. 2**: if you're switching between the CwlPreconditionTesting_OSX and CwlPreconditionTesting_POSIX targets, Xcode (as of Xcode 7.2.1) will not detect the change and will not remove the old framework correctly so you'll need to *clean your project* otherwise the old framework will hang around. - -Additional problems in decreasing severity include: - -* the signal handler is whole process (rather than correctly scoped to the thread where the "catch" occurs) -* the signal handler doesn't deal with re-entrancy whereas the mach exception handler remains deterministic in the face of multiple fatal errors -* the signal handler overwrites the "[red zone](https://en.wikipedia.org/wiki/Red_zone_(computing))" which is technically frowned upon in signal handlers (although unlikely to cause problems here) +**Warning**: this POSIX version can't be used when lldb is attached since lldb's Mach exception handler blocks the SIGILL from ever occurring. You should disable the "Debug Executable" setting for the tests in Xcode. The POSIX version of the signal handler is also whole process (rather than correctly scoped to the thread where the "catch" occurs). diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.m index 8183196..2ab0ea5 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.m @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -18,33 +18,36 @@ // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // -#if defined(__x86_64__) +#ifdef __APPLE__ +#import "TargetConditionals.h" +#if TARGET_OS_OSX || TARGET_OS_IOS - #import "mach_excServer.h" - #import "CwlMachBadInstructionHandler.h" +#import "mach_excServer.h" +#import "CwlMachBadInstructionHandler.h" + +@protocol BadInstructionReply ++(NSNumber *)receiveReply:(NSValue *)value; +@end + +/// A basic function that receives callbacks from mach_exc_server and relays them to the Swift implemented BadInstructionException.catch_mach_exception_raise_state. +kern_return_t catch_mach_exception_raise_state(mach_port_t exception_port, exception_type_t exception, const mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, const thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { + bad_instruction_exception_reply_t reply = { exception_port, exception, code, codeCnt, flavor, old_state, old_stateCnt, new_state, new_stateCnt }; + Class badInstructionClass = NSClassFromString(@"BadInstructionException"); + NSValue *value = [NSValue valueWithBytes: &reply objCType: @encode(bad_instruction_exception_reply_t)]; + return [[badInstructionClass performSelector: @selector(receiveReply:) withObject: value] intValue]; +} + +// The mach port should be configured so that this function is never used. +kern_return_t catch_mach_exception_raise(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt) { + assert(false); + return KERN_FAILURE; +} + +// The mach port should be configured so that this function is never used. +kern_return_t catch_mach_exception_raise_state_identity(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { + assert(false); + return KERN_FAILURE; +} - @protocol BadInstructionReply - +(NSNumber *)receiveReply:(NSValue *)value; - @end - - /// A basic function that receives callbacks from mach_exc_server and relays them to the Swift implemented BadInstructionException.catch_mach_exception_raise_state. - kern_return_t catch_mach_exception_raise_state(mach_port_t exception_port, exception_type_t exception, const mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, const thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { - bad_instruction_exception_reply_t reply = { exception_port, exception, code, codeCnt, flavor, old_state, old_stateCnt, new_state, new_stateCnt }; - Class badInstructionClass = NSClassFromString(@"BadInstructionException"); - NSValue *value = [NSValue valueWithBytes: &reply objCType: @encode(bad_instruction_exception_reply_t)]; - return [[badInstructionClass performSelector: @selector(receiveReply:) withObject: value] intValue]; - } - - // The mach port should be configured so that this function is never used. - kern_return_t catch_mach_exception_raise(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt) { - assert(false); - return KERN_FAILURE; - } - - // The mach port should be configured so that this function is never used. - kern_return_t catch_mach_exception_raise_state_identity(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { - assert(false); - return KERN_FAILURE; - } - -#endif +#endif /* TARGET_OS_OSX || TARGET_OS_IOS */ +#endif /* __APPLE__ */ diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h index aef59c2..3fbd5a4 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -19,8 +19,14 @@ // #import + +#if TARGET_OS_OSX || TARGET_OS_IOS + #import +extern bool _swift_disableExclusivityChecking; +extern bool _swift_reportFatalErrorsToDebugger; + NS_ASSUME_NONNULL_BEGIN extern boolean_t mach_exc_server(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); @@ -68,3 +74,5 @@ typedef struct } bad_instruction_exception_reply_t; NS_ASSUME_NONNULL_END + +#endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.c b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.c index 733c564..ccd8f84 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.c +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.c @@ -5,13 +5,12 @@ * OPTIONS: */ -#if defined(__x86_64__) - /* Module mach_exc */ #define __MIG_check__Request__mach_exc_subsystem__ 1 -#include "mach_excServer.h" +#import "mach_excServer.h" +#if TARGET_OS_OSX || TARGET_OS_IOS #ifndef mig_internal #define mig_internal static __inline__ @@ -534,4 +533,4 @@ mig_external mig_routine_t mach_exc_server_routine return catch_mach_exc_subsystem.routine[msgh_id].stub_routine; } -#endif +#endif /* TARGET_OS_OSX || TARGET_OS_IOS */ diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.h index 52e53ae..1f03d66 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.h +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.h @@ -1,9 +1,14 @@ +#ifdef __APPLE__ +#import "TargetConditionals.h" +#if TARGET_OS_OSX || TARGET_OS_IOS + #ifndef _mach_exc_server_ #define _mach_exc_server_ /* Module mach_exc */ #include + #include #include #include @@ -319,3 +324,6 @@ __AfterMigServerHeader #endif /* __AfterMigServerHeader */ #endif /* _mach_exc_server_ */ + +#endif /* TARGET_OS_OSX || TARGET_OS_IOS */ +#endif /* __APPLE__ */ diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPosixPreconditionTesting/CwlCatchBadInstructionPosix.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPosixPreconditionTesting/CwlCatchBadInstructionPosix.swift new file mode 100644 index 0000000..4296a79 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPosixPreconditionTesting/CwlCatchBadInstructionPosix.swift @@ -0,0 +1,108 @@ +// +// CwlCatchBadInstructionPosix.swift +// CwlPreconditionTesting +// +// Created by Matt Gallagher on 8/02/2016. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// + +#if arch(x86_64) + +import Foundation + +// This file is an alternative implementation to CwlCatchBadInstruction.swift that uses a SIGILL signal action and setenv/longjmp instead of a Mach exception handler and Objective-C exception raising. +// +// WARNING: +// This code is quick and dirty. It's a proof of concept for using a SIGILL handler and setjmp/longjmp where Mach exceptions and the Obj-C runtime aren't available. I ran the automated tests when I first wrote this code but I don't personally use it at all so by the time you're reading this comment, it probably broke and I didn't notice. +// Obvious limitations: +// * It doesn't work when debugging with lldb. +// * It doesn't scope correctly to the thread (it's global) +// * In violation of rules for signal handlers, it writes to the "red zone" on the stack +// * It isn't re-entrant +// * Plus all of the same caveats as the Mach exceptions version (doesn't play well with other handlers, probably leaks ARC memory, etc) +// Treat it like a loaded shotgun. Don't point it at your face. + +// This function is called from the signal handler to shut down the thread and return 1 (indicating a SIGILL was received). +private func callThreadExit() { + pthread_exit(UnsafeMutableRawPointer(bitPattern: 1)) +} + +// When called, this signal handler simulates a function call to `callThreadExit` +private func sigIllHandler(code: Int32, info: UnsafeMutablePointer<__siginfo>?, uap: UnsafeMutableRawPointer?) -> Void { + guard let context = uap?.assumingMemoryBound(to: ucontext64_t.self) else { return } + + // 1. Decrement the stack pointer + context.pointee.uc_mcontext64.pointee.__ss.__rsp -= __uint64_t(MemoryLayout.size) + + // 2. Save the old Instruction Pointer to the stack. + let rsp = context.pointee.uc_mcontext64.pointee.__ss.__rsp + if let ump = UnsafeMutablePointer<__uint64_t>(bitPattern: UInt(rsp)) { + ump.pointee = rsp + } + + // 3. Set the Instruction Pointer to the new function's address + var f: @convention(c) () -> Void = callThreadExit + withUnsafePointer(to: &f) { $0.withMemoryRebound(to: __uint64_t.self, capacity: 1) { ptr in + context.pointee.uc_mcontext64.pointee.__ss.__rip = ptr.pointee + } } +} + +/// Without Mach exceptions or the Objective-C runtime, there's nothing to put in the exception object. It's really just a boolean – either a SIGILL was caught or not. +public class BadInstructionException { +} + +/// Run the provided block. If a POSIX SIGILL is received, handle it and return a BadInstructionException (which is just an empty object in this POSIX signal version). Otherwise return nil. +/// NOTE: This function is only intended for use in test harnesses – use in a distributed build is almost certainly a bad choice. If a SIGILL is received, the block will be interrupted using a C `longjmp`. The risks associated with abrupt jumps apply here: most Swift functions are *not* interrupt-safe. Memory may be leaked and the program will not necessarily be left in a safe state. +/// - parameter block: a function without parameters that will be run +/// - returns: if an SIGILL is raised during the execution of `block` then a BadInstructionException will be returned, otherwise `nil`. +public func catchBadInstruction(block: @escaping () -> Void) -> BadInstructionException? { + // Construct the signal action + var sigActionPrev = sigaction() + let action = __sigaction_u(__sa_sigaction: sigIllHandler) + var sigActionNew = sigaction(__sigaction_u: action, sa_mask: sigset_t(), sa_flags: SA_SIGINFO) + + // Install the signal action + if sigaction(SIGILL, &sigActionNew, &sigActionPrev) != 0 { + fatalError("Sigaction error: \(errno)") + } + + defer { + // Restore the previous signal action + if sigaction(SIGILL, &sigActionPrev, nil) != 0 { + fatalError("Sigaction error: \(errno)") + } + } + + var b = block + let caught: Bool = withUnsafeMutablePointer(to: &b) { blockPtr in + // Run the block on its own thread + var handlerThread: pthread_t? = nil + let e = pthread_create(&handlerThread, nil, { arg in + (arg.assumingMemoryBound(to: (() -> Void).self).pointee)() + return nil + }, blockPtr) + precondition(e == 0, "Unable to create thread") + + // Wait for completion and get the result. It will be either `nil` or bitPattern 1 + var rawResult: UnsafeMutableRawPointer? = nil + let e2 = pthread_join(handlerThread!, &rawResult) + precondition(e2 == 0, "Thread join failed") + return Int(bitPattern: rawResult) != 0 + } + + return caught ? BadInstructionException() : nil +} + +#endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift index 91e5d4d..90ee022 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -18,6 +18,8 @@ // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // +#if (os(macOS) || os(iOS)) && arch(x86_64) + import Foundation #if SWIFT_PACKAGE @@ -44,46 +46,44 @@ public class BadInstructionException: NSException { /// An Objective-C callable function, invoked from the `mach_exc_server` callback function `catch_mach_exception_raise_state` to push the `raiseBadInstructionException` function onto the stack. @objc(receiveReply:) public class func receiveReply(_ value: NSValue) -> NSNumber { - #if arch(x86_64) - var reply = bad_instruction_exception_reply_t(exception_port: 0, exception: 0, code: nil, codeCnt: 0, flavor: nil, old_state: nil, old_stateCnt: 0, new_state: nil, new_stateCnt: nil) - withUnsafeMutablePointer(to: &reply) { value.getValue(UnsafeMutableRawPointer($0)) } - - let old_state: UnsafePointer = reply.old_state! - let old_stateCnt: mach_msg_type_number_t = reply.old_stateCnt - let new_state: thread_state_t = reply.new_state! - let new_stateCnt: UnsafeMutablePointer = reply.new_stateCnt! - - // Make sure we've been given enough memory - if old_stateCnt != x86_THREAD_STATE64_COUNT || new_stateCnt.pointee < x86_THREAD_STATE64_COUNT { - return NSNumber(value: KERN_INVALID_ARGUMENT) - } - - // Read the old thread state - var state = old_state.withMemoryRebound(to: x86_thread_state64_t.self, capacity: 1) { return $0.pointee } - - // 1. Decrement the stack pointer - state.__rsp -= __uint64_t(MemoryLayout.size) - - // 2. Save the old Instruction Pointer to the stack. - if let pointer = UnsafeMutablePointer<__uint64_t>(bitPattern: UInt(state.__rsp)) { - pointer.pointee = state.__rip - } else { - return NSNumber(value: KERN_INVALID_ARGUMENT) - } - - // 3. Set the Instruction Pointer to the new function's address - var f: @convention(c) () -> Void = raiseBadInstructionException - withUnsafePointer(to: &f) { - state.__rip = $0.withMemoryRebound(to: __uint64_t.self, capacity: 1) { return $0.pointee } - } - - // Write the new thread state - new_state.withMemoryRebound(to: x86_thread_state64_t.self, capacity: 1) { $0.pointee = state } - new_stateCnt.pointee = x86_THREAD_STATE64_COUNT - - return NSNumber(value: KERN_SUCCESS) - #else - fatalError("Unavailable for this CPU architecture") - #endif + var reply = bad_instruction_exception_reply_t(exception_port: 0, exception: 0, code: nil, codeCnt: 0, flavor: nil, old_state: nil, old_stateCnt: 0, new_state: nil, new_stateCnt: nil) + withUnsafeMutablePointer(to: &reply) { value.getValue(UnsafeMutableRawPointer($0)) } + + let old_state: UnsafePointer = reply.old_state! + let old_stateCnt: mach_msg_type_number_t = reply.old_stateCnt + let new_state: thread_state_t = reply.new_state! + let new_stateCnt: UnsafeMutablePointer = reply.new_stateCnt! + + // Make sure we've been given enough memory + if old_stateCnt != x86_THREAD_STATE64_COUNT || new_stateCnt.pointee < x86_THREAD_STATE64_COUNT { + return NSNumber(value: KERN_INVALID_ARGUMENT) + } + + // Read the old thread state + var state = old_state.withMemoryRebound(to: x86_thread_state64_t.self, capacity: 1) { return $0.pointee } + + // 1. Decrement the stack pointer + state.__rsp -= __uint64_t(MemoryLayout.size) + + // 2. Save the old Instruction Pointer to the stack. + if let pointer = UnsafeMutablePointer<__uint64_t>(bitPattern: UInt(state.__rsp)) { + pointer.pointee = state.__rip + } else { + return NSNumber(value: KERN_INVALID_ARGUMENT) + } + + // 3. Set the Instruction Pointer to the new function's address + var f: @convention(c) () -> Void = raiseBadInstructionException + withUnsafePointer(to: &f) { + state.__rip = $0.withMemoryRebound(to: __uint64_t.self, capacity: 1) { return $0.pointee } + } + + // Write the new thread state + new_state.withMemoryRebound(to: x86_thread_state64_t.self, capacity: 1) { $0.pointee = state } + new_stateCnt.pointee = x86_THREAD_STATE64_COUNT + + return NSNumber(value: KERN_SUCCESS) } } + +#endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift index f96ec63..521b2a1 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -18,180 +18,192 @@ // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // +#if (os(macOS) || os(iOS)) && arch(x86_64) + import Foundation +import Swift #if SWIFT_PACKAGE import CwlMachBadInstructionHandler #endif -#if arch(x86_64) - - private enum PthreadError: Error { case code(Int32) } - private enum MachExcServer: Error { case code(kern_return_t) } - - /// A quick function for converting Mach error results into Swift errors - private func kernCheck(_ f: () -> Int32) throws { - let r = f() - guard r == KERN_SUCCESS else { - throw NSError(domain: NSMachErrorDomain, code: Int(r), userInfo: nil) - } +private enum PthreadError: Error { case code(Int32) } +private enum MachExcServer: Error { case code(kern_return_t) } + +/// A quick function for converting Mach error results into Swift errors +private func kernCheck(_ f: () -> Int32) throws { + let r = f() + guard r == KERN_SUCCESS else { + throw NSError(domain: NSMachErrorDomain, code: Int(r), userInfo: nil) } - - extension request_mach_exception_raise_t { - mutating func withMsgHeaderPointer(in block: (UnsafeMutablePointer) -> R) -> R { - return withUnsafeMutablePointer(to: &self) { p -> R in - return p.withMemoryRebound(to: mach_msg_header_t.self, capacity: 1) { ptr -> R in - return block(ptr) - } +} + +extension request_mach_exception_raise_t { + mutating func withMsgHeaderPointer(in block: (UnsafeMutablePointer) -> R) -> R { + return withUnsafeMutablePointer(to: &self) { p -> R in + return p.withMemoryRebound(to: mach_msg_header_t.self, capacity: 1) { ptr -> R in + return block(ptr) } } } - - extension reply_mach_exception_raise_state_t { - mutating func withMsgHeaderPointer(in block: (UnsafeMutablePointer) -> R) -> R { - return withUnsafeMutablePointer(to: &self) { p -> R in - return p.withMemoryRebound(to: mach_msg_header_t.self, capacity: 1) { ptr -> R in - return block(ptr) - } +} + +extension reply_mach_exception_raise_state_t { + mutating func withMsgHeaderPointer(in block: (UnsafeMutablePointer) -> R) -> R { + return withUnsafeMutablePointer(to: &self) { p -> R in + return p.withMemoryRebound(to: mach_msg_header_t.self, capacity: 1) { ptr -> R in + return block(ptr) } } } +} + +/// A structure used to store context associated with the Mach message port +private struct MachContext { + var masks = execTypesCountTuple() + var count: mach_msg_type_number_t = 0 + var ports = execTypesCountTuple() + var behaviors = execTypesCountTuple() + var flavors = execTypesCountTuple() + var currentExceptionPort: mach_port_t = 0 + var handlerThread: pthread_t? = nil - /// A structure used to store context associated with the Mach message port - private struct MachContext { - var masks = execTypesCountTuple() - var count: mach_msg_type_number_t = 0 - var ports = execTypesCountTuple() - var behaviors = execTypesCountTuple() - var flavors = execTypesCountTuple() - var currentExceptionPort: mach_port_t = 0 - var handlerThread: pthread_t? = nil - - static func internalMutablePointers(_ m: UnsafeMutablePointer>, _ c: UnsafeMutablePointer, _ p: UnsafeMutablePointer>, _ b: UnsafeMutablePointer>, _ f: UnsafeMutablePointer>, _ block: (UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer) -> R) -> R { - return m.withMemoryRebound(to: exception_mask_t.self, capacity: 1) { masksPtr in - return c.withMemoryRebound(to: mach_msg_type_number_t.self, capacity: 1) { countPtr in - return p.withMemoryRebound(to: mach_port_t.self, capacity: 1) { portsPtr in - return b.withMemoryRebound(to: exception_behavior_t.self, capacity: 1) { behaviorsPtr in - return f.withMemoryRebound(to: thread_state_flavor_t.self, capacity: 1) { flavorsPtr in - return block(masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) - } + static func internalMutablePointers(_ m: UnsafeMutablePointer>, _ c: UnsafeMutablePointer, _ p: UnsafeMutablePointer>, _ b: UnsafeMutablePointer>, _ f: UnsafeMutablePointer>, _ block: (UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer) -> R) -> R { + return m.withMemoryRebound(to: exception_mask_t.self, capacity: 1) { masksPtr in + return c.withMemoryRebound(to: mach_msg_type_number_t.self, capacity: 1) { countPtr in + return p.withMemoryRebound(to: mach_port_t.self, capacity: 1) { portsPtr in + return b.withMemoryRebound(to: exception_behavior_t.self, capacity: 1) { behaviorsPtr in + return f.withMemoryRebound(to: thread_state_flavor_t.self, capacity: 1) { flavorsPtr in + return block(masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) } } } } } - - mutating func withUnsafeMutablePointers(in block: @escaping (UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer) -> R) -> R { - return MachContext.internalMutablePointers(&masks, &count, &ports, &behaviors, &flavors, block) - } } - /// A function for receiving mach messages and parsing the first with mach_exc_server (and if any others are received, throwing them away). - private func machMessageHandler(_ arg: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer? { - let context = arg.assumingMemoryBound(to: MachContext.self).pointee - var request = request_mach_exception_raise_t() - var reply = reply_mach_exception_raise_state_t() + mutating func withUnsafeMutablePointers(in block: @escaping (UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer) -> R) -> R { + return MachContext.internalMutablePointers(&masks, &count, &ports, &behaviors, &flavors, block) + } +} + +/// A function for receiving mach messages and parsing the first with mach_exc_server (and if any others are received, throwing them away). +private func machMessageHandler(_ arg: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer? { + let context = arg.assumingMemoryBound(to: MachContext.self).pointee + var request = request_mach_exception_raise_t() + var reply = reply_mach_exception_raise_state_t() + + var handledfirstException = false + repeat { do { + // Request the next mach message from the port + request.Head.msgh_local_port = context.currentExceptionPort + request.Head.msgh_size = UInt32(MemoryLayout.size) + let requestSize = request.Head.msgh_size + try kernCheck { request.withMsgHeaderPointer { requestPtr in + mach_msg(requestPtr, MACH_RCV_MSG | MACH_RCV_INTERRUPT, 0, requestSize, context.currentExceptionPort, 0, UInt32(MACH_PORT_NULL)) + } } - var handledfirstException = false - repeat { do { - // Request the next mach message from the port - request.Head.msgh_local_port = context.currentExceptionPort - request.Head.msgh_size = UInt32(MemoryLayout.size) - let requestSize = request.Head.msgh_size - try kernCheck { request.withMsgHeaderPointer { requestPtr in - mach_msg(requestPtr, MACH_RCV_MSG | MACH_RCV_INTERRUPT, 0, requestSize, context.currentExceptionPort, 0, UInt32(MACH_PORT_NULL)) - } } + // Prepare the reply structure + reply.Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(request.Head.msgh_bits), 0) + reply.Head.msgh_local_port = UInt32(MACH_PORT_NULL) + reply.Head.msgh_remote_port = request.Head.msgh_remote_port + reply.Head.msgh_size = UInt32(MemoryLayout.size) + reply.NDR = NDR_record + + if !handledfirstException { + // Use the MiG generated server to invoke our handler for the request and fill in the rest of the reply structure + guard request.withMsgHeaderPointer(in: { requestPtr in reply.withMsgHeaderPointer { replyPtr in + mach_exc_server(requestPtr, replyPtr) + } }) != 0 else { throw MachExcServer.code(reply.RetCode) } - // Prepare the reply structure - reply.Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(request.Head.msgh_bits), 0) - reply.Head.msgh_local_port = UInt32(MACH_PORT_NULL) - reply.Head.msgh_remote_port = request.Head.msgh_remote_port - reply.Head.msgh_size = UInt32(MemoryLayout.size) - reply.NDR = NDR_record - - if !handledfirstException { - // Use the MiG generated server to invoke our handler for the request and fill in the rest of the reply structure - guard request.withMsgHeaderPointer(in: { requestPtr in reply.withMsgHeaderPointer { replyPtr in - mach_exc_server(requestPtr, replyPtr) - } }) != 0 else { throw MachExcServer.code(reply.RetCode) } - - handledfirstException = true - } else { - // If multiple fatal errors occur, don't handle subsquent errors (let the program crash) - reply.RetCode = KERN_FAILURE - } - - // Send the reply - let replySize = reply.Head.msgh_size - try kernCheck { reply.withMsgHeaderPointer { replyPtr in - mach_msg(replyPtr, MACH_SEND_MSG, replySize, 0, UInt32(MACH_PORT_NULL), 0, UInt32(MACH_PORT_NULL)) - } } - } catch let error as NSError where (error.domain == NSMachErrorDomain && (error.code == Int(MACH_RCV_PORT_CHANGED) || error.code == Int(MACH_RCV_INVALID_NAME))) { - // Port was already closed before we started or closed while we were listening. - // This means the controlling thread shut down. - return nil - } catch { - // Should never be reached but this is testing code, don't try to recover, just abort - fatalError("Mach message error: \(error)") - } } while true + handledfirstException = true + } else { + // If multiple fatal errors occur, don't handle subsquent errors (let the program crash) + reply.RetCode = KERN_FAILURE + } + + // Send the reply + let replySize = reply.Head.msgh_size + try kernCheck { reply.withMsgHeaderPointer { replyPtr in + mach_msg(replyPtr, MACH_SEND_MSG, replySize, 0, UInt32(MACH_PORT_NULL), 0, UInt32(MACH_PORT_NULL)) + } } + } catch let error as NSError where (error.domain == NSMachErrorDomain && (error.code == Int(MACH_RCV_PORT_CHANGED) || error.code == Int(MACH_RCV_INVALID_NAME))) { + // Port was already closed before we started or closed while we were listening. + // This means the controlling thread shut down. + return nil + } catch { + // Should never be reached but this is testing code, don't try to recover, just abort + fatalError("Mach message error: \(error)") + } } while true +} + +/// Run the provided block. If a mach "BAD_INSTRUCTION" exception is raised, catch it and return a BadInstructionException (which captures stack information about the throw site, if desired). Otherwise return nil. +/// NOTE: This function is only intended for use in test harnesses – use in a distributed build is almost certainly a bad choice. If a "BAD_INSTRUCTION" exception is raised, the block will be exited before completion via Objective-C exception. The risks associated with an Objective-C exception apply here: most Swift/Objective-C functions are *not* exception-safe. Memory may be leaked and the program will not necessarily be left in a safe state. +/// - parameter block: a function without parameters that will be run +/// - returns: if an EXC_BAD_INSTRUCTION is raised during the execution of `block` then a BadInstructionException will be returned, otherwise `nil`. +public func catchBadInstruction(in block: @escaping () -> Void) -> BadInstructionException? { + // Suppress Swift runtime's direct triggering of the debugger and exclusivity checking which crashes when we throw past it + let previousExclusivity = _swift_disableExclusivityChecking + let previousReporting = _swift_reportFatalErrorsToDebugger + _swift_disableExclusivityChecking = true + _swift_reportFatalErrorsToDebugger = false + defer { + _swift_reportFatalErrorsToDebugger = previousReporting + _swift_disableExclusivityChecking = previousExclusivity } - /// Run the provided block. If a mach "BAD_INSTRUCTION" exception is raised, catch it and return a BadInstructionException (which captures stack information about the throw site, if desired). Otherwise return nil. - /// NOTE: This function is only intended for use in test harnesses – use in a distributed build is almost certainly a bad choice. If a "BAD_INSTRUCTION" exception is raised, the block will be exited before completion via Objective-C exception. The risks associated with an Objective-C exception apply here: most Swift/Objective-C functions are *not* exception-safe. Memory may be leaked and the program will not necessarily be left in a safe state. - /// - parameter block: a function without parameters that will be run - /// - returns: if an EXC_BAD_INSTRUCTION is raised during the execution of `block` then a BadInstructionException will be returned, otherwise `nil`. - public func catchBadInstruction(in block: () -> Void) -> BadInstructionException? { - var context = MachContext() - var result: BadInstructionException? = nil - do { - var handlerThread: pthread_t? = nil - defer { - // 8. Wait for the thread to terminate *if* we actually made it to the creation point - // The mach port should be destroyed *before* calling pthread_join to avoid a deadlock. - if handlerThread != nil { - pthread_join(handlerThread!, nil) - } + var context = MachContext() + var result: BadInstructionException? = nil + do { + var handlerThread: pthread_t? = nil + defer { + // 8. Wait for the thread to terminate *if* we actually made it to the creation point + // The mach port should be destroyed *before* calling pthread_join to avoid a deadlock. + if handlerThread != nil { + pthread_join(handlerThread!, nil) } - - try kernCheck { - // 1. Create the mach port - mach_port_allocate(mach_task_self_, MACH_PORT_RIGHT_RECEIVE, &context.currentExceptionPort) - } - defer { - // 7. Cleanup the mach port - mach_port_destroy(mach_task_self_, context.currentExceptionPort) - } - - try kernCheck { - // 2. Configure the mach port - mach_port_insert_right(mach_task_self_, context.currentExceptionPort, context.currentExceptionPort, MACH_MSG_TYPE_MAKE_SEND) - } - - let currentExceptionPtr = context.currentExceptionPort - try kernCheck { context.withUnsafeMutablePointers { masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr in - // 3. Apply the mach port as the handler for this thread - thread_swap_exception_ports(mach_thread_self(), EXC_MASK_BAD_INSTRUCTION, currentExceptionPtr, Int32(bitPattern: UInt32(EXCEPTION_STATE) | MACH_EXCEPTION_CODES), x86_THREAD_STATE64, masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) - } } - - defer { context.withUnsafeMutablePointers { masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr in - // 6. Unapply the mach port - _ = thread_swap_exception_ports(mach_thread_self(), EXC_MASK_BAD_INSTRUCTION, 0, EXCEPTION_DEFAULT, THREAD_STATE_NONE, masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) - } } - - try withUnsafeMutablePointer(to: &context) { c throws in - // 4. Create the thread - let e = pthread_create(&handlerThread, nil, machMessageHandler, c) - guard e == 0 else { throw PthreadError.code(e) } - - // 5. Run the block - result = BadInstructionException.catchException(in: block) - } - } catch { - // Should never be reached but this is testing code, don't try to recover, just abort - fatalError("Mach port error: \(error)") } - return result + + try kernCheck { + // 1. Create the mach port + mach_port_allocate(mach_task_self_, MACH_PORT_RIGHT_RECEIVE, &context.currentExceptionPort) + } + defer { + // 7. Cleanup the mach port + mach_port_destroy(mach_task_self_, context.currentExceptionPort) + } + + try kernCheck { + // 2. Configure the mach port + mach_port_insert_right(mach_task_self_, context.currentExceptionPort, context.currentExceptionPort, MACH_MSG_TYPE_MAKE_SEND) + } + + let currentExceptionPtr = context.currentExceptionPort + try kernCheck { context.withUnsafeMutablePointers { masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr in + // 3. Apply the mach port as the handler for this thread + thread_swap_exception_ports(mach_thread_self(), EXC_MASK_BAD_INSTRUCTION, currentExceptionPtr, Int32(bitPattern: UInt32(EXCEPTION_STATE) | MACH_EXCEPTION_CODES), x86_THREAD_STATE64, masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) + } } + + defer { context.withUnsafeMutablePointers { masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr in + // 6. Unapply the mach port + _ = thread_swap_exception_ports(mach_thread_self(), EXC_MASK_BAD_INSTRUCTION, 0, EXCEPTION_DEFAULT, THREAD_STATE_NONE, masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) + } } + + try withUnsafeMutablePointer(to: &context) { c throws in + // 4. Create the thread + let e = pthread_create(&handlerThread, nil, machMessageHandler, c) + guard e == 0 else { throw PthreadError.code(e) } + + // 5. Run the block + result = BadInstructionException.catchException(in: block) + } + } catch { + // Should never be reached but this is testing code, don't try to recover, just abort + fatalError("Mach port error: \(error)") } + + return result +} #endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift deleted file mode 100644 index eb9bc19..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift +++ /dev/null @@ -1,108 +0,0 @@ -// -// CwlCatchBadInstructionPosix.swift -// CwlPreconditionTesting -// -// Created by Matt Gallagher on 8/02/2016. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// - -import Foundation - -#if arch(x86_64) - - // This file is an alternative implementation to CwlCatchBadInstruction.swift that uses a SIGILL signal action and setenv/longjmp instead of a Mach exception handler and Objective-C exception raising. - // - // WARNING: - // This code is quick and dirty. It's a proof of concept for using a SIGILL handler and setjmp/longjmp where Mach exceptions and the Obj-C runtime aren't available. I ran the automated tests when I first wrote this code but I don't personally use it at all so by the time you're reading this comment, it probably broke and I didn't notice. - // Obvious limitations: - // * It doesn't work when debugging with lldb. - // * It doesn't scope correctly to the thread (it's global) - // * In violation of rules for signal handlers, it writes to the "red zone" on the stack - // * It isn't re-entrant - // * Plus all of the same caveats as the Mach exceptions version (doesn't play well with other handlers, probably leaks ARC memory, etc) - // Treat it like a loaded shotgun. Don't point it at your face. - - // This function is called from the signal handler to shut down the thread and return 1 (indicating a SIGILL was received). - private func callThreadExit() { - pthread_exit(UnsafeMutableRawPointer(bitPattern: 1)) - } - - // When called, this signal handler simulates a function call to `callThreadExit` - private func sigIllHandler(code: Int32, info: UnsafeMutablePointer<__siginfo>?, uap: UnsafeMutableRawPointer?) -> Void { - guard let context = uap?.assumingMemoryBound(to: ucontext64_t.self) else { return } - - // 1. Decrement the stack pointer - context.pointee.uc_mcontext64.pointee.__ss.__rsp -= __uint64_t(MemoryLayout.size) - - // 2. Save the old Instruction Pointer to the stack. - let rsp = context.pointee.uc_mcontext64.pointee.__ss.__rsp - if let ump = UnsafeMutablePointer<__uint64_t>(bitPattern: UInt(rsp)) { - ump.pointee = rsp - } - - // 3. Set the Instruction Pointer to the new function's address - var f: @convention(c) () -> Void = callThreadExit - withUnsafePointer(to: &f) { $0.withMemoryRebound(to: __uint64_t.self, capacity: 1) { ptr in - context.pointee.uc_mcontext64.pointee.__ss.__rip = ptr.pointee - } } - } - - /// Without Mach exceptions or the Objective-C runtime, there's nothing to put in the exception object. It's really just a boolean – either a SIGILL was caught or not. - public class BadInstructionException { - } - - /// Run the provided block. If a POSIX SIGILL is received, handle it and return a BadInstructionException (which is just an empty object in this POSIX signal version). Otherwise return nil. - /// NOTE: This function is only intended for use in test harnesses – use in a distributed build is almost certainly a bad choice. If a SIGILL is received, the block will be interrupted using a C `longjmp`. The risks associated with abrupt jumps apply here: most Swift functions are *not* interrupt-safe. Memory may be leaked and the program will not necessarily be left in a safe state. - /// - parameter block: a function without parameters that will be run - /// - returns: if an SIGILL is raised during the execution of `block` then a BadInstructionException will be returned, otherwise `nil`. - public func catchBadInstruction(block: @escaping () -> Void) -> BadInstructionException? { - // Construct the signal action - var sigActionPrev = sigaction() - let action = __sigaction_u(__sa_sigaction: sigIllHandler) - var sigActionNew = sigaction(__sigaction_u: action, sa_mask: sigset_t(), sa_flags: SA_SIGINFO) - - // Install the signal action - if sigaction(SIGILL, &sigActionNew, &sigActionPrev) != 0 { - fatalError("Sigaction error: \(errno)") - } - - defer { - // Restore the previous signal action - if sigaction(SIGILL, &sigActionPrev, nil) != 0 { - fatalError("Sigaction error: \(errno)") - } - } - - var b = block - let caught: Bool = withUnsafeMutablePointer(to: &b) { blockPtr in - // Run the block on its own thread - var handlerThread: pthread_t? = nil - let e = pthread_create(&handlerThread, nil, { arg in - (arg.assumingMemoryBound(to: (() -> Void).self).pointee)() - return nil - }, blockPtr) - precondition(e == 0, "Unable to create thread") - - // Wait for completion and get the result. It will be either `nil` or bitPattern 1 - var rawResult: UnsafeMutableRawPointer? = nil - let e2 = pthread_join(handlerThread!, &rawResult) - precondition(e2 == 0, "Thread join failed") - return Int(bitPattern: rawResult) != 0 - } - - return caught ? BadInstructionException() : nil - } - -#endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift index 8d99d5e..f22ed1f 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -18,38 +18,38 @@ // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // +#if (os(macOS) || os(iOS)) && arch(x86_64) + import Darwin -#if arch(x86_64) - - // From /usr/include/mach/message.h - // #define MACH_MSG_TYPE_MAKE_SEND 20 /* Must hold receive right */ - // #define MACH_MSGH_BITS_REMOTE(bits) \ - // ((bits) & MACH_MSGH_BITS_REMOTE_MASK) - // #define MACH_MSGH_BITS(remote, local) /* legacy */ \ - // ((remote) | ((local) << 8)) - public let MACH_MSG_TYPE_MAKE_SEND: UInt32 = 20 - public func MACH_MSGH_BITS_REMOTE(_ bits: UInt32) -> UInt32 { return bits & UInt32(MACH_MSGH_BITS_REMOTE_MASK) } - public func MACH_MSGH_BITS(_ remote: UInt32, _ local: UInt32) -> UInt32 { return ((remote) | ((local) << 8)) } - - // From /usr/include/mach/exception_types.h - // #define EXC_BAD_INSTRUCTION 2 /* Instruction failed */ - // #define EXC_MASK_BAD_INSTRUCTION (1 << EXC_BAD_INSTRUCTION) - public let EXC_BAD_INSTRUCTION: UInt32 = 2 - public let EXC_MASK_BAD_INSTRUCTION: UInt32 = 1 << EXC_BAD_INSTRUCTION - - // From /usr/include/mach/i386/thread_status.h - // #define x86_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \ - // ( sizeof (x86_thread_state64_t) / sizeof (int) )) - public let x86_THREAD_STATE64_COUNT = UInt32(MemoryLayout.size / MemoryLayout.size) - - public let EXC_TYPES_COUNT = 14 - public struct execTypesCountTuple { - // From /usr/include/mach/i386/exception.h - // #define EXC_TYPES_COUNT 14 /* incl. illegal exception 0 */ - public var value: (T, T, T, T, T, T, T, T, T, T, T, T, T, T) = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) - public init() { - } +// From /usr/include/mach/message.h +// #define MACH_MSG_TYPE_MAKE_SEND 20 /* Must hold receive right */ +// #define MACH_MSGH_BITS_REMOTE(bits) \ +// ((bits) & MACH_MSGH_BITS_REMOTE_MASK) +// #define MACH_MSGH_BITS(remote, local) /* legacy */ \ +// ((remote) | ((local) << 8)) +public let MACH_MSG_TYPE_MAKE_SEND: UInt32 = 20 +public func MACH_MSGH_BITS_REMOTE(_ bits: UInt32) -> UInt32 { return bits & UInt32(MACH_MSGH_BITS_REMOTE_MASK) } +public func MACH_MSGH_BITS(_ remote: UInt32, _ local: UInt32) -> UInt32 { return ((remote) | ((local) << 8)) } + +// From /usr/include/mach/exception_types.h +// #define EXC_BAD_INSTRUCTION 2 /* Instruction failed */ +// #define EXC_MASK_BAD_INSTRUCTION (1 << EXC_BAD_INSTRUCTION) +public let EXC_BAD_INSTRUCTION: UInt32 = 2 +public let EXC_MASK_BAD_INSTRUCTION: UInt32 = 1 << EXC_BAD_INSTRUCTION + +// From /usr/include/mach/i386/thread_status.h +// #define x86_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \ +// ( sizeof (x86_thread_state64_t) / sizeof (int) )) +public let x86_THREAD_STATE64_COUNT = UInt32(MemoryLayout.size / MemoryLayout.size) + +public let EXC_TYPES_COUNT = 14 +public struct execTypesCountTuple { + // From /usr/include/mach/i386/exception.h + // #define EXC_TYPES_COUNT 14 /* incl. illegal exception 0 */ + public var value: (T, T, T, T, T, T, T, T, T, T, T, T, T, T) = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + public init() { } +} #endif diff --git a/Carthage/Checkouts/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 deleted file mode 100644 index 7c50da1..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// CwlPreconditionTesting.h -// CwlPreconditionTesting -// -// Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// - -#import - -extern bool _swift_reportFatalErrorsToDebugger; - -//! Project version number for CwlUtils. -FOUNDATION_EXPORT double CwlPreconditionTestingVersionNumber; - -//! Project version string for CwlUtils. -FOUNDATION_EXPORT const unsigned char CwlAssertingTestingVersionString[]; - -#include "CwlMachBadInstructionHandler.h" -#include "CwlCatchException.h" diff --git a/Carthage/Checkouts/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 deleted file mode 100644 index 4e28f95..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// CwlPreconditionTesting.h -// CwlPreconditionTesting -// -// Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// - -#import - -extern bool _swift_reportFatalErrorsToDebugger; - -//! Project version number for CwlUtils. -FOUNDATION_EXPORT double CwlPreconditionTesting_POSIXVersionNumber; - -//! Project version string for CwlUtils. -FOUNDATION_EXPORT const unsigned char CwlAssertingTesting_POSIXVersionString[]; diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Gemfile b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Gemfile index 206f109..847d7ea 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.6.0.rc.2' +gem 'cocoapods', '~> 1.9' diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Gemfile.lock b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Gemfile.lock index cc03cbf..e480070 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Gemfile.lock +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Gemfile.lock @@ -1,76 +1,90 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.0) - activesupport (4.2.11) + CFPropertyList (3.0.2) + activesupport (4.2.11.3) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) + algoliasearch (1.27.3) + httpclient (~> 2.8, >= 2.8.3) + json (>= 1.5.1) atomos (0.1.3) - claide (1.0.2) - cocoapods (1.6.0.rc.2) + claide (1.0.3) + cocoapods (1.9.3) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.6.0.rc.2) - cocoapods-deintegrate (>= 1.0.2, < 2.0) + cocoapods-core (= 1.9.3) + 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.1, < 2.0) + cocoapods-trunk (>= 1.4.0, < 2.0) cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) - fourflusher (>= 2.2.0, < 3.0) + fourflusher (>= 2.3.0, < 3.0) gh_inspector (~> 1.0) molinillo (~> 0.6.6) nap (~> 1.0) - ruby-macho (~> 1.3, >= 1.3.1) - xcodeproj (>= 1.8.0, < 2.0) - cocoapods-core (1.6.0.rc.2) + ruby-macho (~> 1.4) + xcodeproj (>= 1.14.0, < 2.0) + cocoapods-core (1.9.3) activesupport (>= 4.0.2, < 6) + algoliasearch (~> 1.0) + concurrent-ruby (~> 1.1) fuzzy_match (~> 2.0.4) nap (~> 1.0) - cocoapods-deintegrate (1.0.2) - cocoapods-downloader (1.2.2) + netrc (~> 0.11) + typhoeus (~> 1.0) + cocoapods-deintegrate (1.0.4) + cocoapods-downloader (1.4.0) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) cocoapods-stats (1.1.0) - cocoapods-trunk (1.3.1) + cocoapods-trunk (1.5.0) nap (>= 0.8, < 2.0) netrc (~> 0.11) - cocoapods-try (1.1.0) + cocoapods-try (1.2.0) colored2 (3.1.2) - concurrent-ruby (1.1.4) + concurrent-ruby (1.1.6) escape (0.0.4) - fourflusher (2.2.0) + ethon (0.12.0) + ffi (>= 1.3.0) + ffi (1.13.1) + fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) + httpclient (2.8.3) i18n (0.9.5) concurrent-ruby (~> 1.0) - minitest (5.11.3) + json (2.3.1) + minitest (5.14.1) molinillo (0.6.6) - nanaimo (0.2.6) + nanaimo (0.3.0) nap (1.1.0) netrc (0.11.0) - ruby-macho (1.3.1) + ruby-macho (1.4.0) thread_safe (0.3.6) - tzinfo (1.2.5) + typhoeus (1.4.0) + ethon (>= 0.9.0) + tzinfo (1.2.7) thread_safe (~> 0.1) - xcodeproj (1.8.0) + xcodeproj (1.17.1) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) - nanaimo (~> 0.2.6) + nanaimo (~> 0.3.0) PLATFORMS ruby DEPENDENCIES - cocoapods (~> 1.6.0.rc.2) + cocoapods (~> 1.9) BUNDLED WITH - 1.17.2 + 2.1.4 diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Nimble.podspec b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Nimble.podspec index d66190b..469901f 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 = "8.0.0" + s.version = "9.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. @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.homepage = "https://github.com/Quick/Nimble" s.license = { :type => "Apache 2.0", :file => "LICENSE" } s.author = "Quick Contributors" - s.ios.deployment_target = "8.0" + s.ios.deployment_target = "9.0" s.osx.deployment_target = "10.10" s.tvos.deployment_target = "9.0" s.source = { :git => "https://github.com/Quick/Nimble.git", @@ -21,15 +21,13 @@ Pod::Spec.new do |s| ] s.osx.exclude_files = [ - "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift", - "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h", + "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPosixPreconditionTesting/CwlCatchBadInstructionPosix.swift", ] s.ios.exclude_files = [ - "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift", - "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h", + "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPosixPreconditionTesting/CwlCatchBadInstructionPosix.swift", ] s.tvos.exclude_files = [ - "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h", + "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h", "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift", "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift", "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift", @@ -44,12 +42,17 @@ Pod::Spec.new do |s| s.compiler_flags = '-DPRODUCT_NAME=Nimble/Nimble' s.pod_target_xcconfig = { 'APPLICATION_EXTENSION_API_ONLY' => 'YES', + 'DEFINES_MODULE' => 'YES', 'ENABLE_BITCODE' => 'NO', + 'ENABLE_TESTING_SEARCH_PATHS' => 'YES', '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' + if s.respond_to?(:swift_versions) then + s.swift_versions = ['5.0'] + else + s.swift_version = '5.0' + end 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 2bf9a6a..221dee0 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.pbxproj +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 53; objects = { /* Begin PBXAggregateTarget section */ @@ -21,6 +21,9 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + 0477153523B740AD00402D4E /* DispatchTimeInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477153423B740AD00402D4E /* DispatchTimeInterval.swift */; }; + 0477153623B740B700402D4E /* DispatchTimeInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477153423B740AD00402D4E /* DispatchTimeInterval.swift */; }; + 0477153723B740B800402D4E /* DispatchTimeInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477153423B740AD00402D4E /* DispatchTimeInterval.swift */; }; 1F0648CC19639F5A001F9C46 /* ObjectWithLazyProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */; }; 1F0648CD19639F5A001F9C46 /* ObjectWithLazyProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */; }; 1F0648D41963AAB2001F9C46 /* SynchronousTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */; }; @@ -62,8 +65,6 @@ 1F1B5AD51963E13900CA8BF9 /* BeAKindOfTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1B5AD31963E13900CA8BF9 /* BeAKindOfTest.swift */; }; 1F299EAB19627B2D002641AF /* BeEmptyTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F299EAA19627B2D002641AF /* BeEmptyTest.swift */; }; 1F299EAC19627B2D002641AF /* BeEmptyTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F299EAA19627B2D002641AF /* BeEmptyTest.swift */; }; - 1F43728A1A1B343800EB80F8 /* Functional.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD251968AB07008ED995 /* Functional.swift */; }; - 1F43728B1A1B343900EB80F8 /* Functional.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD251968AB07008ED995 /* Functional.swift */; }; 1F43728C1A1B343C00EB80F8 /* SourceLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD271968AB07008ED995 /* SourceLocation.swift */; }; 1F43728D1A1B343D00EB80F8 /* SourceLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD271968AB07008ED995 /* SourceLocation.swift */; }; 1F43728E1A1B343F00EB80F8 /* Stringers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD281968AB07008ED995 /* Stringers.swift */; }; @@ -142,7 +143,6 @@ 1F5DF1871BDCA0F500C3A531 /* Match.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDB4D5EC19FE43C200E9D9FE /* Match.swift */; }; 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 /* 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 */; }; @@ -284,15 +284,18 @@ 29EA59641B551ED2002D767E /* ThrowErrorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29EA59621B551ED2002D767E /* ThrowErrorTest.swift */; }; 29EA59661B551EE6002D767E /* ThrowError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29EA59651B551EE6002D767E /* ThrowError.swift */; }; 29EA59671B551EE6002D767E /* ThrowError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29EA59651B551EE6002D767E /* ThrowError.swift */; }; - 347155CA1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 347155C91C337C8900549F03 /* XCTestCaseProvider.swift */; }; - 347155CB1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 347155C91C337C8900549F03 /* XCTestCaseProvider.swift */; }; - 347155CC1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 347155C91C337C8900549F03 /* XCTestCaseProvider.swift */; }; 472FD1351B9E085700C7B8DA /* HaveCount.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472FD1341B9E085700C7B8DA /* HaveCount.swift */; }; 472FD1391B9E0A9700C7B8DA /* HaveCount.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472FD1341B9E085700C7B8DA /* HaveCount.swift */; }; 472FD13A1B9E0A9F00C7B8DA /* HaveCountTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472FD1361B9E094B00C7B8DA /* HaveCountTest.swift */; }; 472FD13B1B9E0CFE00C7B8DA /* HaveCountTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472FD1361B9E094B00C7B8DA /* HaveCountTest.swift */; }; 4793854D1BA0BB2500296F85 /* ObjCHaveCountTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4793854C1BA0BB2500296F85 /* ObjCHaveCountTest.m */; }; 4793854E1BA0BB2500296F85 /* ObjCHaveCountTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4793854C1BA0BB2500296F85 /* ObjCHaveCountTest.m */; }; + 62FB326223B78BF90047BED9 /* BeginWithPrefix.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62FB326123B78BF90047BED9 /* BeginWithPrefix.swift */; }; + 62FB326323B78BF90047BED9 /* BeginWithPrefix.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62FB326123B78BF90047BED9 /* BeginWithPrefix.swift */; }; + 62FB326423B78BF90047BED9 /* BeginWithPrefix.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62FB326123B78BF90047BED9 /* BeginWithPrefix.swift */; }; + 62FB326923B78D4F0047BED9 /* BeginWithPrefixTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62FB326523B78D4A0047BED9 /* BeginWithPrefixTest.swift */; }; + 62FB326A23B78D500047BED9 /* BeginWithPrefixTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62FB326523B78D4A0047BED9 /* BeginWithPrefixTest.swift */; }; + 62FB326B23B78D510047BED9 /* BeginWithPrefixTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62FB326523B78D4A0047BED9 /* BeginWithPrefixTest.swift */; }; 6CAEDD0A1CAEA86F003F1584 /* LinuxSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CAEDD091CAEA86F003F1584 /* LinuxSupport.swift */; }; 6CAEDD0B1CAEA86F003F1584 /* LinuxSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CAEDD091CAEA86F003F1584 /* LinuxSupport.swift */; }; 6CAEDD0C1CAEA86F003F1584 /* LinuxSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CAEDD091CAEA86F003F1584 /* LinuxSupport.swift */; }; @@ -353,7 +356,10 @@ 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 */; }; + CD3D9A79232647BC00802581 /* CwlCatchBadInstructionPosix.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD3D9A78232647BC00802581 /* CwlCatchBadInstructionPosix.swift */; }; + CD4C8F092464365300A7BDE0 /* SynchronousDeprecatedTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD4C8F082464365300A7BDE0 /* SynchronousDeprecatedTest.swift */; }; + CD4C8F0A2464365300A7BDE0 /* SynchronousDeprecatedTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD4C8F082464365300A7BDE0 /* SynchronousDeprecatedTest.swift */; }; + CD4C8F0B2464365300A7BDE0 /* SynchronousDeprecatedTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD4C8F082464365300A7BDE0 /* SynchronousDeprecatedTest.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 */; }; @@ -380,6 +386,12 @@ CD79C9B51D2CC848004B6F9A /* ObjCUserDescriptionTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 965B0D081B62B8ED0005AE66 /* ObjCUserDescriptionTest.m */; }; CD79C9B61D2CC848004B6F9A /* ObjCAllPassTest.m in Sources */ = {isa = PBXBuildFile; fileRef = DDEFAEB31A93CBE6005CA37A /* ObjCAllPassTest.m */; }; CD79C9B71D2CC848004B6F9A /* ObjCSatisfyAnyOfTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B5358C11C39155600A23FAA /* ObjCSatisfyAnyOfTest.m */; }; + CDBC39B92462EA7D00069677 /* PredicateTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDBC39B82462EA7D00069677 /* PredicateTest.swift */; }; + CDBC39BA2462EA7D00069677 /* PredicateTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDBC39B82462EA7D00069677 /* PredicateTest.swift */; }; + CDBC39BB2462EA7D00069677 /* PredicateTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDBC39B82462EA7D00069677 /* PredicateTest.swift */; }; + CDC157912511957100EAA480 /* DSLTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC157902511957100EAA480 /* DSLTest.swift */; }; + CDC157922511957100EAA480 /* DSLTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC157902511957100EAA480 /* DSLTest.swift */; }; + CDC157932511957100EAA480 /* DSLTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC157902511957100EAA480 /* DSLTest.swift */; }; CDD80B831F2030790002CD65 /* MatcherProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1D1968AB07008ED995 /* MatcherProtocols.swift */; }; CDD80B841F20307A0002CD65 /* MatcherProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1D1968AB07008ED995 /* MatcherProtocols.swift */; }; CDD80B851F20307B0002CD65 /* MatcherProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1D1968AB07008ED995 /* MatcherProtocols.swift */; }; @@ -395,8 +407,6 @@ CDFB6A3C1F7E082500AD8CC7 /* CwlCatchBadInstruction.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A2B1F7E082400AD8CC7 /* CwlCatchBadInstruction.swift */; }; CDFB6A3F1F7E082500AD8CC7 /* CwlDarwinDefinitions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A2D1F7E082400AD8CC7 /* CwlDarwinDefinitions.swift */; }; CDFB6A401F7E082500AD8CC7 /* CwlDarwinDefinitions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A2D1F7E082400AD8CC7 /* CwlDarwinDefinitions.swift */; }; - CDFB6A431F7E082500AD8CC7 /* CwlPreconditionTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A301F7E082400AD8CC7 /* CwlPreconditionTesting.h */; settings = {ATTRIBUTES = (Public, ); }; }; - CDFB6A441F7E082500AD8CC7 /* CwlPreconditionTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A301F7E082400AD8CC7 /* CwlPreconditionTesting.h */; settings = {ATTRIBUTES = (Public, ); }; }; CDFB6A471F7E082500AD8CC7 /* CwlMachBadInstructionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A341F7E082400AD8CC7 /* CwlMachBadInstructionHandler.m */; }; CDFB6A481F7E082500AD8CC7 /* CwlMachBadInstructionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A341F7E082400AD8CC7 /* CwlMachBadInstructionHandler.m */; }; CDFB6A491F7E082500AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A361F7E082400AD8CC7 /* CwlMachBadInstructionHandler.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -404,9 +414,6 @@ CDFB6A4B1F7E082500AD8CC7 /* mach_excServer.c in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A371F7E082400AD8CC7 /* mach_excServer.c */; }; CDFB6A4C1F7E082500AD8CC7 /* mach_excServer.c in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A371F7E082400AD8CC7 /* mach_excServer.c */; }; CDFB6A4F1F7E084600AD8CC7 /* CwlMachBadInstructionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A341F7E082400AD8CC7 /* CwlMachBadInstructionHandler.m */; }; - CDFB6A501F7E085600AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A361F7E082400AD8CC7 /* CwlMachBadInstructionHandler.h */; }; - CDFB6A511F7E087500AD8CC7 /* CwlCatchBadInstructionPosix.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A2C1F7E082400AD8CC7 /* CwlCatchBadInstructionPosix.swift */; }; - CDFB6A521F7E089F00AD8CC7 /* CwlPreconditionTesting_POSIX.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A321F7E082400AD8CC7 /* CwlPreconditionTesting_POSIX.h */; settings = {ATTRIBUTES = (Public, ); }; }; DA9E8C821A414BB9002633C2 /* DSL+Wait.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9E8C811A414BB9002633C2 /* DSL+Wait.swift */; }; DA9E8C831A414BB9002633C2 /* DSL+Wait.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9E8C811A414BB9002633C2 /* DSL+Wait.swift */; }; DD72EC641A93874A002F7651 /* AllPassTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD72EC631A93874A002F7651 /* AllPassTest.swift */; }; @@ -493,6 +500,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 0477153423B740AD00402D4E /* DispatchTimeInterval.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DispatchTimeInterval.swift; sourceTree = ""; }; 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectWithLazyProperty.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 = ""; }; @@ -588,7 +596,6 @@ 1FD8CD1C1968AB07008ED995 /* Equal.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Equal.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 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 /* 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 = ""; }; @@ -596,10 +603,11 @@ 1FE661561E6574E20035F243 /* ExpectationMessage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExpectationMessage.swift; sourceTree = ""; }; 29EA59621B551ED2002D767E /* ThrowErrorTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ThrowErrorTest.swift; sourceTree = ""; }; 29EA59651B551EE6002D767E /* ThrowError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ThrowError.swift; sourceTree = ""; }; - 347155C91C337C8900549F03 /* XCTestCaseProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTestCaseProvider.swift; sourceTree = ""; }; 472FD1341B9E085700C7B8DA /* HaveCount.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HaveCount.swift; sourceTree = ""; }; 472FD1361B9E094B00C7B8DA /* HaveCountTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HaveCountTest.swift; sourceTree = ""; }; 4793854C1BA0BB2500296F85 /* ObjCHaveCountTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ObjCHaveCountTest.m; sourceTree = ""; }; + 62FB326123B78BF90047BED9 /* BeginWithPrefix.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BeginWithPrefix.swift; sourceTree = ""; }; + 62FB326523B78D4A0047BED9 /* BeginWithPrefixTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BeginWithPrefixTest.swift; sourceTree = ""; }; 6CAEDD091CAEA86F003F1584 /* LinuxSupport.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LinuxSupport.swift; sourceTree = ""; }; 7A0A26221E7F52360092A34E /* ToSucceed.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToSucceed.swift; sourceTree = ""; }; 7A6AB2C11E7F547E00A2F694 /* ToSucceedTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToSucceedTest.swift; sourceTree = ""; }; @@ -621,16 +629,16 @@ 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 = ""; }; + CD3D9A78232647BC00802581 /* CwlCatchBadInstructionPosix.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlCatchBadInstructionPosix.swift; sourceTree = ""; }; + CD4C8F082464365300A7BDE0 /* SynchronousDeprecatedTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SynchronousDeprecatedTest.swift; sourceTree = ""; }; + CDBC39B82462EA7D00069677 /* PredicateTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PredicateTest.swift; sourceTree = ""; }; + CDC157902511957100EAA480 /* DSLTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DSLTest.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 = ""; }; CDFB6A2A1F7E082400AD8CC7 /* CwlBadInstructionException.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlBadInstructionException.swift; sourceTree = ""; }; CDFB6A2B1F7E082400AD8CC7 /* CwlCatchBadInstruction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlCatchBadInstruction.swift; sourceTree = ""; }; - CDFB6A2C1F7E082400AD8CC7 /* CwlCatchBadInstructionPosix.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlCatchBadInstructionPosix.swift; sourceTree = ""; }; CDFB6A2D1F7E082400AD8CC7 /* CwlDarwinDefinitions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlDarwinDefinitions.swift; sourceTree = ""; }; - CDFB6A301F7E082400AD8CC7 /* CwlPreconditionTesting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlPreconditionTesting.h; sourceTree = ""; }; - CDFB6A321F7E082400AD8CC7 /* CwlPreconditionTesting_POSIX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlPreconditionTesting_POSIX.h; sourceTree = ""; }; CDFB6A341F7E082400AD8CC7 /* CwlMachBadInstructionHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CwlMachBadInstructionHandler.m; sourceTree = ""; }; CDFB6A361F7E082400AD8CC7 /* CwlMachBadInstructionHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlMachBadInstructionHandler.h; sourceTree = ""; }; CDFB6A371F7E082400AD8CC7 /* mach_excServer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mach_excServer.c; sourceTree = ""; }; @@ -699,7 +707,6 @@ children = ( 1F14FB63194180C5009F2A08 /* utils.swift */, 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */, - 347155C91C337C8900549F03 /* XCTestCaseProvider.swift */, ); path = Helpers; sourceTree = ""; @@ -777,11 +784,13 @@ 1F1A74381940169200FFFC47 /* NimbleTests */ = { isa = PBXGroup; children = ( - 1F925EE5195C121200ED456B /* AsynchronousTest.swift */, + CDC157902511957100EAA480 /* DSLTest.swift */, + CDBC39B82462EA7D00069677 /* PredicateTest.swift */, 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */, + CD4C8F082464365300A7BDE0 /* SynchronousDeprecatedTest.swift */, + 1F925EE5195C121200ED456B /* AsynchronousTest.swift */, 965B0D0B1B62C06D0005AE66 /* UserDescriptionTest.swift */, 6CAEDD091CAEA86F003F1584 /* LinuxSupport.swift */, - CD037212207DCC580047AF28 /* XCTestManifests.swift */, 1FFD729A1963FC8200CD29A2 /* objc */, 1F14FB61194180A7009F2A08 /* Helpers */, 1F925EE3195C11B000ED456B /* Matchers */, @@ -807,6 +816,7 @@ 1F925EE8195C124400ED456B /* BeAnInstanceOfTest.swift */, 1F925EF5195C147800ED456B /* BeCloseToTest.swift */, 1F299EAA19627B2D002641AF /* BeEmptyTest.swift */, + 62FB326523B78D4A0047BED9 /* BeginWithPrefixTest.swift */, 1F925EFB195C186800ED456B /* BeginWithTest.swift */, 1F925F10195C190B00ED456B /* BeGreaterThanOrEqualToTest.swift */, 1F925F07195C18CF00ED456B /* BeGreaterThanTest.swift */, @@ -819,18 +829,18 @@ 1F91DD2C1C74BF36002C309F /* BeVoidTest.swift */, 7B13BA091DD360DE00C9098C /* ContainElementSatisfyingTest.swift */, 1F925F01195C189500ED456B /* ContainTest.swift */, + B20058C420E92CE400C1264D /* ElementsEqualTest.swift */, 1F925EFE195C187600ED456B /* EndWithTest.swift */, 1F925F04195C18B700ED456B /* EqualTest.swift */, - B20058C420E92CE400C1264D /* ElementsEqualTest.swift */, 472FD1361B9E094B00C7B8DA /* HaveCountTest.swift */, - DDB4D5EF19FE442800E9D9FE /* MatchTest.swift */, - 1F925EEB195C12C800ED456B /* RaisesExceptionTest.swift */, - 29EA59621B551ED2002D767E /* ThrowErrorTest.swift */, - 7B5358B91C3846C900A23FAA /* SatisfyAnyOfTest.swift */, - A8A3B6E920712FC100E25A08 /* SatisfyAllOfTest.swift */, - 1FCF914E1C61C85A00B15DCB /* PostNotificationTest.swift */, AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */, + DDB4D5EF19FE442800E9D9FE /* MatchTest.swift */, + 1FCF914E1C61C85A00B15DCB /* PostNotificationTest.swift */, + 1F925EEB195C12C800ED456B /* RaisesExceptionTest.swift */, + A8A3B6E920712FC100E25A08 /* SatisfyAllOfTest.swift */, + 7B5358B91C3846C900A23FAA /* SatisfyAnyOfTest.swift */, 1F4BB8B31DACA0D00048464B /* ThrowAssertionTest.swift */, + 29EA59621B551ED2002D767E /* ThrowErrorTest.swift */, 7A6AB2C11E7F547E00A2F694 /* ToSucceedTest.swift */, ); path = Matchers; @@ -861,6 +871,7 @@ 1FD8CD0F1968AB07008ED995 /* BeCloseTo.swift */, 1FD8CD101968AB07008ED995 /* BeEmpty.swift */, 1FD8CD111968AB07008ED995 /* BeginWith.swift */, + 62FB326123B78BF90047BED9 /* BeginWithPrefix.swift */, 1FD8CD121968AB07008ED995 /* BeGreaterThan.swift */, 1FD8CD131968AB07008ED995 /* BeGreaterThanOrEqualTo.swift */, 1FD8CD141968AB07008ED995 /* BeIdenticalTo.swift */, @@ -871,9 +882,9 @@ 1F91DD301C74BF61002C309F /* BeVoid.swift */, 1FD8CD1A1968AB07008ED995 /* Contain.swift */, 7B13BA051DD360AA00C9098C /* ContainElementSatisfying.swift */, + B20058C020E92C7500C1264D /* ElementsEqual.swift */, 1FD8CD1B1968AB07008ED995 /* EndWith.swift */, 1FD8CD1C1968AB07008ED995 /* Equal.swift */, - B20058C020E92C7500C1264D /* ElementsEqual.swift */, 472FD1341B9E085700C7B8DA /* HaveCount.swift */, DDB4D5EC19FE43C200E9D9FE /* Match.swift */, 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */, @@ -882,8 +893,8 @@ 1FCF91521C61C8A400B15DCB /* PostNotification.swift */, 1FA0C3FE1E30B14500623165 /* Predicate.swift */, 1FD8CD1E1968AB07008ED995 /* RaisesException.swift */, - 7B5358BD1C38479700A23FAA /* SatisfyAnyOf.swift */, A8F6B5BC2070186D00FCB5ED /* SatisfyAllOf.swift */, + 7B5358BD1C38479700A23FAA /* SatisfyAnyOf.swift */, 964CFEFC1C4FF48900513336 /* ThrowAssertion.swift */, 29EA59651B551EE6002D767E /* ThrowError.swift */, 7A0A26221E7F52360092A34E /* ToSucceed.swift */, @@ -894,11 +905,11 @@ 1FD8CD241968AB07008ED995 /* Utils */ = { isa = PBXGroup; children = ( - 1FD8CD251968AB07008ED995 /* Functional.swift */, 1FD8CD261968AB07008ED995 /* Await.swift */, 1FD8CD271968AB07008ED995 /* SourceLocation.swift */, 1FD8CD281968AB07008ED995 /* Stringers.swift */, AE4BA9AC1C88DDB500B73906 /* Errors.swift */, + 0477153423B740AD00402D4E /* DispatchTimeInterval.swift */, ); path = Utils; sourceTree = ""; @@ -940,6 +951,14 @@ path = objc; sourceTree = ""; }; + CD3D9A77232647BC00802581 /* CwlPosixPreconditionTesting */ = { + isa = PBXGroup; + children = ( + CD3D9A78232647BC00802581 /* CwlCatchBadInstructionPosix.swift */, + ); + path = CwlPosixPreconditionTesting; + sourceTree = ""; + }; CDFB69521F7E06E600AD8CC7 /* Carthage-Checkouts */ = { isa = PBXGroup; children = ( @@ -965,6 +984,7 @@ children = ( CDFB6A331F7E082400AD8CC7 /* CwlMachBadInstructionHandler */, CDFB6A291F7E082400AD8CC7 /* CwlPreconditionTesting */, + CD3D9A77232647BC00802581 /* CwlPosixPreconditionTesting */, ); name = CwlPreconditionTesting; path = CwlPreconditionTesting/Sources; @@ -1000,30 +1020,11 @@ children = ( CDFB6A2A1F7E082400AD8CC7 /* CwlBadInstructionException.swift */, CDFB6A2B1F7E082400AD8CC7 /* CwlCatchBadInstruction.swift */, - CDFB6A2C1F7E082400AD8CC7 /* CwlCatchBadInstructionPosix.swift */, CDFB6A2D1F7E082400AD8CC7 /* CwlDarwinDefinitions.swift */, - CDFB6A2F1F7E082400AD8CC7 /* Mach */, - CDFB6A311F7E082400AD8CC7 /* Posix */, ); path = CwlPreconditionTesting; sourceTree = ""; }; - CDFB6A2F1F7E082400AD8CC7 /* Mach */ = { - isa = PBXGroup; - children = ( - CDFB6A301F7E082400AD8CC7 /* CwlPreconditionTesting.h */, - ); - path = Mach; - sourceTree = ""; - }; - CDFB6A311F7E082400AD8CC7 /* Posix */ = { - isa = PBXGroup; - children = ( - CDFB6A321F7E082400AD8CC7 /* CwlPreconditionTesting_POSIX.h */, - ); - path = Posix; - sourceTree = ""; - }; CDFB6A331F7E082400AD8CC7 /* CwlMachBadInstructionHandler */ = { isa = PBXGroup; children = ( @@ -1052,7 +1053,6 @@ files = ( CDFB6A4A1F7E082500AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */, CDFB6A281F7E07C700AD8CC7 /* CwlCatchException.h in Headers */, - CDFB6A441F7E082500AD8CC7 /* CwlPreconditionTesting.h in Headers */, 1F1871C91CA89EDB00A34BF2 /* NMBStringify.h in Headers */, 1F1871C51CA89EDB00A34BF2 /* DSL.h in Headers */, 1F1871C71CA89EDB00A34BF2 /* NMBExceptionCapture.h in Headers */, @@ -1064,11 +1064,9 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - CDFB6A521F7E089F00AD8CC7 /* CwlPreconditionTesting_POSIX.h in Headers */, 1F1871E21CA89EF600A34BF2 /* NMBStringify.h in Headers */, 1F1871E01CA89EF600A34BF2 /* DSL.h in Headers */, 1F1871E11CA89EF600A34BF2 /* NMBExceptionCapture.h in Headers */, - CDFB6A501F7E085600AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */, 1F4999A61DBF2DD100BF8877 /* Nimble.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1080,7 +1078,6 @@ CDFB6A491F7E082500AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */, CDFB6A271F7E07C700AD8CC7 /* CwlCatchException.h in Headers */, 1F1871DF1CA89EF500A34BF2 /* NMBStringify.h in Headers */, - CDFB6A431F7E082500AD8CC7 /* CwlPreconditionTesting.h in Headers */, 1F1871DD1CA89EF500A34BF2 /* DSL.h in Headers */, 1F1871DE1CA89EF500A34BF2 /* NMBExceptionCapture.h in Headers */, 1F925EC7195C0DD100ED456B /* Nimble.h in Headers */, @@ -1211,7 +1208,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "Jeff Hui"; TargetAttributes = { 1F1A74281940169200FFFC47 = { @@ -1247,11 +1244,12 @@ }; }; buildConfigurationList = 1F1A74231940169200FFFC47 /* Build configuration list for PBXProject "Nimble" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + compatibilityVersion = "Xcode 11.4"; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = 1F1A741F1940169200FFFC47; productRefGroup = 1F1A742A1940169200FFFC47 /* Products */; @@ -1344,9 +1342,9 @@ 1F43728D1A1B343D00EB80F8 /* SourceLocation.swift in Sources */, 1FD8CD4E1968AB07008ED995 /* BeLessThanOrEqual.swift in Sources */, 1FDBD8671AF8A4FF0089F27B /* AssertionDispatcher.swift in Sources */, - 1F43728A1A1B343800EB80F8 /* Functional.swift in Sources */, AE4BA9AD1C88DDB500B73906 /* Errors.swift in Sources */, 1FD8CD3C1968AB07008ED995 /* BeAnInstanceOf.swift in Sources */, + 0477153623B740B700402D4E /* DispatchTimeInterval.swift in Sources */, 7A6AB2C51E7F628900A2F694 /* ToSucceed.swift in Sources */, 1FD8CD501968AB07008ED995 /* BeLogical.swift in Sources */, 1F1871CB1CA89EDB00A34BF2 /* NMBExpectation.swift in Sources */, @@ -1360,6 +1358,7 @@ 1FCF91531C61C8A400B15DCB /* PostNotification.swift in Sources */, 1FD8CD2E1968AB07008ED995 /* AssertionRecorder.swift in Sources */, 29EA59661B551EE6002D767E /* ThrowError.swift in Sources */, + 62FB326323B78BF90047BED9 /* BeginWithPrefix.swift in Sources */, 1FD8CD5A1968AB07008ED995 /* Equal.swift in Sources */, 1FD8CD4C1968AB07008ED995 /* BeLessThan.swift in Sources */, 1F1871CC1CA89EDB00A34BF2 /* NMBObjCMatcher.swift in Sources */, @@ -1406,9 +1405,11 @@ files = ( 1F4A569A1A3B3539009E1637 /* ObjCEqualTest.m in Sources */, 1F925EEC195C12C800ED456B /* RaisesExceptionTest.swift in Sources */, + 62FB326A23B78D500047BED9 /* BeginWithPrefixTest.swift in Sources */, 1F925EFF195C187600ED456B /* EndWithTest.swift in Sources */, 1F1B5AD41963E13900CA8BF9 /* BeAKindOfTest.swift in Sources */, 1F925F0E195C18F500ED456B /* BeLessThanOrEqualToTest.swift in Sources */, + CDBC39BA2462EA7D00069677 /* PredicateTest.swift in Sources */, 1F4A56661A3B305F009E1637 /* ObjCAsyncTest.m in Sources */, 1F925EFC195C186800ED456B /* BeginWithTest.swift in Sources */, 1F14FB64194180C5009F2A08 /* utils.swift in Sources */, @@ -1430,7 +1431,9 @@ 1F91DD2D1C74BF36002C309F /* BeVoidTest.swift in Sources */, 1F4A56761A3B3253009E1637 /* ObjCBeGreaterThanTest.m in Sources */, 1F925EF9195C175000ED456B /* BeNilTest.swift in Sources */, + CDC157922511957100EAA480 /* DSLTest.swift in Sources */, 7A6AB2C31E7F547E00A2F694 /* ToSucceedTest.swift in Sources */, + CD4C8F0A2464365300A7BDE0 /* SynchronousDeprecatedTest.swift in Sources */, A8A3B707207368F000E25A08 /* ObjCSatisfyAllOfTest.m in Sources */, 1F4A56701A3B319F009E1637 /* ObjCBeCloseToTest.m in Sources */, 1F4A56971A3B34AA009E1637 /* ObjCEndWithTest.m in Sources */, @@ -1457,7 +1460,6 @@ DD9A9A8F19CF439B00706F49 /* BeIdenticalToObjectTest.swift in Sources */, 1F4BB8B71DACA0E40048464B /* ThrowAssertionTest.swift in Sources */, 1F0648D41963AAB2001F9C46 /* SynchronousTest.swift in Sources */, - 347155CA1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */, 4793854D1BA0BB2500296F85 /* ObjCHaveCountTest.m in Sources */, 1F925F08195C18CF00ED456B /* BeGreaterThanTest.swift in Sources */, 7B5358BA1C3846C900A23FAA /* SatisfyAnyOfTest.swift in Sources */, @@ -1482,8 +1484,10 @@ 1F1871D71CA89EEF00A34BF2 /* NMBExceptionCapture.m in Sources */, 1F5DF16E1BDCA0F500C3A531 /* NimbleXCTestHandler.swift in Sources */, 7A6AB2C61E7F628A00A2F694 /* ToSucceed.swift in Sources */, + 62FB326423B78BF90047BED9 /* BeginWithPrefix.swift in Sources */, 1F5DF1751BDCA0F500C3A531 /* FailureMessage.swift in Sources */, A8A3B6EC2071487F00E25A08 /* SatisfyAllOf.swift in Sources */, + CD3D9A79232647BC00802581 /* CwlCatchBadInstructionPosix.swift in Sources */, 1F5DF1801BDCA0F500C3A531 /* BeLessThanOrEqual.swift in Sources */, 1F1871E81CA8A18400A34BF2 /* Async.swift in Sources */, 1F5DF18A1BDCA0F500C3A531 /* ThrowError.swift in Sources */, @@ -1518,7 +1522,6 @@ 1F5DF17E1BDCA0F500C3A531 /* BeIdenticalTo.swift in Sources */, 1F1871E91CA8A18700A34BF2 /* MatcherFunc.swift in Sources */, 1F5DF17A1BDCA0F500C3A531 /* BeEmpty.swift in Sources */, - CDFB6A511F7E087500AD8CC7 /* CwlCatchBadInstructionPosix.swift in Sources */, 1F5DF18C1BDCA0F500C3A531 /* Await.swift in Sources */, 1F1871D81CA89EEF00A34BF2 /* NMBStringify.m in Sources */, 1F5DF1821BDCA0F500C3A531 /* BeNil.swift in Sources */, @@ -1531,8 +1534,8 @@ CDD80B851F20307B0002CD65 /* MatcherProtocols.swift in Sources */, 1F5DF1721BDCA0F500C3A531 /* Expectation.swift in Sources */, 7B5358C01C38479700A23FAA /* SatisfyAnyOf.swift in Sources */, + 0477153723B740B800402D4E /* DispatchTimeInterval.swift in Sources */, 7B13BA0C1DD361D300C9098C /* ContainElementSatisfying.swift in Sources */, - 1F5DF18B1BDCA0F500C3A531 /* Functional.swift in Sources */, 1F5DF1871BDCA0F500C3A531 /* Match.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1543,9 +1546,11 @@ files = ( CD79C9AD1D2CC848004B6F9A /* ObjCBeTrueTest.m in Sources */, CD79C9B41D2CC848004B6F9A /* ObjCRaiseExceptionTest.m in Sources */, + 62FB326923B78D4F0047BED9 /* BeginWithPrefixTest.swift in Sources */, 1F5DF1A31BDCA10200C3A531 /* BeLogicalTest.swift in Sources */, 1F5DF1951BDCA10200C3A531 /* utils.swift in Sources */, CD79C9B01D2CC848004B6F9A /* ObjCEndWithTest.m in Sources */, + CDBC39BB2462EA7D00069677 /* PredicateTest.swift in Sources */, CD79C9B21D2CC848004B6F9A /* ObjCHaveCountTest.m in Sources */, CD79C9A41D2CC848004B6F9A /* ObjCBeFalsyTest.m in Sources */, 1F5DF1981BDCA10200C3A531 /* BeAKindOfTest.swift in Sources */, @@ -1567,7 +1572,9 @@ CD79C9A81D2CC848004B6F9A /* ObjCBeIdenticalToTest.m in Sources */, CD79C9AE1D2CC848004B6F9A /* ObjCBeTruthyTest.m in Sources */, 1F5DF1921BDCA10200C3A531 /* AsynchronousTest.swift in Sources */, + CDC157932511957100EAA480 /* DSLTest.swift in Sources */, 1F5DF1A91BDCA10200C3A531 /* MatchTest.swift in Sources */, + CD4C8F0B2464365300A7BDE0 /* SynchronousDeprecatedTest.swift in Sources */, A8A3B708207368F100E25A08 /* ObjCSatisfyAllOfTest.m in Sources */, 1F5DF1A81BDCA10200C3A531 /* HaveCountTest.swift in Sources */, 1F5DF1971BDCA10200C3A531 /* AllPassTest.swift in Sources */, @@ -1591,7 +1598,6 @@ 7A6AB2C41E7F547E00A2F694 /* ToSucceedTest.swift in Sources */, CD79C9A71D2CC848004B6F9A /* ObjCBeGreaterThanTest.m in Sources */, CD79C9A51D2CC848004B6F9A /* ObjCBeginWithTest.m in Sources */, - 347155CC1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */, 1F5DF1AA1BDCA10200C3A531 /* RaisesExceptionTest.swift in Sources */, 1F5DF1941BDCA10200C3A531 /* UserDescriptionTest.swift in Sources */, CD79C9AF1D2CC848004B6F9A /* ObjCContainTest.m in Sources */, @@ -1624,8 +1630,8 @@ 1FD8CD4F1968AB07008ED995 /* BeLessThanOrEqual.swift in Sources */, 1F1871E71CA8A18400A34BF2 /* Async.swift in Sources */, 1FDBD8681AF8A4FF0089F27B /* AssertionDispatcher.swift in Sources */, - 1F43728B1A1B343900EB80F8 /* Functional.swift in Sources */, AE4BA9AE1C88DDB500B73906 /* Errors.swift in Sources */, + 0477153523B740AD00402D4E /* DispatchTimeInterval.swift in Sources */, 1FD8CD3D1968AB07008ED995 /* BeAnInstanceOf.swift in Sources */, 1FD8CD511968AB07008ED995 /* BeLogical.swift in Sources */, 1F1871D91CA89EF100A34BF2 /* NMBExpectation.swift in Sources */, @@ -1639,6 +1645,7 @@ 1FCF91541C61C8A400B15DCB /* PostNotification.swift in Sources */, DDB4D5EE19FE43C200E9D9FE /* Match.swift in Sources */, 29EA59671B551EE6002D767E /* ThrowError.swift in Sources */, + 62FB326223B78BF90047BED9 /* BeginWithPrefix.swift in Sources */, 1FD8CD5B1968AB07008ED995 /* Equal.swift in Sources */, 1FD8CD4D1968AB07008ED995 /* BeLessThan.swift in Sources */, 1FD8CD471968AB07008ED995 /* BeGreaterThan.swift in Sources */, @@ -1685,16 +1692,17 @@ files = ( 1F4A569B1A3B3539009E1637 /* ObjCEqualTest.m in Sources */, 1F925EED195C12C800ED456B /* RaisesExceptionTest.swift in Sources */, + 62FB326B23B78D510047BED9 /* BeginWithPrefixTest.swift in Sources */, 1F925F00195C187600ED456B /* EndWithTest.swift in Sources */, 1F1B5AD51963E13900CA8BF9 /* BeAKindOfTest.swift in Sources */, 1F925F0F195C18F500ED456B /* BeLessThanOrEqualToTest.swift in Sources */, + CDBC39B92462EA7D00069677 /* PredicateTest.swift in Sources */, 1F4A56671A3B305F009E1637 /* ObjCAsyncTest.m in Sources */, 1F925EFD195C186800ED456B /* BeginWithTest.swift in Sources */, 1F925EE2195C0DFD00ED456B /* utils.swift in Sources */, 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 */, @@ -1710,7 +1718,9 @@ 1FB90099195EC4B8001D7FAE /* BeIdenticalToTest.swift in Sources */, 1F91DD2E1C74BF36002C309F /* BeVoidTest.swift in Sources */, 1F4A56771A3B3253009E1637 /* ObjCBeGreaterThanTest.m in Sources */, + CDC157912511957100EAA480 /* DSLTest.swift in Sources */, 1F925EFA195C175000ED456B /* BeNilTest.swift in Sources */, + CD4C8F092464365300A7BDE0 /* SynchronousDeprecatedTest.swift in Sources */, 7A6AB2C21E7F547E00A2F694 /* ToSucceedTest.swift in Sources */, A8A3B706207368EF00E25A08 /* ObjCSatisfyAllOfTest.m in Sources */, 1F4A56711A3B319F009E1637 /* ObjCBeCloseToTest.m in Sources */, @@ -1737,7 +1747,6 @@ DD9A9A9019CF43AD00706F49 /* BeIdenticalToObjectTest.swift in Sources */, 1F4BB8B61DACA0E30048464B /* ThrowAssertionTest.swift in Sources */, 1F0648D51963AAB2001F9C46 /* SynchronousTest.swift in Sources */, - 347155CB1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */, 4793854E1BA0BB2500296F85 /* ObjCHaveCountTest.m in Sources */, 1F925F09195C18CF00ED456B /* BeGreaterThanTest.swift in Sources */, 7B5358BB1C3846C900A23FAA /* SatisfyAnyOfTest.swift in Sources */, @@ -1809,6 +1818,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; APPLICATION_EXTENSION_API_ONLY = YES; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -1839,6 +1849,7 @@ CURRENT_PROJECT_VERSION = 1; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_TESTING_SEARCH_PATHS = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -1855,16 +1866,18 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; + OTHER_LDFLAGS = ( + "$(inherited)", + "-Xlinker", + "-no_application_extension", + ); + SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; - TARGETED_DEVICE_FAMILY = "1,2"; - TVOS_DEPLOYMENT_TARGET = 9.0; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -1875,6 +1888,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; APPLICATION_EXTENSION_API_ONLY = YES; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -1905,6 +1919,7 @@ CURRENT_PROJECT_VERSION = 1; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTING_SEARCH_PATHS = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -1914,15 +1929,19 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + OTHER_LDFLAGS = ( + "$(inherited)", + "-Xlinker", + "-no_application_extension", + ); + OTHER_SWIFT_FLAGS = "$(inherited) -suppress-warnings"; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; - TARGETED_DEVICE_FAMILY = "1,2"; - TVOS_DEPLOYMENT_TARGET = 9.0; + SWIFT_VERSION = 5.0; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1932,16 +1951,13 @@ 1F1A74401940169200FFFC47 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "PRODUCT_NAME=$(PRODUCT_NAME)/$(PRODUCT_NAME)", @@ -1950,37 +1966,38 @@ GCC_TREAT_WARNINGS_AS_ERRORS = YES; INFOPLIST_FILE = Sources/Nimble/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - ONLY_ACTIVE_ARCH = NO; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + 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; PRODUCT_NAME = Nimble; + SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; 1F1A74411940169200FFFC47 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); GCC_PREPROCESSOR_DEFINITIONS = ( "PRODUCT_NAME=$(PRODUCT_NAME)/$(PRODUCT_NAME)", "$(inherited)", @@ -1988,20 +2005,26 @@ GCC_TREAT_WARNINGS_AS_ERRORS = YES; INFOPLIST_FILE = Sources/Nimble/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + 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; PRODUCT_NAME = Nimble; + SDKROOT = iphoneos; SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; }; @@ -2009,20 +2032,22 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(inherited)", - ); GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); INFOPLIST_FILE = Tests/NimbleTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); METAL_ENABLE_DEBUG_INFO = YES; OTHER_CODE_SIGN_FLAGS = "--verbose"; PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = NimbleTests; + SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -2031,33 +2056,33 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(inherited)", - ); INFOPLIST_FILE = Tests/NimbleTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); METAL_ENABLE_DEBUG_INFO = NO; OTHER_CODE_SIGN_FLAGS = "--verbose"; PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = NimbleTests; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; }; name = Release; }; 1F5DF1661BDCA0CE00C3A531 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); GCC_NO_COMMON_BLOCKS = YES; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -2066,15 +2091,17 @@ ); INFOPLIST_FILE = Sources/Nimble/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + 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; @@ -2082,12 +2109,14 @@ SDKROOT = appletvos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; }; 1F5DF1671BDCA0CE00C3A531 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; @@ -2095,10 +2124,6 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); GCC_NO_COMMON_BLOCKS = YES; GCC_PREPROCESSOR_DEFINITIONS = ( "PRODUCT_NAME=$(PRODUCT_NAME)/$(PRODUCT_NAME)", @@ -2106,23 +2131,27 @@ ); INFOPLIST_FILE = Sources/Nimble/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + 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; PRODUCT_NAME = Nimble; SDKROOT = appletvos; SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Release; }; @@ -2130,19 +2159,20 @@ isa = XCBuildConfiguration; buildSettings = { DEBUG_INFORMATION_FORMAT = dwarf; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(inherited)", - ); GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = Tests/NimbleTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); MTL_ENABLE_DEBUG_INFO = YES; OTHER_CODE_SIGN_FLAGS = "--verbose"; PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = NimbleTests; SDKROOT = appletvos; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; }; @@ -2151,35 +2181,34 @@ buildSettings = { COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(inherited)", - ); GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = Tests/NimbleTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); MTL_ENABLE_DEBUG_INFO = NO; OTHER_CODE_SIGN_FLAGS = "--verbose"; PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = NimbleTests; SDKROOT = appletvos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Release; }; 1F925EC1195C0D6300ED456B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); FRAMEWORK_VERSION = A; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -2189,38 +2218,37 @@ GCC_TREAT_WARNINGS_AS_ERRORS = YES; INFOPLIST_FILE = Sources/Nimble/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = ( "$(inherited)", "-weak_framework", XCTest, "-weak-lswiftXCTest", - "-Xlinker", - "-no_application_extension", ); PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Nimble; PRODUCT_NAME = Nimble; SDKROOT = macosx; SKIP_INSTALL = YES; - VALID_ARCHS = x86_64; }; name = Debug; }; 1F925EC2195C0D6300ED456B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); FRAMEWORK_VERSION = A; GCC_PREPROCESSOR_DEFINITIONS = ( "PRODUCT_NAME=$(PRODUCT_NAME)/$(PRODUCT_NAME)", @@ -2229,23 +2257,26 @@ GCC_TREAT_WARNINGS_AS_ERRORS = YES; INFOPLIST_FILE = Sources/Nimble/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = NO; OTHER_LDFLAGS = ( "$(inherited)", "-weak_framework", XCTest, "-weak-lswiftXCTest", - "-Xlinker", - "-no_application_extension", ); PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Nimble; PRODUCT_NAME = Nimble; SDKROOT = macosx; SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - VALID_ARCHS = x86_64; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; }; name = Release; }; @@ -2254,16 +2285,17 @@ buildSettings = { CLANG_ENABLE_MODULES = YES; COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(DEVELOPER_FRAMEWORKS_DIR)", - "$(inherited)", - ); GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); INFOPLIST_FILE = Tests/NimbleTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = NimbleTests; @@ -2278,17 +2310,19 @@ CLANG_ENABLE_MODULES = YES; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - FRAMEWORK_SEARCH_PATHS = ( - "$(DEVELOPER_FRAMEWORKS_DIR)", - "$(inherited)", - ); INFOPLIST_FILE = Tests/NimbleTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = NimbleTests; SDKROOT = macosx; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; }; name = Release; }; diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Nimble.xcodeproj/xcshareddata/xcschemes/Nimble-iOS.xcscheme b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Nimble.xcodeproj/xcshareddata/xcschemes/Nimble-iOS.xcscheme index 80405c9..2175cc3 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Nimble.xcodeproj/xcshareddata/xcschemes/Nimble-iOS.xcscheme +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Nimble.xcodeproj/xcshareddata/xcschemes/Nimble-iOS.xcscheme @@ -1,6 +1,6 @@ + skipped = "NO" + parallelizable = "YES"> - - - - + skipped = "NO" + parallelizable = "YES"> - - - - - - - - - - - - + + + + + + - - @@ -344,10 +345,10 @@ cases, use the `timeout` parameter: // Swift // Waits three seconds for ocean to contain "starfish": -expect(ocean).toEventually(contain("starfish"), timeout: 3) +expect(ocean).toEventually(contain("starfish"), timeout: .seconds(3)) // Evaluate someValue every 0.2 seconds repeatedly until it equals 100, or fails if it timeouts after 5.5 seconds. -expect(someValue).toEventually(equal(100), timeout: 5.5, pollInterval: 0.2) +expect(someValue).toEventually(equal(100), timeout: .milliseconds(5500), pollInterval: .milliseconds(200)) ``` ```objc @@ -386,7 +387,7 @@ waitUntil(^(void (^done)(void)){ ```swift // Swift -waitUntil(timeout: 10) { done in +waitUntil(timeout: .seconds(10)) { done in ocean.goFish { success in expect(success).to(beTrue()) done() @@ -418,10 +419,10 @@ the default timeout and poll interval values. This can be done as follows: // Swift // Increase the global timeout to 5 seconds: -Nimble.AsyncDefaults.Timeout = 5 +Nimble.AsyncDefaults.timeout = .seconds(1) // Slow the polling interval to 0.1 seconds: -Nimble.AsyncDefaults.PollInterval = 0.1 +Nimble.AsyncDefaults.pollInterval = .milliseconds(100) ``` ## Objective-C Support @@ -1171,20 +1172,31 @@ For Objective-C, the actual value must be one of the following classes, or their ```swift // Swift -let testNotification = Notification(name: "Foo", object: nil) +let testNotification = Notification(name: Notification.Name("Foo"), object: nil) -// passes if the closure in expect { ... } posts a notification to the default +// Passes if the closure in expect { ... } posts a notification to the default // notification center. expect { - NotificationCenter.default.postNotification(testNotification) -}.to(postNotifications(equal([testNotification])) + NotificationCenter.default.post(testNotification) +}.to(postNotifications(equal([testNotification]))) -// passes if the closure in expect { ... } posts a notification to a given +// Passes if the closure in expect { ... } posts a notification to a given // notification center let notificationCenter = NotificationCenter() expect { - notificationCenter.postNotification(testNotification) -}.to(postNotifications(equal([testNotification]), fromNotificationCenter: notificationCenter)) + notificationCenter.post(testNotification) +}.to(postNotifications(equal([testNotification]), from: notificationCenter)) + +// Passes if the closure in expect { ... } posts a notification with the provided names to a given +// notification center. Make sure to use this when running tests on Catalina, +// using DistributedNotificationCenter as there is currently no way +// of observing notifications without providing specific names. +let distributedNotificationCenter = DistributedNotificationCenter() +expect { + distributedNotificationCenter.post(testNotification) +}.toEventually(postDistributedNotifications(equal([testNotification]), + from: distributedNotificationCenter, + names: [testNotification.name])) ``` > This matcher is only available in Swift. @@ -1503,19 +1515,17 @@ For a more comprehensive message that spans multiple lines, use ## Supporting Objective-C To use a custom matcher written in Swift from Objective-C, you'll have -to extend the `NMBObjCMatcher` class, adding a new class method for your +to extend the `NMBPredicate` class, adding a new class method for your custom matcher. The example below defines the class method -`+[NMBObjCMatcher beNilMatcher]`: +`+[NMBPredicate beNilMatcher]`: ```swift // Swift -extension NMBObjCMatcher { - public class func beNilMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualBlock, failureMessage, location in - let block = ({ actualBlock() as NSObject? }) - let expr = Expression(expression: block, location: location) - return beNil().matches(expr, failureMessage: failureMessage) +extension NMBPredicate { + @objc public class func beNilMatcher() -> NMBPredicate { + return NMBPredicate { actualExpression in + return try beNil().satisfies(actualExpression).toObjectiveC() } } } @@ -1526,7 +1536,7 @@ The above allows you to use the matcher from Objective-C: ```objc // Objective-C -expect(actual).to([NMBObjCMatcher beNilMatcher]()); +expect(actual).to([NMBPredicate beNilMatcher]()); ``` To make the syntax easier to use, define a C function that calls the @@ -1535,8 +1545,8 @@ class method: ```objc // Objective-C -FOUNDATION_EXPORT id beNil() { - return [NMBObjCMatcher beNilMatcher]; +FOUNDATION_EXPORT NMBPredicate *beNil() { + return [NMBPredicate beNilMatcher]; } ``` @@ -1558,29 +1568,25 @@ expect(nil).to(equal(nil)); // fails expect(nil).to(beNil()); // passes ``` -If your matcher does not want to match with nil, you use `NonNilMatcherFunc` -and the `canMatchNil` constructor on `NMBObjCMatcher`. Using both types will -automatically generate expected value failure messages when they're nil. +If your matcher does not want to match with nil, you use `Predicate.define` or `Predicate.simple`. +Using those factory methods will automatically generate expected value failure messages when they're nil. ```swift +public func beginWith(_ startingElement: S.Element) -> Predicate where S.Element: Equatable { + return Predicate.simple("begin with <\(startingElement)>") { actualExpression in + guard let actualValue = try actualExpression.evaluate() else { return .fail } -public func beginWith(startingElement: T) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "begin with <\(startingElement)>" - if let actualValue = actualExpression.evaluate() { - var actualGenerator = actualValue.makeIterator() - return actualGenerator.next() == startingElement - } - return false + var actualGenerator = actualValue.makeIterator() + return PredicateStatus(bool: actualGenerator.next() == startingElement) } } -extension NMBObjCMatcher { - public class func beginWithMatcher(expected: AnyObject) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let actual = actualExpression.evaluate() +extension NMBPredicate { + @objc public class func beginWithMatcher(_ expected: Any) -> NMBPredicate { + return NMBPredicate { actualExpression in + let actual = try actualExpression.evaluate() let expr = actualExpression.cast { $0 as? NMBOrderedCollection } - return beginWith(expected).matches(expr, failureMessage: failureMessage) + return try beginWith(expected).satisfies(expr).toObjectiveC() } } } @@ -1605,7 +1611,7 @@ converts those types to the newer `Predicate`. ```swift // Swift -public func beginWith(startingElement: T) -> Predicate { +public func beginWith(_ startingElement: S.Element) -> Predicate where S.Element: Equatable { return NonNilMatcherFunc { actualExpression, failureMessage in failureMessage.postfixMessage = "begin with <\(startingElement)>" if let actualValue = actualExpression.evaluate() { @@ -1628,7 +1634,7 @@ matcher types. ```swift // Swift -public func beginWith(startingElement: T) -> Predicate { +public func beginWith(_ startingElement: S.Element) -> Predicate where S.Element: Equatable { return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in failureMessage.postfixMessage = "begin with <\(startingElement)>" if let actualValue = actualExpression.evaluate() { @@ -1705,12 +1711,33 @@ source 'https://github.com/CocoaPods/Specs.git' target 'YOUR_APP_NAME_HERE_Tests', :exclusive => true do use_frameworks! - pod 'Nimble', '~> 6.0.0' + pod 'Nimble' end ``` Finally run `pod install`. +## Installing Nimble via Accio + +Add the following to your Package.swift: + +```swift +.package(url: "https://github.com/Quick/Nimble.git", .upToNextMajor(from: "8.0.1")), +``` + +Next, add `Nimble` to your App targets dependencies like so: + +```swift +.testTarget( + name: "AppTests", + dependencies: [ + "Nimble", + ] +), +``` + +Then run `accio update`. + ## Using Nimble without XCTest Nimble is integrated with XCTest to allow it work well when used in Xcode test diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift index abaf532..a28bf2b 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 @@ -1,5 +1,3 @@ -import Foundation - /// Protocol for the assertion handler that Nimble uses for all expectations. public protocol AssertionHandler { func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) 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 0f5df59..ac75467 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 @@ -1,5 +1,3 @@ -import Foundation - /// A data structure that stores information about an assertion when /// AssertionRecorder is set as the Nimble assertion handler. /// 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 b3eb09a..32d9b60 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,6 +1,7 @@ -import Foundation - #if canImport(Darwin) && !SWIFT_PACKAGE +import class Foundation.NSObject +import typealias Foundation.TimeInterval +import enum Dispatch.DispatchTimeInterval private func from(objcPredicate: NMBPredicate) -> Predicate { return Predicate { actualExpression in @@ -10,24 +11,27 @@ private func from(objcPredicate: NMBPredicate) -> Predicate { } } -internal struct ObjCMatcherWrapper: Matcher { - let matcher: NMBMatcher - - func matches(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { - return matcher.matches( - // swiftlint:disable:next force_try - ({ try! actualExpression.evaluate() }), - failureMessage: failureMessage, - location: actualExpression.location) - } - - func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { - return matcher.doesNotMatch( - // swiftlint:disable:next force_try - ({ try! actualExpression.evaluate() }), - failureMessage: failureMessage, - location: actualExpression.location) +private func from(matcher: NMBMatcher, style: ExpectationStyle) -> Predicate { + // Almost same as `Matcher.toClosure` + let closure: (Expression, FailureMessage) throws -> Bool = { expr, msg in + switch style { + case .toMatch: + return matcher.matches( + // swiftlint:disable:next force_try + ({ try! expr.evaluate() }), + failureMessage: msg, + location: expr.location + ) + case .toNotMatch: + return !matcher.doesNotMatch( + // swiftlint:disable:next force_try + ({ try! expr.evaluate() }), + failureMessage: msg, + location: expr.location + ) + } } + return Predicate._fromDeprecatedClosure(closure) } // Equivalent to Expectation, but for Nimble's Objective-C interface @@ -37,7 +41,7 @@ public class NMBExpectation: NSObject { internal var _negative: Bool internal let _file: FileString internal let _line: UInt - internal var _timeout: TimeInterval = 1.0 + internal var _timeout: DispatchTimeInterval = .seconds(1) // swiftlint:enable identifier_name @objc public init(actualBlock: @escaping () -> NSObject?, negative: Bool, file: FileString, line: UInt) { @@ -48,63 +52,65 @@ public class NMBExpectation: NSObject { } private var expectValue: Expectation { - return expect(_file, line: _line) { - self._actualBlock() as NSObject? - } + return expect(file: _file, line: _line, self._actualBlock() as NSObject?) } @objc public var withTimeout: (TimeInterval) -> NMBExpectation { - return ({ timeout in self._timeout = timeout + return { timeout in self._timeout = timeout.dispatchInterval return self - }) + } } - @objc public var to: (NMBMatcher) -> Void { - return ({ matcher in + @objc public var to: (NMBMatcher) -> NMBExpectation { + return { matcher in if let pred = matcher as? NMBPredicate { self.expectValue.to(from(objcPredicate: pred)) } else { - self.expectValue.to(ObjCMatcherWrapper(matcher: matcher)) + self.expectValue.to(from(matcher: matcher, style: .toMatch)) } - }) + return self + } } - @objc public var toWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in + @objc public var toWithDescription: (NMBMatcher, String) -> NMBExpectation { + return { matcher, description in if let pred = matcher as? NMBPredicate { self.expectValue.to(from(objcPredicate: pred), description: description) } else { - self.expectValue.to(ObjCMatcherWrapper(matcher: matcher), description: description) + self.expectValue.to(from(matcher: matcher, style: .toMatch), description: description) } - }) + return self + } } - @objc public var toNot: (NMBMatcher) -> Void { - return ({ matcher in + @objc public var toNot: (NMBMatcher) -> NMBExpectation { + return { matcher in if let pred = matcher as? NMBPredicate { self.expectValue.toNot(from(objcPredicate: pred)) } else { - self.expectValue.toNot(ObjCMatcherWrapper(matcher: matcher)) + self.expectValue.toNot(from(matcher: matcher, style: .toNotMatch)) } - }) + return self + } } - @objc public var toNotWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in + @objc public var toNotWithDescription: (NMBMatcher, String) -> NMBExpectation { + return { matcher, description in if let pred = matcher as? NMBPredicate { self.expectValue.toNot(from(objcPredicate: pred), description: description) } else { - self.expectValue.toNot(ObjCMatcherWrapper(matcher: matcher), description: description) + self.expectValue.toNot(from(matcher: matcher, style: .toNotMatch), description: description) } - }) + return self + } } - @objc public var notTo: (NMBMatcher) -> Void { return toNot } + @objc public var notTo: (NMBMatcher) -> NMBExpectation { return toNot } - @objc public var notToWithDescription: (NMBMatcher, String) -> Void { return toNotWithDescription } + @objc public var notToWithDescription: (NMBMatcher, String) -> NMBExpectation { return toNotWithDescription } @objc public var toEventually: (NMBMatcher) -> Void { - return ({ matcher in + return { matcher in if let pred = matcher as? NMBPredicate { self.expectValue.toEventually( from(objcPredicate: pred), @@ -113,16 +119,16 @@ public class NMBExpectation: NSObject { ) } else { self.expectValue.toEventually( - ObjCMatcherWrapper(matcher: matcher), + from(matcher: matcher, style: .toMatch), timeout: self._timeout, description: nil ) } - }) + } } @objc public var toEventuallyWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in + return { matcher, description in if let pred = matcher as? NMBPredicate { self.expectValue.toEventually( from(objcPredicate: pred), @@ -131,16 +137,16 @@ public class NMBExpectation: NSObject { ) } else { self.expectValue.toEventually( - ObjCMatcherWrapper(matcher: matcher), + from(matcher: matcher, style: .toMatch), timeout: self._timeout, description: description ) } - }) + } } @objc public var toEventuallyNot: (NMBMatcher) -> Void { - return ({ matcher in + return { matcher in if let pred = matcher as? NMBPredicate { self.expectValue.toEventuallyNot( from(objcPredicate: pred), @@ -149,16 +155,16 @@ public class NMBExpectation: NSObject { ) } else { self.expectValue.toEventuallyNot( - ObjCMatcherWrapper(matcher: matcher), + from(matcher: matcher, style: .toNotMatch), timeout: self._timeout, description: nil ) } - }) + } } @objc public var toEventuallyNotWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in + return { matcher, description in if let pred = matcher as? NMBPredicate { self.expectValue.toEventuallyNot( from(objcPredicate: pred), @@ -167,12 +173,12 @@ public class NMBExpectation: NSObject { ) } else { self.expectValue.toEventuallyNot( - ObjCMatcherWrapper(matcher: matcher), + from(matcher: matcher, style: .toNotMatch), timeout: self._timeout, description: description ) } - }) + } } @objc public var toNotEventually: (NMBMatcher) -> Void { 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 a91efe3..8b8258d 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,12 +1,12 @@ -import Foundation - #if canImport(Darwin) +import class Foundation.NSObject // swiftlint:disable line_length public typealias MatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage) throws -> Bool public typealias FullMatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage, _ shouldNotMatch: Bool) throws -> Bool // swiftlint:enable line_length +@available(*, deprecated, message: "Use NMBPredicate instead") public class NMBObjCMatcher: NSObject, NMBMatcher { // swiftlint:disable identifier_name let _match: MatcherBlock 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 1b2e8c0..06bde8a 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 @@ -1,5 +1,6 @@ import Dispatch -import Foundation +import class Foundation.NSObject +import class Foundation.Thread /// "Global" state of Nimble is stored here. Only DSL functions should access / be aware of this /// class' existence 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 719bf44..5f29628 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 @@ -45,7 +45,7 @@ class NimbleXCTestUnavailableHandler: AssertionHandler { private var stashed_swift_reportFatalErrorsToDebugger: Bool = false @objc func testCaseWillStart(_ testCase: XCTestCase) { - #if swift(>=3.2) + #if os(macOS) || os(iOS) stashed_swift_reportFatalErrorsToDebugger = _swift_reportFatalErrorsToDebugger _swift_reportFatalErrorsToDebugger = false #endif @@ -56,7 +56,7 @@ class NimbleXCTestUnavailableHandler: AssertionHandler { @objc func testCaseDidFinish(_ testCase: XCTestCase) { currentTestCase = nil - #if swift(>=3.2) + #if os(macOS) || os(iOS) _swift_reportFatalErrorsToDebugger = stashed_swift_reportFatalErrorsToDebugger #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 d0871fc..8cb8e16 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 !canImport(Darwin) +#if canImport(Darwin) +import class Foundation.NSException +#else // 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 c049417..4be4524 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 @@ -21,13 +21,13 @@ internal class NMBWait: NSObject { file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) -> Void) { - return throwableUntil(timeout: timeout, file: file, line: line) { done in - action(done) - } + // Convert TimeInterval to DispatchTimeInterval + until(timeout: timeout.dispatchInterval, file: file, line: line, action: action) } -#else +#endif + internal class func until( - timeout: TimeInterval, + timeout: DispatchTimeInterval, file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) -> Void) { @@ -35,16 +35,15 @@ internal class NMBWait: NSObject { action(done) } } -#endif // Using a throwable closure makes this method not objc compatible. internal class func throwableUntil( - timeout: TimeInterval, + timeout: DispatchTimeInterval, file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) throws -> Void) { let awaiter = NimbleEnvironment.activeInstance.awaiter - let leeway = timeout / 2.0 + let leeway = timeout.divided // swiftlint:disable:next line_length let result = awaiter.performBlock(file: file, line: line) { (done: @escaping (ErrorResult) -> Void) throws -> Void in DispatchQueue.main.async { @@ -72,8 +71,7 @@ internal class NMBWait: NSObject { fail(blockedRunLoopErrorMessageFor("-waitUntil()", leeway: leeway), file: file, line: line) case .timedOut: - let pluralize = (timeout == 1 ? "" : "s") - fail("Waited more than \(timeout) second\(pluralize)", file: file, line: line) + fail("Waited more than \(timeout.description)", file: file, line: line) case let .raisedException(exception): fail("Unexpected exception raised: \(exception)") case let .errorThrown(error): @@ -93,21 +91,21 @@ internal class NMBWait: NSObject { _ file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) -> Void) { - until(timeout: 1, file: file, line: line, action: action) + until(timeout: .seconds(1), file: file, line: line, action: action) } #else internal class func until( _ file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) -> Void) { - until(timeout: 1, file: file, line: line, action: action) + until(timeout: .seconds(1), file: file, line: line, action: action) } #endif } -internal func blockedRunLoopErrorMessageFor(_ fnName: String, leeway: TimeInterval) -> String { +internal func blockedRunLoopErrorMessageFor(_ fnName: String, leeway: DispatchTimeInterval) -> String { // swiftlint:disable:next line_length - return "\(fnName) timed out but was unable to run the timeout handler because the main thread is unresponsive (\(leeway) seconds is allow after the wait times out). Conditions that may cause this include processing blocking IO on the main thread, calls to sleep(), deadlocks, and synchronous IPC. Nimble forcefully stopped run loop which may cause future failures in test run." + return "\(fnName) timed out but was unable to run the timeout handler because the main thread is unresponsive (\(leeway.description) is allow after the wait times out). Conditions that may cause this include processing blocking IO on the main thread, calls to sleep(), deadlocks, and synchronous IPC. Nimble forcefully stopped run loop which may cause future failures in test run." } /// Wait asynchronously until the done closure is called or the timeout has been reached. @@ -117,6 +115,6 @@ internal func blockedRunLoopErrorMessageFor(_ fnName: String, leeway: TimeInterv /// /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. -public func waitUntil(timeout: TimeInterval = AsyncDefaults.Timeout, file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) -> Void) { +public func waitUntil(timeout: DispatchTimeInterval = AsyncDefaults.timeout, file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) -> Void) { NMBWait.until(timeout: timeout, file: file, line: line, action: action) } 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 d6dc9cc..e481f87 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/DSL.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/DSL.swift @@ -1,7 +1,5 @@ -import Foundation - /// Make an expectation on a given actual value. The value given is lazily evaluated. -public func expect(_ expression: @autoclosure @escaping () throws -> T?, file: FileString = #file, line: UInt = #line) -> Expectation { +public func expect(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure @escaping () throws -> T?) -> Expectation { return Expectation( expression: Expression( expression: expression, @@ -10,10 +8,28 @@ public func expect(_ expression: @autoclosure @escaping () throws -> T?, file } /// Make an expectation on a given actual value. The closure is lazily invoked. -public func expect(_ file: FileString = #file, line: UInt = #line, expression: @escaping () throws -> T?) -> Expectation { +public func expect(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure () -> (() throws -> T)) -> Expectation { return Expectation( expression: Expression( - expression: expression, + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +/// Make an expectation on a given actual value. The closure is lazily invoked. +public func expect(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure () -> (() throws -> T?)) -> Expectation { + return Expectation( + expression: Expression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +/// Make an expectation on a given actual value. The closure is lazily invoked. +public func expect(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure () -> (() throws -> Void)) -> Expectation { + return Expectation( + expression: Expression( + expression: expression(), location: SourceLocation(file: file, line: line), isClosure: true)) } @@ -36,24 +52,16 @@ public func fail(_ file: FileString = #file, line: UInt = #line) { /// Like Swift's precondition(), but raises NSExceptions instead of sigaborts internal func nimblePrecondition( - _ expr: @autoclosure() -> Bool, - _ name: @autoclosure() -> String, - _ message: @autoclosure() -> String, + _ expr: @autoclosure () -> Bool, + _ name: @autoclosure () -> String, + _ message: @autoclosure () -> String, file: StaticString = #file, - line: UInt = #line) { - let result = expr() - if !result { -#if canImport(Darwin) - let exception = NSException( - name: NSExceptionName(name()), - reason: message(), - userInfo: nil - ) - exception.raise() -#else - preconditionFailure("\(name()) - \(message())", file: file, line: line) -#endif - } + line: UInt = #line +) { + let result = expr() + if !result { + _nimblePrecondition(name(), message(), file, line) + } } internal func internalError(_ msg: String, file: FileString = #file, line: UInt = #line) -> Never { @@ -66,3 +74,31 @@ internal func internalError(_ msg: String, file: FileString = #file, line: UInt ) // swiftlint:enable line_length } + +#if canImport(Darwin) +import class Foundation.NSException +import struct Foundation.NSExceptionName + +private func _nimblePrecondition( + _ name: String, + _ message: String, + _ file: StaticString, + _ line: UInt +) { + let exception = NSException( + name: NSExceptionName(name), + reason: message, + userInfo: nil + ) + exception.raise() +} +#else +private func _nimblePrecondition( + _ name: String, + _ message: String, + _ file: StaticString, + _ line: UInt +) { + preconditionFailure("\(name) - \(message)", file: file, line: line) +} +#endif 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 41625a1..9906c70 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Expectation.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Expectation.swift @@ -1,6 +1,4 @@ -import Foundation - -// Deprecated +@available(*, deprecated) internal func expressionDoesNotMatch(_ expression: Expression, matcher: U, toNot: String, description: String?) -> (Bool, FailureMessage) where U: Matcher, U.ValueType == T { let msg = FailureMessage() @@ -69,7 +67,9 @@ public struct Expectation { ////////////////// OLD API ///////////////////// /// DEPRECATED: Tests the actual value using a matcher to match. - public func to(_ matcher: U, description: String? = nil) + @available(*, deprecated, message: "Use Predicate instead") + @discardableResult + public func to(_ matcher: U, description: String? = nil) -> Self where U: Matcher, U.ValueType == T { let (pass, msg) = execute( expression, @@ -80,43 +80,54 @@ public struct Expectation { captureExceptions: false ) verify(pass, msg) + return self } /// DEPRECATED: Tests the actual value using a matcher to not match. - public func toNot(_ matcher: U, description: String? = nil) + @available(*, deprecated, message: "Use Predicate instead") + @discardableResult + public func toNot(_ matcher: U, description: String? = nil) -> Self where U: Matcher, U.ValueType == T { // swiftlint:disable:next line_length let (pass, msg) = expressionDoesNotMatch(expression, matcher: matcher, toNot: "to not", description: description) verify(pass, msg) + return self } /// DEPRECATED: Tests the actual value using a matcher to not match. /// /// Alias to toNot(). - public func notTo(_ matcher: U, description: String? = nil) + @available(*, deprecated, message: "Use Predicate instead") + @discardableResult + public func notTo(_ matcher: U, description: String? = nil) -> Self where U: Matcher, U.ValueType == T { - toNot(matcher, description: description) + return toNot(matcher, description: description) } ////////////////// NEW API ///////////////////// /// Tests the actual value using a matcher to match. - public func to(_ predicate: Predicate, description: String? = nil) { + @discardableResult + public func to(_ predicate: Predicate, description: String? = nil) -> Self { let (pass, msg) = execute(expression, .toMatch, predicate, to: "to", description: description) verify(pass, msg) + return self } /// Tests the actual value using a matcher to not match. - public func toNot(_ predicate: Predicate, description: String? = nil) { + @discardableResult + public func toNot(_ predicate: Predicate, description: String? = nil) -> Self { let (pass, msg) = execute(expression, .toNotMatch, predicate, to: "to not", description: description) verify(pass, msg) + return self } /// Tests the actual value using a matcher to not match. /// /// Alias to toNot(). - public func notTo(_ predicate: Predicate, description: String? = nil) { - toNot(predicate, description: description) + @discardableResult + public func notTo(_ predicate: Predicate, description: String? = nil) -> Self { + return toNot(predicate, description: description) } // see: 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 b0cbcc3..4efda7c 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/ExpectationMessage.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/ExpectationMessage.swift @@ -1,11 +1,9 @@ -import Foundation - public indirect enum ExpectationMessage { // --- Primary Expectations --- /// includes actual value in output ("expected to , got ") case expectedActualValueTo(/* message: */ String) /// uses a custom actual value string in output ("expected to , got ") - case expectedCustomValueTo(/* message: */ String, /* actual: */ String) + case expectedCustomValueTo(/* message: */ String, actual: String) /// excludes actual value in output ("expected to ") case expectedTo(/* message: */ String) /// allows any free-form message ("") @@ -23,14 +21,6 @@ public indirect enum ExpectationMessage { /// provides long-form multi-line explainations ("\n\n") case details(ExpectationMessage, String) - internal var sampleMessage: String { - let asStr = toString(actual: "", expected: "expected", to: "to") - let asFailureMessage = FailureMessage() - update(failureMessage: asFailureMessage) - // swiftlint:disable:next line_length - return "(toString(actual:expected:to:) -> \(asStr) || update(failureMessage:) -> \(asFailureMessage.stringValue))" - } - /// Returns the smallest message after the "expected to" string that summarizes the error. /// /// Returns the message part from ExpectationMessage, ignoring all .appends and .details. @@ -118,7 +108,7 @@ public indirect enum ExpectationMessage { case let .expectedActualValueTo(msg): return .expectedActualValueTo(message + msg) case let .expectedCustomValueTo(msg, actual): - return .expectedCustomValueTo(message + msg, actual) + return .expectedCustomValueTo(message + msg, actual: actual) default: return msg.visitLeafs(walk) } @@ -193,7 +183,7 @@ extension FailureMessage { var message: ExpectationMessage = .fail(userDescription ?? "") if actualValue != "" && actualValue != nil { - message = .expectedCustomValueTo(postfixMessage, actualValue ?? "") + message = .expectedCustomValueTo(postfixMessage, actual: actualValue ?? "") } else if postfixMessage != defaultMessage.postfixMessage { if actualValue == nil { message = .expectedTo(postfixMessage) @@ -212,6 +202,7 @@ extension FailureMessage { } #if canImport(Darwin) +import class Foundation.NSObject public class NMBExpectationMessage: NSObject { private let msg: ExpectationMessage @@ -228,7 +219,7 @@ public class NMBExpectationMessage: NSObject { } public init(expectedActualValueTo message: String, customActualValue actual: String) { - self.msg = .expectedCustomValueTo(message, actual) + self.msg = .expectedCustomValueTo(message, actual: actual) } public init(fail message: String) { 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 b6b2ee3..40dde89 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Expression.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Expression.swift @@ -1,15 +1,13 @@ -import Foundation - // Memoizes the given closure, only calling the passed // closure once; even if repeat calls to the returned closure internal func memoizedClosure(_ closure: @escaping () throws -> T) -> (Bool) throws -> T { var cache: T? - return ({ withoutCaching in + return { withoutCaching in if withoutCaching || cache == nil { cache = try closure() } return cache! - }) + } } /// Expression represents the closure of the value inside expect(...). diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/AllPass.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/AllPass.swift index dbbccb9..f067aff 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 @@ -1,70 +1,71 @@ -import Foundation +public func allPass( + _ passFunc: @escaping (S.Element?) throws -> Bool +) -> Predicate { + let matcher = Predicate.simpleNilable("pass a condition") { actualExpression in + return PredicateStatus(bool: try passFunc(try actualExpression.evaluate())) + } + return createPredicate(matcher) +} -public func allPass - (_ passFunc: @escaping (T?) throws -> Bool) -> Predicate - where U: Sequence, T == U.Iterator.Element { - let matcher = Predicate.simpleNilable("pass a condition") { actualExpression in - return PredicateStatus(bool: try passFunc(try actualExpression.evaluate())) +public func allPass( + _ passName: String, + _ passFunc: @escaping (S.Element?) throws -> Bool +) -> Predicate { + let matcher = Predicate.simpleNilable(passName) { actualExpression in + return PredicateStatus(bool: try passFunc(try actualExpression.evaluate())) + } + return createPredicate(matcher) +} + +@available(*, deprecated, message: "Use Predicate instead") +public func allPass(_ elementMatcher: M) -> Predicate where S.Element == M.ValueType { + return createPredicate(elementMatcher.predicate) +} + +public func allPass(_ elementPredicate: Predicate) -> Predicate { + return createPredicate(elementPredicate) +} + +private func createPredicate(_ elementMatcher: Predicate) -> Predicate { + return Predicate { actualExpression in + guard let actualValue = try actualExpression.evaluate() else { + return PredicateResult( + status: .fail, + message: .appends(.expectedTo("all pass"), " (use beNil() to match nils)") + ) } - return createPredicate(matcher) -} -public func allPass - (_ passName: String, _ passFunc: @escaping (T?) throws -> Bool) -> Predicate - where U: Sequence, T == U.Iterator.Element { - let matcher = Predicate.simpleNilable(passName) { actualExpression in - return PredicateStatus(bool: try passFunc(try actualExpression.evaluate())) - } - return createPredicate(matcher) -} - -public func allPass(_ elementMatcher: M) -> Predicate - where S: Sequence, M: Matcher, S.Iterator.Element == M.ValueType { - return createPredicate(elementMatcher.predicate) -} - -public func allPass(_ elementPredicate: Predicate) -> Predicate - where S: Sequence { - return createPredicate(elementPredicate) -} - -private func createPredicate(_ elementMatcher: Predicate) -> Predicate - where S: Sequence { - return Predicate { actualExpression in - guard let actualValue = try actualExpression.evaluate() else { - return PredicateResult( - status: .fail, - message: .appends(.expectedTo("all pass"), " (use beNil() to match nils)") + var failure: ExpectationMessage = .expectedTo("all pass") + for currentElement in actualValue { + let exp = Expression( + expression: {currentElement}, location: actualExpression.location) + let predicateResult = try elementMatcher.satisfies(exp) + if predicateResult.status == .matches { + failure = predicateResult.message.prepended(expectation: "all ") + } else { + failure = predicateResult.message + .replacedExpectation({ .expectedTo($0.expectedMessage) }) + .wrappedExpectation( + before: "all ", + after: ", but failed first at element <\(stringify(currentElement))>" + + " in <\(stringify(actualValue))>" ) + return PredicateResult(status: .doesNotMatch, message: failure) } - - var failure: ExpectationMessage = .expectedTo("all pass") - for currentElement in actualValue { - let exp = Expression( - expression: {currentElement}, location: actualExpression.location) - let predicateResult = try elementMatcher.satisfies(exp) - if predicateResult.status == .matches { - failure = predicateResult.message.prepended(expectation: "all ") - } else { - failure = predicateResult.message - .replacedExpectation({ .expectedTo($0.expectedMessage) }) - .wrappedExpectation( - before: "all ", - after: ", but failed first at element <\(stringify(currentElement))>" - + " in <\(stringify(actualValue))>" - ) - return PredicateResult(status: .doesNotMatch, message: failure) - } - } - failure = failure.replacedExpectation({ expectation in - return .expectedTo(expectation.expectedMessage) - }) - return PredicateResult(status: .matches, message: failure) } + failure = failure.replacedExpectation({ expectation in + return .expectedTo(expectation.expectedMessage) + }) + return PredicateResult(status: .matches, message: failure) + } } #if canImport(Darwin) -extension NMBObjCMatcher { +import class Foundation.NSObject +import struct Foundation.NSFastEnumerationIterator +import protocol Foundation.NSFastEnumeration + +extension NMBPredicate { @objc public class func allPassMatcher(_ matcher: NMBMatcher) -> NMBPredicate { return NMBPredicate { actualExpression in let location = actualExpression.location diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Async.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Async.swift index 5022fe2..dc5e5ed 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Async.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Async.swift @@ -1,13 +1,21 @@ import Foundation +import Dispatch /// If you are running on a slower machine, it could be useful to increase the default timeout value /// or slow down poll interval. Default timeout interval is 1, and poll interval is 0.01. public struct AsyncDefaults { + public static var timeout: DispatchTimeInterval = .seconds(1) + public static var pollInterval: DispatchTimeInterval = .milliseconds(10) +} + +extension AsyncDefaults { + @available(*, unavailable, renamed: "timeout") public static var Timeout: TimeInterval = 1 + @available(*, unavailable, renamed: "pollInterval") public static var PollInterval: TimeInterval = 0.01 } -private func async(style: ExpectationStyle, predicate: Predicate, timeout: TimeInterval, poll: TimeInterval, fnName: String) -> Predicate { +private func async(style: ExpectationStyle, predicate: Predicate, timeout: DispatchTimeInterval, poll: DispatchTimeInterval, fnName: String) -> Predicate { return Predicate { actualExpression in let uncachedExpression = actualExpression.withoutCaching() let fnName = "expect(...).\(fnName)(...)" @@ -55,7 +63,7 @@ extension Expectation { /// @discussion /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. - public func toEventually(_ predicate: Predicate, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) { + public func toEventually(_ predicate: Predicate, timeout: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) { nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) let (pass, msg) = execute( @@ -75,7 +83,7 @@ extension Expectation { /// @discussion /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. - public func toEventuallyNot(_ predicate: Predicate, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) { + public func toEventuallyNot(_ predicate: Predicate, timeout: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) { nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) let (pass, msg) = execute( @@ -103,12 +111,12 @@ extension Expectation { /// @discussion /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. - public func toNotEventually(_ predicate: Predicate, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) { + public func toNotEventually(_ predicate: Predicate, timeout: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) { return toEventuallyNot(predicate, timeout: timeout, pollInterval: pollInterval, description: description) } } -// Deprecated +@available(*, deprecated, message: "Use Predicate instead") extension Expectation { /// Tests the actual value using a matcher to match by checking continuously /// at each pollInterval until the timeout is reached. @@ -116,7 +124,7 @@ extension Expectation { /// @discussion /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. - public func toEventually(_ matcher: U, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) + public func toEventually(_ matcher: U, timeout: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) where U: Matcher, U.ValueType == T { if expression.isClosure { let (pass, msg) = execute( @@ -145,7 +153,7 @@ extension Expectation { /// @discussion /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. - public func toEventuallyNot(_ matcher: U, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) + public func toEventuallyNot(_ matcher: U, timeout: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) where U: Matcher, U.ValueType == T { if expression.isClosure { let (pass, msg) = expressionDoesNotMatch( @@ -174,7 +182,7 @@ extension Expectation { /// @discussion /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. - public func toNotEventually(_ matcher: U, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) + public func toNotEventually(_ matcher: U, timeout: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) where U: Matcher, U.ValueType == T { return toEventuallyNot(matcher, timeout: timeout, pollInterval: pollInterval, 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 3a68b09..f01ca77 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 @@ -1,5 +1,3 @@ -import Foundation - private func matcherMessage(forType expectedType: T.Type) -> String { return "be a kind of \(String(describing: expectedType))" } @@ -14,12 +12,12 @@ public func beAKindOf(_ expectedType: T.Type) -> Predicate { let instance = try actualExpression.evaluate() guard let validInstance = instance else { - message = .expectedCustomValueTo(matcherMessage(forType: expectedType), "") + message = .expectedCustomValueTo(matcherMessage(forType: expectedType), actual: "") return PredicateResult(status: .fail, message: message) } message = .expectedCustomValueTo( "be a kind of \(String(describing: expectedType))", - "<\(String(describing: type(of: validInstance))) instance>" + actual: "<\(String(describing: type(of: validInstance))) instance>" ) return PredicateResult( @@ -30,6 +28,7 @@ public func beAKindOf(_ expectedType: T.Type) -> Predicate { } #if canImport(Darwin) +import class Foundation.NSObject /// 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 @@ -43,13 +42,13 @@ public func beAKindOf(_ expectedClass: AnyClass) -> Predicate { status = PredicateStatus(bool: instance != nil && instance!.isKind(of: expectedClass)) message = .expectedCustomValueTo( matcherMessage(forClass: expectedClass), - "<\(String(describing: type(of: validInstance))) instance>" + actual: "<\(String(describing: type(of: validInstance))) instance>" ) } else { status = .fail message = .expectedCustomValueTo( matcherMessage(forClass: expectedClass), - "" + actual: "" ) } @@ -57,8 +56,8 @@ public func beAKindOf(_ expectedClass: AnyClass) -> Predicate { } } -extension NMBObjCMatcher { - @objc public class func beAKindOfMatcher(_ expected: AnyClass) -> NMBMatcher { +extension NMBPredicate { + @objc public class func beAKindOfMatcher(_ expected: AnyClass) -> NMBPredicate { 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 3cef3a7..47ea663 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 @@ -16,7 +16,7 @@ public func beAnInstanceOf(_ expectedType: T.Type) -> Predicate { return PredicateResult( status: PredicateStatus(bool: type(of: validInstance) == expectedType), - message: .expectedCustomValueTo(errorMessage, actualString) + message: .expectedCustomValueTo(errorMessage, actual: actualString) ) } } @@ -40,14 +40,14 @@ public func beAnInstanceOf(_ expectedClass: AnyClass) -> Predicate { #endif return PredicateResult( status: PredicateStatus(bool: matches), - message: .expectedCustomValueTo(errorMessage, actualString) + message: .expectedCustomValueTo(errorMessage, actual: actualString) ) } } #if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func beAnInstanceOfMatcher(_ expected: AnyClass) -> NMBMatcher { +extension NMBPredicate { + @objc public class func beAnInstanceOfMatcher(_ expected: AnyClass) -> NMBPredicate { 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 d6fd1ee..891193f 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 @@ -11,7 +11,7 @@ internal func isCloseTo(_ actualValue: NMBDoubleConvertible?, return PredicateResult( bool: actualValue != nil && abs(actualValue!.doubleValue - expectedValue.doubleValue) < delta, - message: .expectedCustomValueTo(errorMessage, "<\(stringify(actualValue))>") + message: .expectedCustomValueTo(errorMessage, actual: "<\(stringify(actualValue))>") ) } @@ -19,73 +19,44 @@ internal func isCloseTo(_ actualValue: NMBDoubleConvertible?, /// point values which can have imprecise results when doing arithmetic on them. /// /// @see equal -public func beCloseTo(_ expectedValue: Double, within delta: Double = DefaultDelta) -> Predicate { +public func beCloseTo(_ expectedValue: Value, within delta: Double = DefaultDelta) -> Predicate { return Predicate.define { actualExpression in return isCloseTo(try actualExpression.evaluate(), expectedValue: expectedValue, delta: delta) } } -/// A Nimble matcher that succeeds when a value is close to another. This is used for floating -/// point values which can have imprecise results when doing arithmetic on them. -/// -/// @see equal -public func beCloseTo(_ expectedValue: NMBDoubleConvertible, within delta: Double = DefaultDelta) -> Predicate { +private func beCloseTo(_ expectedValue: NMBDoubleConvertible, within delta: Double = DefaultDelta) -> Predicate { return Predicate.define { actualExpression in return isCloseTo(try actualExpression.evaluate(), expectedValue: expectedValue, delta: delta) } } #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) { +public class NMBObjCBeCloseToPredicate: NMBPredicate { + private let _expected: NSNumber + + fileprivate init(expected: NSNumber, within: CDouble) { _expected = expected - _delta = within - } - @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) - - do { - return try matcher.matches(expr, failureMessage: failureMessage) - } catch let error { - failureMessage.stringValue = "unexpected error thrown: <\(error)>" - return false + let predicate = beCloseTo(expected, within: within) + let predicateBlock: PredicateBlock = { actualExpression in + let expr = actualExpression.cast { $0 as? NMBDoubleConvertible } + return try predicate.satisfies(expr).toObjectiveC() } + super.init(predicate: predicateBlock) } - @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) - - do { - return try matcher.doesNotMatch(expr, failureMessage: failureMessage) - } catch let error { - failureMessage.stringValue = "unexpected error thrown: <\(error)>" - return false + @objc public var within: (CDouble) -> NMBObjCBeCloseToPredicate { + let expected = _expected + return { delta in + return NMBObjCBeCloseToPredicate(expected: expected, within: delta) } } - - @objc public var within: (CDouble) -> NMBObjCBeCloseToMatcher { - return ({ delta in - return NMBObjCBeCloseToMatcher(expected: self._expected, within: delta) - }) - } } -extension NMBObjCMatcher { - @objc public class func beCloseToMatcher(_ expected: NSNumber, within: CDouble) -> NMBObjCBeCloseToMatcher { - return NMBObjCBeCloseToMatcher(expected: expected, within: within) +extension NMBPredicate { + @objc public class func beCloseToMatcher(_ expected: NSNumber, within: CDouble) -> NMBObjCBeCloseToPredicate { + return NMBObjCBeCloseToPredicate(expected: expected, within: within) } } #endif @@ -113,23 +84,27 @@ 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)) +extension Expectation where T == [Double] { + // swiftlint:disable:next identifier_name + public static func ≈(lhs: Expectation, rhs: [Double]) { + lhs.to(beCloseTo(rhs)) + } } -// swiftlint:disable:next identifier_name -public func ≈(lhs: Expectation, rhs: NMBDoubleConvertible) { - lhs.to(beCloseTo(rhs)) -} +extension Expectation where T == NMBDoubleConvertible { + // swiftlint:disable:next identifier_name + public static 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)) -} + // swiftlint:disable:next identifier_name + public static func ≈(lhs: Expectation, rhs: (expected: NMBDoubleConvertible, delta: Double)) { + lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) + } -public func == (lhs: Expectation, rhs: (expected: NMBDoubleConvertible, delta: Double)) { - lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) + public static func == (lhs: Expectation, rhs: (expected: NMBDoubleConvertible, delta: Double)) { + lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) + } } // make this higher precedence than exponents so the Doubles either end aren't pulled in 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 79bf923..3e890d5 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 @@ -4,11 +4,9 @@ import Foundation /// means the are no items in that collection. For strings, it is an empty string. public func beEmpty() -> Predicate { return Predicate.simple("be empty") { actualExpression in - let actualSeq = try actualExpression.evaluate() - if actualSeq == nil { - return .fail - } - var generator = actualSeq!.makeIterator() + guard let actual = try actualExpression.evaluate() else { return .fail } + + var generator = actual.makeIterator() return PredicateStatus(bool: generator.next() == nil) } } @@ -17,9 +15,16 @@ public func beEmpty() -> Predicate { /// 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 - } + guard let actual = try actualExpression.evaluate() else { return .fail } + return PredicateStatus(bool: actual.isEmpty) + } +} + +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For strings, it is an empty string. +public func beEmpty() -> Predicate { + return Predicate.simple("be empty") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } return PredicateStatus(bool: actual.isEmpty) } } @@ -28,8 +33,8 @@ public func beEmpty() -> Predicate { /// means the are no items in that collection. For strings, it is an empty string. public func beEmpty() -> Predicate { return Predicate.simple("be empty") { actualExpression in - let actualString = try actualExpression.evaluate() - return PredicateStatus(bool: actualString == nil || NSString(string: actualString!).length == 0) + guard let actual = try actualExpression.evaluate() else { return .fail } + return PredicateStatus(bool: actual.isEmpty) } } @@ -37,8 +42,8 @@ public func beEmpty() -> Predicate { /// means the are no items in that collection. For NSString instances, it is an empty string. public func beEmpty() -> Predicate { return Predicate.simple("be empty") { actualExpression in - let actualString = try actualExpression.evaluate() - return PredicateStatus(bool: actualString == nil || actualString!.length == 0) + guard let actual = try actualExpression.evaluate() else { return .fail } + return PredicateStatus(bool: actual.length == 0) } } @@ -48,42 +53,42 @@ 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 - let actualDictionary = try actualExpression.evaluate() - return PredicateStatus(bool: actualDictionary == nil || actualDictionary!.count == 0) - } + return Predicate.simple("be empty") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + return PredicateStatus(bool: actual.count == 0) + } } /// 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 - let actualArray = try actualExpression.evaluate() - return PredicateStatus(bool: actualArray == nil || actualArray!.count == 0) - } + return Predicate.simple("be empty") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + return PredicateStatus(bool: actual.count == 0) + } } /// 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 - let actual = try actualExpression.evaluate() - return PredicateStatus(bool: actual == nil || actual!.count == 0) + guard let actual = try actualExpression.evaluate() else { return .fail } + return PredicateStatus(bool: actual.count == 0) } } #if canImport(Darwin) -extension NMBObjCMatcher { +extension NMBPredicate { @objc public class func beEmptyMatcher() -> NMBPredicate { return NMBPredicate { actualExpression in let location = actualExpression.location let actualValue = try actualExpression.evaluate() if let value = actualValue as? NMBCollection { - let expr = Expression(expression: ({ value as NMBCollection }), location: location) + let expr = Expression(expression: ({ value }), location: location) return try beEmpty().satisfies(expr).toObjectiveC() } else if let value = actualValue as? NSString { - let expr = Expression(expression: ({ value as String }), location: location) + let expr = Expression(expression: ({ value }), location: location) return try beEmpty().satisfies(expr).toObjectiveC() } else if let actualValue = actualValue { // swiftlint:disable:next line_length 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 4a4cdd2..a8d1212 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 @@ -1,16 +1,20 @@ -import Foundation - /// A Nimble matcher that succeeds when the actual value is greater than the expected value. public func beGreaterThan(_ expectedValue: T?) -> Predicate { let errorMessage = "be greater than <\(stringify(expectedValue))>" return Predicate.simple(errorMessage) { actualExpression in - if let actual = try actualExpression.evaluate(), let expected = expectedValue { - return PredicateStatus(bool: actual > expected) - } - return .fail + guard let actual = try actualExpression.evaluate(), let expected = expectedValue else { return .fail } + + return PredicateStatus(bool: actual > expected) } } +public func >(lhs: Expectation, rhs: T) { + lhs.to(beGreaterThan(rhs)) +} + +#if canImport(Darwin) +import enum Foundation.ComparisonResult + /// A Nimble matcher that succeeds when the actual value is greater than the expected value. public func beGreaterThan(_ expectedValue: NMBComparable?) -> Predicate { let errorMessage = "be greater than <\(stringify(expectedValue))>" @@ -22,17 +26,12 @@ public func beGreaterThan(_ expectedValue: NMBComparable?) -> Predicate(lhs: Expectation, rhs: T) { - lhs.to(beGreaterThan(rhs)) -} - public func > (lhs: Expectation, rhs: NMBComparable?) { lhs.to(beGreaterThan(rhs)) } -#if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBMatcher { +extension NMBPredicate { + @objc public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBPredicate { return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } 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 39d9e63..affa58c 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 @@ -1,18 +1,21 @@ -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 { 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 PredicateStatus(bool: actual >= expected) - } - return .fail + guard let actual = try actualExpression.evaluate(), let expected = expectedValue else { return .fail } + + return PredicateStatus(bool: actual >= expected) } } +public func >=(lhs: Expectation, rhs: T) { + lhs.to(beGreaterThanOrEqualTo(rhs)) +} + +#if canImport(Darwin) +import enum Foundation.ComparisonResult + /// A Nimble matcher that succeeds when the actual value is greater than /// or equal to the expected value. public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Predicate { @@ -24,17 +27,12 @@ public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Pre } } -public func >=(lhs: Expectation, rhs: T) { - lhs.to(beGreaterThanOrEqualTo(rhs)) -} - public func >=(lhs: Expectation, rhs: T) { lhs.to(beGreaterThanOrEqualTo(rhs)) } -#if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func beGreaterThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBMatcher { +extension NMBPredicate { + @objc public class func beGreaterThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBPredicate { return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } 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 49e503e..85e14f9 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 @@ -1,36 +1,28 @@ -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.define { actualExpression in - #if os(Linux) && !swift(>=4.1.50) - let actual = try actualExpression.evaluate() as? AnyObject - #else - let actual = try actualExpression.evaluate() as AnyObject? - #endif + let actual = try actualExpression.evaluate() as AnyObject? - let bool: Bool - #if os(Linux) && !swift(>=4.1.50) - bool = actual === (expected as? AnyObject) && actual !== nil - #else - bool = actual === (expected as AnyObject?) && actual !== nil - #endif + let bool = actual === (expected as AnyObject?) && actual !== nil return PredicateResult( bool: bool, message: .expectedCustomValueTo( "be identical to \(identityAsString(expected))", - "\(identityAsString(actual))" + actual: "\(identityAsString(actual))" ) ) } } -public func === (lhs: Expectation, rhs: Any?) { - lhs.to(beIdenticalTo(rhs)) -} -public func !== (lhs: Expectation, rhs: Any?) { - lhs.toNot(beIdenticalTo(rhs)) +extension Expectation where T == Any { + public static func === (lhs: Expectation, rhs: Any?) { + lhs.to(beIdenticalTo(rhs)) + } + + public static func !== (lhs: Expectation, rhs: Any?) { + lhs.toNot(beIdenticalTo(rhs)) + } } /// A Nimble matcher that succeeds when the actual value is the same instance @@ -42,8 +34,10 @@ public func be(_ expected: Any?) -> Predicate { } #if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func beIdenticalToMatcher(_ expected: NSObject?) -> NMBMatcher { +import class Foundation.NSObject + +extension NMBPredicate { + @objc public class func beIdenticalToMatcher(_ expected: NSObject?) -> NMBPredicate { return NMBPredicate { actualExpression in let aExpr = actualExpression.cast { $0 as Any? } 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 ef0a7d4..256f3a6 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 @@ -1,16 +1,20 @@ -import Foundation - /// A Nimble matcher that succeeds when the actual value is less than the expected value. public func beLessThan(_ expectedValue: T?) -> Predicate { let message = "be less than <\(stringify(expectedValue))>" return Predicate.simple(message) { actualExpression in - if let actual = try actualExpression.evaluate(), let expected = expectedValue { - return PredicateStatus(bool: actual < expected) - } - return .fail + guard let actual = try actualExpression.evaluate(), let expected = expectedValue else { return .fail } + + return PredicateStatus(bool: actual < expected) } } +public func <(lhs: Expectation, rhs: T) { + lhs.to(beLessThan(rhs)) +} + +#if canImport(Darwin) +import enum Foundation.ComparisonResult + /// A Nimble matcher that succeeds when the actual value is less than the expected value. public func beLessThan(_ expectedValue: NMBComparable?) -> Predicate { let message = "be less than <\(stringify(expectedValue))>" @@ -21,17 +25,12 @@ public func beLessThan(_ expectedValue: NMBComparable?) -> Predicate(lhs: Expectation, rhs: T) { - lhs.to(beLessThan(rhs)) -} - public func < (lhs: Expectation, rhs: NMBComparable?) { lhs.to(beLessThan(rhs)) } -#if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func beLessThanMatcher(_ expected: NMBComparable?) -> NMBMatcher { +extension NMBPredicate { + @objc public class func beLessThanMatcher(_ expected: NMBComparable?) -> NMBPredicate { return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } 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 30ce043..6174be5 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 @@ -1,16 +1,20 @@ -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.simple("be less than or equal to <\(stringify(expectedValue))>") { actualExpression in - if let actual = try actualExpression.evaluate(), let expected = expectedValue { - return PredicateStatus(bool: actual <= expected) - } - return .fail + guard let actual = try actualExpression.evaluate(), let expected = expectedValue else { return .fail } + + return PredicateStatus(bool: actual <= expected) } } +public func <=(lhs: Expectation, rhs: T) { + lhs.to(beLessThanOrEqualTo(rhs)) +} + +#if canImport(Darwin) +import enum Foundation.ComparisonResult + /// A Nimble matcher that succeeds when the actual value is less than /// or equal to the expected value. public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predicate { @@ -21,17 +25,12 @@ public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predic } } -public func <=(lhs: Expectation, rhs: T) { - lhs.to(beLessThanOrEqualTo(rhs)) -} - public func <=(lhs: Expectation, rhs: T) { lhs.to(beLessThanOrEqualTo(rhs)) } -#if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func beLessThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBMatcher { +extension NMBPredicate { + @objc public class func beLessThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBPredicate { return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } 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 788234b..1676ba4 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 @@ -119,29 +119,29 @@ public func beFalsy() -> Predicate NMBMatcher { +extension NMBPredicate { + @objc public class func beTruthyMatcher() -> NMBPredicate { return NMBPredicate { actualExpression in let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } return try beTruthy().satisfies(expr).toObjectiveC() } } - @objc public class func beFalsyMatcher() -> NMBMatcher { + @objc public class func beFalsyMatcher() -> NMBPredicate { return NMBPredicate { actualExpression in let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } return try beFalsy().satisfies(expr).toObjectiveC() } } - @objc public class func beTrueMatcher() -> NMBMatcher { + @objc public class func beTrueMatcher() -> NMBPredicate { return NMBPredicate { actualExpression in let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } return try beTrue().satisfies(expr).toObjectiveC() } } - @objc public class func beFalseMatcher() -> NMBMatcher { + @objc public class func beFalseMatcher() -> NMBPredicate { return NMBPredicate { actualExpression in let expr = actualExpression.cast { value -> Bool? in guard let value = value else { return nil } 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 0f21d41..270bd35 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 @@ -1,5 +1,3 @@ -import Foundation - /// A Nimble matcher that succeeds when the actual value is nil. public func beNil() -> Predicate { return Predicate.simpleNilable("be nil") { actualExpression in @@ -9,8 +7,10 @@ public func beNil() -> Predicate { } #if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func beNilMatcher() -> NMBMatcher { +import Foundation + +extension NMBPredicate { + @objc public class func beNilMatcher() -> NMBPredicate { 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 9a7eafd..c4bbaf6 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 @@ -1,5 +1,3 @@ -import Foundation - /// A Nimble matcher that succeeds when the actual value is Void. public func beVoid() -> Predicate<()> { return Predicate.simpleNilable("be void") { actualExpression in 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 3183eb9..1da7818 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 @@ -2,14 +2,12 @@ import Foundation /// A Nimble matcher that succeeds when the actual sequence's first element /// is equal to the expected value. -public func beginWith(_ startingElement: T) -> Predicate - where S.Iterator.Element == T { +public func beginWith(_ startingElement: S.Element) -> Predicate where S.Element: Equatable { return Predicate.simple("begin with <\(startingElement)>") { actualExpression in - if let actualValue = try actualExpression.evaluate() { - var actualGenerator = actualValue.makeIterator() - return PredicateStatus(bool: actualGenerator.next() == startingElement) - } - return .fail + guard let actualValue = try actualExpression.evaluate() else { return .fail } + + var actualGenerator = actualValue.makeIterator() + return PredicateStatus(bool: actualGenerator.next() == startingElement) } } @@ -34,16 +32,15 @@ public func beginWith(_ startingElement: Any) -> Predicate /// where the expected substring's location is zero. public func beginWith(_ startingSubstring: String) -> Predicate { return Predicate.simple("begin with <\(startingSubstring)>") { actualExpression in - if let actual = try actualExpression.evaluate() { - return PredicateStatus(bool: actual.hasPrefix(startingSubstring)) - } - return .fail + guard let actual = try actualExpression.evaluate() else { return .fail } + + return PredicateStatus(bool: actual.hasPrefix(startingSubstring)) } } #if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func beginWithMatcher(_ expected: Any) -> NMBMatcher { +extension NMBPredicate { + @objc public class func beginWithMatcher(_ expected: Any) -> NMBPredicate { return NMBPredicate { actualExpression in let actual = try actualExpression.evaluate() if actual is String { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeginWithPrefix.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeginWithPrefix.swift new file mode 100644 index 0000000..c3a79b1 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/BeginWithPrefix.swift @@ -0,0 +1,39 @@ +/// A Nimble matcher that succeeds when the exepected sequence is a prefix of the actual sequence. +/// +/// This is a matcher abstraction for https://developer.apple.com/documentation/swift/sequence/2854218-starts +public func beginWith(prefix expectedPrefix: Seq2?) + -> Predicate where Seq1.Element: Equatable, Seq1.Element == Seq2.Element { + return Predicate.define("begin with <\(stringify(expectedPrefix))>") { (actualExpression, msg) in + let actualPrefix = try actualExpression.evaluate() + switch (expectedPrefix, actualPrefix) { + 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 = actual.starts(with: expected) + return PredicateResult(bool: matches, message: msg) + } + } +} + +/// A Nimble matcher that succeeds when the expected sequence is the prefix of the actual sequence, using the given predicate as the equivalence test. +/// +/// This is a matcher abstraction for https://developer.apple.com/documentation/swift/sequence/2996828-starts +public func beginWith( + prefix expectedPrefix: Seq2?, + by areEquivalent: @escaping (Seq1.Element, Seq2.Element) -> Bool +) -> Predicate { + return Predicate.define("begin with <\(stringify(expectedPrefix))>") { (actualExpression, msg) in + let actualPrefix = try actualExpression.evaluate() + switch (expectedPrefix, actualPrefix) { + 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 = actual.starts(with: expected, by: areEquivalent) + return PredicateResult(bool: matches, message: msg) + } + } +} 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 1d16fb1..c7fc15b 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,43 +1,56 @@ +#if canImport(Foundation) import Foundation +#endif /// A Nimble matcher that succeeds when the actual sequence contains the expected values. -public func contain(_ items: T...) -> Predicate - where S.Element == T { +public func contain(_ items: S.Element...) -> Predicate where S.Element: Equatable { return contain(items) } /// A Nimble matcher that succeeds when the actual sequence contains the expected values. -public func contain(_ items: [T]) -> Predicate - where S.Element == T { +public func contain(_ items: [S.Element]) -> Predicate where S.Element: Equatable { 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) + guard let actual = try actualExpression.evaluate() else { return .fail } + + let matches = items.allSatisfy { + return actual.contains($0) } - return .fail + return PredicateStatus(bool: matches) } } /// 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) +public func contain(_ items: S.Element...) -> Predicate where S.Element: Equatable { + 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 +public func contain(_ items: [S.Element]) -> Predicate where S.Element: Equatable { + return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + + let matches = items.allSatisfy { + return actual.contains($0) } + return PredicateStatus(bool: matches) + } +} + +/// A Nimble matcher that succeeds when the actual set contains the expected values. +public func contain(_ items: S.Element...) -> Predicate where S.Element: Equatable { + return contain(items) +} + +/// A Nimble matcher that succeeds when the actual set contains the expected values. +public func contain(_ items: [S.Element]) -> Predicate where S.Element: Equatable { + return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + + let matches = items.allSatisfy { + return actual.contains($0) + } + return PredicateStatus(bool: matches) + } } /// A Nimble matcher that succeeds when the actual string contains the expected substring. @@ -47,17 +60,17 @@ public func contain(_ substrings: String...) -> Predicate { public func contain(_ substrings: [String]) -> Predicate { return Predicate.simple("contain <\(arrayAsString(substrings))>") { actualExpression in - if let actual = try actualExpression.evaluate() { - let matches = substrings.allSatisfy { - let range = actual.range(of: $0) - return range != nil && !range!.isEmpty - } - return PredicateStatus(bool: matches) + guard let actual = try actualExpression.evaluate() else { return .fail } + + let matches = substrings.allSatisfy { + let range = actual.range(of: $0) + return range != nil && !range!.isEmpty } - return .fail + return PredicateStatus(bool: matches) } } +#if canImport(Foundation) /// A Nimble matcher that succeeds when the actual string contains the expected substring. public func contain(_ substrings: NSString...) -> Predicate { return contain(substrings) @@ -65,13 +78,13 @@ public func contain(_ substrings: NSString...) -> Predicate { public func contain(_ substrings: [NSString]) -> Predicate { return Predicate.simple("contain <\(arrayAsString(substrings))>") { actualExpression in - if let actual = try actualExpression.evaluate() { - let matches = substrings.allSatisfy { actual.range(of: $0.description).length != 0 } - return PredicateStatus(bool: matches) - } - return .fail + guard let actual = try actualExpression.evaluate() else { return .fail } + + let matches = substrings.allSatisfy { actual.range(of: $0.description).length != 0 } + return PredicateStatus(bool: matches) } } +#endif /// A Nimble matcher that succeeds when the actual collection contains the expected object. public func contain(_ items: Any?...) -> Predicate { @@ -81,6 +94,7 @@ public func contain(_ items: Any?...) -> Predicate { public func contain(_ items: [Any?]) -> Predicate { return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in guard let actual = try actualExpression.evaluate() else { return .fail } + let matches = items.allSatisfy { item in return item.map { actual.contains($0) } ?? false } @@ -89,8 +103,8 @@ public func contain(_ items: [Any?]) -> Predicate { } #if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func containMatcher(_ expected: [NSObject]) -> NMBMatcher { +extension NMBPredicate { + @objc public class func containMatcher(_ expected: [NSObject]) -> NMBPredicate { return NMBPredicate { actualExpression in let location = actualExpression.location let actualValue = try actualExpression.evaluate() 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 331f3bc..2e7875b 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 @@ -1,7 +1,6 @@ -import Foundation - -public func containElementSatisfying(_ predicate: @escaping ((T) -> Bool), _ predicateDescription: String = "") -> Predicate where S.Iterator.Element == T { - +public func containElementSatisfying( + _ predicate: @escaping ((S.Element) -> Bool), _ predicateDescription: String = "" +) -> Predicate { return Predicate.define { actualExpression in let message: ExpectationMessage if predicateDescription == "" { @@ -25,34 +24,38 @@ public func containElementSatisfying(_ predicate: @escaping ((T) } #if canImport(Darwin) - extension NMBObjCMatcher { - @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 { - let message = ExpectationMessage.fail( - "containElementSatisfying must be provided an NSFastEnumeration object" - ) - return NMBPredicateResult(status: .fail, message: message.toObjectiveC()) - } +import class Foundation.NSObject +import struct Foundation.NSFastEnumerationIterator +import protocol Foundation.NSFastEnumeration - 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 { - continue - } - - if predicate(object) { - return NMBPredicateResult(status: .matches, message: message) - } - } - - return NMBPredicateResult(status: .doesNotMatch, message: message) +extension NMBPredicate { + @objc public class func containElementSatisfyingMatcher(_ predicate: @escaping ((NSObject) -> Bool)) -> NMBPredicate { + return NMBPredicate { actualExpression in + let value = try actualExpression.evaluate() + guard let enumeration = value as? NSFastEnumeration else { + 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 { + continue + } + + if predicate(object) { + return NMBPredicateResult(status: .matches, message: message) + } + } + + return NMBPredicateResult(status: .doesNotMatch, message: message) } } +} #endif 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 index 1704e94..708cf1c 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ElementsEqual.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ElementsEqual.swift @@ -1,6 +1,10 @@ -/// 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 +/// A Nimble matcher that succeeds when the actual sequence and the exepected sequence contain the same elements in +/// the same order. +/// +/// This is a matcher abstraction for https://developer.apple.com/documentation/swift/sequence/2854213-elementsequal +public func elementsEqual( + _ expectedValue: Seq2? +) -> Predicate where Seq1.Element: Equatable, Seq1.Element == Seq2.Element { return Predicate.define("elementsEqual <\(stringify(expectedValue))>") { (actualExpression, msg) in let actualValue = try actualExpression.evaluate() switch (expectedValue, actualValue) { @@ -14,3 +18,25 @@ public func elementsEqual(_ expectedValue: S?) -> Predicate wher } } } + +/// A Nimble matcher that succeeds when the actual sequence and the exepected sequence contain equivalent elements in +/// the same order, using the given predicate as the equivalence test. +/// +/// This is a matcher abstraction for https://developer.apple.com/documentation/swift/sequence/2949668-elementsequal +public func elementsEqual( + _ expectedValue: Seq2?, + by areEquivalent: @escaping (Seq1.Element, Seq2.Element) -> Bool +) -> Predicate { + 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 = actual.elementsEqual(expected, by: areEquivalent) + 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 13bdb31..16c4d06 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 @@ -2,21 +2,19 @@ import Foundation /// A Nimble matcher that succeeds when the actual sequence's last element /// is equal to the expected value. -public func endWith(_ endingElement: T) -> Predicate - where S.Iterator.Element == T { +public func endWith(_ endingElement: S.Element) -> Predicate where S.Element: Equatable { return Predicate.simple("end with <\(endingElement)>") { actualExpression in - if let actualValue = try actualExpression.evaluate() { - var actualGenerator = actualValue.makeIterator() - var lastItem: T? - var item: T? - repeat { - lastItem = item - item = actualGenerator.next() - } while(item != nil) + guard let actualValue = try actualExpression.evaluate() else { return .fail } - return PredicateStatus(bool: lastItem == endingElement) - } - return .fail + var actualGenerator = actualValue.makeIterator() + var lastItem: S.Element? + var item: S.Element? + repeat { + lastItem = item + item = actualGenerator.next() + } while(item != nil) + + return PredicateStatus(bool: lastItem == endingElement) } } @@ -25,6 +23,7 @@ public func endWith(_ endingElement: T) -> Predicate< public func endWith(_ endingElement: Any) -> Predicate { 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 { @@ -43,16 +42,15 @@ public func endWith(_ endingElement: Any) -> Predicate { /// expected substring's length. public func endWith(_ endingSubstring: String) -> Predicate { return Predicate.simple("end with <\(endingSubstring)>") { actualExpression in - if let collection = try actualExpression.evaluate() { - return PredicateStatus(bool: collection.hasSuffix(endingSubstring)) - } - return .fail + guard let collection = try actualExpression.evaluate() else { return .fail } + + return PredicateStatus(bool: collection.hasSuffix(endingSubstring)) } } #if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func endWithMatcher(_ expected: Any) -> NMBMatcher { +extension NMBPredicate { + @objc public class func endWithMatcher(_ expected: Any) -> NMBPredicate { return NMBPredicate { actualExpression in let actual = try actualExpression.evaluate() if actual is String { 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 b08d5f6..190edb4 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 @@ -1,5 +1,3 @@ -import Foundation - /// A Nimble matcher that succeeds when the actual value is equal to the expected value. /// Values can support equal by supporting the Equatable protocol. /// @@ -71,7 +69,7 @@ private func equal(_ expectedValue: Set?, stringify: @escaping (Set?) - errorMessage = .expectedCustomValueTo( "equal <\(stringify(expectedValue))>", - "<\(stringify(actualValue))>" + actual: "<\(stringify(actualValue))>" ) if expectedValue == actualValue { @@ -138,8 +136,10 @@ public func !=(lhs: Expectation<[T: C]>, rhs: [T: C]?) { } #if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func equalMatcher(_ expected: NSObject) -> NMBMatcher { +import class Foundation.NSObject + +extension NMBPredicate { + @objc public class func equalMatcher(_ expected: NSObject) -> NMBPredicate { 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 984e2d4..20397f5 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 @@ -1,5 +1,3 @@ -import Foundation - // The `haveCount` matchers do not print the full string representation of the collection value, // instead they only print the type name and the expected count. This makes it easier to understand // the reason for failed expectations. See: https://github.com/Quick/Nimble/issues/308. @@ -13,7 +11,7 @@ public func haveCount(_ expectedValue: Int) -> Predicate { let message = ExpectationMessage .expectedCustomValueTo( "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))", - "\(actualValue.count)" + actual: "\(actualValue.count)" ) .appended(details: "Actual Value: \(stringify(actualValue))") @@ -33,7 +31,7 @@ public func haveCount(_ expectedValue: Int) -> Predicate { let message = ExpectationMessage .expectedCustomValueTo( "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))", - "\(actualValue.count)" + actual: "\(actualValue.count)" ) .appended(details: "Actual Value: \(stringify(actualValue))") @@ -46,8 +44,10 @@ public func haveCount(_ expectedValue: Int) -> Predicate { } #if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func haveCountMatcher(_ expected: NSNumber) -> NMBMatcher { +import Foundation + +extension NMBPredicate { + @objc public class func haveCountMatcher(_ expected: NSNumber) -> NMBPredicate { return NMBPredicate { actualExpression in let location = actualExpression.location let actualValue = try actualExpression.evaluate() @@ -60,7 +60,7 @@ extension NMBObjCMatcher { if let actualValue = actualValue { message = ExpectationMessage.expectedCustomValueTo( "get type of NSArray, NSSet, NSDictionary, or NSHashTable", - "\(String(describing: type(of: actualValue)))" + actual: "\(String(describing: type(of: actualValue)))" ) } else { message = ExpectationMessage 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 dbcff09..93363b3 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 @@ -1,29 +1,23 @@ -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.simple("match <\(stringify(expectedValue))>") { actualExpression in - if let actual = try actualExpression.evaluate() { - if let regexp = expectedValue { - let bool = actual.range(of: regexp, options: .regularExpression) != nil - return PredicateStatus(bool: bool) - } - } + guard let actual = try actualExpression.evaluate(), let regexp = expectedValue else { return .fail } - return .fail + let bool = actual.range(of: regexp, options: .regularExpression) != nil + return PredicateStatus(bool: bool) } } #if canImport(Darwin) +import class Foundation.NSString -extension NMBObjCMatcher { - @objc public class func matchMatcher(_ expected: NSString) -> NMBMatcher { +extension NMBPredicate { + @objc public class func matchMatcher(_ expected: NSString) -> NMBPredicate { return NMBPredicate { actualExpression in let actual = actualExpression.cast { $0 as? String } return try match(expected.description).satisfies(actual).toObjectiveC() } } } - #endif 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 4ad71d4..3edc99b 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 @@ -1,5 +1,3 @@ -import Foundation - /// A Nimble matcher that succeeds when the actual expression evaluates to an /// error from the specified case. /// @@ -9,9 +7,7 @@ public func matchError(_ error: T) -> Predicate { return Predicate.define { actualExpression in let actualError = try actualExpression.evaluate() - let failureMessage = FailureMessage() - setFailureMessageForError( - failureMessage, + let message = messageForError( postfixMessageVerb: "match", actualError: actualError, error: error @@ -22,7 +18,7 @@ public func matchError(_ error: T) -> Predicate { matches = true } - return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + return PredicateResult(bool: matches, message: message) } } @@ -35,9 +31,7 @@ public func matchError(_ error: T) -> Predicate { return Predicate.define { actualExpression in let actualError = try actualExpression.evaluate() - let failureMessage = FailureMessage() - setFailureMessageForError( - failureMessage, + let message = messageForError( postfixMessageVerb: "match", actualError: actualError, error: error @@ -48,7 +42,7 @@ public func matchError(_ error: T) -> Predicate { matches = true } - return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + return PredicateResult(bool: matches, message: message) } } @@ -58,9 +52,7 @@ public func matchError(_ errorType: T.Type) -> Predicate { return Predicate.define { actualExpression in let actualError = try actualExpression.evaluate() - let failureMessage = FailureMessage() - setFailureMessageForError( - failureMessage, + let message = messageForError( postfixMessageVerb: "match", actualError: actualError, errorType: errorType @@ -71,6 +63,6 @@ public func matchError(_ errorType: T.Type) -> Predicate { matches = true } - return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + return PredicateResult(bool: matches, message: message) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/MatcherFunc.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/MatcherFunc.swift index abcafa9..cba4d33 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/MatcherFunc.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/MatcherFunc.swift @@ -9,7 +9,7 @@ /// Use the Matcher protocol instead of this type to accept custom matchers as /// input parameters. /// @see allPass for an example that uses accepts other matchers as input. -@available(*, deprecated, message: "Use to Predicate instead") +@available(*, deprecated, message: "Use Predicate instead") public struct MatcherFunc: Matcher { public let matcher: (Expression, FailureMessage) throws -> Bool @@ -28,6 +28,7 @@ public struct MatcherFunc: Matcher { /// Compatibility layer to new Matcher API. Converts an old-style matcher to a new one. /// Note: You should definitely spend the time to convert to the new api as soon as possible /// since this struct type is deprecated. + @available(*, deprecated, message: "Use Predicate directly instead") public var predicate: Predicate { return Predicate.fromDeprecatedMatcher(self) } @@ -44,7 +45,7 @@ public struct MatcherFunc: Matcher { /// Use the Matcher protocol instead of this type to accept custom matchers as /// input parameters. /// @see allPass for an example that uses accepts other matchers as input. -@available(*, deprecated, message: "Use to Predicate instead") +@available(*, deprecated, message: "Use Predicate instead") public struct NonNilMatcherFunc: Matcher { public let matcher: (Expression, FailureMessage) throws -> Bool @@ -79,6 +80,7 @@ public struct NonNilMatcherFunc: Matcher { /// Compatibility layer to new Matcher API. Converts an old-style matcher to a new one. /// Note: You should definitely spend the time to convert to the new api as soon as possible /// since this struct type is deprecated. + @available(*, deprecated, message: "Use Predicate directly instead") public var predicate: Predicate { return Predicate.fromDeprecatedMatcher(self) } 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 38bb297..720ced0 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 @@ -12,19 +12,20 @@ public protocol Matcher { func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool } +@available(*, deprecated) extension Matcher { var predicate: Predicate { return Predicate.fromDeprecatedMatcher(self) } var toClosure: (Expression, FailureMessage, Bool) throws -> Bool { - return ({ expr, msg, expectedResult in + return { expr, msg, expectedResult in if expectedResult { return try self.matches(expr, failureMessage: msg) } else { return try self.doesNotMatch(expr, failureMessage: msg) } - }) + } } } @@ -128,20 +129,14 @@ extension NSDate: TestOutputStringConvertible { } } +#if canImport(Darwin) /// Protocol for types to support beLessThan(), beLessThanOrEqualTo(), /// beGreaterThan(), beGreaterThanOrEqualTo(), and equal() matchers. /// /// Types that conform to Swift's Comparable protocol will work implicitly too -#if canImport(Darwin) @objc public protocol NMBComparable { func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult } -#else -// This should become obsolete once Corelibs Foundation adds Comparable conformance to NSNumber -public protocol NMBComparable { - func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult -} -#endif extension NSNumber: NMBComparable { public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult { @@ -155,3 +150,4 @@ extension NSString: NMBComparable { return compare(otherObject as! String) } } +#endif 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 7d3e44c..cf20186 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,48 +1,115 @@ +#if canImport(Foundation) import Foundation internal class NotificationCollector { private(set) var observedNotifications: [Notification] private let notificationCenter: NotificationCenter - #if canImport(Darwin) - private var token: AnyObject? - #else - private var token: NSObjectProtocol? - #endif + private let names: Set + private var tokens: [NSObjectProtocol] - required init(notificationCenter: NotificationCenter) { + required init(notificationCenter: NotificationCenter, names: Set = []) { self.notificationCenter = notificationCenter self.observedNotifications = [] + self.names = names + self.tokens = [] } func startObserving() { - // swiftlint:disable:next line_length - 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(notification) + func addObserver(forName name: Notification.Name?) -> NSObjectProtocol { + return notificationCenter.addObserver(forName: name, object: nil, queue: nil) { [weak self] notification in + // linux-swift gets confused by .append(n) + self?.observedNotifications.append(notification) + } + } + + if names.isEmpty { + tokens.append(addObserver(forName: nil)) + } else { + names.forEach { name in + tokens.append(addObserver(forName: name)) + } } } deinit { - #if canImport(Darwin) - if let token = self.token { - self.notificationCenter.removeObserver(token) - } - #else - if let token = self.token as? AnyObject { - self.notificationCenter.removeObserver(token) - } - #endif + tokens.forEach { token in + notificationCenter.removeObserver(token) + } } } private let mainThread = pthread_self() +private func _postNotifications( + _ predicate: Predicate<[Notification]>, + from center: NotificationCenter, + names: Set = [] +) -> Predicate { + _ = mainThread // Force lazy-loading of this value + let collector = NotificationCollector(notificationCenter: center, names: names) + collector.startObserving() + var once: Bool = false + + return Predicate { actualExpression in + let collectorNotificationsExpression = Expression( + memoizedExpression: { _ in + return collector.observedNotifications + }, + location: actualExpression.location, + withoutCaching: true + ) + + assert(pthread_equal(mainThread, pthread_self()) != 0, "Only expecting closure to be evaluated on main thread.") + if !once { + once = true + _ = try actualExpression.evaluate() + } + + let actualValue: String + if collector.observedNotifications.isEmpty { + actualValue = "no notifications" + } else { + actualValue = "<\(stringify(collector.observedNotifications))>" + } + + var result = try predicate.satisfies(collectorNotificationsExpression) + result.message = result.message.replacedExpectation { message in + return .expectedCustomValueTo(message.expectedMessage, actual: actualValue) + } + return result + } +} + +public func postNotifications( + _ predicate: Predicate<[Notification]>, + from center: NotificationCenter = .default +) -> Predicate { + _postNotifications(predicate, from: center) +} + +@available(*, deprecated, renamed: "postNotifications(_:from:)") +public func postNotifications( + _ predicate: Predicate<[Notification]>, + fromNotificationCenter center: NotificationCenter +) -> Predicate { + postNotifications(predicate, from: center) +} + +#if os(macOS) +public func postDistributedNotifications( + _ predicate: Predicate<[Notification]>, + from center: DistributedNotificationCenter = .default(), + names: Set +) -> Predicate { + _postNotifications(predicate, from: center, names: names) +} +#endif + +@available(*, deprecated, message: "Use Predicate instead") public func postNotifications( _ notificationsMatcher: T, - fromNotificationCenter center: NotificationCenter = .default) - -> Predicate - where T: Matcher, T.ValueType == [Notification] -{ + from center: NotificationCenter = .default +) -> Predicate where T: Matcher, T.ValueType == [Notification] { _ = mainThread // Force lazy-loading of this value let collector = NotificationCollector(notificationCenter: center) collector.startObserving() @@ -69,3 +136,12 @@ public func postNotifications( return PredicateResult(bool: match, message: failureMessage.toExpectationMessage()) } } + +@available(*, deprecated, renamed: "postNotifications(_:from:)") +public func postNotifications( + _ notificationsMatcher: T, + fromNotificationCenter center: NotificationCenter +) -> Predicate where T: Matcher, T.ValueType == [Notification] { + return postNotifications(notificationsMatcher, from: center) +} +#endif 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 2604411..fa0128f 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 @@ -1,6 +1,5 @@ // New Matcher API // -import Foundation /// A Predicate is part of the new matcher API that provides assertions to expectations. /// @@ -45,17 +44,17 @@ extension Predicate { /// Defines a predicate with a default message that can be returned in the closure /// Also ensures the predicate's actual value cannot pass with `nil` given. - public static func define(_ msg: String, matcher: @escaping (Expression, ExpectationMessage) throws -> PredicateResult) -> Predicate { + public static func define(_ message: String = "match", matcher: @escaping (Expression, ExpectationMessage) throws -> PredicateResult) -> Predicate { return Predicate { actual in - return try matcher(actual, .expectedActualValueTo(msg)) + return try matcher(actual, .expectedActualValueTo(message)) }.requireNonNil } /// Defines a predicate with a default message that can be returned in the closure /// Unlike `define`, this allows nil values to succeed if the given closure chooses to. - public static func defineNilable(_ msg: String, matcher: @escaping (Expression, ExpectationMessage) throws -> PredicateResult) -> Predicate { + public static func defineNilable(_ message: String = "match", matcher: @escaping (Expression, ExpectationMessage) throws -> PredicateResult) -> Predicate { return Predicate { actual in - return try matcher(actual, .expectedActualValueTo(msg)) + return try matcher(actual, .expectedActualValueTo(message)) } } } @@ -65,9 +64,9 @@ extension Predicate { /// error message. /// /// Also ensures the predicate's actual value cannot pass with `nil` given. - public static func simple(_ msg: String, matcher: @escaping (Expression) throws -> PredicateStatus) -> Predicate { + public static func simple(_ message: String = "match", matcher: @escaping (Expression) throws -> PredicateStatus) -> Predicate { return Predicate { actual in - return PredicateResult(status: try matcher(actual), message: .expectedActualValueTo(msg)) + return PredicateResult(status: try matcher(actual), message: .expectedActualValueTo(message)) }.requireNonNil } @@ -75,9 +74,9 @@ extension Predicate { /// error message. /// /// Unlike `simple`, this allows nil values to succeed if the given closure chooses to. - public static func simpleNilable(_ msg: String, matcher: @escaping (Expression) throws -> PredicateStatus) -> Predicate { + public static func simpleNilable(_ message: String = "match", matcher: @escaping (Expression) throws -> PredicateStatus) -> Predicate { return Predicate { actual in - return PredicateResult(status: try matcher(actual), message: .expectedActualValueTo(msg)) + return PredicateResult(status: try matcher(actual), message: .expectedActualValueTo(message)) } } } @@ -166,7 +165,24 @@ public enum PredicateStatus { } } +extension Predicate { + /// Compatibility layer for old Matcher API, deprecated. + /// Emulates the MatcherFunc API + internal static func _fromDeprecatedClosure(_ matcher: @escaping (Expression, FailureMessage) throws -> Bool) -> Predicate { + // swiftlint:disable:previous identifier_name + return Predicate { actual in + let failureMessage = FailureMessage() + let result = try matcher(actual, failureMessage) + return PredicateResult( + status: PredicateStatus(bool: result), + message: failureMessage.toExpectationMessage() + ) + } + } +} + // Backwards compatibility until Old Matcher API removal +@available(*, deprecated, message: "Use Predicate directly instead") extension Predicate: Matcher { /// Compatibility layer for old Matcher API, deprecated public static func fromDeprecatedFullClosure(_ matcher: @escaping (Expression, FailureMessage, Bool) throws -> Bool) -> Predicate { @@ -183,15 +199,7 @@ extension Predicate: Matcher { /// Compatibility layer for old Matcher API, deprecated. /// Emulates the MatcherFunc API public static func fromDeprecatedClosure(_ matcher: @escaping (Expression, FailureMessage) throws -> Bool) -> Predicate { - return Predicate { actual in - let failureMessage = FailureMessage() - let result = try matcher(actual, failureMessage) - return PredicateResult( - status: PredicateStatus(bool: result), - message: failureMessage.toExpectationMessage() - ) - } - + return _fromDeprecatedClosure(matcher) } /// Compatibility layer for old Matcher API, deprecated. @@ -243,6 +251,8 @@ extension Predicate { } #if canImport(Darwin) +import class Foundation.NSObject + public typealias PredicateBlock = (_ actualExpression: Expression) throws -> NMBPredicateResult public class NMBPredicate: NSObject { 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 f44c810..7c1b2b2 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,8 @@ -import Foundation - -// This matcher requires the Objective-C, and being built by Xcode rather than the Swift Package Manager +// This matcher requires the Objective-C, and being built by Xcode rather than the Swift Package Manager #if canImport(Darwin) && !SWIFT_PACKAGE +import class Foundation.NSObject +import class Foundation.NSDictionary +import class Foundation.NSException /// A Nimble matcher that succeeds when the actual expression raises an /// exception with the specified name, reason, and/or userInfo. @@ -12,78 +13,97 @@ import Foundation /// /// nil arguments indicates that the matcher should not attempt to match against /// that parameter. -public func raiseException( - named: String? = nil, +public func raiseException( + named: NSExceptionName? = nil, reason: String? = nil, userInfo: NSDictionary? = nil, - closure: ((NSException) -> Void)? = nil) -> Predicate { - return Predicate { actualExpression in - var exception: NSException? - let capture = NMBExceptionCapture(handler: ({ e in - exception = e - }), finally: nil) - - 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, - named: named, - reason: reason, - userInfo: userInfo, - closure: closure - ) - - let matches = exceptionMatchesNonNilFieldsOrClosure( - exception, - named: named, - reason: reason, - userInfo: userInfo, - closure: closure - ) - return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) - } + closure: ((NSException) -> Void)? = nil +) -> Predicate { + return raiseException(named: named?.rawValue, reason: reason, userInfo: userInfo, closure: closure) } -// swiftlint:disable:next function_parameter_count -internal func setFailureMessageForException( - _ failureMessage: FailureMessage, +/// A Nimble matcher that succeeds when the actual expression raises an +/// exception with the specified name, reason, and/or userInfo. +/// +/// Alternatively, you can pass a closure to do any arbitrary custom matching +/// to the raised exception. The closure only gets called when an exception +/// is raised. +/// +/// nil arguments indicates that the matcher should not attempt to match against +/// that parameter. +public func raiseException( + named: String?, + reason: String? = nil, + userInfo: NSDictionary? = nil, + closure: ((NSException) -> Void)? = nil +) -> Predicate { + return Predicate { actualExpression in + var exception: NSException? + let capture = NMBExceptionCapture(handler: ({ e in + exception = e + }), finally: nil) + + do { + try capture.tryBlockThrows { + _ = try actualExpression.evaluate() + } + } catch { + return PredicateResult(status: .fail, message: .fail("unexpected error thrown: <\(error)>")) + } + + let message = messageForException( + exception: exception, + named: named, + reason: reason, + userInfo: userInfo, + closure: closure + ) + + let matches = exceptionMatchesNonNilFieldsOrClosure( + exception, + named: named, + reason: reason, + userInfo: userInfo, + closure: closure + ) + return PredicateResult(bool: matches, message: message) + } +} + +internal func messageForException( exception: NSException?, named: String?, reason: String?, userInfo: NSDictionary?, - closure: ((NSException) -> Void)?) { - failureMessage.postfixMessage = "raise exception" + closure: ((NSException) -> Void)? +) -> ExpectationMessage { + var rawMessage: String = "raise exception" - if let named = named { - failureMessage.postfixMessage += " with name <\(named)>" - } - if let reason = reason { - failureMessage.postfixMessage += " with reason <\(reason)>" - } - if let userInfo = userInfo { - failureMessage.postfixMessage += " with userInfo <\(userInfo)>" - } - if closure != nil { - failureMessage.postfixMessage += " that satisfies block" - } - if named == nil && reason == nil && userInfo == nil && closure == nil { - failureMessage.postfixMessage = "raise any exception" - } + if let named = named { + rawMessage += " with name <\(named)>" + } + if let reason = reason { + rawMessage += " with reason <\(reason)>" + } + if let userInfo = userInfo { + rawMessage += " with userInfo <\(userInfo)>" + } + if closure != nil { + rawMessage += " that satisfies block" + } + if named == nil && reason == nil && userInfo == nil && closure == nil { + rawMessage = "raise any exception" + } - if let exception = exception { - // swiftlint:disable:next line_length - failureMessage.actualValue = "\(String(describing: type(of: exception))) { name=\(exception.name), reason='\(stringify(exception.reason))', userInfo=\(stringify(exception.userInfo)) }" - } else { - failureMessage.actualValue = "no exception" - } + let actual: String + if let exception = exception { + // swiftlint:disable:next line_length + actual = "\(String(describing: type(of: exception))) { name=\(exception.name), reason='\(stringify(exception.reason))', userInfo=\(stringify(exception.userInfo)) }" + } else { + actual = "no exception" + } + + return .expectedCustomValueTo(rawMessage, actual: actual) } internal func exceptionMatchesNonNilFieldsOrClosure( @@ -121,90 +141,82 @@ internal func exceptionMatchesNonNilFieldsOrClosure( return matches } -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 +public class NMBObjCRaiseExceptionPredicate: NMBPredicate { + private let _name: String? + private let _reason: String? + private let _userInfo: NSDictionary? + private let _block: ((NSException) -> Void)? - internal init(name: String?, reason: String?, userInfo: NSDictionary?, block: ((NSException) -> Void)?) { + fileprivate init(name: String?, reason: String?, userInfo: NSDictionary?, block: ((NSException) -> Void)?) { _name = name _reason = reason _userInfo = userInfo _block = block + + let predicate: Predicate = raiseException( + named: name, + reason: reason, + userInfo: userInfo, + closure: block + ) + let predicateBlock: PredicateBlock = { actualExpression in + return try predicate.satisfies(actualExpression).toObjectiveC() + } + super.init(predicate: predicateBlock) } - @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) - - 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 var named: (_ name: String) -> NMBObjCRaiseExceptionPredicate { + let (reason, userInfo, block) = (_reason, _userInfo, _block) + return { name in + return NMBObjCRaiseExceptionPredicate( + name: name, + reason: reason, + userInfo: userInfo, + block: block + ) } } - @objc public func doesNotMatch(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool { - return !matches(actualBlock, failureMessage: failureMessage, location: location) - } - - @objc public var named: (_ name: String) -> NMBObjCRaiseExceptionMatcher { - return ({ name in - return NMBObjCRaiseExceptionMatcher( + @objc public var reason: (_ reason: String?) -> NMBObjCRaiseExceptionPredicate { + let (name, userInfo, block) = (_name, _userInfo, _block) + return { reason in + return NMBObjCRaiseExceptionPredicate( name: name, - reason: self._reason, - userInfo: self._userInfo, - block: self._block - ) - }) - } - - @objc public var reason: (_ reason: String?) -> NMBObjCRaiseExceptionMatcher { - return ({ reason in - return NMBObjCRaiseExceptionMatcher( - name: self._name, reason: reason, - userInfo: self._userInfo, - block: self._block - ) - }) - } - - @objc public var userInfo: (_ userInfo: NSDictionary?) -> NMBObjCRaiseExceptionMatcher { - return ({ userInfo in - return NMBObjCRaiseExceptionMatcher( - name: self._name, - reason: self._reason, userInfo: userInfo, - block: self._block - ) - }) - } - - @objc public var satisfyingBlock: (_ block: ((NSException) -> Void)?) -> NMBObjCRaiseExceptionMatcher { - return ({ block in - return NMBObjCRaiseExceptionMatcher( - name: self._name, - reason: self._reason, - userInfo: self._userInfo, block: block ) - }) + } + } + + @objc public var userInfo: (_ userInfo: NSDictionary?) -> NMBObjCRaiseExceptionPredicate { + let (name, reason, block) = (_name, _reason, _block) + return { userInfo in + return NMBObjCRaiseExceptionPredicate( + name: name, + reason: reason, + userInfo: userInfo, + block: block + ) + } + } + + @objc public var satisfyingBlock: (_ block: ((NSException) -> Void)?) -> NMBObjCRaiseExceptionPredicate { + let (name, reason, userInfo) = (_name, _reason, _userInfo) + return { block in + return NMBObjCRaiseExceptionPredicate( + name: name, + reason: reason, + userInfo: userInfo, + block: block + ) + } } } -extension NMBObjCMatcher { - @objc public class func raiseExceptionMatcher() -> NMBObjCRaiseExceptionMatcher { - return NMBObjCRaiseExceptionMatcher(name: nil, reason: nil, userInfo: nil, block: nil) +extension NMBPredicate { + @objc public class func raiseExceptionMatcher() -> NMBObjCRaiseExceptionPredicate { + return NMBObjCRaiseExceptionPredicate(name: nil, reason: nil, userInfo: nil, block: nil) } } #endif 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 da3ea9a..7fbeeef 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 @@ -1,7 +1,12 @@ -import Foundation +/// A Nimble matcher that succeeds when the actual value matches with all of the matchers +/// provided in the variable list of matchers. +public func satisfyAllOf(_ predicates: Predicate...) -> Predicate { + return satisfyAllOf(predicates) +} /// A Nimble matcher that succeeds when the actual value matches with all of the matchers /// provided in the variable list of matchers. +@available(*, deprecated, message: "Use Predicate instead") public func satisfyAllOf(_ matchers: U...) -> Predicate where U: Matcher, U.ValueType == T { return satisfyAllOf(matchers.map { $0.predicate }) @@ -23,7 +28,7 @@ internal func satisfyAllOf(_ predicates: [Predicate]) -> Predicate { if let actualValue = try actualExpression.evaluate() { msg = .expectedCustomValueTo( "match all of: " + postfixMessages.joined(separator: ", and "), - "\(actualValue)" + actual: "\(actualValue)" ) } else { msg = .expectedActualValueTo( @@ -40,7 +45,9 @@ public func && (left: Predicate, right: Predicate) -> Predicate { } #if canImport(Darwin) -extension NMBObjCMatcher { +import class Foundation.NSObject + +extension NMBPredicate { @objc public class func satisfyAllOfMatcher(_ matchers: [NMBMatcher]) -> NMBPredicate { return NMBPredicate { actualExpression in if matchers.isEmpty { 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 6724956..44615dc 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 @@ -1,7 +1,12 @@ -import Foundation +/// A Nimble matcher that succeeds when the actual value matches with any of the matchers +/// provided in the variable list of matchers. +public func satisfyAnyOf(_ predicates: Predicate...) -> Predicate { + return satisfyAnyOf(predicates) +} /// A Nimble matcher that succeeds when the actual value matches with any of the matchers /// provided in the variable list of matchers. +@available(*, deprecated, message: "Use Predicate instead") public func satisfyAnyOf(_ matchers: U...) -> Predicate where U: Matcher, U.ValueType == T { return satisfyAnyOf(matchers.map { $0.predicate }) @@ -23,7 +28,7 @@ internal func satisfyAnyOf(_ predicates: [Predicate]) -> Predicate { if let actualValue = try actualExpression.evaluate() { msg = .expectedCustomValueTo( "match one of: " + postfixMessages.joined(separator: ", or "), - "\(actualValue)" + actual: "\(actualValue)" ) } else { msg = .expectedActualValueTo( @@ -39,16 +44,20 @@ public func || (left: Predicate, right: Predicate) -> Predicate { return satisfyAnyOf(left, right) } +@available(*, deprecated, message: "Use Predicate instead") public func || (left: NonNilMatcherFunc, right: NonNilMatcherFunc) -> Predicate { return satisfyAnyOf(left, right) } +@available(*, deprecated, message: "Use Predicate instead") public func || (left: MatcherFunc, right: MatcherFunc) -> Predicate { return satisfyAnyOf(left, right) } #if canImport(Darwin) -extension NMBObjCMatcher { +import class Foundation.NSObject + +extension NMBPredicate { @objc public class func satisfyAnyOfMatcher(_ matchers: [NMBMatcher]) -> NMBPredicate { return NMBPredicate { actualExpression in if matchers.isEmpty { 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 53d9191..5bbe96b 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,8 +1,12 @@ -import Foundation +#if canImport(CwlPreconditionTesting) && (os(macOS) || os(iOS)) +import CwlPreconditionTesting +#elseif canImport(CwlPosixPreconditionTesting) +import CwlPosixPreconditionTesting +#endif -public func throwAssertion() -> Predicate { +public func throwAssertion() -> Predicate { return Predicate { actualExpression in - #if arch(x86_64) && canImport(Darwin) && !SWIFT_PACKAGE + #if arch(x86_64) && canImport(Darwin) let message = ExpectationMessage.expectedTo("throw an assertion") var actualError: Error? @@ -24,7 +28,7 @@ public func throwAssertion() -> Predicate { } #endif do { - try actualExpression.evaluate() + _ = try actualExpression.evaluate() } catch { actualError = error } @@ -38,10 +42,6 @@ public func throwAssertion() -> Predicate { } else { return PredicateResult(bool: caughtException != nil, message: message) } - #elseif SWIFT_PACKAGE - fatalError("The throwAssertion Nimble matcher does not currently support Swift CLI." + - " You can silence this error by placing the test case inside an #if !SWIFT_PACKAGE" + - " conditional statement") #else fatalError("The throwAssertion Nimble matcher can only run on x86_64 platforms with " + "Objective-C (e.g. macOS, iPhone 5s or later simulators). You can silence this error " + diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ThrowError.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ThrowError.swift index d294ba3..d5ac732 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 @@ -1,5 +1,3 @@ -import Foundation - /// A Nimble matcher that succeeds when the actual expression throws an /// error of the specified type or from the specified case. /// @@ -11,7 +9,7 @@ import Foundation /// /// nil arguments indicates that the matcher should not attempt to match against /// that parameter. -public func throwError() -> Predicate { +public func throwError() -> Predicate { return Predicate { actualExpression in var actualError: Error? do { @@ -21,9 +19,15 @@ public func throwError() -> Predicate { } if let actualError = actualError { - return PredicateResult(bool: true, message: .expectedCustomValueTo("throw any error", "<\(actualError)>")) + return PredicateResult( + bool: true, + message: .expectedCustomValueTo("throw any error", actual: "<\(actualError)>") + ) } else { - return PredicateResult(bool: false, message: .expectedCustomValueTo("throw any error", "no error")) + return PredicateResult( + bool: false, + message: .expectedCustomValueTo("throw any error", actual: "no error") + ) } } } @@ -39,7 +43,7 @@ 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 { +public func throwError(_ error: T, closure: ((Error) -> Void)? = nil) -> Predicate { return Predicate { actualExpression in var actualError: Error? do { @@ -48,9 +52,7 @@ public func throwError(_ error: T, closure: ((Error) -> Void)? = nil) actualError = error } - let failureMessage = FailureMessage() - setFailureMessageForError( - failureMessage, + let message = messageForError( actualError: actualError, error: error, errorType: nil, @@ -72,7 +74,7 @@ public func throwError(_ error: T, closure: ((Error) -> Void)? = nil) } } - return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + return PredicateResult(bool: matches, message: message) } } @@ -87,7 +89,7 @@ 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 { +public func throwError(_ error: T, closure: ((T) -> Void)? = nil) -> Predicate { return Predicate { actualExpression in var actualError: Error? do { @@ -96,9 +98,7 @@ public func throwError(_ error: T, closure: ((T) -> Void)? actualError = error } - let failureMessage = FailureMessage() - setFailureMessageForError( - failureMessage, + let message = messageForError( actualError: actualError, error: error, errorType: nil, @@ -120,7 +120,7 @@ public func throwError(_ error: T, closure: ((T) -> Void)? } } - return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + return PredicateResult(bool: matches, message: message) } } @@ -135,9 +135,10 @@ public func throwError(_ error: T, closure: ((T) -> Void)? /// /// nil arguments indicates that the matcher should not attempt to match against /// that parameter. -public func throwError( +public func throwError( errorType: T.Type, - closure: ((T) -> Void)? = nil) -> Predicate { + closure: ((T) -> Void)? = nil +) -> Predicate { return Predicate { actualExpression in var actualError: Error? do { @@ -146,9 +147,7 @@ public func throwError( actualError = error } - let failureMessage = FailureMessage() - setFailureMessageForError( - failureMessage, + let message = messageForError( actualError: actualError, error: nil, errorType: errorType, @@ -187,7 +186,7 @@ public func throwError( } } - return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + return PredicateResult(bool: matches, message: message) } } @@ -198,7 +197,7 @@ public func throwError( /// values of the existential type `Error` in the closure. /// /// The closure only gets called when an error was thrown. -public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate { +public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate { return Predicate { actualExpression in var actualError: Error? do { @@ -207,8 +206,7 @@ public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate { actualError = error } - let failureMessage = FailureMessage() - setFailureMessageForError(failureMessage, actualError: actualError, closure: closure) + let message = messageForError(actualError: actualError, closure: closure) var matches = false if let actualError = actualError { @@ -223,7 +221,7 @@ public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate { } } - return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + return PredicateResult(bool: matches, message: message) } } @@ -234,7 +232,7 @@ public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate { /// values of the existential type `Error` in the closure. /// /// The closure only gets called when an error was thrown. -public func throwError(closure: @escaping ((T) -> Void)) -> Predicate { +public func throwError(closure: @escaping ((T) -> Void)) -> Predicate { return Predicate { actualExpression in var actualError: Error? do { @@ -243,8 +241,7 @@ public func throwError(closure: @escaping ((T) -> Void)) -> Predicate< actualError = error } - let failureMessage = FailureMessage() - setFailureMessageForError(failureMessage, actualError: actualError, closure: closure) + let message = messageForError(actualError: actualError, closure: closure) var matches = false if let actualError = actualError as? T { @@ -259,6 +256,6 @@ public func throwError(closure: @escaping ((T) -> Void)) -> Predicate< } } - return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + return PredicateResult(bool: matches, message: message) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ToSucceed.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ToSucceed.swift index 01369bb..0b52ee9 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ToSucceed.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/ToSucceed.swift @@ -25,12 +25,12 @@ public func succeed() -> Predicate<() -> ToSucceedResult> { case .succeeded: return PredicateResult( bool: true, - message: .expectedCustomValueTo("succeed", "") + message: .expectedCustomValueTo("succeed", actual: "") ) case .failed(let reason): return PredicateResult( bool: false, - message: .expectedCustomValueTo("succeed", " because <\(reason)>") + message: .expectedCustomValueTo("succeed", actual: " because <\(reason)>") ) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Nimble.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Nimble.h index 2bbc693..d975a72 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Nimble.h +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Nimble.h @@ -3,10 +3,9 @@ #import "NMBStringify.h" #import "DSL.h" -#if TARGET_OS_TV - #import "CwlPreconditionTesting_POSIX.h" -#else - #import "CwlPreconditionTesting.h" +#if TARGET_OS_OSX || TARGET_OS_IOS + #import "CwlMachBadInstructionHandler.h" + #import "CwlCatchException.h" #endif FOUNDATION_EXPORT double NimbleVersionNumber; diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Await.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Await.swift index 276f618..ce1b823 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Await.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Await.swift @@ -2,10 +2,6 @@ import CoreFoundation import Dispatch import Foundation -#if canImport(CDispatch) - import CDispatch -#endif - private let timeoutLeeway = DispatchTimeInterval.milliseconds(1) private let pollLeeway = DispatchTimeInterval.milliseconds(1) @@ -32,11 +28,7 @@ internal class AssertionWaitLock: WaitLock { func acquireWaitingLock(_ fnName: String, file: FileString, line: UInt) { let info = WaitingInfo(name: fnName, file: file, lineNumber: line) - #if canImport(Darwin) - let isMainThread = Thread.isMainThread - #else - let isMainThread = _CFIsMainThread() - #endif + let isMainThread = Thread.isMainThread nimblePrecondition( isMainThread, "InvalidNimbleAPIUsage", @@ -102,7 +94,7 @@ internal enum AwaitResult { /// Holds the resulting value from an asynchronous expectation. /// This class is thread-safe at receiving an "response" to this promise. -internal class AwaitPromise { +internal final class AwaitPromise { private(set) internal var asyncResult: AwaitResult = .incomplete private var signal: DispatchSemaphore @@ -156,7 +148,7 @@ internal class AwaitPromiseBuilder { self.trigger = trigger } - func timeout(_ timeoutInterval: TimeInterval, forcefullyAbortTimeout: TimeInterval) -> Self { + func timeout(_ timeoutInterval: DispatchTimeInterval, forcefullyAbortTimeout: DispatchTimeInterval) -> Self { // = Discussion = // // There's a lot of technical decisions here that is useful to elaborate on. This is @@ -261,11 +253,7 @@ internal class AwaitPromiseBuilder { self.trigger.timeoutSource.resume() while self.promise.asyncResult.isIncomplete() { // Stopping the run loop does not work unless we run only 1 mode - #if (swift(>=4.2) && 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() @@ -305,11 +293,19 @@ internal class Awaiter { let timeoutSource = createTimerSource(timeoutQueue) var completionCount = 0 let trigger = AwaitTrigger(timeoutSource: timeoutSource, actionSource: nil) { - try closure { + try closure { result in completionCount += 1 if completionCount < 2 { - if promise.resolveResult(.completed($0)) { - CFRunLoopStop(CFRunLoopGetMain()) + func completeBlock() { + if promise.resolveResult(.completed(result)) { + CFRunLoopStop(CFRunLoopGetMain()) + } + } + + if Thread.isMainThread { + completeBlock() + } else { + DispatchQueue.main.async { completeBlock() } } } else { fail("waitUntil(..) expects its completion closure to be only called once", @@ -325,12 +321,12 @@ internal class Awaiter { trigger: trigger) } - func poll(_ pollInterval: TimeInterval, closure: @escaping () throws -> T?) -> AwaitPromiseBuilder { + func poll(_ pollInterval: DispatchTimeInterval, closure: @escaping () throws -> T?) -> AwaitPromiseBuilder { let promise = AwaitPromise() let timeoutSource = createTimerSource(timeoutQueue) let asyncSource = createTimerSource(asyncQueue) let trigger = AwaitTrigger(timeoutSource: timeoutSource, actionSource: asyncSource) { - let interval = DispatchTimeInterval.nanoseconds(Int(pollInterval * TimeInterval(NSEC_PER_SEC))) + let interval = pollInterval asyncSource.schedule(deadline: .now(), repeating: interval, leeway: pollLeeway) asyncSource.setEventHandler { do { @@ -357,8 +353,8 @@ internal class Awaiter { } internal func pollBlock( - pollInterval: TimeInterval, - timeoutInterval: TimeInterval, + pollInterval: DispatchTimeInterval, + timeoutInterval: DispatchTimeInterval, file: FileString, line: UInt, fnName: String = #function, @@ -369,7 +365,7 @@ internal func pollBlock( return true } return nil - }.timeout(timeoutInterval, forcefullyAbortTimeout: timeoutInterval / 2.0).wait(fnName, file: file, line: line) + }.timeout(timeoutInterval, forcefullyAbortTimeout: timeoutInterval.divided).wait(fnName, file: file, line: line) return result } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/DispatchTimeInterval.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/DispatchTimeInterval.swift new file mode 100644 index 0000000..a4b1d65 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/DispatchTimeInterval.swift @@ -0,0 +1,41 @@ +import Dispatch + +#if canImport(CDispatch) +import CDispatch +#endif + +extension DispatchTimeInterval { + // ** Note: We cannot simply divide the time interval because DispatchTimeInterval associated value type is Int + var divided: DispatchTimeInterval { + switch self { + case let .seconds(val): return val < 2 ? .milliseconds(Int(Float(val)/2*1000)) : .seconds(val/2) + case let .milliseconds(val): return .milliseconds(val/2) + case let .microseconds(val): return .microseconds(val/2) + case let .nanoseconds(val): return .nanoseconds(val/2) + case .never: return .never + @unknown default: fatalError("Unknown DispatchTimeInterval value") + } + } + + var description: String { + switch self { + case let .seconds(val): return val == 1 ? "\(Float(val)) second" : "\(Float(val)) seconds" + case let .milliseconds(val): return "\(Float(val)/1_000) seconds" + case let .microseconds(val): return "\(Float(val)/1_000_000) seconds" + case let .nanoseconds(val): return "\(Float(val)/1_000_000_000) seconds" + default: fatalError("Unknown DispatchTimeInterval value") + } + } +} + +#if canImport(Foundation) +import typealias Foundation.TimeInterval + +extension TimeInterval { + var dispatchInterval: DispatchTimeInterval { + let microseconds = Int64(self * TimeInterval(USEC_PER_SEC)) + // perhaps use nanoseconds, though would more often be > Int.max + return microseconds < Int.max ? .microseconds(Int(microseconds)) : .seconds(Int(self)) + } +} +#endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Errors.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Errors.swift index 074cb20..4c3e434 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Errors.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Errors.swift @@ -1,33 +1,34 @@ -import Foundation - // Generic -internal func setFailureMessageForError( - _ failureMessage: FailureMessage, +internal func messageForError( postfixMessageVerb: String = "throw", actualError: Error?, error: T? = nil, errorType: T.Type? = nil, - closure: ((T) -> Void)? = nil) { - failureMessage.postfixMessage = "\(postfixMessageVerb) error" + closure: ((T) -> Void)? = nil +) -> ExpectationMessage { + var rawMessage = "\(postfixMessageVerb) error" if let error = error { - failureMessage.postfixMessage += " <\(error)>" + rawMessage += " <\(error)>" } else if errorType != nil || closure != nil { - failureMessage.postfixMessage += " from type <\(T.self)>" + rawMessage += " from type <\(T.self)>" } if closure != nil { - failureMessage.postfixMessage += " that satisfies block" + rawMessage += " that satisfies block" } if error == nil && errorType == nil && closure == nil { - failureMessage.postfixMessage = "\(postfixMessageVerb) any error" + rawMessage = "\(postfixMessageVerb) any error" } + let actual: String if let actualError = actualError { - failureMessage.actualValue = "<\(actualError)>" + actual = "<\(actualError)>" } else { - failureMessage.actualValue = "no error" + actual = "no error" } + + return .expectedCustomValueTo(rawMessage, actual: actual) } internal func errorMatchesExpectedError( @@ -39,21 +40,24 @@ internal func errorMatchesExpectedError( // Non-generic -internal func setFailureMessageForError( - _ failureMessage: FailureMessage, +internal func messageForError( actualError: Error?, - closure: ((Error) -> Void)?) { - failureMessage.postfixMessage = "throw error" + closure: ((Error) -> Void)? +) -> ExpectationMessage { + var rawMessage = "throw error" if closure != nil { - failureMessage.postfixMessage += " that satisfies block" + rawMessage += " that satisfies block" } else { - failureMessage.postfixMessage = "throw any error" + rawMessage = "throw any error" } + let actual: String if let actualError = actualError { - failureMessage.actualValue = "<\(actualError)>" + actual = "<\(actualError)>" } else { - failureMessage.actualValue = "no error" + actual = "no error" } + + return .expectedCustomValueTo(rawMessage, actual: actual) } 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 deleted file mode 100644 index c87af76..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Functional.swift +++ /dev/null @@ -1,14 +0,0 @@ -import Foundation - -#if !swift(>=4.2) -extension Sequence { - internal func allSatisfy(_ predicate: (Element) throws -> Bool) rethrows -> Bool { - for item in self { - 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 4ab18d2..88e84bb 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 @@ -1,12 +1,7 @@ import Foundation internal func identityAsString(_ value: Any?) -> String { - let anyObject: AnyObject? -#if os(Linux) && !swift(>=4.1.50) - anyObject = value as? AnyObject -#else - anyObject = value as AnyObject? -#endif + let anyObject = value as AnyObject? if let value = anyObject { return NSString(format: "<%p>", unsafeBitCast(value, to: Int.self)).description } else { @@ -45,32 +40,24 @@ extension Float: TestOutputStringConvertible { } extension NSNumber: TestOutputStringConvertible { - // This is using `NSString(format:)` instead of - // `String(format:)` because the latter somehow breaks - // the travis CI build on linux. public var testDescription: String { let description = self.description if description.contains(".") { - // Travis linux swiftpm build doesn't like casting String to NSString, - // which is why this annoying nested initializer thing is here. - // Maybe this will change in a future snapshot. - let decimalPlaces = NSString(string: NSString(string: description) - .components(separatedBy: ".")[1]) - - // SeeAlso: https://bugs.swift.org/browse/SR-1464 - switch decimalPlaces.length { + let decimalPlaces = description.split(separator: ".")[1] + switch decimalPlaces.count { case 1: - return NSString(format: "%0.1f", self.doubleValue).description + return String(format: "%0.1f", doubleValue) case 2: - return NSString(format: "%0.2f", self.doubleValue).description + return String(format: "%0.2f", doubleValue) case 3: - return NSString(format: "%0.3f", self.doubleValue).description + return String(format: "%0.3f", doubleValue) default: - return NSString(format: "%0.4f", self.doubleValue).description + return String(format: "%0.4f", doubleValue) } } - return self.description + + return description } } @@ -85,7 +72,7 @@ extension AnySequence: TestOutputStringConvertible { public var testDescription: String { let generator = self.makeIterator() var strings = [String]() - var value: AnySequence.Iterator.Element? + var value: AnySequence.Element? repeat { value = generator.next() @@ -121,13 +108,7 @@ extension String: TestOutputStringConvertible { extension Data: TestOutputStringConvertible { public var testDescription: String { - #if os(Linux) - // swiftlint:disable:next todo - // FIXME: Swift on Linux triggers a segfault when calling NSData's hash() (last checked on 03-11-16) - return "Data" - #else - return "Data" - #endif + return "Data" } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/NimbleObjectiveC/DSL.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/NimbleObjectiveC/DSL.h index 9170541..9ae06a4 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/NimbleObjectiveC/DSL.h +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/NimbleObjectiveC/DSL.h @@ -1,9 +1,9 @@ #import @class NMBExpectation; -@class NMBObjCBeCloseToMatcher; -@class NMBObjCRaiseExceptionMatcher; -@protocol NMBMatcher; +@class NMBPredicate; +@class NMBObjCBeCloseToPredicate; +@class NMBObjCRaiseExceptionPredicate; NS_ASSUME_NONNULL_BEGIN @@ -66,16 +66,16 @@ NIMBLE_EXPORT NMBExpectation *NMB_expectAction(void(^actualBlock)(void), NSStrin #define DEFINE_OVERLOAD(TYPE, EXPR) \ NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - id NMB_equal(TYPE expectedValue) { \ + NMBPredicate *NMB_equal(TYPE expectedValue) { \ return NMB_equal((EXPR)); \ } \ - NIMBLE_SHORT_OVERLOADED(id equal(TYPE expectedValue), NMB_equal(expectedValue)); + NIMBLE_SHORT_OVERLOADED(NMBPredicate *equal(TYPE expectedValue), NMB_equal(expectedValue)); NIMBLE_EXPORT NIMBLE_OVERLOADABLE - id NMB_equal(__nullable id expectedValue); + NMBPredicate *NMB_equal(__nullable id expectedValue); - NIMBLE_SHORT_OVERLOADED(id equal(__nullable id expectedValue), + NIMBLE_SHORT_OVERLOADED(NMBPredicate *equal(__nullable id expectedValue), NMB_equal(expectedValue)); // overloaded dispatch for nils - expect(nil) @@ -101,17 +101,17 @@ NIMBLE_EXPORT NMBExpectation *NMB_expectAction(void(^actualBlock)(void), NSStrin #define DEFINE_OVERLOAD(TYPE, EXPR) \ NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - id NMB_haveCount(TYPE expectedValue) { \ + NMBPredicate *NMB_haveCount(TYPE expectedValue) { \ return NMB_haveCount((EXPR)); \ } \ - NIMBLE_SHORT_OVERLOADED(id haveCount(TYPE expectedValue), \ + NIMBLE_SHORT_OVERLOADED(NMBPredicate *haveCount(TYPE expectedValue), \ NMB_haveCount(expectedValue)); NIMBLE_EXPORT NIMBLE_OVERLOADABLE - id NMB_haveCount(id expectedValue); + NMBPredicate *NMB_haveCount(id expectedValue); - NIMBLE_SHORT_OVERLOADED(id haveCount(id expectedValue), + NIMBLE_SHORT_OVERLOADED(NMBPredicate *haveCount(id expectedValue), NMB_haveCount(expectedValue)); DEFINE_OVERLOAD(long, @(expectedValue)) @@ -127,14 +127,14 @@ NIMBLE_EXPORT NMBExpectation *NMB_expectAction(void(^actualBlock)(void), NSStrin #define DEFINE_OVERLOAD(TYPE, EXPR) \ NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - NMBObjCBeCloseToMatcher *NMB_beCloseTo(TYPE expectedValue) { \ + NMBObjCBeCloseToPredicate *NMB_beCloseTo(TYPE expectedValue) { \ return NMB_beCloseTo((NSNumber *)(EXPR)); \ } \ - NIMBLE_SHORT_OVERLOADED(NMBObjCBeCloseToMatcher *beCloseTo(TYPE expectedValue), \ + NIMBLE_SHORT_OVERLOADED(NMBObjCBeCloseToPredicate *beCloseTo(TYPE expectedValue), \ NMB_beCloseTo(expectedValue)); - NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBObjCBeCloseToMatcher *NMB_beCloseTo(NSNumber *expectedValue); - NIMBLE_SHORT_OVERLOADED(NMBObjCBeCloseToMatcher *beCloseTo(NSNumber *expectedValue), + NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBObjCBeCloseToPredicate *NMB_beCloseTo(NSNumber *expectedValue); + NIMBLE_SHORT_OVERLOADED(NMBObjCBeCloseToPredicate *beCloseTo(NSNumber *expectedValue), NMB_beCloseTo(expectedValue)); // it would be better to only overload float & double, but zero becomes ambigious @@ -152,33 +152,33 @@ NIMBLE_EXPORT NMBExpectation *NMB_expectAction(void(^actualBlock)(void), NSStrin #undef DEFINE_OVERLOAD -NIMBLE_EXPORT id NMB_beAnInstanceOf(Class expectedClass); -NIMBLE_EXPORT_INLINE id beAnInstanceOf(Class expectedClass) { +NIMBLE_EXPORT NMBPredicate *NMB_beAnInstanceOf(Class expectedClass); +NIMBLE_EXPORT_INLINE NMBPredicate *beAnInstanceOf(Class expectedClass) { return NMB_beAnInstanceOf(expectedClass); } -NIMBLE_EXPORT id NMB_beAKindOf(Class expectedClass); -NIMBLE_EXPORT_INLINE id beAKindOf(Class expectedClass) { +NIMBLE_EXPORT NMBPredicate *NMB_beAKindOf(Class expectedClass); +NIMBLE_EXPORT_INLINE NMBPredicate *beAKindOf(Class expectedClass) { return NMB_beAKindOf(expectedClass); } -NIMBLE_EXPORT id NMB_beginWith(id itemElementOrSubstring); -NIMBLE_EXPORT_INLINE id beginWith(id itemElementOrSubstring) { +NIMBLE_EXPORT NMBPredicate *NMB_beginWith(id itemElementOrSubstring); +NIMBLE_EXPORT_INLINE NMBPredicate *beginWith(id itemElementOrSubstring) { return NMB_beginWith(itemElementOrSubstring); } #define DEFINE_OVERLOAD(TYPE, EXPR) \ NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - id NMB_beGreaterThan(TYPE expectedValue) { \ + NMBPredicate *NMB_beGreaterThan(TYPE expectedValue) { \ return NMB_beGreaterThan((EXPR)); \ } \ - NIMBLE_SHORT_OVERLOADED(id beGreaterThan(TYPE expectedValue), NMB_beGreaterThan(expectedValue)); + NIMBLE_SHORT_OVERLOADED(NMBPredicate *beGreaterThan(TYPE expectedValue), NMB_beGreaterThan(expectedValue)); NIMBLE_EXPORT NIMBLE_OVERLOADABLE - id NMB_beGreaterThan(NSNumber *expectedValue); + NMBPredicate *NMB_beGreaterThan(NSNumber *expectedValue); NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE - id beGreaterThan(NSNumber *expectedValue) { + NMBPredicate *beGreaterThan(NSNumber *expectedValue) { return NMB_beGreaterThan(expectedValue); } @@ -197,17 +197,17 @@ NIMBLE_EXPORT_INLINE id beginWith(id itemElementOrSubstring) { #define DEFINE_OVERLOAD(TYPE, EXPR) \ NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - id NMB_beGreaterThanOrEqualTo(TYPE expectedValue) { \ + NMBPredicate *NMB_beGreaterThanOrEqualTo(TYPE expectedValue) { \ return NMB_beGreaterThanOrEqualTo((EXPR)); \ } \ - NIMBLE_SHORT_OVERLOADED(id beGreaterThanOrEqualTo(TYPE expectedValue), \ + NIMBLE_SHORT_OVERLOADED(NMBPredicate *beGreaterThanOrEqualTo(TYPE expectedValue), \ NMB_beGreaterThanOrEqualTo(expectedValue)); NIMBLE_EXPORT NIMBLE_OVERLOADABLE - id NMB_beGreaterThanOrEqualTo(NSNumber *expectedValue); + NMBPredicate *NMB_beGreaterThanOrEqualTo(NSNumber *expectedValue); NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE - id beGreaterThanOrEqualTo(NSNumber *expectedValue) { + NMBPredicate *beGreaterThanOrEqualTo(NSNumber *expectedValue) { return NMB_beGreaterThanOrEqualTo(expectedValue); } @@ -225,28 +225,28 @@ NIMBLE_EXPORT_INLINE id beginWith(id itemElementOrSubstring) { #undef DEFINE_OVERLOAD -NIMBLE_EXPORT id NMB_beIdenticalTo(id expectedInstance); -NIMBLE_SHORT(id beIdenticalTo(id expectedInstance), +NIMBLE_EXPORT NMBPredicate *NMB_beIdenticalTo(id expectedInstance); +NIMBLE_SHORT(NMBPredicate *beIdenticalTo(id expectedInstance), NMB_beIdenticalTo(expectedInstance)); -NIMBLE_EXPORT id NMB_be(id expectedInstance); -NIMBLE_SHORT(id be(id expectedInstance), +NIMBLE_EXPORT NMBPredicate *NMB_be(id expectedInstance); +NIMBLE_SHORT(NMBPredicate *be(id expectedInstance), NMB_be(expectedInstance)); #define DEFINE_OVERLOAD(TYPE, EXPR) \ NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - id NMB_beLessThan(TYPE expectedValue) { \ + NMBPredicate *NMB_beLessThan(TYPE expectedValue) { \ return NMB_beLessThan((EXPR)); \ } \ - NIMBLE_SHORT_OVERLOADED(id beLessThan(TYPE expectedValue), \ + NIMBLE_SHORT_OVERLOADED(NMBPredicate *beLessThan(TYPE expectedValue), \ NMB_beLessThan(expectedValue)); NIMBLE_EXPORT NIMBLE_OVERLOADABLE - id NMB_beLessThan(NSNumber *expectedValue); + NMBPredicate *NMB_beLessThan(NSNumber *expectedValue); NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE - id beLessThan(NSNumber *expectedValue) { + NMBPredicate *beLessThan(NSNumber *expectedValue) { return NMB_beLessThan(expectedValue); } @@ -266,18 +266,18 @@ NIMBLE_SHORT(id be(id expectedInstance), #define DEFINE_OVERLOAD(TYPE, EXPR) \ NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - id NMB_beLessThanOrEqualTo(TYPE expectedValue) { \ + NMBPredicate *NMB_beLessThanOrEqualTo(TYPE expectedValue) { \ return NMB_beLessThanOrEqualTo((EXPR)); \ } \ - NIMBLE_SHORT_OVERLOADED(id beLessThanOrEqualTo(TYPE expectedValue), \ + NIMBLE_SHORT_OVERLOADED(NMBPredicate *beLessThanOrEqualTo(TYPE expectedValue), \ NMB_beLessThanOrEqualTo(expectedValue)); NIMBLE_EXPORT NIMBLE_OVERLOADABLE - id NMB_beLessThanOrEqualTo(NSNumber *expectedValue); + NMBPredicate *NMB_beLessThanOrEqualTo(NSNumber *expectedValue); NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE - id beLessThanOrEqualTo(NSNumber *expectedValue) { + NMBPredicate *beLessThanOrEqualTo(NSNumber *expectedValue) { return NMB_beLessThanOrEqualTo(expectedValue); } @@ -294,63 +294,63 @@ NIMBLE_SHORT(id be(id expectedInstance), #undef DEFINE_OVERLOAD -NIMBLE_EXPORT id NMB_beTruthy(void); -NIMBLE_SHORT(id beTruthy(void), +NIMBLE_EXPORT NMBPredicate *NMB_beTruthy(void); +NIMBLE_SHORT(NMBPredicate *beTruthy(void), NMB_beTruthy()); -NIMBLE_EXPORT id NMB_beFalsy(void); -NIMBLE_SHORT(id beFalsy(void), +NIMBLE_EXPORT NMBPredicate *NMB_beFalsy(void); +NIMBLE_SHORT(NMBPredicate *beFalsy(void), NMB_beFalsy()); -NIMBLE_EXPORT id NMB_beTrue(void); -NIMBLE_SHORT(id beTrue(void), +NIMBLE_EXPORT NMBPredicate *NMB_beTrue(void); +NIMBLE_SHORT(NMBPredicate *beTrue(void), NMB_beTrue()); -NIMBLE_EXPORT id NMB_beFalse(void); -NIMBLE_SHORT(id beFalse(void), +NIMBLE_EXPORT NMBPredicate *NMB_beFalse(void); +NIMBLE_SHORT(NMBPredicate *beFalse(void), NMB_beFalse()); -NIMBLE_EXPORT id NMB_beNil(void); -NIMBLE_SHORT(id beNil(void), +NIMBLE_EXPORT NMBPredicate *NMB_beNil(void); +NIMBLE_SHORT(NMBPredicate *beNil(void), NMB_beNil()); -NIMBLE_EXPORT id NMB_beEmpty(void); -NIMBLE_SHORT(id beEmpty(void), +NIMBLE_EXPORT NMBPredicate *NMB_beEmpty(void); +NIMBLE_SHORT(NMBPredicate *beEmpty(void), NMB_beEmpty()); -NIMBLE_EXPORT id NMB_containWithNilTermination(id itemOrSubstring, ...) NS_REQUIRES_NIL_TERMINATION; +NIMBLE_EXPORT NMBPredicate *NMB_containWithNilTermination(id itemOrSubstring, ...) NS_REQUIRES_NIL_TERMINATION; #define NMB_contain(...) NMB_containWithNilTermination(__VA_ARGS__, nil) #ifndef NIMBLE_DISABLE_SHORT_SYNTAX #define contain(...) NMB_contain(__VA_ARGS__) #endif -NIMBLE_EXPORT id NMB_containElementSatisfying(BOOL(^predicate)(id)); -NIMBLE_SHORT(id containElementSatisfying(BOOL(^predicate)(id)), +NIMBLE_EXPORT NMBPredicate *NMB_containElementSatisfying(BOOL(^predicate)(id)); +NIMBLE_SHORT(NMBPredicate *containElementSatisfying(BOOL(^predicate)(id)), NMB_containElementSatisfying(predicate)); -NIMBLE_EXPORT id NMB_endWith(id itemElementOrSubstring); -NIMBLE_SHORT(id endWith(id itemElementOrSubstring), +NIMBLE_EXPORT NMBPredicate *NMB_endWith(id itemElementOrSubstring); +NIMBLE_SHORT(NMBPredicate *endWith(id itemElementOrSubstring), NMB_endWith(itemElementOrSubstring)); -NIMBLE_EXPORT NMBObjCRaiseExceptionMatcher *NMB_raiseException(void); -NIMBLE_SHORT(NMBObjCRaiseExceptionMatcher *raiseException(void), +NIMBLE_EXPORT NMBObjCRaiseExceptionPredicate *NMB_raiseException(void); +NIMBLE_SHORT(NMBObjCRaiseExceptionPredicate *raiseException(void), NMB_raiseException()); -NIMBLE_EXPORT id NMB_match(id expectedValue); -NIMBLE_SHORT(id match(id expectedValue), +NIMBLE_EXPORT NMBPredicate *NMB_match(id expectedValue); +NIMBLE_SHORT(NMBPredicate *match(id expectedValue), NMB_match(expectedValue)); -NIMBLE_EXPORT id NMB_allPass(id matcher); -NIMBLE_SHORT(id allPass(id matcher), +NIMBLE_EXPORT NMBPredicate *NMB_allPass(id matcher); +NIMBLE_SHORT(NMBPredicate *allPass(id matcher), NMB_allPass(matcher)); -NIMBLE_EXPORT id NMB_satisfyAnyOfWithMatchers(id matchers); +NIMBLE_EXPORT NMBPredicate *NMB_satisfyAnyOfWithMatchers(id matchers); #define NMB_satisfyAnyOf(...) NMB_satisfyAnyOfWithMatchers(@[__VA_ARGS__]) #ifndef NIMBLE_DISABLE_SHORT_SYNTAX #define satisfyAnyOf(...) NMB_satisfyAnyOf(__VA_ARGS__) #endif -NIMBLE_EXPORT id NMB_satisfyAllOfWithMatchers(id matchers); +NIMBLE_EXPORT NMBPredicate *NMB_satisfyAllOfWithMatchers(id matchers); #define NMB_satisfyAllOf(...) NMB_satisfyAllOfWithMatchers(@[__VA_ARGS__]) #ifndef NIMBLE_DISABLE_SHORT_SYNTAX #define satisfyAllOf(...) NMB_satisfyAllOf(__VA_ARGS__) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/NimbleObjectiveC/DSL.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/NimbleObjectiveC/DSL.m index 670415b..6f7572f 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/NimbleObjectiveC/DSL.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/NimbleObjectiveC/DSL.m @@ -28,71 +28,71 @@ NIMBLE_EXPORT void NMB_failWithMessage(NSString *msg, NSString *file, NSUInteger return [NMBExpectation failWithMessage:msg file:file line:line]; } -NIMBLE_EXPORT id NMB_beAnInstanceOf(Class expectedClass) { - return [NMBObjCMatcher beAnInstanceOfMatcher:expectedClass]; +NIMBLE_EXPORT NMBPredicate *NMB_beAnInstanceOf(Class expectedClass) { + return [NMBPredicate beAnInstanceOfMatcher:expectedClass]; } -NIMBLE_EXPORT id NMB_beAKindOf(Class expectedClass) { - return [NMBObjCMatcher beAKindOfMatcher:expectedClass]; +NIMBLE_EXPORT NMBPredicate *NMB_beAKindOf(Class expectedClass) { + return [NMBPredicate beAKindOfMatcher:expectedClass]; } -NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBObjCBeCloseToMatcher *NMB_beCloseTo(NSNumber *expectedValue) { - return [NMBObjCMatcher beCloseToMatcher:expectedValue within:0.001]; +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBObjCBeCloseToPredicate *NMB_beCloseTo(NSNumber *expectedValue) { + return [NMBPredicate beCloseToMatcher:expectedValue within:0.001]; } -NIMBLE_EXPORT id NMB_beginWith(id itemElementOrSubstring) { - return [NMBObjCMatcher beginWithMatcher:itemElementOrSubstring]; +NIMBLE_EXPORT NMBPredicate *NMB_beginWith(id itemElementOrSubstring) { + return [NMBPredicate beginWithMatcher:itemElementOrSubstring]; } -NIMBLE_EXPORT NIMBLE_OVERLOADABLE id NMB_beGreaterThan(NSNumber *expectedValue) { - return [NMBObjCMatcher beGreaterThanMatcher:expectedValue]; +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBPredicate *NMB_beGreaterThan(NSNumber *expectedValue) { + return [NMBPredicate beGreaterThanMatcher:expectedValue]; } -NIMBLE_EXPORT NIMBLE_OVERLOADABLE id NMB_beGreaterThanOrEqualTo(NSNumber *expectedValue) { - return [NMBObjCMatcher beGreaterThanOrEqualToMatcher:expectedValue]; +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBPredicate *NMB_beGreaterThanOrEqualTo(NSNumber *expectedValue) { + return [NMBPredicate beGreaterThanOrEqualToMatcher:expectedValue]; } -NIMBLE_EXPORT id NMB_beIdenticalTo(id expectedInstance) { - return [NMBObjCMatcher beIdenticalToMatcher:expectedInstance]; +NIMBLE_EXPORT NMBPredicate *NMB_beIdenticalTo(id expectedInstance) { + return [NMBPredicate beIdenticalToMatcher:expectedInstance]; } -NIMBLE_EXPORT id NMB_be(id expectedInstance) { - return [NMBObjCMatcher beIdenticalToMatcher:expectedInstance]; +NIMBLE_EXPORT NMBPredicate *NMB_be(id expectedInstance) { + return [NMBPredicate beIdenticalToMatcher:expectedInstance]; } -NIMBLE_EXPORT NIMBLE_OVERLOADABLE id NMB_beLessThan(NSNumber *expectedValue) { - return [NMBObjCMatcher beLessThanMatcher:expectedValue]; +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBPredicate *NMB_beLessThan(NSNumber *expectedValue) { + return [NMBPredicate beLessThanMatcher:expectedValue]; } -NIMBLE_EXPORT NIMBLE_OVERLOADABLE id NMB_beLessThanOrEqualTo(NSNumber *expectedValue) { - return [NMBObjCMatcher beLessThanOrEqualToMatcher:expectedValue]; +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBPredicate *NMB_beLessThanOrEqualTo(NSNumber *expectedValue) { + return [NMBPredicate beLessThanOrEqualToMatcher:expectedValue]; } -NIMBLE_EXPORT id NMB_beTruthy() { - return [NMBObjCMatcher beTruthyMatcher]; +NIMBLE_EXPORT NMBPredicate *NMB_beTruthy() { + return [NMBPredicate beTruthyMatcher]; } -NIMBLE_EXPORT id NMB_beFalsy() { - return [NMBObjCMatcher beFalsyMatcher]; +NIMBLE_EXPORT NMBPredicate *NMB_beFalsy() { + return [NMBPredicate beFalsyMatcher]; } -NIMBLE_EXPORT id NMB_beTrue() { - return [NMBObjCMatcher beTrueMatcher]; +NIMBLE_EXPORT NMBPredicate *NMB_beTrue() { + return [NMBPredicate beTrueMatcher]; } -NIMBLE_EXPORT id NMB_beFalse() { - return [NMBObjCMatcher beFalseMatcher]; +NIMBLE_EXPORT NMBPredicate *NMB_beFalse() { + return [NMBPredicate beFalseMatcher]; } -NIMBLE_EXPORT id NMB_beNil() { - return [NMBObjCMatcher beNilMatcher]; +NIMBLE_EXPORT NMBPredicate *NMB_beNil() { + return [NMBPredicate beNilMatcher]; } -NIMBLE_EXPORT id NMB_beEmpty() { - return [NMBObjCMatcher beEmptyMatcher]; +NIMBLE_EXPORT NMBPredicate *NMB_beEmpty() { + return [NMBPredicate beEmptyMatcher]; } -NIMBLE_EXPORT id NMB_containWithNilTermination(id itemOrSubstring, ...) { +NIMBLE_EXPORT NMBPredicate *NMB_containWithNilTermination(id itemOrSubstring, ...) { NSMutableArray *itemOrSubstringArray = [NSMutableArray array]; if (itemOrSubstring) { @@ -107,43 +107,43 @@ NIMBLE_EXPORT id NMB_containWithNilTermination(id itemOrSubstring, . va_end(args); } - return [NMBObjCMatcher containMatcher:itemOrSubstringArray]; + return [NMBPredicate containMatcher:itemOrSubstringArray]; } -NIMBLE_EXPORT id NMB_containElementSatisfying(BOOL(^predicate)(id)) { - return [NMBObjCMatcher containElementSatisfyingMatcher:predicate]; +NIMBLE_EXPORT NMBPredicate *NMB_containElementSatisfying(BOOL(^predicate)(id)) { + return [NMBPredicate containElementSatisfyingMatcher:predicate]; } -NIMBLE_EXPORT id NMB_endWith(id itemElementOrSubstring) { - return [NMBObjCMatcher endWithMatcher:itemElementOrSubstring]; +NIMBLE_EXPORT NMBPredicate *NMB_endWith(id itemElementOrSubstring) { + return [NMBPredicate endWithMatcher:itemElementOrSubstring]; } -NIMBLE_EXPORT NIMBLE_OVERLOADABLE id NMB_equal(__nullable id expectedValue) { - return [NMBObjCMatcher equalMatcher:expectedValue]; +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBPredicate *NMB_equal(__nullable id expectedValue) { + return [NMBPredicate equalMatcher:expectedValue]; } -NIMBLE_EXPORT NIMBLE_OVERLOADABLE id NMB_haveCount(id expectedValue) { - return [NMBObjCMatcher haveCountMatcher:expectedValue]; +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBPredicate *NMB_haveCount(id expectedValue) { + return [NMBPredicate haveCountMatcher:expectedValue]; } -NIMBLE_EXPORT id NMB_match(id expectedValue) { - return [NMBObjCMatcher matchMatcher:expectedValue]; +NIMBLE_EXPORT NMBPredicate *NMB_match(id expectedValue) { + return [NMBPredicate matchMatcher:expectedValue]; } -NIMBLE_EXPORT id NMB_allPass(id expectedValue) { - return [NMBObjCMatcher allPassMatcher:expectedValue]; +NIMBLE_EXPORT NMBPredicate *NMB_allPass(id expectedValue) { + return [NMBPredicate allPassMatcher:expectedValue]; } -NIMBLE_EXPORT id NMB_satisfyAnyOfWithMatchers(id matchers) { - return [NMBObjCMatcher satisfyAnyOfMatcher:matchers]; +NIMBLE_EXPORT NMBPredicate *NMB_satisfyAnyOfWithMatchers(id matchers) { + return [NMBPredicate satisfyAnyOfMatcher:matchers]; } -NIMBLE_EXPORT id NMB_satisfyAllOfWithMatchers(id matchers) { - return [NMBObjCMatcher satisfyAllOfMatcher:matchers]; +NIMBLE_EXPORT NMBPredicate *NMB_satisfyAllOfWithMatchers(id matchers) { + return [NMBPredicate satisfyAllOfMatcher:matchers]; } -NIMBLE_EXPORT NMBObjCRaiseExceptionMatcher *NMB_raiseException() { - return [NMBObjCMatcher raiseExceptionMatcher]; +NIMBLE_EXPORT NMBObjCRaiseExceptionPredicate *NMB_raiseException() { + return [NMBPredicate raiseExceptionMatcher]; } NIMBLE_EXPORT NMBWaitUntilTimeoutBlock NMB_waitUntilTimeoutBuilder(NSString *file, NSUInteger line) { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/NimbleObjectiveC/XCTestObservationCenter+Register.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/NimbleObjectiveC/XCTestObservationCenter+Register.m index fa5030a..3c1110b 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/NimbleObjectiveC/XCTestObservationCenter+Register.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Sources/NimbleObjectiveC/XCTestObservationCenter+Register.m @@ -1,5 +1,4 @@ #import -#import #if __has_include("Nimble-Swift.h") #import "Nimble-Swift.h" @@ -7,77 +6,12 @@ #import #endif -#pragma mark - Method Swizzling - -/// Swaps the implementations between two instance methods. -/// -/// @param class The class containing `originalSelector`. -/// @param originalSelector Original method to replace. -/// @param replacementSelector Replacement method. -void swizzleSelectors(Class class, SEL originalSelector, SEL replacementSelector) { - Method originalMethod = class_getInstanceMethod(class, originalSelector); - Method replacementMethod = class_getInstanceMethod(class, replacementSelector); - - BOOL didAddMethod = - class_addMethod(class, - originalSelector, - method_getImplementation(replacementMethod), - method_getTypeEncoding(replacementMethod)); - - if (didAddMethod) { - class_replaceMethod(class, - replacementSelector, - method_getImplementation(originalMethod), - method_getTypeEncoding(originalMethod)); - } else { - method_exchangeImplementations(originalMethod, replacementMethod); - } -} - #pragma mark - Private -@interface XCTestObservationCenter (Private) -- (void)_addLegacyTestObserver:(id)observer; -@end - @implementation XCTestObservationCenter (Register) -/// Uses objc method swizzling to register `CurrentTestCaseTracker` as a test observer. This is necessary -/// because Xcode 7.3 introduced timing issues where if a custom `XCTestObservation` is registered too early -/// it suppresses all console output (generated by `XCTestLog`), breaking any tools that depend on this output. -/// This approach waits to register our custom test observer until XCTest adds its first "legacy" observer, -/// falling back to registering after the first normal observer if this private method ever changes. + (void)load { - if (class_getInstanceMethod([self class], @selector(_addLegacyTestObserver:))) { - // Swizzle -_addLegacyTestObserver: - swizzleSelectors([self class], @selector(_addLegacyTestObserver:), @selector(NMB_original__addLegacyTestObserver:)); - } else { - // Swizzle -addTestObserver:, only if -_addLegacyTestObserver: is not implemented - swizzleSelectors([self class], @selector(addTestObserver:), @selector(NMB_original_addTestObserver:)); - } -} - -#pragma mark - Replacement Methods - -/// Registers `CurrentTestCaseTracker` as a test observer after `XCTestLog` has been added. -- (void)NMB_original__addLegacyTestObserver:(id)observer { - [self NMB_original__addLegacyTestObserver:observer]; - - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - [self addTestObserver:[CurrentTestCaseTracker sharedInstance]]; - }); -} - -/// Registers `CurrentTestCaseTracker` as a test observer after `XCTestLog` has been added. -/// This method is only used if `-_addLegacyTestObserver:` is not impelemented. (added in Xcode 7.3) -- (void)NMB_original_addTestObserver:(id)observer { - [self NMB_original_addTestObserver:observer]; - - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - [self NMB_original_addTestObserver:[CurrentTestCaseTracker sharedInstance]]; - }); + [[XCTestObservationCenter sharedTestObservationCenter] addTestObserver:[CurrentTestCaseTracker sharedInstance]]; } @end 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 bfa34c2..e517638 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/AsynchronousTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/AsynchronousTest.swift @@ -1,9 +1,10 @@ import Dispatch +import CoreFoundation import Foundation import XCTest import Nimble -final class AsyncTest: XCTestCase, XCTestCaseProvider { +final class AsyncTest: XCTestCase { class Error: Swift.Error {} let errorToThrow = Error() @@ -37,9 +38,9 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { } func testToEventuallyWithCustomDefaultTimeout() { - AsyncDefaults.Timeout = 2 + AsyncDefaults.timeout = .seconds(2) defer { - AsyncDefaults.Timeout = 1 + AsyncDefaults.timeout = .seconds(1) } var value = 0 @@ -61,12 +62,12 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { } func testWaitUntilWithCustomDefaultsTimeout() { - AsyncDefaults.Timeout = 5 + AsyncDefaults.timeout = .seconds(3) defer { - AsyncDefaults.Timeout = 1 + AsyncDefaults.timeout = .seconds(1) } waitUntil { done in - Thread.sleep(forTimeInterval: 4.8) + Thread.sleep(forTimeInterval: 2.8) done() } } @@ -84,14 +85,14 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { func testWaitUntilTimesOutIfNotCalled() { failsWithErrorMessage("Waited more than 1.0 second") { - waitUntil(timeout: 1) { _ in return } + waitUntil(timeout: .seconds(1)) { _ in return } } } func testWaitUntilTimesOutWhenExceedingItsTime() { var waiting = true failsWithErrorMessage("Waited more than 0.01 seconds") { - waitUntil(timeout: 0.01) { done in + waitUntil(timeout: .milliseconds(10)) { done in let asyncOperation: () -> Void = { Thread.sleep(forTimeInterval: 0.1) done() @@ -120,8 +121,8 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { func testWaitUntilDetectsStalledMainThreadActivity() { let msg = "-waitUntil() timed out but was unable to run the timeout handler because the main thread is unresponsive (0.5 seconds is allow after the wait times out). Conditions that may cause this include processing blocking IO on the main thread, calls to sleep(), deadlocks, and synchronous IPC. Nimble forcefully stopped run loop which may cause future failures in test run." failsWithErrorMessage(msg) { - waitUntil(timeout: 1) { done in - Thread.sleep(forTimeInterval: 5.0) + waitUntil(timeout: .seconds(1)) { done in + Thread.sleep(forTimeInterval: 3.0) done() } } @@ -141,7 +142,7 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { is currently managing the main run loop. """ failsWithErrorMessage(msg) { // reference line - waitUntil(timeout: 2.0) { done in + waitUntil(timeout: .seconds(2)) { done in var protected: Int = 0 DispatchQueue.main.async { protected = 1 @@ -165,6 +166,39 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { } } + func testWaitUntilDoesNotCompleteBeforeRunLoopIsWaiting() { + // This verifies the fix for a race condition in which `done()` is + // called asynchronously on a background thread after the main thread checks + // for completion, but prior to `RunLoop.current.run(mode:before:)` being called. + // This race condition resulted in the RunLoop locking up. + var failed = false + + let timeoutQueue = DispatchQueue(label: "Nimble.waitUntilTest.timeout", qos: .background) + let timer = DispatchSource.makeTimerSource(flags: .strict, queue: timeoutQueue) + timer.schedule( + deadline: DispatchTime.now() + 5, + repeating: .never, + leeway: .milliseconds(1) + ) + timer.setEventHandler { + failed = true + fail("Timed out: Main RunLoop stalled.") + CFRunLoopStop(CFRunLoopGetMain()) + } + timer.resume() + + for index in 0..<100 { + if failed { break } + waitUntil(line: UInt(index)) { done in + DispatchQueue(label: "Nimble.waitUntilTest.\(index)").async { + done() + } + } + } + + timer.cancel() + } + func testWaitUntilMustBeInMainThread() { #if !SWIFT_PACKAGE var executedAsyncBlock: Bool = false @@ -203,11 +237,11 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { var subject: ClassUnderTest? = ClassUnderTest() if let sub = subject { - expect(sub.count).toEventually(equal(0), timeout: 0.1) - expect(sub.count).toEventuallyNot(equal(1), timeout: 0.1) + expect(sub.count).toEventually(equal(0), timeout: .milliseconds(100)) + expect(sub.count).toEventuallyNot(equal(1), timeout: .milliseconds(100)) } - waitUntil(timeout: 0.5) { done in + waitUntil(timeout: .milliseconds(500)) { done in subject?.deinitCalled = { done() } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/DSLTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/DSLTest.swift new file mode 100644 index 0000000..afa6fab --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/DSLTest.swift @@ -0,0 +1,39 @@ +import XCTest +import Nimble + +private func nonThrowingInt() -> Int { + return 1 +} + +private func throwingInt() throws -> Int { + return 1 +} + +final class DSLTest: XCTestCase { + func testExpectAutoclosureNonThrowing() throws { + let _: Expectation = expect(1) + let _: Expectation = expect(nonThrowingInt()) + } + + func testExpectAutoclosureThrowing() throws { + let _: Expectation = expect(try throwingInt()) + } + + func testExpectClosure() throws { + let _: Expectation = expect { 1 } + let _: Expectation = expect { nonThrowingInt() } + let _: Expectation = expect { try throwingInt() } + let _: Expectation = expect { () -> Int in 1 } + let _: Expectation = expect { () -> Int? in 1 } + let _: Expectation = expect { () -> Int? in nil } + + let _: Expectation = expect { } + let _: Expectation = expect { () -> Void in } + + let _: Expectation = expect { return } + let _: Expectation = expect { () -> Void in return } + + let _: Expectation = expect { return () } + let _: Expectation = expect { () -> Void in return () } + } +} 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 deleted file mode 100644 index 08567fd..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Helpers/XCTestCaseProvider.swift +++ /dev/null @@ -1,62 +0,0 @@ -import Foundation -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` -// has a default implementation provided by a protocol extension. - -// Implementation note: This is broken down into two separate protocols because we need a -// protocol with no Self references to which we can cast XCTestCase instances in a non-generic context. - -public protocol XCTestCaseProviderStatic { - // This should be explicitly implemented by XCTestCase subclasses - static var __allTests: [(String, (Self) -> () -> ())] { get } -} - -public protocol XCTestCaseNameProvider { - // This does not need to be explicitly implemented because of the protocol extension below - 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 name - }) - } -} -#else -public protocol XCTestCaseProvider {} -#endif - -#if os(macOS) - -extension XCTestCase { - override open func tearDown() { - if let provider = self as? XCTestCaseNameProvider { - provider.assertContainsTest(invocation!.selector.description) - } - - super.tearDown() - } -} - -extension XCTestCaseNameProvider { - fileprivate func assertContainsTest(_ name: String) { - let contains = self.allTestNames.contains(name) - XCTAssert( - contains, - """ - Test '\(name)' is missing from the __allTests array. - Please run `$ swift test --generate-linuxmain` to update the manifests. - """ - ) - } -} - -#endif 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 c90b72a..785d601 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 @@ -71,7 +71,7 @@ func deferToMainQueue(action: @escaping () -> Void) { } } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE public class NimbleHelper: NSObject { @objc public class func expectFailureMessage(_ message: NSString, block: () -> Void, file: FileString, line: UInt) { failsWithErrorMessage(String(describing: message), file: file, line: line, preferOriginalSourceLocation: true, closure: block) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/AllPassTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/AllPassTest.swift index 683121c..17a330f 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 @@ -42,7 +42,7 @@ extension Optional where Wrapped: Comparable { } } -final class AllPassTest: XCTestCase, XCTestCaseProvider { +final class AllPassTest: XCTestCase { 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 64a439b..5628ec3 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 @@ -7,7 +7,7 @@ private protocol TestProtocol {} private class TestClassConformingToProtocol: TestProtocol {} private struct TestStructConformingToProtocol: TestProtocol {} -final class BeAKindOfSwiftTest: XCTestCase, XCTestCaseProvider { +final class BeAKindOfSwiftTest: XCTestCase { enum TestEnum { case one, two } @@ -47,29 +47,31 @@ final class BeAKindOfSwiftTest: XCTestCase, XCTestCaseProvider { } } -final class BeAKindOfObjCTest: XCTestCase, XCTestCaseProvider { +final class BeAKindOfObjCTest: XCTestCase { 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 + expect(1 as NSNumber).toNot(beAKindOf(NSDate.self)) } 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)) } failsWithErrorMessageForNil("expected to be a kind of NSString, got ") { expect(nil as NSString?).to(beAKindOf(NSString.self)) } - failsWithErrorMessage("expected to be a kind of NSString, got <__NSCFNumber instance>") { - expect(NSNumber(value: 1)).to(beAKindOf(NSString.self)) + + #if canImport(Darwin) + let numberTypeName = "__NSCFNumber" + #else + let numberTypeName = "NSNumber" + #endif + failsWithErrorMessage("expected to be a kind of NSString, got <\(numberTypeName) instance>") { + expect(1 as NSNumber).to(beAKindOf(NSString.self)) } - failsWithErrorMessage("expected to not be a kind of NSNumber, got <__NSCFNumber instance>") { - expect(NSNumber(value: 1)).toNot(beAKindOf(NSNumber.self)) + failsWithErrorMessage("expected to not be a kind of NSNumber, got <\(numberTypeName) instance>") { + expect(1 as NSNumber).toNot(beAKindOf(NSNumber.self)) } -#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 df431e6..1648fa5 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 @@ -6,10 +6,10 @@ private protocol TestProtocol {} private class TestClassConformingToProtocol: TestProtocol {} private struct TestStructConformingToProtocol: TestProtocol {} -final class BeAnInstanceOfTest: XCTestCase, XCTestCaseProvider { +final class BeAnInstanceOfTest: XCTestCase { func testPositiveMatch() { expect(NSNull()).to(beAnInstanceOf(NSNull.self)) - expect(NSNumber(value: 1)).toNot(beAnInstanceOf(NSDate.self)) + expect(1 as NSNumber).toNot(beAnInstanceOf(NSDate.self)) } enum TestEnum { @@ -40,16 +40,17 @@ final class BeAnInstanceOfTest: XCTestCase, XCTestCaseProvider { failsWithErrorMessageForNil("expected to be an instance of NSString, got ") { expect(nil as NSString?).to(beAnInstanceOf(NSString.self)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + + #if canImport(Darwin) let numberTypeName = "__NSCFNumber" -#else + #else let numberTypeName = "NSNumber" -#endif + #endif failsWithErrorMessage("expected to be an instance of NSString, got <\(numberTypeName) instance>") { - expect(NSNumber(value: 1)).to(beAnInstanceOf(NSString.self)) + expect(1 as NSNumber).to(beAnInstanceOf(NSString.self)) } failsWithErrorMessage("expected to not be an instance of \(numberTypeName), got <\(numberTypeName) instance>") { - expect(NSNumber(value: 1)).toNot(beAnInstanceOf(type(of: NSNumber(value: 1)))) + expect(1 as NSNumber).toNot(beAnInstanceOf(type(of: 1 as NSNumber))) } } 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 f724be6..cdb92ad 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 @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -final class BeCloseToTest: XCTestCase, XCTestCaseProvider { +final class BeCloseToTest: XCTestCase { func testBeCloseTo() { expect(1.2).to(beCloseTo(1.2001)) expect(1.2 as CDouble).to(beCloseTo(1.2001)) @@ -22,12 +22,12 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { } func testBeCloseToWithNSNumber() { - expect(NSNumber(value: 1.2)).to(beCloseTo(9.300, within: 10)) - expect(NSNumber(value: 1.2)).to(beCloseTo(NSNumber(value: 9.300), within: 10)) - expect(1.2).to(beCloseTo(NSNumber(value: 9.300), within: 10)) + expect(1.2 as NSNumber).to(beCloseTo(9.300, within: 10)) + expect(1.2 as NSNumber).to(beCloseTo(9.300 as NSNumber, within: 10)) + expect(1.2).to(beCloseTo(9.300 as NSNumber, within: 10)) 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)) + expect(1.2 as NSNumber).toNot(beCloseTo(1.2001, within: 1.1)) } } @@ -53,7 +53,8 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect(NSDate(dateTimeString: "2015-08-26 11:43:00")).to(beCloseTo(NSDate(dateTimeString: "2015-08-26 11:43:05"), within: 10)) failsWithErrorMessage("expected to not be close to <2015-08-26 11:43:00.0050> (within 0.006), got <2015-08-26 11:43:00.0000>") { - let expectedDate = NSDate(dateTimeString: "2015-08-26 11:43:00").addingTimeInterval(0.005) + // Cast to NSDate is needed for Linux (swift-corelibs-foundation) compatibility. + let expectedDate = NSDate(dateTimeString: "2015-08-26 11:43:00").addingTimeInterval(0.005) as NSDate expect(NSDate(dateTimeString: "2015-08-26 11:43:00")).toNot(beCloseTo(expectedDate, within: 0.006)) } } @@ -139,4 +140,10 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect([0.1, 1.2]).to(beCloseTo([0.3, 1.3], within: 0.1)) } } + + // https://github.com/Quick/Nimble/issues/831 + func testCombinationWithAllPass() { + let values: [NSNumber] = [0] + expect(values).to(allPass(beCloseTo(0))) + } } 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 637bc7a..90aa03d 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 @@ -2,60 +2,102 @@ import Foundation import XCTest import Nimble -final class BeEmptyTest: XCTestCase, XCTestCaseProvider { +final class BeEmptyTest: XCTestCase { func testBeEmptyPositive() { + // Array expect([] as [Int]).to(beEmpty()) expect([1]).toNot(beEmpty()) expect([] as [CInt]).to(beEmpty()) expect([1] as [CInt]).toNot(beEmpty()) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - expect(NSDictionary() as? [Int: Int]).to(beEmpty()) - expect(NSDictionary(object: 1, forKey: 1 as NSNumber) as? [Int: Int]).toNot(beEmpty()) -#endif + // Set + expect([] as Set).to(beEmpty()) + expect([1] as Set).toNot(beEmpty()) + // Dictionary expect([Int: Int]()).to(beEmpty()) - expect(["hi": 1]).toNot(beEmpty()) + expect([1: 1]).toNot(beEmpty()) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - expect(NSArray() as? [Int]).to(beEmpty()) - expect(NSArray(array: [1]) as? [Int]).toNot(beEmpty()) -#endif + // NSArray + expect(NSArray()).to(beEmpty()) + expect([1] as NSArray).toNot(beEmpty()) + // NSSet expect(NSSet()).to(beEmpty()) - expect(NSSet(array: [NSNumber(value: 1)])).toNot(beEmpty()) + expect(NSSet(array: [1 as NSNumber])).toNot(beEmpty()) + // NSIndexSet expect(NSIndexSet()).to(beEmpty()) expect(NSIndexSet(index: 1)).toNot(beEmpty()) - expect(NSString()).to(beEmpty()) - expect(NSString(string: "hello")).toNot(beEmpty()) + // NSDictionary + expect(NSDictionary()).to(beEmpty()) + expect([1: 1] as NSDictionary).toNot(beEmpty()) + // String expect("").to(beEmpty()) expect("foo").toNot(beEmpty()) + // NSString + expect(NSString()).to(beEmpty()) + expect("hello" as NSString).toNot(beEmpty()) + + // OptionSet expect([] as TestOptionSet).to(beEmpty()) expect(TestOptionSet.one).toNot(beEmpty()) } func testBeEmptyNegative() { + // NSArray failsWithErrorMessage("expected to not be empty, got <()>") { expect(NSArray()).toNot(beEmpty()) } + failsWithErrorMessage("expected to be empty, got <(1)>") { + expect([1] as NSArray).to(beEmpty()) + } + + // Array + failsWithErrorMessage("expected to not be empty, got <[]>") { + expect([]).toNot(beEmpty()) + } failsWithErrorMessage("expected to be empty, got <[1]>") { expect([1]).to(beEmpty()) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + // NSDictionary + failsWithErrorMessage("expected to not be empty, got <{}>") { + expect(NSDictionary()).toNot(beEmpty()) + } + failsWithErrorMessage("expected to be empty, got <{1 = 1;}>") { + expect([1: 1] as NSDictionary).to(beEmpty()) + } + + // Dictionary + failsWithErrorMessage("expected to not be empty, got <[:]>") { + expect([Int: Int]()).toNot(beEmpty()) + } + failsWithErrorMessage("expected to be empty, got <[1: 1]>") { + expect([1: 1]).to(beEmpty()) + } + + // Set + failsWithErrorMessage("expected to not be empty, got ") { + expect([] as Set).toNot(beEmpty()) + } + failsWithErrorMessage("expected to be empty, got ") { + expect([1] as Set).to(beEmpty()) + } + + // NSSet 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()) + expect(NSSet(object: 1 as NSNumber)).to(beEmpty()) } -#endif + // NSIndexSet failsWithErrorMessage("expected to not be empty, got <()>") { expect(NSIndexSet()).toNot(beEmpty()) } @@ -63,6 +105,7 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect(NSIndexSet(index: 1)).to(beEmpty()) } + // String failsWithErrorMessage("expected to not be empty, got <>") { expect("").toNot(beEmpty()) } @@ -70,6 +113,15 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect("foo").to(beEmpty()) } + // NSString + failsWithErrorMessage("expected to not be empty, got <>") { + expect("" as NSString).toNot(beEmpty()) + } + failsWithErrorMessage("expected to be empty, got ") { + expect("foo" as NSString).to(beEmpty()) + } + + // OptionSet failsWithErrorMessage("expected to not be empty, got ") { expect([] as TestOptionSet).toNot(beEmpty()) } @@ -79,6 +131,13 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { } func testNilMatches() { + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as String?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as String?).toNot(beEmpty()) + } + failsWithErrorMessageForNil("expected to be empty, got ") { expect(nil as NSString?).to(beEmpty()) } @@ -93,6 +152,41 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect(nil as [CInt]?).toNot(beEmpty()) } + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as NSArray?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as NSArray?).toNot(beEmpty()) + } + + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as NSDictionary?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as NSDictionary?).toNot(beEmpty()) + } + + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as Set?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as Set?).toNot(beEmpty()) + } + + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as NSSet?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as NSSet?).toNot(beEmpty()) + } + + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as NSIndexSet?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as NSIndexSet?).toNot(beEmpty()) + } + failsWithErrorMessageForNil("expected to be empty, got ") { expect(nil as TestOptionSet?).to(beEmpty()) } 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 4c91fec..d2cabdd 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 @@ -2,16 +2,14 @@ import Foundation import XCTest import Nimble -final class BeGreaterThanOrEqualToTest: XCTestCase, XCTestCaseProvider { +final class BeGreaterThanOrEqualToTest: XCTestCase { func testGreaterThanOrEqualTo() { expect(10).to(beGreaterThanOrEqualTo(10)) expect(10).to(beGreaterThanOrEqualTo(2)) expect(1).toNot(beGreaterThanOrEqualTo(2)) - expect(NSNumber(value: 1)).toNot(beGreaterThanOrEqualTo(2)) - expect(NSNumber(value: 2)).to(beGreaterThanOrEqualTo(NSNumber(value: 2))) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - expect(1).to(beGreaterThanOrEqualTo(NSNumber(value: 0))) -#endif + expect(1 as NSNumber).toNot(beGreaterThanOrEqualTo(2)) + expect(2 as NSNumber).to(beGreaterThanOrEqualTo(2 as NSNumber)) + expect(1).to(beGreaterThanOrEqualTo(0 as NSNumber)) failsWithErrorMessage("expected to be greater than or equal to <2>, got <0>") { expect(0).to(beGreaterThanOrEqualTo(2)) @@ -32,8 +30,8 @@ final class BeGreaterThanOrEqualToTest: XCTestCase, XCTestCaseProvider { func testGreaterThanOrEqualToOperator() { expect(0) >= 0 expect(1) >= 0 - expect(NSNumber(value: 1)) >= 1 - expect(NSNumber(value: 1)) >= NSNumber(value: 1) + expect(1 as NSNumber) >= 1 + expect(1 as NSNumber) >= 1 as NSNumber expect(2.5) >= 2.5 expect(2.5) >= 2 expect(Float(2.5)) >= Float(2.5) 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 3d742f4..7278dc8 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 @@ -2,16 +2,12 @@ import Foundation import XCTest import Nimble -final class BeGreaterThanTest: XCTestCase, XCTestCaseProvider { +final class BeGreaterThanTest: XCTestCase { func testGreaterThan() { expect(10).to(beGreaterThan(2)) expect(1).toNot(beGreaterThan(2)) -#if SUPPORT_IMPLICIT_BRIDGING_CONVERSION - expect(NSNumber(value: 3)).to(beGreaterThan(2)) -#else - expect(NSNumber(value: 3)).to(beGreaterThan(2 as NSNumber)) -#endif - expect(NSNumber(value: 1)).toNot(beGreaterThan(NSNumber(value: 2))) + expect(3 as NSNumber).to(beGreaterThan(2 as NSNumber)) + expect(1 as NSNumber).toNot(beGreaterThan(2 as NSNumber)) failsWithErrorMessage("expected to be greater than <2>, got <0>") { expect(0).to(beGreaterThan(2)) @@ -29,12 +25,8 @@ final class BeGreaterThanTest: XCTestCase, XCTestCaseProvider { func testGreaterThanOperator() { expect(1) > 0 - expect(NSNumber(value: 1)) > NSNumber(value: 0) -#if SUPPORT_IMPLICIT_BRIDGING_CONVERSION - expect(NSNumber(value: 1)) > 0 -#else - expect(NSNumber(value: 1)) > 0 as NSNumber -#endif + expect(1 as NSNumber) > 0 as NSNumber + expect(1 as NSNumber) > 0 as NSNumber expect(2.5) > 1.5 expect(Float(2.5)) > Float(1.5) 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 b1155fb..1f705bf 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 @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -final class BeIdenticalToObjectTest: XCTestCase, XCTestCaseProvider { +final class BeIdenticalToObjectTest: XCTestCase { 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 8830647..54ae6f4 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 @@ -2,20 +2,20 @@ import Foundation import XCTest @testable import Nimble -final class BeIdenticalToTest: XCTestCase, XCTestCaseProvider { +final class BeIdenticalToTest: XCTestCase { func testBeIdenticalToPositive() { let value = NSDate() expect(value).to(beIdenticalTo(value)) } func testBeIdenticalToNegative() { - expect(NSNumber(value: 1)).toNot(beIdenticalTo(NSString(string: "yo"))) - expect(NSArray(array: [NSNumber(value: 1)])).toNot(beIdenticalTo(NSArray(array: [NSNumber(value: 1)]))) + expect(1 as NSNumber).toNot(beIdenticalTo("yo" as NSString)) + expect([1 as NSNumber] as NSArray).toNot(beIdenticalTo([1 as NSNumber] as NSArray)) } func testBeIdenticalToPositiveMessage() { - let num1 = NSNumber(value: 1) - let num2 = NSNumber(value: 2) + let num1 = 1 as NSNumber + let num2 = 2 as NSNumber let message = "expected to be identical to \(identityAsString(num2)), got \(identityAsString(num1))" failsWithErrorMessage(message) { expect(num1).to(beIdenticalTo(num2)) @@ -23,7 +23,7 @@ final class BeIdenticalToTest: XCTestCase, XCTestCaseProvider { } func testBeIdenticalToNegativeMessage() { - let value1 = NSArray(array: []) + let value1 = NSArray() let value2 = value1 let message = "expected to not be identical to \(identityAsString(value2)), got \(identityAsString(value1))" failsWithErrorMessage(message) { @@ -34,20 +34,17 @@ final class BeIdenticalToTest: XCTestCase, XCTestCaseProvider { func testOperators() { let value = NSDate() expect(value) === value - expect(NSNumber(value: 1)) !== NSNumber(value: 2) + expect(1 as NSNumber) !== 2 as NSNumber } func testBeAlias() { let value = NSDate() expect(value).to(be(value)) - expect(NSNumber(value: 1)).toNot(be(NSString(string: "turtles"))) - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - expect([1]).toNot(be([1])) - #else - expect(NSArray(array: [NSNumber(value: 1)])).toNot(beIdenticalTo(NSArray(array: [NSNumber(value: 1)]))) - #endif + expect(1 as NSNumber).toNot(be("turtles" as NSString)) + expect([1]).toNot(be([1])) + expect([1 as NSNumber] as NSArray).toNot(be([1 as NSNumber] as NSArray)) - let value1 = NSArray(array: []) + let value1 = NSArray() let value2 = value1 let message = "expected to not be identical to \(identityAsString(value1)), got \(identityAsString(value2))" failsWithErrorMessage(message) { 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 f389469..78b37f4 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 @@ -2,18 +2,16 @@ import Foundation import XCTest import Nimble -final class BeLessThanOrEqualToTest: XCTestCase, XCTestCaseProvider { +final class BeLessThanOrEqualToTest: XCTestCase { func testLessThanOrEqualTo() { expect(10).to(beLessThanOrEqualTo(10)) expect(2).to(beLessThanOrEqualTo(10)) expect(2).toNot(beLessThanOrEqualTo(1)) - expect(NSNumber(value: 2)).to(beLessThanOrEqualTo(10)) - expect(NSNumber(value: 2)).toNot(beLessThanOrEqualTo(1)) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - expect(2).to(beLessThanOrEqualTo(NSNumber(value: 10))) - expect(2).toNot(beLessThanOrEqualTo(NSNumber(value: 1))) -#endif + expect(2 as NSNumber).to(beLessThanOrEqualTo(10)) + expect(2 as NSNumber).toNot(beLessThanOrEqualTo(1)) + expect(2).to(beLessThanOrEqualTo(10 as NSNumber)) + expect(2).toNot(beLessThanOrEqualTo(1 as NSNumber)) failsWithErrorMessage("expected to be less than or equal to <0>, got <2>") { expect(2).to(beLessThanOrEqualTo(0)) 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 d560232..e30238c 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 @@ -2,23 +2,12 @@ import Foundation import XCTest import Nimble -final class BeLessThanTest: XCTestCase, XCTestCaseProvider { +final class BeLessThanTest: XCTestCase { func testLessThan() { expect(2).to(beLessThan(10)) expect(2).toNot(beLessThan(1)) -#if SUPPORT_IMPLICIT_BRIDGING_CONVERSION - expect(NSNumber(value: 2)).to(beLessThan(10)) - expect(NSNumber(value: 2)).toNot(beLessThan(1)) - - expect(2).to(beLessThan(NSNumber(value: 10))) - expect(2).toNot(beLessThan(NSNumber(value: 1))) -#else - expect(NSNumber(value: 2)).to(beLessThan(10 as NSNumber)) - expect(NSNumber(value: 2)).toNot(beLessThan(1 as NSNumber)) - - expect(2 as NSNumber).to(beLessThan(NSNumber(value: 10))) - expect(2 as NSNumber).toNot(beLessThan(NSNumber(value: 1))) -#endif + expect(2 as NSNumber).to(beLessThan(10 as NSNumber)) + expect(2 as NSNumber).toNot(beLessThan(1 as NSNumber)) failsWithErrorMessage("expected to be less than <0>, got <2>") { expect(2).to(beLessThan(0)) @@ -37,11 +26,7 @@ final class BeLessThanTest: XCTestCase, XCTestCaseProvider { func testLessThanOperator() { expect(0) < 1 -#if SUPPORT_IMPLICIT_BRIDGING_CONVERSION - expect(NSNumber(value: 0)) < 1 -#else - expect(NSNumber(value: 0)) < 1 as NSNumber -#endif + expect(0 as NSNumber) < 1 as NSNumber failsWithErrorMessage("expected to be less than <1>, got <2>") { expect(2) < 1 return 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 d9ef8ea..dfe3bcd 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 @@ -29,7 +29,7 @@ enum ConvertsToBool: ExpressibleByBooleanLiteral, CustomStringConvertible { } } -final class BeTruthyTest: XCTestCase, XCTestCaseProvider { +final class BeTruthyTest: XCTestCase { func testShouldMatchNonNilTypes() { expect(true as Bool?).to(beTruthy()) @@ -110,7 +110,7 @@ final class BeTruthyTest: XCTestCase, XCTestCaseProvider { } } -final class BeTrueTest: XCTestCase, XCTestCaseProvider { +final class BeTrueTest: XCTestCase { func testShouldMatchTrue() { expect(true).to(beTrue()) @@ -138,7 +138,7 @@ final class BeTrueTest: XCTestCase, XCTestCaseProvider { } } -final class BeFalsyTest: XCTestCase, XCTestCaseProvider { +final class BeFalsyTest: XCTestCase { func testShouldMatchNilTypes() { expect(false as Bool?).to(beFalsy()) @@ -203,7 +203,7 @@ final class BeFalsyTest: XCTestCase, XCTestCaseProvider { } } -final class BeFalseTest: XCTestCase, XCTestCaseProvider { +final class BeFalseTest: XCTestCase { 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 9e37116..df35eeb 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 @@ -1,7 +1,7 @@ import XCTest import Nimble -final class BeNilTest: XCTestCase, XCTestCaseProvider { +final class BeNilTest: XCTestCase { 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 bb5d324..bea7f4e 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 @@ -1,7 +1,7 @@ import XCTest import Nimble -final class BeVoidTest: XCTestCase, XCTestCaseProvider { +final class BeVoidTest: XCTestCase { func testBeVoid() { expect(()).to(beVoid()) expect(() as ()?).to(beVoid()) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeginWithPrefixTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeginWithPrefixTest.swift new file mode 100644 index 0000000..e649790 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/BeginWithPrefixTest.swift @@ -0,0 +1,64 @@ +import Foundation +import Nimble +import XCTest + +final class BeginWithPrefixTest: XCTestCase { + + func testBeginWithSequencePrefix() { + failsWithErrorMessageForNil("expected to begin with , got ") { + expect(nil as [Int]?).to(beginWith(prefix: nil as [Int]?)) + } + + failsWithErrorMessageForNil("expected to begin with <[1, 2]>, got ") { + expect(nil as [Int]?).to(beginWith(prefix: [1, 2])) + } + + failsWithErrorMessageForNil("expected to begin with , got <[1, 2]>") { + expect([1, 2]).to(beginWith(prefix: nil as [Int]?)) + } + + let sequence = [1, 2, 3] + expect(sequence).toNot(beginWith(prefix: [1, 2, 3, 4])) + expect(sequence).toNot(beginWith(prefix: [2, 3])) + + expect(sequence).to(beginWith(prefix: [1, 2, 3])) + expect(sequence).to(beginWith(prefix: [1, 2])) + expect(sequence).to(beginWith(prefix: [])) + + expect([]).toNot(beginWith(prefix: [1])) + expect([]).to(beginWith(prefix: [] as [Int])) + } + + func testBeginWithSequencePrefixUsingPredicateClosure() { + failsWithErrorMessageForNil("expected to begin with , got ") { + expect(nil as [Int]?).to(beginWith(prefix: nil as [Int]?, by: { $0 == $1 })) + } + + failsWithErrorMessageForNil("expected to begin with <[1, 2]>, got ") { + expect(nil as [Int]?).to(beginWith(prefix: [1, 2], by: { $0 == $1 })) + } + + failsWithErrorMessageForNil("expected to begin with , got <[1, 2]>") { + expect([1, 2]).to(beginWith(prefix: nil as [Int]?, by: { $0 == $1 })) + } + + let sequence = [1, 2, 3] + expect(sequence).toNot(beginWith(prefix: [1, 2, 3, 4], by: { $0 == $1 })) + expect(sequence).toNot(beginWith(prefix: [2, 3], by: { $0 == $1 })) + + expect(sequence).to(beginWith(prefix: [1, 2, 3], by: { $0 == $1 })) + expect(sequence).to(beginWith(prefix: [1, 2], by: { $0 == $1 })) + expect(sequence).to(beginWith(prefix: [], by: { $0 == $1 })) + + expect([]).toNot(beginWith(prefix: [1], by: { $0 == $1 })) + expect([]).to(beginWith(prefix: [] as [Int], by: { $0 == $1 })) + } + + func testBeginWithSequencePrefixWithDifferentSequenceTypes() { + expect(1...3).to(beginWith(prefix: [1, 2, 3])) + expect(1...3).toNot(beginWith(prefix: [1, 2, 3, 4, 5])) + + expect(1...3).to(beginWith(prefix: [1, 2, 3], by: { $0 == $1 })) + expect(1...3).toNot(beginWith(prefix: [1, 2, 3, 4, 5], by: { $0 == $1 })) + } +} 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 3a5162e..4babb0b 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 @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -final class BeginWithTest: XCTestCase, XCTestCaseProvider { +final class BeginWithTest: XCTestCase { func testPositiveMatches() { expect([1, 2, 3]).to(beginWith(1)) expect([1, 2, 3]).toNot(beginWith(2)) @@ -12,21 +12,19 @@ final class BeginWithTest: XCTestCase, XCTestCaseProvider { expect("foobarfoo").to(beginWith("foo")) - expect(NSString(string: "foobar").description).to(beginWith("foo")) - expect(NSString(string: "foobar").description).toNot(beginWith("oo")) + expect(("foobar" as NSString).description).to(beginWith("foo")) + expect(("foobar" as NSString).description).toNot(beginWith("oo")) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - expect(NSArray(array: ["a", "b"])).to(beginWith("a")) - expect(NSArray(array: ["a", "b"])).toNot(beginWith("b")) -#endif + expect(["a", "b"] as NSArray).to(beginWith("a")) + expect(["a", "b"] as NSArray).toNot(beginWith("b")) } func testNegativeMatches() { failsWithErrorMessageForNil("expected to begin with , got ") { - expect(nil as NSArray?).to(beginWith(NSString(string: "b"))) + expect(nil as NSArray?).to(beginWith("b" as NSString)) } failsWithErrorMessageForNil("expected to not begin with , got ") { - expect(nil as NSArray?).toNot(beginWith(NSString(string: "b"))) + expect(nil as NSArray?).toNot(beginWith("b" as NSString)) } failsWithErrorMessage("expected to begin with <2>, got <[1, 2, 3]>") { 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 6944375..324b0c9 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 @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -final class ContainElementSatisfyingTest: XCTestCase, XCTestCaseProvider { +final class ContainElementSatisfyingTest: XCTestCase { 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 f69f351..5dea081 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 @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -final class ContainTest: XCTestCase, XCTestCaseProvider { +final class ContainTest: XCTestCase { func testContainSequence() { expect([1, 2, 3]).to(contain(1)) expect([1, 2, 3]).toNot(contain(4)) @@ -10,10 +10,10 @@ final class ContainTest: XCTestCase, XCTestCaseProvider { expect([1, 2, 3] as [CInt]).toNot(contain(4 as CInt)) expect(["foo", "bar", "baz"]).to(contain("baz")) expect(["foo", "bar", "baz"]).toNot(contain("ba")) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - expect(NSArray(array: ["a"])).to(contain(NSString(string: "a"))) - expect(NSArray(array: ["a"])).toNot(contain(NSString(string: "b"))) - expect(NSArray(object: 1) as NSArray?).to(contain(1)) +#if canImport(Darwin) + expect(["a"] as NSArray).to(contain("a" as NSString)) + expect(["a"] as NSArray).toNot(contain("b" as NSString)) + expect([1] as NSArray?).to(contain(1)) #endif failsWithErrorMessage("expected to contain , got <[a, b, c]>") { @@ -50,6 +50,27 @@ final class ContainTest: XCTestCase, XCTestCaseProvider { } } + func testContainSequenceAndSetAlgebra() { + let set = [1, 2, 3] as Set + + expect(set).to(contain(1)) + expect(set).toNot(contain(4)) + + failsWithErrorMessage("expected to contain <4>, got <\(set.debugDescription)>") { + expect(set).to(contain(4)) + } + failsWithErrorMessage("expected to not contain <2>, got <\(set.debugDescription)>") { + expect(set).toNot(contain(2)) + } + + failsWithErrorMessageForNil("expected to contain <1>, got ") { + expect(nil as Set?).to(contain(1)) + } + failsWithErrorMessageForNil("expected to not contain <1>, got ") { + expect(nil as Set?).toNot(contain(1)) + } + } + func testContainSubstring() { expect("foo").to(contain("o")) expect("foo").to(contain("oo")) @@ -64,12 +85,12 @@ final class ContainTest: XCTestCase, XCTestCaseProvider { } } - func testContainObjCSubstring() { - let str = NSString(string: "foo") - expect(str).to(contain(NSString(string: "o"))) - expect(str).to(contain(NSString(string: "oo"))) - expect(str).toNot(contain(NSString(string: "z"))) - expect(str).toNot(contain(NSString(string: "zz"))) + func testContainNSStringSubstring() { + let str = "foo" as NSString + expect(str).to(contain("o" as NSString)) + expect(str).to(contain("oo" as NSString)) + expect(str).toNot(contain("z" as NSString)) + expect(str).toNot(contain("zz" as NSString)) } func testVariadicArguments() { 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 index ec7a0dd..39dd1f4 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ElementsEqualTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/Matchers/ElementsEqualTest.swift @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -final class ElementsEqualTest: XCTestCase, XCTestCaseProvider { +final class ElementsEqualTest: XCTestCase { func testSequenceElementsEquality() { failsWithErrorMessageForNil("expected to elementsEqual , got ") { @@ -22,6 +22,35 @@ final class ElementsEqualTest: XCTestCase, XCTestCaseProvider { expect(sequence1).toNot(elementsEqual(sequence2)) expect(sequence1).toNot(elementsEqual([3, 2, 1])) expect(sequence1).to(elementsEqual([1, 2, 3])) + } + func testSequenceElementsEqualityUsingPredicateClosure() { + failsWithErrorMessageForNil("expected to elementsEqual , got ") { + expect(nil as [Int]?).to(elementsEqual(nil as [Int]?, by: { $0 == $1 })) + } + let sequence = [1, 2] + failsWithErrorMessageForNil("expected to elementsEqual <[1, 2]>, got ") { + expect(nil as [Int]?).to(elementsEqual(sequence, by: { $0 == $1 })) + } + + failsWithErrorMessageForNil("expected to elementsEqual , got <[1, 2]>") { + expect(sequence).to(elementsEqual(nil as [Int]?, by: { $0 == $1 })) + } + + let sequence1 = [1, 2, 3] + let sequence2 = [1, 2, 3, 4, 5] + expect(sequence1).toNot(elementsEqual(sequence2, by: { $0 == $1 })) + expect(sequence1).toNot(elementsEqual([3, 2, 1], by: { $0 == $1 })) + expect(sequence1).to(elementsEqual([1, 2, 3], by: { $0 == $1 })) + } + + func testElementsEqualDifferentSequenceTypes() { + expect(1...3).to(elementsEqual([1, 2, 3])) + expect(1...3).toNot(elementsEqual([1, 2, 3, 4, 5])) + expect(1...3).toNot(elementsEqual([3, 2, 1])) + + expect(1...3).to(elementsEqual([1, 2, 3], by: { $0 == $1 })) + expect(1...3).toNot(elementsEqual([1, 2, 3, 4, 5], by: { $0 == $1 })) + expect(1...3).toNot(elementsEqual([3, 2, 1], by: { $0 == $1 })) } } 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 88005e8..ea38757 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 @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -final class EndWithTest: XCTestCase, XCTestCaseProvider { +final class EndWithTest: XCTestCase { func testEndWithPositives() { expect([1, 2, 3]).to(endWith(3)) expect([1, 2, 3]).toNot(endWith(2)) @@ -13,15 +13,13 @@ final class EndWithTest: XCTestCase, XCTestCaseProvider { expect("foobar").toNot(endWith("oo")) expect("foobarfoo").to(endWith("foo")) - expect(NSString(string: "foobar").description).to(endWith("bar")) - expect(NSString(string: "foobar").description).toNot(endWith("oo")) + expect(("foobar" as NSString).description).to(endWith("bar")) + expect(("foobar" as NSString).description).toNot(endWith("oo")) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - expect(NSArray(array: ["a", "b"])).to(endWith("b")) - expect(NSArray(array: ["a", "b"])).toNot(endWith("a")) - expect(NSArray(array: [])).toNot(endWith("a")) - expect(NSArray(array: ["a", "b", "a"])).to(endWith("a")) -#endif + expect(["a", "b"] as NSArray).to(endWith("b")) + expect(["a", "b"] as NSArray).toNot(endWith("a")) + expect([] as NSArray).toNot(endWith("a")) + expect(["a", "b", "a"] as NSArray).to(endWith("a")) } func testEndWithNegatives() { 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 18b0647..5dad499 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 @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -final class EqualTest: XCTestCase, XCTestCaseProvider { +final class EqualTest: XCTestCase { func testEquality() { expect(1 as CInt).to(equal(1 as CInt)) expect(1 as CInt).to(equal(1)) @@ -33,9 +33,7 @@ final class EqualTest: XCTestCase, XCTestCaseProvider { expect(array1).to(equal([1, 2, 3])) expect(array1).toNot(equal([1, 2] as [Int])) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - expect(NSArray(array: [1, 2, 3])).to(equal(NSArray(array: [1, 2, 3]))) -#endif + expect([1, 2, 3] as NSArray).to(equal([1, 2, 3] as NSArray)) failsWithErrorMessage("expected to equal <[1, 2]>, got <[1, 2, 3]>") { expect([1, 2, 3]).to(equal([1, 2])) @@ -119,10 +117,8 @@ final class EqualTest: XCTestCase, XCTestCaseProvider { expect(actual).to(equal(expected)) expect(actual).toNot(equal(unexpected)) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - expect(NSDictionary(object: "bar", forKey: "foo" as NSString)).to(equal(["foo": "bar"])) - expect(NSDictionary(object: "bar", forKey: "foo" as NSString) as? [String: String]).to(equal(expected)) -#endif + expect(["foo": "bar"] as NSDictionary).to(equal(["foo": "bar"])) + expect((["foo": "bar"] as NSDictionary) as? [String: String]).to(equal(expected)) } func testDataEquality() { @@ -133,14 +129,8 @@ final class EqualTest: XCTestCase, XCTestCaseProvider { expect(actual).to(equal(expected)) expect(actual).toNot(equal(unexpected)) - #if os(Linux) - // swiftlint:disable:next todo - // FIXME: Swift on Linux triggers a segfault when calling NSData's hash() (last checked on 03-11) - let expectedErrorMessage = "expected to equal >, got >" - #else - let expectedErrorMessage = "expected to equal >," + let expectedErrorMessage = "expected to equal >," + " got >" - #endif failsWithErrorMessage(expectedErrorMessage) { expect(actual).to(equal(unexpected)) @@ -148,10 +138,10 @@ final class EqualTest: XCTestCase, XCTestCaseProvider { } func testNSObjectEquality() { - expect(NSNumber(value: 1)).to(equal(NSNumber(value: 1))) - expect(NSNumber(value: 1)) == NSNumber(value: 1) - expect(NSNumber(value: 1)) != NSNumber(value: 2) - expect { NSNumber(value: 1) }.to(equal(1)) + expect(1 as NSNumber).to(equal(1 as NSNumber)) + expect(1 as NSNumber) == 1 as NSNumber + expect(1 as NSNumber) != 2 as NSNumber + expect { 1 as NSNumber }.to(equal(1)) } func testOperatorEquality() { 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 4ef610e..5b5f194 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 @@ -1,7 +1,7 @@ import XCTest import Nimble -final class HaveCountTest: XCTestCase, XCTestCaseProvider { +final class HaveCountTest: XCTestCase { func testHaveCountForArray() { expect([1, 2, 3]).to(haveCount(3)) expect([1, 2, 3]).notTo(haveCount(1)) 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 41e5159..a2517c1 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 @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -final class MatchErrorTest: XCTestCase, XCTestCaseProvider { +final class MatchErrorTest: XCTestCase { func testMatchErrorPositive() { expect(NimbleError.laugh).to(matchError(NimbleError.laugh)) expect(NimbleError.laugh).to(matchError(NimbleError.self)) @@ -19,12 +19,10 @@ 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,13 +43,11 @@ 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 1285ecc..73b0c16 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 @@ -1,7 +1,7 @@ import XCTest import Nimble -final class MatchTest: XCTestCase, XCTestCaseProvider { +final class MatchTest: XCTestCase { 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 32f5100..613435e 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 @@ -2,33 +2,31 @@ import XCTest import Nimble import Foundation -final class PostNotificationTest: XCTestCase, XCTestCaseProvider { +final class PostNotificationTest: XCTestCase { let notificationCenter = NotificationCenter() func testPassesWhenNoNotificationsArePosted() { expect { // no notifications here! - return nil - }.to(postNotifications(beEmpty(), fromNotificationCenter: notificationCenter)) + }.to(postNotifications(beEmpty())) } func testPassesWhenExpectedNotificationIsPosted() { let testNotification = Notification(name: Notification.Name("Foo"), object: nil) expect { self.notificationCenter.post(testNotification) - }.to(postNotifications(equal([testNotification]), fromNotificationCenter: notificationCenter)) + }.to(postNotifications(equal([testNotification]), from: notificationCenter)) } func testPassesWhenAllExpectedNotificationsArePosted() { - let foo = NSNumber(value: 1) - let bar = NSNumber(value: 2) + let foo = 1 as NSNumber + let bar = 2 as NSNumber let n1 = Notification(name: Notification.Name("Foo"), object: foo) let n2 = Notification(name: Notification.Name("Bar"), object: bar) expect { self.notificationCenter.post(n1) self.notificationCenter.post(n2) - return nil - }.to(postNotifications(equal([n1, n2]), fromNotificationCenter: notificationCenter)) + }.to(postNotifications(equal([n1, n2]), from: notificationCenter)) } func testFailsWhenNoNotificationsArePosted() { @@ -36,8 +34,7 @@ final class PostNotificationTest: XCTestCase, XCTestCaseProvider { failsWithErrorMessage("expected to equal <[\(testNotification)]>, got no notifications") { expect { // no notifications here! - return nil - }.to(postNotifications(equal([testNotification]), fromNotificationCenter: self.notificationCenter)) + }.to(postNotifications(equal([testNotification]), from: self.notificationCenter)) } } @@ -47,8 +44,7 @@ final class PostNotificationTest: XCTestCase, XCTestCaseProvider { failsWithErrorMessage("expected to equal <[\(n1)]>, got <[\(n2)]>") { expect { self.notificationCenter.post(n2) - return nil - }.to(postNotifications(equal([n1]), fromNotificationCenter: self.notificationCenter)) + }.to(postNotifications(equal([n1]), from: self.notificationCenter)) } } @@ -58,22 +54,28 @@ final class PostNotificationTest: XCTestCase, XCTestCaseProvider { failsWithErrorMessage("expected to equal <[\(n1)]>, got <[\(n2)]>") { expect { self.notificationCenter.post(n2) - return nil - }.to(postNotifications(equal([n1]), fromNotificationCenter: self.notificationCenter)) + }.to(postNotifications(equal([n1]), from: self.notificationCenter)) } } func testPassesWhenExpectedNotificationEventuallyIsPosted() { - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - let testNotification = Notification(name: Notification.Name("Foo"), object: nil) - expect { - deferToMainQueue { - self.notificationCenter.post(testNotification) - } - return nil - }.toEventually(postNotifications(equal([testNotification]), fromNotificationCenter: notificationCenter)) - #else - print("\(#function) is missing because toEventually is not implement on this platform") - #endif + let testNotification = Notification(name: Notification.Name("Foo"), object: nil) + expect { + deferToMainQueue { + self.notificationCenter.post(testNotification) + } + }.toEventually(postNotifications(equal([testNotification]), from: notificationCenter)) } + + #if os(macOS) + func testPassesWhenAllExpectedNotificationsarePostedInDistributedNotificationCenter() { + let center = DistributedNotificationCenter() + let n1 = Notification(name: Notification.Name("Foo"), object: "1") + let n2 = Notification(name: Notification.Name("Bar"), object: "2") + expect { + center.post(n1) + center.post(n2) + }.toEventually(postDistributedNotifications(equal([n1, n2]), from: center, names: [n1.name, n2.name])) + } + #endif } 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 beca75b..50a858c 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 @@ -1,115 +1,115 @@ import XCTest import Nimble -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE + +let anException = NSException(name: NSExceptionName("laugh"), reason: "Lulz", userInfo: ["key": "value"]) final class RaisesExceptionTest: XCTestCase { - var anException = NSException(name: NSExceptionName("laugh"), reason: "Lulz", userInfo: ["key": "value"]) - func testPositiveMatches() { - expect { self.anException.raise() }.to(raiseException()) - expect { self.anException.raise() }.to(raiseException(named: "laugh")) - expect { self.anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz")) - expect { self.anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"])) + expect { anException.raise() }.to(raiseException()) + expect { anException.raise() }.to(raiseException(named: "laugh")) + expect { anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz")) + expect { anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"])) } func testPositiveMatchesWithClosures() { - expect { self.anException.raise() }.to(raiseException { (exception: NSException) in + expect { anException.raise() }.to(raiseException { (exception: NSException) in expect(exception.name).to(equal(NSExceptionName("laugh"))) }) - expect { self.anException.raise() }.to(raiseException(named: "laugh") { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "laugh") { (exception: NSException) in expect(exception.name.rawValue).to(beginWith("lau")) }) - expect { self.anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz") { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz") { (exception: NSException) in expect(exception.name.rawValue).to(beginWith("lau")) }) - expect { self.anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"]) { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"]) { (exception: NSException) in expect(exception.name.rawValue).to(beginWith("lau")) }) - expect { self.anException.raise() }.to(raiseException(named: "laugh") { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "laugh") { (exception: NSException) in expect(exception.name.rawValue).toNot(beginWith("as")) }) - expect { self.anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz") { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz") { (exception: NSException) in expect(exception.name.rawValue).toNot(beginWith("df")) }) - expect { self.anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"]) { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"]) { (exception: NSException) in expect(exception.name.rawValue).toNot(beginWith("as")) }) } func testNegativeMatches() { failsWithErrorMessage("expected to raise exception with name , got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }") { - expect { self.anException.raise() }.to(raiseException(named: "foo")) + expect { anException.raise() }.to(raiseException(named: "foo")) } failsWithErrorMessage("expected to raise exception with name with reason , got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }") { - expect { self.anException.raise() }.to(raiseException(named: "laugh", reason: "bar")) + expect { anException.raise() }.to(raiseException(named: "laugh", reason: "bar")) } failsWithErrorMessage( "expected to raise exception with name with reason with userInfo <{k = v;}>, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }") { - expect { self.anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz", userInfo: ["k": "v"])) + expect { anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz", userInfo: ["k": "v"])) } failsWithErrorMessage("expected to raise any exception, got no exception") { - expect { self.anException }.to(raiseException()) + expect {}.to(raiseException()) } failsWithErrorMessage("expected to not raise any exception, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }") { - expect { self.anException.raise() }.toNot(raiseException()) + expect { anException.raise() }.toNot(raiseException()) } failsWithErrorMessage("expected to raise exception with name with reason , got no exception") { - expect { self.anException }.to(raiseException(named: "laugh", reason: "Lulz")) + expect {}.to(raiseException(named: "laugh", reason: "Lulz")) } failsWithErrorMessage("expected to raise exception with name with reason , got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }") { - expect { self.anException.raise() }.to(raiseException(named: "bar", reason: "Lulz")) + expect { anException.raise() }.to(raiseException(named: "bar", reason: "Lulz")) } failsWithErrorMessage("expected to not raise exception with name , got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }") { - expect { self.anException.raise() }.toNot(raiseException(named: "laugh")) + expect { anException.raise() }.toNot(raiseException(named: "laugh")) } failsWithErrorMessage("expected to not raise exception with name with reason , got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }") { - expect { self.anException.raise() }.toNot(raiseException(named: "laugh", reason: "Lulz")) + expect { anException.raise() }.toNot(raiseException(named: "laugh", reason: "Lulz")) } failsWithErrorMessage("expected to not raise exception with name with reason with userInfo <{key = value;}>, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }") { - expect { self.anException.raise() }.toNot(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"])) + expect { anException.raise() }.toNot(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"])) } } func testNegativeMatchesDoNotCallClosureWithoutException() { failsWithErrorMessage("expected to raise exception that satisfies block, got no exception") { - expect { self.anException }.to(raiseException { (exception: NSException) in + expect {}.to(raiseException { (exception: NSException) in expect(exception.name).to(equal(NSExceptionName(rawValue: "foo"))) }) } failsWithErrorMessage("expected to raise exception with name that satisfies block, got no exception") { - expect { self.anException }.to(raiseException(named: "foo") { (exception: NSException) in + expect {}.to(raiseException(named: "foo") { (exception: NSException) in expect(exception.name.rawValue).to(equal("foo")) }) } failsWithErrorMessage("expected to raise exception with name with reason that satisfies block, got no exception") { - expect { self.anException }.to(raiseException(named: "foo", reason: "ha") { (exception: NSException) in + expect {}.to(raiseException(named: "foo", reason: "ha") { (exception: NSException) in expect(exception.name.rawValue).to(equal("foo")) }) } failsWithErrorMessage("expected to raise exception with name with reason with userInfo <{}> that satisfies block, got no exception") { - expect { self.anException }.to(raiseException(named: "foo", reason: "Lulz", userInfo: [:]) { (exception: NSException) in + expect {}.to(raiseException(named: "foo", reason: "Lulz", userInfo: [:]) { (exception: NSException) in expect(exception.name.rawValue).to(equal("foo")) }) } failsWithErrorMessage("expected to not raise any exception, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }") { - expect { self.anException.raise() }.toNot(raiseException()) + expect { anException.raise() }.toNot(raiseException()) } } func testNegativeMatchesWithClosure() { failsWithErrorMessage("expected to raise exception that satisfies block, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }") { - expect { self.anException.raise() }.to(raiseException { (exception: NSException) in + expect { anException.raise() }.to(raiseException { (exception: NSException) in expect(exception.name.rawValue).to(equal("foo")) }) } @@ -117,40 +117,57 @@ final class RaisesExceptionTest: XCTestCase { let innerFailureMessage = "expected to begin with , got " failsWithErrorMessage([innerFailureMessage, "expected to raise exception with name that satisfies block, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }"]) { - expect { self.anException.raise() }.to(raiseException(named: "laugh") { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "laugh") { (exception: NSException) in expect(exception.name.rawValue).to(beginWith("fo")) }) } failsWithErrorMessage([innerFailureMessage, "expected to raise exception with name that satisfies block, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }"]) { - expect { self.anException.raise() }.to(raiseException(named: "lol") { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "lol") { (exception: NSException) in expect(exception.name.rawValue).to(beginWith("fo")) }) } failsWithErrorMessage([innerFailureMessage, "expected to raise exception with name with reason that satisfies block, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }"]) { - expect { self.anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz") { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz") { (exception: NSException) in expect(exception.name.rawValue).to(beginWith("fo")) }) } failsWithErrorMessage([innerFailureMessage, "expected to raise exception with name with reason that satisfies block, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }"]) { - expect { self.anException.raise() }.to(raiseException(named: "lol", reason: "wrong") { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "lol", reason: "wrong") { (exception: NSException) in expect(exception.name.rawValue).to(beginWith("fo")) }) } failsWithErrorMessage([innerFailureMessage, "expected to raise exception with name with reason with userInfo <{key = value;}> that satisfies block, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }"]) { - expect { self.anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"]) { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"]) { (exception: NSException) in expect(exception.name.rawValue).to(beginWith("fo")) }) } failsWithErrorMessage([innerFailureMessage, "expected to raise exception with name with reason with userInfo <{}> that satisfies block, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }"]) { - expect { self.anException.raise() }.to(raiseException(named: "lol", reason: "Lulz", userInfo: [:]) { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "lol", reason: "Lulz", userInfo: [:]) { (exception: NSException) in expect(exception.name.rawValue).to(beginWith("fo")) }) } } + + func testNSExceptionName() { + let exception = NSException(name: .genericException, reason: nil, userInfo: nil) + expect { exception.raise() }.to(raiseException(named: .genericException)) + } + + func testNonVoidClosure() { + expect { return 1 }.toNot(raiseException()) + expect { return 2 }.toNot(raiseException(named: "laugh")) + expect { return 3 }.toNot(raiseException(named: "laugh", reason: "Lulz")) + expect { return 4 }.toNot(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"])) + expect { return 5 }.toNot(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"]) { _ in }) + } + + func testChainOnRaiseException() { + expect { () -> Int in return 5 }.toNot(raiseException()).to(equal(5)) + } } #endif 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 be60a41..f85b5fc 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 @@ -2,14 +2,10 @@ import XCTest import Nimble import Foundation -final class SatisfyAllOfTest: XCTestCase, XCTestCaseProvider { +final class SatisfyAllOfTest: XCTestCase { func testSatisfyAllOf() { expect(2).to(satisfyAllOf(equal(2), beLessThan(3))) -#if SUPPORT_IMPLICIT_BRIDGING_CONVERSION - expect(2).toNot(satisfyAllOf(equal(3), equal("turtles"))) -#else expect(2 as NSNumber).toNot(satisfyAllOf(equal(3 as NSNumber), equal("turtles" as NSString))) -#endif expect([1, 2, 3]).to(satisfyAllOf(equal([1, 2, 3]), allPass({$0 < 4}), haveCount(3))) expect("turtle").to(satisfyAllOf(contain("e"), beginWith("tur"))) expect(82.0).to(satisfyAllOf(beGreaterThan(10.5), beLessThan(100.75), beCloseTo(82.00001))) @@ -36,11 +32,8 @@ final class SatisfyAllOfTest: XCTestCase, XCTestCaseProvider { func testOperatorAnd() { expect(2).to(equal(2) && beLessThan(3)) -#if SUPPORT_IMPLICIT_BRIDGING_CONVERSION expect(2).to(beLessThan(3) && beGreaterThan(1)) -#else expect(2 as NSNumber).to(beLessThan(3 as NSNumber) && beGreaterThan(1 as NSNumber)) -#endif expect("turtle").to(contain("t") && endWith("tle")) expect(82.0).to(beGreaterThan(10.5) && beLessThan(100.75)) expect(false).to(beFalsy() && beFalse()) 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 0cba8d5..102616d 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 @@ -2,14 +2,10 @@ import XCTest import Nimble import Foundation -final class SatisfyAnyOfTest: XCTestCase, XCTestCaseProvider { +final class SatisfyAnyOfTest: XCTestCase { func testSatisfyAnyOf() { expect(2).to(satisfyAnyOf(equal(2), equal(3))) -#if SUPPORT_IMPLICIT_BRIDGING_CONVERSION - expect(2).toNot(satisfyAnyOf(equal(3), equal("turtles"))) -#else expect(2 as NSNumber).toNot(satisfyAnyOf(equal(3 as NSNumber), equal("turtles" as NSString))) -#endif expect([1, 2, 3]).to(satisfyAnyOf(equal([1, 2, 3]), allPass({$0 < 4}), haveCount(3))) expect("turtle").toNot(satisfyAnyOf(contain("a"), endWith("magic"))) expect(82.0).toNot(satisfyAnyOf(beLessThan(10.5), beGreaterThan(100.75), beCloseTo(50.1))) @@ -36,11 +32,7 @@ final class SatisfyAnyOfTest: XCTestCase, XCTestCaseProvider { func testOperatorOr() { expect(2).to(equal(2) || equal(3)) -#if SUPPORT_IMPLICIT_BRIDGING_CONVERSION - expect(2).toNot(equal(3) || equal("turtles")) -#else expect(2 as NSNumber).toNot(equal(3 as NSNumber) || equal("turtles" as NSString)) -#endif expect("turtle").toNot(contain("a") || endWith("magic")) expect(82.0).toNot(beLessThan(10.5) || beGreaterThan(100.75)) expect(false).to(beTrue() || beFalse()) 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 edd9e0e..f3b9969 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 @@ -2,20 +2,23 @@ import Foundation import XCTest import Nimble -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE - private let error: Error = NSError(domain: "test", code: 0, userInfo: nil) final class ThrowAssertionTest: XCTestCase { func testPositiveMatch() { + #if canImport(Darwin) expect { () -> Void in fatalError() }.to(throwAssertion()) + #endif } func testErrorThrown() { + #if canImport(Darwin) expect { throw error }.toNot(throwAssertion()) + #endif } func testPostAssertionCodeNotRun() { + #if canImport(Darwin) var reachedPoint1 = false var reachedPoint2 = false @@ -27,17 +30,21 @@ final class ThrowAssertionTest: XCTestCase { expect(reachedPoint1) == true expect(reachedPoint2) == false + #endif } func testNegativeMatch() { + #if canImport(Darwin) var reachedPoint1 = false expect { reachedPoint1 = true }.toNot(throwAssertion()) expect(reachedPoint1) == true + #endif } func testPositiveMessage() { + #if canImport(Darwin) failsWithErrorMessage("expected to throw an assertion") { expect { () -> Void? in return }.to(throwAssertion()) } @@ -45,13 +52,26 @@ final class ThrowAssertionTest: XCTestCase { failsWithErrorMessage("expected to throw an assertion; threw error instead <\(error)>") { expect { throw error }.to(throwAssertion()) } + #endif } func testNegativeMessage() { + #if canImport(Darwin) failsWithErrorMessage("expected to not throw an assertion") { expect { () -> Void in fatalError() }.toNot(throwAssertion()) } + #endif + } + + func testNonVoidClosure() { + #if canImport(Darwin) + expect { () -> Int in fatalError() }.to(throwAssertion()) + #endif + } + + func testChainOnThrowAssertion() { + #if canImport(Darwin) + expect { () -> Int in return 5 }.toNot(throwAssertion()).to(equal(5)) + #endif } } - -#endif 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 7a7253f..5c15567 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 @@ -6,7 +6,7 @@ enum NimbleError: Error { case cry } -enum EquatableError: Error { +enum EquatableError: Error, Equatable { case parameterized(x: Int) } @@ -19,16 +19,6 @@ extension EquatableError: CustomDebugStringConvertible { } } -extension EquatableError: Equatable { -} - -func == (lhs: EquatableError, rhs: EquatableError) -> Bool { - switch (lhs, rhs) { - case (.parameterized(let l), .parameterized(let r)): - return l == r - } -} - enum CustomDebugStringConvertibleError: Error { // swiftlint:disable identifier_name case a @@ -42,7 +32,7 @@ extension CustomDebugStringConvertibleError: CustomDebugStringConvertible { } } -final class ThrowErrorTest: XCTestCase, XCTestCaseProvider { +final class ThrowErrorTest: XCTestCase { func testPositiveMatches() { expect { throw NimbleError.laugh }.to(throwError()) expect { throw NimbleError.laugh }.to(throwError(NimbleError.laugh)) @@ -135,7 +125,7 @@ final class ThrowErrorTest: XCTestCase, XCTestCaseProvider { func testNegativeMatchesWithClosure() { let moduleName = "NimbleTests" let innerFailureMessage = "expected to equal , got <\(moduleName).NimbleError>" - let closure = { (error: Error) in + let closure = { (error: Error) -> Void in expect(error._domain).to(equal("foo")) } @@ -151,4 +141,31 @@ final class ThrowErrorTest: XCTestCase, XCTestCaseProvider { expect { throw NimbleError.laugh }.to(throwError(NimbleError.laugh, closure: closure)) } } + + func testNonVoidClosure() { + expect { return 1 }.toNot(throwError()) + expect { return 2 }.toNot(throwError(NimbleError.laugh)) + expect { return 3 }.toNot(throwError(errorType: NimbleError.self)) + expect { return 4 }.toNot(throwError(EquatableError.parameterized(x: 1))) + expect { return 5 }.toNot(throwError(EquatableError.parameterized(x: 2))) + + // swiftlint:disable unused_closure_parameter + + // Generic typed closure + expect { return "1" }.toNot(throwError { error in }) + // Explicit typed closure + expect { return "2" }.toNot(throwError { (error: EquatableError) in }) + // Typed closure over errorType argument + expect { return "3" }.toNot(throwError(errorType: EquatableError.self) { error in }) + // Typed closure over error argument + expect { return "4" }.toNot(throwError(NimbleError.laugh) { (error: Error) in }) + // Typed closure over error argument + expect { return "5" }.toNot(throwError(NimbleError.laugh) { (error: Error) in }) + + // swiftlint:enable unused_closure_parameter + } + + func testChainOnThrowError() { + expect { () throws -> Int in return 5 }.toNot(throwError()).to(equal(5)) + } } 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 0079f23..df6b0aa 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 @@ -1,7 +1,7 @@ import XCTest import Nimble -final class ToSucceedTest: XCTestCase, XCTestCaseProvider { +final class ToSucceedTest: XCTestCase { func testToSucceed() { expect({ return .succeeded diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/PredicateTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/PredicateTest.swift new file mode 100644 index 0000000..3fd5615 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/PredicateTest.swift @@ -0,0 +1,28 @@ +import XCTest +import Nimble + +final class PredicateTest: XCTestCase { + func testDefineDefaultMessage() { + failsWithErrorMessage("expected to match, got <1>") { + expect(1).to(Predicate.define { _, msg in PredicateResult(status: .fail, message: msg) }) + } + } + + func testDefineNilableDefaultMessage() { + failsWithErrorMessage("expected to match, got <1>") { + expect(1).to(Predicate.defineNilable { _, msg in PredicateResult(status: .fail, message: msg) }) + } + } + + func testSimpleDefaultMessage() { + failsWithErrorMessage("expected to match, got <1>") { + expect(1).to(Predicate.simple { _ in .fail }) + } + } + + func testSimpleNilableDefaultMessage() { + failsWithErrorMessage("expected to match, got <1>") { + expect(1).to(Predicate.simpleNilable { _ in .fail }) + } + } +} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/SynchronousDeprecatedTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/SynchronousDeprecatedTest.swift new file mode 100644 index 0000000..ed305f0 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/SynchronousDeprecatedTest.swift @@ -0,0 +1,98 @@ +import Foundation +import XCTest +import Nimble + +@available(*, deprecated) +final class SynchronousDeprecatedTest: XCTestCase { + 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) + } + + func testToProvidesActualValueExpression() { + var value: Int? + expect(1).to(MatcherFunc { expr, _ in value = try expr.evaluate(); return true }) + expect(value).to(equal(1)) + } + + func testToProvidesAMemoizedActualValueExpression() { + var callCount = 0 + expect { callCount += 1 }.to(MatcherFunc { expr, _ in + _ = try expr.evaluate() + _ = try expr.evaluate() + return true + }) + expect(callCount).to(equal(1)) + } + + func testToProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl() { + var callCount = 0 + expect { callCount += 1 }.to(MatcherFunc { expr, _ in + expect(callCount).to(equal(0)) + _ = try expr.evaluate() + return true + }) + expect(callCount).to(equal(1)) + } + + // repeated tests from to() for toNot() + 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) + } + + func testToNotProvidesActualValueExpression() { + var value: Int? + expect(1).toNot(MatcherFunc { expr, _ in value = try expr.evaluate(); return false }) + expect(value).to(equal(1)) + } + + func testToNotProvidesAMemoizedActualValueExpression() { + var callCount = 0 + expect { callCount += 1 }.toNot(MatcherFunc { expr, _ in + _ = try expr.evaluate() + _ = try expr.evaluate() + return false + }) + expect(callCount).to(equal(1)) + } + + func testToNotProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl() { + var callCount = 0 + expect { callCount += 1 }.toNot(MatcherFunc { expr, _ in + expect(callCount).to(equal(0)) + _ = try expr.evaluate() + return false + }) + 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) + } + } + + 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) + } + } + + func testNotToMatchesLikeToNot() { + expect(1).notTo(MatcherFunc { _, _ in false }) + expect(1).notTo(MatcherFunc { _, _ in false }.predicate) + } +} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/SynchronousTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/SynchronousTest.swift index 1f412dd..cab4e52 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/SynchronousTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/SynchronousTest.swift @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -final class SynchronousTest: XCTestCase, XCTestCaseProvider { +final class SynchronousTest: XCTestCase { class Error: Swift.Error {} let errorToThrow = Error() @@ -29,38 +29,32 @@ 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 }) + expect(1).to(Predicate.simple { _ in .matches }) + expect {1}.to(Predicate.simple { _ in .matches }) } func testToProvidesActualValueExpression() { var value: Int? - expect(1).to(MatcherFunc { expr, _ in value = try expr.evaluate(); return true }) + expect(1).to(Predicate.simple { expr in value = try expr.evaluate(); return .matches }) expect(value).to(equal(1)) } func testToProvidesAMemoizedActualValueExpression() { var callCount = 0 - expect { callCount += 1 }.to(MatcherFunc { expr, _ in + expect { callCount += 1 }.to(Predicate.simple { expr in _ = try expr.evaluate() _ = try expr.evaluate() - return true + return .matches }) expect(callCount).to(equal(1)) } func testToProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl() { var callCount = 0 - expect { callCount += 1 }.to(MatcherFunc { expr, _ in + expect { callCount += 1 }.to(Predicate.simple { expr in expect(callCount).to(equal(0)) _ = try expr.evaluate() - return true + return .matches }) expect(callCount).to(equal(1)) } @@ -74,69 +68,61 @@ final class SynchronousTest: XCTestCase, XCTestCaseProvider { // repeated tests from to() for toNot() 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 }) + expect(1).toNot(Predicate.simple { _ in .doesNotMatch }) + expect {1}.toNot(Predicate.simple { _ in .doesNotMatch }) } func testToNotProvidesActualValueExpression() { var value: Int? - expect(1).toNot(MatcherFunc { expr, _ in value = try expr.evaluate(); return false }) + expect(1).toNot(Predicate.simple { expr in value = try expr.evaluate(); return .doesNotMatch }) expect(value).to(equal(1)) } func testToNotProvidesAMemoizedActualValueExpression() { var callCount = 0 - expect { callCount += 1 }.toNot(MatcherFunc { expr, _ in + expect { callCount += 1 }.toNot(Predicate.simple { expr in _ = try expr.evaluate() _ = try expr.evaluate() - return false + return .doesNotMatch }) expect(callCount).to(equal(1)) } func testToNotProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl() { var callCount = 0 - expect { callCount += 1 }.toNot(MatcherFunc { expr, _ in + expect { callCount += 1 }.toNot(Predicate.simple { expr in expect(callCount).to(equal(0)) _ = try expr.evaluate() - return false + return .doesNotMatch }) 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 }) + expect(1).to(Predicate.simple { _ 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 }) + expect(1).toNot(Predicate.simple { _ 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 }) + expect(1).notTo(Predicate.simple { _ in .doesNotMatch }) + } + + // MARK: Assertion chaining + + func testChain() { + expect(2).toNot(equal(1)).to(equal(2)).notTo(equal(3)) + } + + func testChainFail() { + failsWithErrorMessage(["expected to not equal <2>, got <2>", "expected to equal <3>, got <2>"]) { + expect(2).toNot(equal(1)).toNot(equal(2)).to(equal(3)) + } } } 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 0c451c8..71feb9b 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/UserDescriptionTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/UserDescriptionTest.swift @@ -1,7 +1,7 @@ import XCTest import Nimble -final class UserDescriptionTest: XCTestCase, XCTestCaseProvider { +final class UserDescriptionTest: XCTestCase { func testToMatcher_CustomFailureMessage() { failsWithErrorMessage( """ @@ -9,7 +9,7 @@ final class UserDescriptionTest: XCTestCase, XCTestCaseProvider { expected to match, got <1> """ ) { - expect(1).to(MatcherFunc { _, _ in false }, description: "These aren't equal!") + expect(1).to(Predicate.simple { _ in .doesNotMatch }, description: "These aren't equal!") } } @@ -20,7 +20,7 @@ final class UserDescriptionTest: XCTestCase, XCTestCaseProvider { expected to not match, got <1> """ ) { - expect(1).notTo(MatcherFunc { _, _ in true }, description: "These aren't equal!") + expect(1).notTo(Predicate.simple { _ in .matches }, description: "These aren't equal!") } } @@ -31,7 +31,7 @@ final class UserDescriptionTest: XCTestCase, XCTestCaseProvider { expected to not match, got <1> """ ) { - expect(1).toNot(MatcherFunc { _, _ in true }, description: "These aren't equal!") + expect(1).toNot(Predicate.simple { _ in .matches }, description: "These aren't 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 deleted file mode 100644 index e0fcd0a..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/XCTestManifests.swift +++ /dev/null @@ -1,386 +0,0 @@ -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/ObjCSyncTest.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCSyncTest.m index 2aae816..64b6a05 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCSyncTest.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/Tests/NimbleTests/objc/ObjCSyncTest.m @@ -18,4 +18,16 @@ }); } +#pragma mark - Assertion chaining + +- (void)testChain { + expect(@2).toNot(equal(@1)).to(equal(@2)).notTo(equal(@3)); +} + +- (void)testChainFail { + expectFailureMessages((@[@"expected to not equal <2>, got <2>", @"expected to equal <3>, got <2>"]), ^{ + expect(@2).toNot(equal(@1)).toNot(equal(@2)).to(equal(@3)); + }); +} + @end diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/script/release b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/script/release index f61c0dc..20d15e9 100755 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/script/release +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/script/release @@ -3,7 +3,7 @@ REMOTE_BRANCH=master POD_NAME=Nimble PODSPEC=Nimble.podspec -POD=${COCOAPODS:-pod} +POD=${COCOAPODS:-"bundle exec pod"} function help { echo "Usage: release VERSION RELEASE_NOTES [-f]" @@ -173,7 +173,7 @@ echo echo "Pushing to pod trunk..." # NOTE: remove allow-warnings after v9.0.0 of Nimble -$POD trunk push "$PODSPEC" --allow-warnings +$POD trunk push "$PODSPEC" --allow-warnings --skip-import-validation echo echo "================ Finalizing the Release ================" diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/test b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/test index c213afe..7e5eec3 100755 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/test +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Nimble/test @@ -7,12 +7,14 @@ if which xcodebuild > /dev/null; then echo -e "Gathering ${GREEN}xcodebuild sdk versions${CLEAR}..." BUILD_DIR=`pwd`/build LATEST_IOS_SDK_VERSION=`xcodebuild -showsdks | grep iphonesimulator | cut -d ' ' -f 4 | ruby -e 'puts STDIN.read.chomp.split("\n").last'` + LATEST_IOS_VERSION=`xcrun simctl list | grep ^iOS | ruby -e 'puts /\(([0-9.]+).*\)/.match(STDIN.read.chomp.split("\n").last).to_a[1]'` LATEST_TVOS_SDK_VERSION=`xcodebuild -showsdks | grep appletvsimulator | cut -d ' ' -f 4 | ruby -e 'puts STDIN.read.chomp.split("\n").last'` - LATEST_MACOS_SDK_VERSION=`xcodebuild -showsdks | grep 'macosx' | cut -d ' ' -f 3 | ruby -e 'puts STDIN.read.chomp.split("\n").last'` + LATEST_TVOS_VERSION=`xcrun simctl list | grep ^tvOS | ruby -e 'puts /\(([0-9.]+).*\)/.match(STDIN.read.chomp.split("\n").last).to_a[1]'` + LATEST_MACOS_SDK_VERSION=`xcodebuild -showsdks | grep 'macosx' | cut -d ' ' -f 2 | ruby -e 'puts STDIN.read.chomp.split("\n").last'` BUILD_IOS_SDK_VERSION=${NIMBLE_BUILD_IOS_SDK_VERSION:-$LATEST_IOS_SDK_VERSION} - RUNTIME_IOS_SDK_VERSION=${NIMBLE_RUNTIME_IOS_SDK_VERSION:-$LATEST_IOS_SDK_VERSION} + RUNTIME_IOS_VERSION=${NIMBLE_RUNTIME_IOS_VERSION:-$LATEST_IOS_VERSION} BUILD_TVOS_SDK_VERSION=${NIMBLE_BUILD_TVOS_SDK_VERSION:-$LATEST_TVOS_SDK_VERSION} - RUNTIME_TVOS_SDK_VERSION=${NIMBLE_RUNTIME_TVOS_SDK_VERSION:-$LATEST_TVOS_SDK_VERSION} + RUNTIME_TVOS_VERSION=${NIMBLE_RUNTIME_TVOS_VERSION:-$LATEST_TVOS_VERSION} BUILD_MACOS_SDK_VERSION=${NIMBLE_BUILD_MACOS_SDK_VERSION:-$LATEST_MACOS_SDK_VERSION} fi @@ -33,12 +35,12 @@ function print_env { echo " iOS:" echo " Latest iOS SDK: $LATEST_IOS_SDK_VERSION" echo " Building with iOS SDK: `color_if_overridden $BUILD_IOS_SDK_VERSION $NIMBLE_BUILD_IOS_SDK_VERSION`" - echo " Running with iOS SDK: `color_if_overridden $RUNTIME_IOS_SDK_VERSION $NIMBLE_RUNTIME_IOS_SDK_VERSION`" + echo " Running with iOS: `color_if_overridden $RUNTIME_IOS_VERSION $NIMBLE_RUNTIME_IOS_VERSION`" echo echo " tvOS:" echo " Latest tvOS SDK: $LATEST_TVOS_SDK_VERSION" echo " Building with tvOS SDK: `color_if_overridden $BUILD_TVOS_SDK_VERSION $NIMBLE_BUILD_TVOS_SDK_VERSION`" - echo " Running with tvOS SDK: `color_if_overridden $RUNTIME_TVOS_SDK_VERSION $NIMBLE_RUNTIME_TVOS_SDK_VERSION`" + echo " Running with tvOS: `color_if_overridden $RUNTIME_TVOS_VERSION $NIMBLE_RUNTIME_TVOS_VERSION`" echo echo " macOS:" echo " Latest macOS SDK: $LATEST_MACOS_SDK_VERSION" @@ -54,39 +56,59 @@ function run { } function test_ios { - run osascript -e 'tell app "Simulator" to quit' - run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -sdk "iphonesimulator$BUILD_IOS_SDK_VERSION" -destination "name=iPad Air,OS=$RUNTIME_IOS_SDK_VERSION" build-for-testing test-without-building + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -destination "generic/platform=iOS" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build | xcpretty run osascript -e 'tell app "Simulator" to quit' - run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -sdk "iphonesimulator$BUILD_IOS_SDK_VERSION" -destination "name=iPhone 5s,OS=$RUNTIME_IOS_SDK_VERSION" build-for-testing test-without-building + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -sdk "iphonesimulator$BUILD_IOS_SDK_VERSION" -destination "name=iPad Pro (9.7-inch),OS=$RUNTIME_IOS_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty + + run osascript -e 'tell app "Simulator" to quit' + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -sdk "iphonesimulator$BUILD_IOS_SDK_VERSION" -destination "name=iPhone 8,OS=$RUNTIME_IOS_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty } function test_tvos { + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-tvOS" -configuration "Debug" -destination "generic/platform=tvOS" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build | xcpretty + run osascript -e 'tell app "Simulator" to quit' - run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-tvOS" -configuration "Debug" -sdk "appletvsimulator$BUILD_TVOS_SDK_VERSION" -destination "name=Apple TV,OS=$RUNTIME_TVOS_SDK_VERSION" build-for-testing test-without-building + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-tvOS" -configuration "Debug" -sdk "appletvsimulator$BUILD_TVOS_SDK_VERSION" -destination "name=Apple TV,OS=$RUNTIME_TVOS_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty } function test_macos { - run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-macOS" -configuration "Debug" -sdk "macosx$BUILD_MACOS_SDK_VERSION" build-for-testing test-without-building + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-macOS" -configuration "Debug" -sdk "macosx$BUILD_MACOS_SDK_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty +} + +function test_xcode_spm_macos { + mv Nimble.xcodeproj Nimble.xcodeproj.bak + trap 'mv Nimble.xcodeproj.bak Nimble.xcodeproj' EXIT + run set -o pipefail && xcodebuild -scheme "Nimble" -configuration "Debug" -sdk "macosx$BUILD_MACOS_SDK_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty +} + +function test_xcode_spm_ios { + run osascript -e 'tell app "Simulator" to quit' + mv Nimble.xcodeproj Nimble.xcodeproj.bak + trap 'mv Nimble.xcodeproj.bak Nimble.xcodeproj' EXIT + run set -o pipefail && xcodebuild -scheme "Nimble" -configuration "Debug" -sdk "iphonesimulator$BUILD_IOS_SDK_VERSION" -destination "name=iPhone 8,OS=$RUNTIME_IOS_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty +} + +function test_xcode_spm_tvos { + run osascript -e 'tell app "Simulator" to quit' + mv Nimble.xcodeproj Nimble.xcodeproj.bak + trap 'mv Nimble.xcodeproj.bak Nimble.xcodeproj' EXIT + run set -o pipefail && xcodebuild -scheme "Nimble" -configuration "Debug" -sdk "appletvsimulator$BUILD_TVOS_SDK_VERSION" -destination "name=Apple TV,OS=$RUNTIME_TVOS_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty } 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 --skip-import-validation - run mv .swift-version.backup .swift-version + run bundle exec pod lib lint Nimble.podspec --allow-warnings --skip-import-validation --verbose } function test_swiftpm { if [ -d .build ]; then run swift package clean fi - run swift build && swift test + run swift build -Xswiftc -suppress-warnings && swift test -Xswiftc -suppress-warnings --enable-test-discovery } function test_swiftpm_docker { @@ -95,9 +117,17 @@ function test_swiftpm_docker { } function test() { + test_macos test_ios test_tvos - test_macos + + if xcodebuild --help 2>&1 | grep xcframework > /dev/null; then + test_xcode_spm_macos + test_xcode_spm_ios + test_xcode_spm_tvos + else + echo "Not testing with Swift Package Manager version of Xcode because it requires at least Xcode 11" + fi if which swift-test; then test_swiftpm @@ -123,12 +153,15 @@ function help { echo " all - Runs the all tests of macos, ios and tvos" echo " clean - Cleans the derived data directory of Xcode. Assumes default location" echo " help - Displays this help" - echo " ios - Runs the tests as an iOS device" echo " macos - Runs the tests on macOS 10.10 (Yosemite and newer only)" + echo " macos_xcodespm - Runs the tests on macOS using the Swift Package Manager version of Xcode" + echo " ios - Runs the tests as an iOS device" + echo " ios_xcodespm - Runs the tests as an iOS device using the Swift Package Manager version of Xcode" + echo " tvos - Runs the tests as an tvOS device" + echo " tvos_xcodespm - Runs the tests as an tvOS device using the Swift Package Manager version of Xcode" echo " podspec - Runs pod lib lint against the podspec to detect breaking changes" echo " swiftpm - Runs the tests built by the Swift Package Manager" echo " swiftpm_docker - Runs the tests built by the Swift Package Manager in a docker linux container" - echo " tvos - Runs the tests as an tvOS device" echo exit 1 } @@ -140,8 +173,11 @@ function main { case "$arg" in clean) clean ;; ios) test_ios ;; + ios_xcodespm) test_xcode_spm_ios ;; tvos) test_tvos ;; + tvos_xcodespm) test_xcode_spm_tvos ;; macos) test_macos ;; + macos_xcodespm) test_xcode_spm_macos ;; podspec) test_podspec ;; test) test ;; all) test ;; diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.github/ISSUE_TEMPLATE b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.github/ISSUE_TEMPLATE index ebe5a2b..5a6346f 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.github/ISSUE_TEMPLATE +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.github/ISSUE_TEMPLATE @@ -24,7 +24,7 @@ List the software versions you're using: Please also mention which package manager you used and its version. Delete the other package managers in this list: - - Cocoapods: *?.?.?* (Use `pod --version` in Terminal) + - CocoaPods: *?.?.?* (Use `pod --version` in Terminal) - Carthage: *?.?* (Use `carthage version` in Terminal) - Swift Package Manager *?.?.? (swiftpm-???)* (Use `swift build --version` in Terminal) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.github/workflows/ci.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.github/workflows/ci.yml new file mode 100644 index 0000000..284628b --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.github/workflows/ci.yml @@ -0,0 +1,52 @@ +name: CI + +on: + push: + branches: + - master + tags: + - "*" + pull_request: + +jobs: + cocoapods: + name: CocoaPods Lint & Danger + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - run: bundle install + - run: bundle exec danger + env: + DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - run: PODSPEC=1 ./script/travis-script-macos + + xcode: + name: Xcode ${{ matrix.xcode }} (${{ matrix.platform }}) + runs-on: macos-latest + strategy: + matrix: + xcode: [11.5] + platform: ["macos", "ios", "tvos"] + fail-fast: false + env: + DEVELOPER_DIR: "/Applications/Xcode_${{ matrix.xcode }}.app" + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - run: PLATFORM=${{ matrix.platform }} ./script/travis-script-macos + - if: ${{ matrix.platform == 'macos' }} + run: PLATFORM=${{ matrix.platform }}_static ./script/travis-script-macos + + swiftpm_darwin: + name: SwiftPM, Darwin, Xcode ${{ matrix.xcode }} + runs-on: macos-latest + strategy: + matrix: + xcode: [11.5] + fail-fast: false + env: + DEVELOPER_DIR: "/Applications/Xcode_${{ matrix.xcode }}.app" + steps: + - uses: actions/checkout@v2 + - run: PLATFORM=swiftpm ./script/travis-script-macos diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.github/workflows/swiftlint.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.github/workflows/swiftlint.yml new file mode 100644 index 0000000..c10adfe --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.github/workflows/swiftlint.yml @@ -0,0 +1,15 @@ +name: SwiftLint + +on: + pull_request: + paths: + - '.github/workflows/swiftlint.yml' + - '.swiftlint.yml' + - '**/*.swift' + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: norio-nomura/action-swiftlint@3.1.0 diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.hound.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.hound.yml deleted file mode 100644 index 5a66441..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.hound.yml +++ /dev/null @@ -1,4 +0,0 @@ -swift: - 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 deleted file mode 100644 index fae6e3d..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.swift-version +++ /dev/null @@ -1 +0,0 @@ -4.2.1 diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.swiftlint.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.swiftlint.yml index 79cda08..092aa07 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.swiftlint.yml +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.swiftlint.yml @@ -1,8 +1,11 @@ disabled_rules: - - line_length - - type_name - - function_body_length - - identifier_name included: - Sources - Tests + +line_length: + warning: 160 + error: 240 + +trailing_comma: + mandatory_comma: true diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.travis.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.travis.yml index 960afba..ff392d5 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.travis.yml +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/.travis.yml @@ -1,48 +1,37 @@ +branches: + only: + - master + language: generic -matrix: +jobs: include: - - 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: - - XCODE_ACTION="build-for-testing test-without-building" - osx_image: xcode10.1 - script: - - PLATFORM=macos ./script/travis-script-macos - - PLATFORM=macos_static ./script/travis-script-macos - - PLATFORM=ios ./script/travis-script-macos - - PLATFORM=tvos ./script/travis-script-macos - - <<: *xcode - name: Xcode 10.2 / Swift 5.0 - osx_image: xcode10.2 - - &swiftpm_darwin - name: SwiftPM / Darwin / Swift 4.2 - os: osx - osx_image: xcode10.1 - script: PLATFORM=swiftpm ./script/travis-script-macos - - <<: *swiftpm_darwin - name: SwiftPM / Darwin / Swift 5.0 - osx_image: xcode10.2 + # - &xcode + # name: Xcode 10.1 / Swift 4.2 + # os: osx + # env: + # - XCODE_ACTION="build-for-testing test-without-building" + # osx_image: xcode10.1 + # script: + # - PLATFORM=macos ./script/travis-script-macos + # - PLATFORM=macos_static ./script/travis-script-macos + # - PLATFORM=ios ./script/travis-script-macos + # - PLATFORM=tvos ./script/travis-script-macos + # - &swiftpm_darwin + # name: SwiftPM / Darwin / Swift 4.2 + # os: osx + # osx_image: xcode10.1 + # script: PLATFORM=swiftpm ./script/travis-script-macos - &swiftpm_linux - name: SwiftPM / Linux / Swift 4.2 + name: SwiftPM / Linux / Swift 5.2.4 os: linux - sudo: required - dist: trusty env: - - SWIFT_VERSION=4.2.1 - install: ./script/travis-install-linux - script: ./script/travis-script-linux + - SWIFT_VERSION=5.2.4 + install: eval "$(curl -sL https://swiftenv.fuller.li/install.sh)" + script: rake test:swiftpm - <<: *swiftpm_linux - name: SwiftPM / Linux / Swift 5.0 Development + name: SwiftPM / Linux / Swift 5.3 Development env: - - SWIFT_VERSION=5.0-DEVELOPMENT-SNAPSHOT-2019-02-28-a + - SWIFT_VERSION=5.3-DEVELOPMENT-SNAPSHOT-2020-05-19-a notifications: email: false diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/CONTRIBUTING.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/CONTRIBUTING.md index e8e32c1..a57b74c 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/CONTRIBUTING.md +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/CONTRIBUTING.md @@ -39,7 +39,7 @@ Be sure to include in your issue: - What are the steps to reproduce this issue? - What platform are you using? (eg - OS X, iOS, watchOS, tvOS) - If the problem is on a UI Testing Bundle, Unit Testing Bundle, or some other target configuration -- Are you using carthage or cocoapods? +- Are you using Carthage or CocoaPods? ## Building the Project diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Dangerfile b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Dangerfile index ff6259f..e9e3128 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Dangerfile +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Dangerfile @@ -1,5 +1,5 @@ # set the number of lines that must be changed before this classifies as a 'Big PR' -@SDM_DANGER_BIG_PR_LINES = 50 +@SDM_DANGER_BIG_PR_LINES = 200 # set the files to watch and fail if there are changes @SDM_DANGER_IMMUTABLE_FILES = ['LICENSE', 'CODE_OF_CONDUCT.md'] @@ -47,7 +47,3 @@ end if github.pr_body.length < 5 warn "Please provide a summary in the Pull Request description" end - -swiftlint.config_file = '.swiftlint.yml' -swiftlint.lint_files - diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/en-us/InstallingQuick.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/en-us/InstallingQuick.md index 258956f..55c19d6 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/en-us/InstallingQuick.md +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/en-us/InstallingQuick.md @@ -11,7 +11,8 @@ There are three recommended ways of linking Quick to your tests: 1. [Git Submodules](#git-submodules) 2. [CocoaPods](#cocoapods) 3. [Carthage](#carthage) -4. [Swift Package Manager (experimental)](#swift-package-manager) +4. [Accio](#accio) +5. [Swift Package Manager (experimental)](#swift-package-manager) Choose one and follow the instructions below. Once you've completed them, you should be able to `import Quick` from within files in your test target. @@ -21,7 +22,7 @@ you should be able to `import Quick` from within files in your test target. To link Quick and Nimble using Git submodules: 1. Add submodule for Quick. -2. If you don't already have a `.xcworkspace` for your project, create one. ([Here's how](https://developer.apple.com/library/ios/recipes/xcode_help-structure_navigator/articles/Adding_an_Existing_Project_to_a_Workspace.html)) +2. If you don't already have a `.xcworkspace` for your project, create one. ([Here's how](https://help.apple.com/xcode/mac/11.4/#/devf5378fca9)) 3. Add `Quick.xcodeproj` to your project's `.xcworkspace`. 4. Add `Nimble.xcodeproj` to your project's `.xcworkspace`. It exists in `path/to/Quick/Externals/Nimble`. By adding Nimble from Quick's dependencies (as opposed to adding directly as a submodule), you'll ensure that you're using the correct version of Nimble for whatever version of Quick you're using. 5. Link `Quick.framework` and `Nimble.framework` in your test target's @@ -140,6 +141,27 @@ to copy them to the target's Frameworks destination. This is not "the one and only way" to use Carthage to manage dependencies. For further reference check out the [Carthage documentation](https://github.com/Carthage/Carthage/blob/master/README.md). +## [Accio](https://github.com/JamitLabs/Accio) + +Add the following to your Package.swift: + +```swift +.package(url: "https://github.com/Quick/Quick.git", .upToNextMajor(from: "2.0.0")), +``` + +Next, add `Quick` to your App test targets dependencies like so: + +```swift +.testTarget( + name: "AppTests", + dependencies: [ + "Quick", + ] +), +``` + +Then run `accio update`. + ## [Swift Package Manager](https://github.com/apple/swift-package-manager) With the advent of the [swift.org](https://swift.org) open-source project, Swift now has an official, though nascent, package manager tool. Notably, this provides the possibility of using Quick on non-Apple platforms for the first time. Initial steps have been taken to allow using Quick to test projects using the Swift Package Manager, although frequent breakage is expected at this point since the tool is still under heavy development. diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/en-us/SharedExamples.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/en-us/SharedExamples.md index 1f14e64..bd670e1 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 @@ -7,6 +7,75 @@ eats something `Edible`, the dolphin becomes happy. `Mackerel` and `Cod` are both edible. Quick allows you to easily test that a dolphin is happy to eat either one. +```swift +protocol Edible { } + +class Dolphin { + private(set) var isHappy: Bool + + init(happy: Bool) { + self.isHappy = happy + } + + /// Makes Doplhin happy + func eat(_ edible: Edible) { + isHappy = true + } +} + +class Mackerel: Edible { } +class Cod: Edible { } +``` + +## Behavior + +The code below defines a `Behavior` object with a set of reusable +examples. It also specifies that both mackerel and cod behave +like `SomethingEdible`: + +```swift +class SomethingEdible: Behavior { + override class func spec(_ context: @escaping () -> Edible) { + var edible: Edible! + beforeEach { + edible = context() + } + + it("makes dolphins happy") { + let dolphin = Dolphin(happy: false) + dolphin.eat(edible) + expect(dolphin.isHappy).to(beTruthy()) + } + } +} + +class MackerelSpec: QuickSpec { + override func spec() { + var mackerel: Mackerel! + beforeEach { + mackerel = Mackerel() + } + + itBehavesLike(SomethingEdible.self) { mackerel } + } +} + +class CodSpec: QuickSpec { + override func spec() { + var cod: Cod! + beforeEach { + cod = Cod() + } + + itBehavesLike(SomethingEdible.self) { cod } + } +} +``` + +Because `Behavior` uses Swift generics, it's not possible to use it from Objective-C. + +## Shared Examples + The example below defines a set of "shared examples" for "something edible", and specifies that both mackerel and cod behave like "something edible": @@ -62,13 +131,13 @@ QuickConfigurationBegin(EdibleSharedExamplesConfiguration) + (void)configure:(Configuration *configuration) { sharedExamples(@"something edible", ^(QCKDSLSharedExampleContext exampleContext) { - it(@"makes dolphins happy") { + it(@"makes dolphins happy", ^{ Dolphin *dolphin = [[Dolphin alloc] init]; dolphin.happy = NO; id edible = exampleContext()[@"edible"]; [dolphin eat:edible]; expect(dolphin.isHappy).to(beTruthy()) - } + }); }); } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ja/InstallingQuick.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ja/InstallingQuick.md index 884b8a5..88182e4 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ja/InstallingQuick.md +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ja/InstallingQuick.md @@ -21,7 +21,7 @@ Quick をテストに組み込むには3つの方法があります。 Git submodules を使って Quick と Nimble をリンクします。手順の流れとしては下記の通りです。 1. Quick を submodule として追加. -2. プロジェクトで`.xcworkspace`を使っていなければ作成してください。 ([こちらを参照](https://developer.apple.com/library/ios/recipes/xcode_help-structure_navigator/articles/Adding_an_Existing_Project_to_a_Workspace.html)) +2. プロジェクトで`.xcworkspace`を使っていなければ作成してください。 ([こちらを参照](https://help.apple.com/xcode/mac/11.4/#/devf5378fca9)) 3. `Quick.xcodeproj` をプロジェクトの`.xcworkspace`に追加してください。 4. `Nimble.xcodeproj` をプロジェクトの`.xcworkspace`に追加してください。 `Nimble.xcodeproj` は `path/to/Quick/Externals/Nimble` にあります。 Quick が依存している Niimble を追加することで Quick のバージョンと Nimble のバージョンを合わせられます。 diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ja/SharedExamples.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ja/SharedExamples.md index a1670d2..bd681d0 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ja/SharedExamples.md +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ja/SharedExamples.md @@ -18,8 +18,8 @@ import Quick import Nimble class EdibleSharedExamplesConfiguration: QuickConfiguration { - override class func configure(configuration: Configuration) { - sharedExamples("something edible") { (sharedExampleContext: SharedExampleContext) in + override class func configure(_ configuration: Configuration) { + sharedExamples("something edible") { (sharedExampleContext: @escaping SharedExampleContext) in it("makes dolphins happy") { let dolphin = Dolphin(happy: false) let edible = sharedExampleContext()["edible"] @@ -63,13 +63,13 @@ QuickConfigurationBegin(EdibleSharedExamplesConfiguration) + (void)configure:(Configuration *configuration) { sharedExamples(@"something edible", ^(QCKDSLSharedExampleContext exampleContext) { - it(@"makes dolphins happy") { + it(@"makes dolphins happy", ^{ Dolphin *dolphin = [[Dolphin alloc] init]; dolphin.happy = NO; id edible = exampleContext()[@"edible"]; [dolphin eat:edible]; expect(dolphin.isHappy).to(beTruthy()) - } + }); }); } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ko-kr/InstallingQuick.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ko-kr/InstallingQuick.md index 6b875d5..70bb1af 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 @@ -18,7 +18,7 @@ Quick은 예제들과 예제 그룹을 정의하는 구문을 제공합니다. N Git 서브 모듈을 사용하여 Quick과 Nimble을 링크하려면: 1. Quick 서브 모듈을 추가하세요. -2. `.xcworkspace` 가 프로젝트에 아직 없는 경우, 만드세요. ([방법은 이곳에](https://developer.apple.com/library/ios/recipes/xcode_help-structure_navigator/articles/Adding_an_Existing_Project_to_a_Workspace.html)) +2. `.xcworkspace` 가 프로젝트에 아직 없는 경우, 만드세요. ([방법은 이곳에](https://help.apple.com/xcode/mac/11.4/#/devf5378fca9)) 3. `Quick.xcodeproj`를 프로젝트의 `.xcworkspace` 에 추가하세요. 4. `Nimble.xcodeproj` 또한 프로젝트의 `.xcworkspace` 에 추가하세요. `path/to/Quick/Externals/Nimble` 에 있습니다. Quick의 종속성에서 Nimble을 추가하면 (하위 모듈에서 바로 추가하는 것과 대조적으로), 당신이 사용하고 있는 Quick의 버전에 맞는 Nimble의 올바른 버전을 사용할 수 있게 됩니다. 5. `Quick.framework`와 `Nimble.framework`를 test target 프로젝트의 "Link Binary with Libraries" build phase에 링크시키세요. diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ko-kr/SharedExamples.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ko-kr/SharedExamples.md index ebc1c9a..5a89075 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ko-kr/SharedExamples.md +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/ko-kr/SharedExamples.md @@ -15,7 +15,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"] @@ -59,13 +59,13 @@ QuickConfigurationBegin(EdibleSharedExamplesConfiguration) + (void)configure:(Configuration *configuration) { sharedExamples(@"something edible", ^(QCKDSLSharedExampleContext exampleContext) { - it(@"makes dolphins happy") { + it(@"makes dolphins happy", ^{ Dolphin *dolphin = [[Dolphin alloc] init]; dolphin.happy = NO; id edible = exampleContext()[@"edible"]; [dolphin eat:edible]; expect(dolphin.isHappy).to(beTruthy()) - } + }); }); } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/pt-br/SharedExamples.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/pt-br/SharedExamples.md index eabde35..dacd2b0 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/pt-br/SharedExamples.md +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/pt-br/SharedExamples.md @@ -15,7 +15,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"] @@ -59,13 +59,13 @@ QuickConfigurationBegin(EdibleSharedExamplesConfiguration) + (void)configure:(Configuration *configuration) { sharedExamples(@"something edible", ^(QCKDSLSharedExampleContext exampleContext) { - it(@"makes dolphins happy") { + it(@"makes dolphins happy", ^{ Dolphin *dolphin = [[Dolphin alloc] init]; dolphin.happy = NO; id edible = exampleContext()[@"edible"]; [dolphin eat:edible]; expect(dolphin.isHappy).to(beTruthy()) - } + }); }); } @@ -113,4 +113,4 @@ itBehavesLike("everything under the sea") > Em Objective-C, é necessário passar um bloco que recebe um `QCKDSLSharedExampleContext`, mesmo se esse argumento não for usado. Desculpe, mas é assim que a banda toca! :trumpet: :notes: -Também é possível "focar" exemplos compartilhados usando a função `fitBehavesLike`. \ No newline at end of file +Também é possível "focar" exemplos compartilhados usando a função `fitBehavesLike`. diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/zh-cn/InstallingQuick.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/zh-cn/InstallingQuick.md index 2f54b0a..78f2dfe 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/zh-cn/InstallingQuick.md +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/zh-cn/InstallingQuick.md @@ -21,7 +21,7 @@ Quick 提供了定义例子和例子群的语法。 Nimble 提供了如 `expect( 通过以下步骤可以使用 Git 的子模块(submodules) 为项目添加 Quick 和 Nimble : 1. 添加子模块 Quick。 -2. 为你的项目新建一个 `.xcworkspace` 文件,如果原本已经有这个文件,则跳过此步骤。 ([如何添加请看这里](https://developer.apple.com/library/ios/recipes/xcode_help-structure_navigator/articles/Adding_an_Existing_Project_to_a_Workspace.html)) +2. 为你的项目新建一个 `.xcworkspace` 文件,如果原本已经有这个文件,则跳过此步骤。 ([如何添加请看这里](https://help.apple.com/xcode/mac/11.4/#/devf5378fca9)) 3. 把 `Quick.xcodeproj` 添加到项目的 `.xcworkspace`中。 4. 把 `Nimble.xcodeproj` 添加到项目的 `.xcworkspace`中。它所在的目录是: `path/to/Quick/Externals/Nimble`。 通过从 Quick 的依赖库中添加 Nimble (而不是直接添加为子模块),可以确保无论所用的 Quick 是什么版本,都能使用正确版本的 Nimble 。 5. 把 `Quick.framework` 和 `Nimble.framework` 添加到项目 "build phase" 选项页的 "Link Binary with Libraries" 列表中。 diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/zh-cn/SharedExamples.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/zh-cn/SharedExamples.md index ec87138..0fc1948 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/zh-cn/SharedExamples.md +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Documentation/zh-cn/SharedExamples.md @@ -14,7 +14,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"] @@ -58,13 +58,13 @@ QuickConfigurationBegin(EdibleSharedExamplesConfiguration) + (void)configure:(Configuration *configuration) { sharedExamples(@"something edible", ^(QCKDSLSharedExampleContext exampleContext) { - it(@"makes dolphins happy") { + it(@"makes dolphins happy", ^{ Dolphin *dolphin = [[Dolphin alloc] init]; dolphin.happy = NO; id edible = exampleContext()[@"edible"]; [dolphin eat:edible]; expect(dolphin.isHappy).to(beTruthy()) - } + }); }); } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.github/ISSUE_TEMPLATE b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.github/ISSUE_TEMPLATE index 85e591e..1273aff 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.github/ISSUE_TEMPLATE +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.github/ISSUE_TEMPLATE @@ -16,17 +16,17 @@ Please replace this with what happened instead. List the software versions you're using: - - Quick: *?.?.?* - - Nimble: *?.?.?* - - Xcode Version: *?.? (????)* (Open Xcode; In menubar: Xcode > About Xcode) - - Swift Version: *?.?* (Open Xcode Preferences; Components > Toolchains. If none, use `Xcode Default`.) +- Quick: *?.?.?* +- Nimble: *?.?.?* +- Xcode Version: *?.? (????)* (Open Xcode; In menubar: Xcode > About Xcode) +- Swift Version: *?.?* (Open Xcode Preferences; Components > Toolchains. If none, use `Xcode Default`.) Please also mention which package manager you used and its version. Delete the other package managers in this list: - - Cocoapods: *?.?.?* (Use `pod --version` in Terminal) - - Carthage: *?.?* (Use `carthage version` in Terminal) - - Swift Package Manager *?.?.? (swiftpm-???)* (Use `swift build --version` in Terminal) +- Cocoapods: *?.?.?* (Use `pod --version` in Terminal) +- Carthage: *?.?* (Use `carthage version` in Terminal) +- Swift Package Manager *?.?.? (swiftpm-???)* (Use `swift build --version` in Terminal) ### Project that demonstrates the issue diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.github/PULL_REQUEST_TEMPLATE b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.github/PULL_REQUEST_TEMPLATE index 20e40c8..0e3395a 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.github/PULL_REQUEST_TEMPLATE +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.github/PULL_REQUEST_TEMPLATE @@ -1,14 +1,13 @@ The PR should summarize what was changed and why. Here are some questions to help you if you're not sure: - - What behavior was changed? - - What code was refactored / updated to support this change? - - What issues are related to this PR? Or why was this change introduced? +- What behavior was changed? +- What code was refactored / updated to support this change? +- What issues are related to this PR? Or why was this change introduced? Checklist - While not every PR needs it, new features should consider this list: - - [ ] Does this have tests? - - [ ] Does this have documentation? - - [ ] Does this break the public API (Requires major version bump)? - - [ ] Is this a new feature (Requires minor version bump)? - +- [ ] Does this have tests? +- [ ] Does this have documentation? +- [ ] Does this break the public API (Requires major version bump)? +- [ ] Is this a new feature (Requires minor version bump)? diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.github/dependabot.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.github/dependabot.yml new file mode 100644 index 0000000..92e8783 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.github/dependabot.yml @@ -0,0 +1,15 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "bundler" + directory: "/" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.github/workflows/ci.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.github/workflows/ci.yml new file mode 100644 index 0000000..bf604fd --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - "*" + +jobs: + cocoapods: + name: CocoaPods Lint + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - run: bundle install + - run: ./test podspec + + xcode: + name: Xcode ${{ matrix.xcode }} - ${{ matrix.platform }} + runs-on: macos-latest + strategy: + matrix: + xcode: [11.7, 12] + platform: [macos, ios, tvos] + fail-fast: false + env: + DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app + steps: + - uses: actions/checkout@v2 + - run: ./test ${{ matrix.platform }} + - run: ./test ${{ matrix.platform }}_xcodespm + + swiftpm_darwin: + name: SwiftPM, Darwin, Xcode ${{ matrix.xcode }} + runs-on: macos-latest + strategy: + matrix: + xcode: [11.7, 12] + env: + DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app + steps: + - uses: actions/checkout@v2 + - run: ./test swiftpm diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.github/workflows/swiftlint.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.github/workflows/swiftlint.yml new file mode 100644 index 0000000..c10adfe --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.github/workflows/swiftlint.yml @@ -0,0 +1,15 @@ +name: SwiftLint + +on: + pull_request: + paths: + - '.github/workflows/swiftlint.yml' + - '.swiftlint.yml' + - '**/*.swift' + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: norio-nomura/action-swiftlint@3.1.0 diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.hound.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.hound.yml deleted file mode 100644 index b867fd9..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.hound.yml +++ /dev/null @@ -1,2 +0,0 @@ -swift: - config_file: .swiftlint.yml diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.swift-version b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.swift-version deleted file mode 100644 index bf77d54..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.swift-version +++ /dev/null @@ -1 +0,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 146ea6a..47543c6 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.swiftlint.yml +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.swiftlint.yml @@ -6,6 +6,7 @@ included: - Tests excluded: + - Package.swift - Carthage/Checkouts - Tests/NimbleTests/XCTestManifests.swift - Tests/NimbleTests/Helpers/XCTestCaseProvider.swift 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 fb72977..810e5d3 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.travis.yml +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/.travis.yml @@ -1,49 +1,40 @@ -osx_image: xcode10.1 +branches: + only: + - master + language: generic -matrix: +jobs: include: - - os: osx - sudo: required - env: TYPE=podspec - install: bundle install - name: CocoaPods Lint - - os: osx - env: TYPE=ios - name: iOS / Swift 4.2.1 - - os: osx - env: TYPE=tvos - name: tvOS / Swift 4.2.1 - - os: osx - env: TYPE=macos - name: macOS / Swift 4.2.1 - - os: osx - env: TYPE=macos - osx_image: xcode10.2 - name: macOS / Swift 5.0 - - os: osx - env: - - TYPE=swiftpm - - os: osx - env: - - TYPE=swiftpm - osx_image: xcode10.2 - - &linux - name: Linux / Swift 4.2.1 + # - &xcode + # name: Xcode 10.3 / Swift 5.0 + # os: osx + # osx_image: xcode10.3 + # script: + # - ./test macos + # - ./test ios + # - ./test tvos + # - &swiftpm_darwin + # name: SwiftPM / Darwin / Swift 5.0 + # os: osx + # osx_image: xcode10.3 + # script: ./test swiftpm + - &swiftpm_linux + name: SwiftPM / Linux / Swift 5.2.5 os: linux - dist: trusty - sudo: required env: - - TYPE=swiftpm - - SWIFT_VERSION=4.2.1 + - SWIFT_VERSION=5.2.5 install: - - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" - - <<: *linux - name: Linux / Swift 5.0 Development + - eval "$(curl -sL https://swiftenv.fuller.li/install.sh)" + script: + - ./test swiftpm + - <<: *swiftpm_linux + name: SwiftPM / Linux / Swift 5.3 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)" + - SWIFT_VERSION=5.3-DEVELOPMENT-SNAPSHOT-2020-09-04-a + - <<: *swiftpm_linux + name: SwiftPM / Linux / Swift Development + env: + - SWIFT_VERSION=DEVELOPMENT-SNAPSHOT-2020-08-31-a install: true script: - ./test $TYPE 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 23d7e11..a04db39 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,2 @@ -github "mattgallagher/CwlPreconditionTesting" "1e62a726d54c743f4585233f08fcaac7307319b5" +github "mattgallagher/CwlCatchException" ~> 2.0 +github "mattgallagher/CwlPreconditionTesting" ~> 2.0 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 32a1c25..2ba0b9e 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" "1e62a726d54c743f4585233f08fcaac7307319b5" +github "mattgallagher/CwlCatchException" "2.0.0" +github "mattgallagher/CwlPreconditionTesting" "2.0.0" diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/LICENSE.txt b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/LICENSE.txt index ca8f5b8..693a2fe 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/LICENSE.txt +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/LICENSE.txt @@ -1,3 +1,5 @@ +ISC License + Copyright © 2017 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. Permission to use, copy, modify, and/or distribute this software for any diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Package.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Package.swift index c1e2ed8..acee395 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Package.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Package.swift @@ -1,9 +1,14 @@ +// swift-tools-version:5.0 import PackageDescription let package = Package( name: "CwlCatchException", + products: [ + .library(name: "CwlCatchException", targets: ["CwlCatchException"]), + ], targets: [ - Target(name: "CwlCatchException", dependencies: ["CwlCatchExceptionSupport"]), - Target(name: "CwlCatchExceptionSupport") + .target(name: "CwlCatchException", dependencies: [.target(name: "CwlCatchExceptionSupport")]), + .target(name: "CwlCatchExceptionSupport"), + .testTarget(name: "CwlCatchExceptionTests", dependencies: [.target(name: "CwlCatchException")]) ] ) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/README.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/README.md index 0f97b03..1e8a6ec 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/README.md +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/README.md @@ -1,46 +1,18 @@ # CwlCatchException A simple Swift wrapper around an Objective-C `@try`/`@catch` statement that selectively catches Objective-C exceptions by `NSException` subtype, rethrowing if any caught exception is not the expected subtype. -Look at [CwlCatchExceptionTests.swift](https://github.com/mattgallagher/CwlCatchException/blob/master/CwlCatchExceptionTests/CwlCatchExceptionTests.swift?ts=4) for syntax. +Look at [CwlCatchExceptionTests.swift](https://github.com/mattgallagher/CwlCatchException/blob/master/Tests/CwlCatchExceptionTests/CwlCatchExceptionTests.swift) for syntax. + +## Requirements + +From version 2.0.0-beta.1, building CwlCatchException requires Swift 5 or newer and the Swift Package Manager. + +For use with older versions of Swift or other package managers, [use version 1.2.0 or older](https://github.com/mattgallagher/CwlCatchException/tree/1.2.0). ## Adding to your project -This project can be used by direct inclusion in your projects or through any of the Swift Package Manager, CocoaPods or Carthage. - -Minimum requirements are iOS 8 or macOS 10.9. - -### Manual inclusion - -1. In a subdirectory of your project's directory, run `git clone https://github.com/mattgallagher/CwlCatchException.git` -2. Drag the "CwlCatchException.xcodeproj" file from the Finder into your own project's file tree in Xcode -3. Add the "CwlCatchException.framework" from the "Products" folder of the CwlCatchException project's file tree to the "Copy Files (Frameworks)" build phases of any target that you want to include this module. - -That third step is a little tricky if you're unfamiliar with Xcode but it involves: - -a. click on your project in the file tree -b. click on the target to whih you want to add this module -c. select the "Build Phases" tab -d. if you don't already have a "Copy File" build phase with a "Destination: Frameworks", add one using the "+" button in the top left of the tab -e. click the "+" within the "Copy File (Frameworks)" phase and from the list that appears, select the "CwlCatchException.framework" (if there are multiple frameworks with the same name, look for the one that appears *above* the corresponding macOS or iOS CwlCatchException testing target). - -### Swift Package Manager - Add the following to the `dependencies` array in your "Package.swift" file: - .Package(url: "https://github.com/mattgallagher/CwlCatchException.git", majorVersion: 1), + .package(url: "https://github.com/mattgallagher/CwlCatchException.git", from: Version("2.0.0-beta.1")) -Or, if you're using the `swift-tools-version:4.0` package manager, add the following to the `dependencies` array in your "Package.swift" file: - - .package(url: "https://github.com/mattgallagher/CwlCatchException.git", majorVersion: 1) - -### CocoaPods - -Add the following to your target in your "Podfile": - - pod 'CwlCatchException', :git => 'https://github.com/mattgallagher/CwlCatchException.git' - -### Carthage - -Add the following line to your Cartfile: - - git "https://github.com/mattgallagher/CwlCatchException.git" "master" +Or by adding `https://github.com/mattgallagher/CwlCatchException.git`, version 2.0.0-beta.1 or later, to the list of Swift packages for any project in Xcode. diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift index 3e89e23..2cb9b29 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift @@ -3,7 +3,7 @@ // CwlAssertionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -24,12 +24,12 @@ import Foundation import CwlCatchExceptionSupport #endif -private func catchReturnTypeConverter(_ type: T.Type, block: () -> Void) -> T? { +private func catchReturnTypeConverter(_ type: T.Type, block: @escaping () -> Void) -> T? { return catchExceptionOfKind(type, block) as? T } extension NSException { - public static func catchException(in block: () -> Void) -> Self? { + public static func catchException(in block: @escaping () -> Void) -> Self? { return catchReturnTypeConverter(self, block: block) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m index 8cf414f..ff35465 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m @@ -3,7 +3,7 @@ // CwlAssertionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -20,10 +20,7 @@ #import "CwlCatchException.h" -#if !SWIFT_PACKAGE && NON_SWIFT_PACKAGE -__attribute__((visibility("hidden"))) -#endif -NSException* catchExceptionOfKind(Class __nonnull type, __attribute__((noescape)) void (^ __nonnull inBlock)(void)) { +NSException* __nullable catchExceptionOfKind(Class __nonnull type, void (^ __nonnull inBlock)(void)) { @try { inBlock(); } @catch (NSException *exception) { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h index 0c8dd87..eb42378 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h @@ -3,7 +3,7 @@ // CwlCatchException // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -20,13 +20,4 @@ #import -//! Project version number for CwlCatchException. -FOUNDATION_EXPORT double CwlCatchExceptionVersionNumber; - -//! Project version string for CwlCatchException. -FOUNDATION_EXPORT const unsigned char CwlCatchExceptionVersionString[]; - -#if !SWIFT_PACKAGE && NON_SWIFT_PACKAGE -__attribute__((visibility("hidden"))) -#endif -NSException* __nullable catchExceptionOfKind(Class __nonnull type, __attribute__((noescape)) void (^ __nonnull inBlock)(void)); +NSException* __nullable catchExceptionOfKind(Class __nonnull type, void (^ __nonnull inBlock)(void)); diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Package.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Package.swift index 8792aac..d6d183d 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Package.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Package.swift @@ -1,19 +1,27 @@ +// swift-tools-version:5.0 import PackageDescription let package = Package( name: "CwlPreconditionTesting", - targets: [ - Target(name: "CwlPreconditionTesting", dependencies: [ - "CwlMachBadInstructionHandler" - ]), - Target(name: "CwlMachBadInstructionHandler") + products: [ + .library(name: "CwlPreconditionTesting", targets: ["CwlPreconditionTesting", "CwlMachBadInstructionHandler"]), + .library(name: "CwlPosixPreconditionTesting", targets: ["CwlPosixPreconditionTesting"]) ], dependencies: [ - .Package(url: "https://github.com/mattgallagher/CwlCatchException.git", Version(1, 0, 2, prereleaseIdentifiers: ["beta", "3"])), + .package(url: "https://github.com/mattgallagher/CwlCatchException.git", from: "2.0.0") ], - exclude: [ - "Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h", - "Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting.h", - "Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift", + targets: [ + .target( + name: "CwlPreconditionTesting", + dependencies: [ + .target(name: "CwlMachBadInstructionHandler"), + .product(name: "CwlCatchException") + ] + ), + .target( + name: "CwlPosixPreconditionTesting" + ), + .target(name: "CwlMachBadInstructionHandler"), + .testTarget(name: "CwlPreconditionTestingTests", dependencies: ["CwlPreconditionTesting", "CwlPosixPreconditionTesting"]) ] ) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/README.md b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/README.md index a42a5b5..9af31c7 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/README.md +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/README.md @@ -8,66 +8,40 @@ For an extended discussion of this code, please see the Cocoa with Love article: [Partial functions in Swift, Part 2: Catching precondition failures](http://cocoawithlove.com/blog/2016/02/02/partial-functions-part-two-catching-precondition-failures.html) +## Requirements + +From version 2.0.0-beta.1, building CwlPreconditionTesting requires Swift 5 or newer and the Swift Package Manager. + +For use with older versions of Swift or other package managers, [use version 1.2.0 or older](https://github.com/mattgallagher/CwlPreconditionTesting/tree/1.2.0). + ## Adding to your project -This project can be used by manual inclusion in your projects or through any of the Swift Package Manager, CocoaPods or Carthage. - -Minimum requirements are iOS 8 (simulator-only) or macOS 10.9. The project includes tvOS 9 and POSIX targets but these aren't regularly tested. - -### Manual inclusion - -1. In a subdirectory of your project's directory, run `git clone https://github.com/mattgallagher/CwlPreconditionTesting.git` -2. Drag the "CwlPreconditionTesting.xcodeproj" file from the Finder into your own project's file tree in Xcode -3. Add the "CwlPreconditionTesting.framework" from the "Products" folder of the CwlPreconditionTesting project's file tree to the "Copy Files (Frameworks)" build phases of any target that you want to include this module. -4. Drag the "CwlCatchException.framework" from the "Dependencies" group (within the CwlPreconditionTesting project's file tree) onto the same "Copy Files (Frameworks)" build phase (this item may be red but that shouldn't be a problem). - -That third step is a little tricky if you're unfamiliar with Xcode but it involves: - -a. click on your project in the file tree -b. click on the target to whih you want to add this module -c. select the "Build Phases" tab -d. if you don't already have a "Copy File" build phase with a "Destination: Frameworks", add one using the "+" button in the top left of the tab -e. click the "+" within the "Copy File (Frameworks)" phase and from the list that appears, select the "CwlPreconditionTesting.framework" (if there are multiple frameworks with the same name, look for the one that appears *above* the corresponding macOS or iOS CwlPreconditionTesting testing target). - -When building using this approach, the "FetchDependencies" target will use the Swift Package Manager to download the "CwlCatchException" project from github. The download is stored in the "Build intermediates" directory for your project. Normally, you can ignore its existence but if you get any errors from the "FetchDependencies" target, you might need to clean the build folder (Hold "Option" key while selecting "Product" → "Clean Build Folder..." from the Xcode menubar). - -You can use the "Package.swift" to manage the behavior of the Swift Package Manager or if you want to download dependencies manually (instead of using this behind-the-scenes use of the Swift package manager), you should delete the "FetchDependencies" target and replace the "CwlCatchException" targets with alternatives that build the dependencies in accordance with your manual download. - -### Swift Package Manager - Add the following to the `dependencies` array in your "Package.swift" file: - .Package(url: "https://github.com/mattgallagher/CwlPreconditionTesting.git", majorVersion: 1), + .package(url: "https://github.com/mattgallagher/CwlPreconditionTesting.git", from: Version("2.0.0-beta.1")) -Or, if you're using the `swift-tools-version:4.0` package manager, add the following to the `dependencies` array in your "Package.swift" file: +Or by adding `https://github.com/mattgallagher/CwlPreconditionTesting.git`, version 2.0.0-beta.1 or later, to the list of Swift packages for any project in Xcode. - .package(url: "https://github.com/mattgallagher/CwlPreconditionTesting.git", majorVersion: 1) +## Usage -### CocoaPods +On macOS and iOS you can use the regular version: -Add the following lines to your target in your "Podfile": +```swift +import CwlPreconditionTesting - pod 'CwlPreconditionTesting', :git => 'https://github.com/mattgallagher/CwlPreconditionTesting.git' - pod 'CwlCatchException', :git => 'https://github.com/mattgallagher/CwlCatchException.git' +let e = catchBadInstruction { + precondition(false, "THIS PRECONDITION FAILURE IS EXPECTED") +} +``` -### Carthage +on tvOS, Linux and other platforms, you can use the POSIX version: -Add the following line to your Cartfile: +```swift +import CwlPosixPreconditionTesting - git "https://github.com/mattgallagher/CwlPreconditionTesting.git" "master" +let e = catchBadInstruction { + precondition(false, "THIS PRECONDITION FAILURE IS EXPECTED") +} +``` -## Using POSIX signals and setjmp/longjmp - -For comparison or for anyone running this code on a platform without Mach exceptions or the Objective-C runtime, I've added a proof-of-concept implementation of `catchBadInstruction` that uses a POSIX SIGILL `sigaction` and `setjmp`/`longjmp` to perform the throw. - -In Xcode, you can simply select the CwlPreconditionTesting_POSIX target (instead of the OSX or iOS targets). If you're building without Xcode: all you need is the CwlCatchBadInstructionPOSIX.swift file (compared to the Mach exception handler, the code is tiny doesn't have any weird Objective-C/MiG file dependencies). - -**Warning No. 1**: on OS X, this approach can't be used when lldb is attached since lldb's Mach exception handler blocks the SIGILL from ever occurring (I've disabled the "Debug Executable" setting for the tests in Xcode - re-enable it to witness the problem). - -**Warning No. 2**: if you're switching between the CwlPreconditionTesting_OSX and CwlPreconditionTesting_POSIX targets, Xcode (as of Xcode 7.2.1) will not detect the change and will not remove the old framework correctly so you'll need to *clean your project* otherwise the old framework will hang around. - -Additional problems in decreasing severity include: - -* the signal handler is whole process (rather than correctly scoped to the thread where the "catch" occurs) -* the signal handler doesn't deal with re-entrancy whereas the mach exception handler remains deterministic in the face of multiple fatal errors -* the signal handler overwrites the "[red zone](https://en.wikipedia.org/wiki/Red_zone_(computing))" which is technically frowned upon in signal handlers (although unlikely to cause problems here) +**Warning**: this POSIX version can't be used when lldb is attached since lldb's Mach exception handler blocks the SIGILL from ever occurring. You should disable the "Debug Executable" setting for the tests in Xcode. The POSIX version of the signal handler is also whole process (rather than correctly scoped to the thread where the "catch" occurs). diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.m index 8183196..2ab0ea5 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.m @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -18,33 +18,36 @@ // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // -#if defined(__x86_64__) +#ifdef __APPLE__ +#import "TargetConditionals.h" +#if TARGET_OS_OSX || TARGET_OS_IOS - #import "mach_excServer.h" - #import "CwlMachBadInstructionHandler.h" +#import "mach_excServer.h" +#import "CwlMachBadInstructionHandler.h" + +@protocol BadInstructionReply ++(NSNumber *)receiveReply:(NSValue *)value; +@end + +/// A basic function that receives callbacks from mach_exc_server and relays them to the Swift implemented BadInstructionException.catch_mach_exception_raise_state. +kern_return_t catch_mach_exception_raise_state(mach_port_t exception_port, exception_type_t exception, const mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, const thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { + bad_instruction_exception_reply_t reply = { exception_port, exception, code, codeCnt, flavor, old_state, old_stateCnt, new_state, new_stateCnt }; + Class badInstructionClass = NSClassFromString(@"BadInstructionException"); + NSValue *value = [NSValue valueWithBytes: &reply objCType: @encode(bad_instruction_exception_reply_t)]; + return [[badInstructionClass performSelector: @selector(receiveReply:) withObject: value] intValue]; +} + +// The mach port should be configured so that this function is never used. +kern_return_t catch_mach_exception_raise(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt) { + assert(false); + return KERN_FAILURE; +} + +// The mach port should be configured so that this function is never used. +kern_return_t catch_mach_exception_raise_state_identity(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { + assert(false); + return KERN_FAILURE; +} - @protocol BadInstructionReply - +(NSNumber *)receiveReply:(NSValue *)value; - @end - - /// A basic function that receives callbacks from mach_exc_server and relays them to the Swift implemented BadInstructionException.catch_mach_exception_raise_state. - kern_return_t catch_mach_exception_raise_state(mach_port_t exception_port, exception_type_t exception, const mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, const thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { - bad_instruction_exception_reply_t reply = { exception_port, exception, code, codeCnt, flavor, old_state, old_stateCnt, new_state, new_stateCnt }; - Class badInstructionClass = NSClassFromString(@"BadInstructionException"); - NSValue *value = [NSValue valueWithBytes: &reply objCType: @encode(bad_instruction_exception_reply_t)]; - return [[badInstructionClass performSelector: @selector(receiveReply:) withObject: value] intValue]; - } - - // The mach port should be configured so that this function is never used. - kern_return_t catch_mach_exception_raise(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt) { - assert(false); - return KERN_FAILURE; - } - - // The mach port should be configured so that this function is never used. - kern_return_t catch_mach_exception_raise_state_identity(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { - assert(false); - return KERN_FAILURE; - } - -#endif +#endif /* TARGET_OS_OSX || TARGET_OS_IOS */ +#endif /* __APPLE__ */ diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h index aef59c2..3fbd5a4 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -19,8 +19,14 @@ // #import + +#if TARGET_OS_OSX || TARGET_OS_IOS + #import +extern bool _swift_disableExclusivityChecking; +extern bool _swift_reportFatalErrorsToDebugger; + NS_ASSUME_NONNULL_BEGIN extern boolean_t mach_exc_server(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); @@ -68,3 +74,5 @@ typedef struct } bad_instruction_exception_reply_t; NS_ASSUME_NONNULL_END + +#endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.c b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.c index 733c564..ccd8f84 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.c +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.c @@ -5,13 +5,12 @@ * OPTIONS: */ -#if defined(__x86_64__) - /* Module mach_exc */ #define __MIG_check__Request__mach_exc_subsystem__ 1 -#include "mach_excServer.h" +#import "mach_excServer.h" +#if TARGET_OS_OSX || TARGET_OS_IOS #ifndef mig_internal #define mig_internal static __inline__ @@ -534,4 +533,4 @@ mig_external mig_routine_t mach_exc_server_routine return catch_mach_exc_subsystem.routine[msgh_id].stub_routine; } -#endif +#endif /* TARGET_OS_OSX || TARGET_OS_IOS */ diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.h index 52e53ae..1f03d66 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.h +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/mach_excServer.h @@ -1,9 +1,14 @@ +#ifdef __APPLE__ +#import "TargetConditionals.h" +#if TARGET_OS_OSX || TARGET_OS_IOS + #ifndef _mach_exc_server_ #define _mach_exc_server_ /* Module mach_exc */ #include + #include #include #include @@ -319,3 +324,6 @@ __AfterMigServerHeader #endif /* __AfterMigServerHeader */ #endif /* _mach_exc_server_ */ + +#endif /* TARGET_OS_OSX || TARGET_OS_IOS */ +#endif /* __APPLE__ */ diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPosixPreconditionTesting/CwlCatchBadInstructionPosix.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPosixPreconditionTesting/CwlCatchBadInstructionPosix.swift new file mode 100644 index 0000000..4296a79 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPosixPreconditionTesting/CwlCatchBadInstructionPosix.swift @@ -0,0 +1,108 @@ +// +// CwlCatchBadInstructionPosix.swift +// CwlPreconditionTesting +// +// Created by Matt Gallagher on 8/02/2016. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// + +#if arch(x86_64) + +import Foundation + +// This file is an alternative implementation to CwlCatchBadInstruction.swift that uses a SIGILL signal action and setenv/longjmp instead of a Mach exception handler and Objective-C exception raising. +// +// WARNING: +// This code is quick and dirty. It's a proof of concept for using a SIGILL handler and setjmp/longjmp where Mach exceptions and the Obj-C runtime aren't available. I ran the automated tests when I first wrote this code but I don't personally use it at all so by the time you're reading this comment, it probably broke and I didn't notice. +// Obvious limitations: +// * It doesn't work when debugging with lldb. +// * It doesn't scope correctly to the thread (it's global) +// * In violation of rules for signal handlers, it writes to the "red zone" on the stack +// * It isn't re-entrant +// * Plus all of the same caveats as the Mach exceptions version (doesn't play well with other handlers, probably leaks ARC memory, etc) +// Treat it like a loaded shotgun. Don't point it at your face. + +// This function is called from the signal handler to shut down the thread and return 1 (indicating a SIGILL was received). +private func callThreadExit() { + pthread_exit(UnsafeMutableRawPointer(bitPattern: 1)) +} + +// When called, this signal handler simulates a function call to `callThreadExit` +private func sigIllHandler(code: Int32, info: UnsafeMutablePointer<__siginfo>?, uap: UnsafeMutableRawPointer?) -> Void { + guard let context = uap?.assumingMemoryBound(to: ucontext64_t.self) else { return } + + // 1. Decrement the stack pointer + context.pointee.uc_mcontext64.pointee.__ss.__rsp -= __uint64_t(MemoryLayout.size) + + // 2. Save the old Instruction Pointer to the stack. + let rsp = context.pointee.uc_mcontext64.pointee.__ss.__rsp + if let ump = UnsafeMutablePointer<__uint64_t>(bitPattern: UInt(rsp)) { + ump.pointee = rsp + } + + // 3. Set the Instruction Pointer to the new function's address + var f: @convention(c) () -> Void = callThreadExit + withUnsafePointer(to: &f) { $0.withMemoryRebound(to: __uint64_t.self, capacity: 1) { ptr in + context.pointee.uc_mcontext64.pointee.__ss.__rip = ptr.pointee + } } +} + +/// Without Mach exceptions or the Objective-C runtime, there's nothing to put in the exception object. It's really just a boolean – either a SIGILL was caught or not. +public class BadInstructionException { +} + +/// Run the provided block. If a POSIX SIGILL is received, handle it and return a BadInstructionException (which is just an empty object in this POSIX signal version). Otherwise return nil. +/// NOTE: This function is only intended for use in test harnesses – use in a distributed build is almost certainly a bad choice. If a SIGILL is received, the block will be interrupted using a C `longjmp`. The risks associated with abrupt jumps apply here: most Swift functions are *not* interrupt-safe. Memory may be leaked and the program will not necessarily be left in a safe state. +/// - parameter block: a function without parameters that will be run +/// - returns: if an SIGILL is raised during the execution of `block` then a BadInstructionException will be returned, otherwise `nil`. +public func catchBadInstruction(block: @escaping () -> Void) -> BadInstructionException? { + // Construct the signal action + var sigActionPrev = sigaction() + let action = __sigaction_u(__sa_sigaction: sigIllHandler) + var sigActionNew = sigaction(__sigaction_u: action, sa_mask: sigset_t(), sa_flags: SA_SIGINFO) + + // Install the signal action + if sigaction(SIGILL, &sigActionNew, &sigActionPrev) != 0 { + fatalError("Sigaction error: \(errno)") + } + + defer { + // Restore the previous signal action + if sigaction(SIGILL, &sigActionPrev, nil) != 0 { + fatalError("Sigaction error: \(errno)") + } + } + + var b = block + let caught: Bool = withUnsafeMutablePointer(to: &b) { blockPtr in + // Run the block on its own thread + var handlerThread: pthread_t? = nil + let e = pthread_create(&handlerThread, nil, { arg in + (arg.assumingMemoryBound(to: (() -> Void).self).pointee)() + return nil + }, blockPtr) + precondition(e == 0, "Unable to create thread") + + // Wait for completion and get the result. It will be either `nil` or bitPattern 1 + var rawResult: UnsafeMutableRawPointer? = nil + let e2 = pthread_join(handlerThread!, &rawResult) + precondition(e2 == 0, "Thread join failed") + return Int(bitPattern: rawResult) != 0 + } + + return caught ? BadInstructionException() : nil +} + +#endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift index 91e5d4d..90ee022 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -18,6 +18,8 @@ // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // +#if (os(macOS) || os(iOS)) && arch(x86_64) + import Foundation #if SWIFT_PACKAGE @@ -44,46 +46,44 @@ public class BadInstructionException: NSException { /// An Objective-C callable function, invoked from the `mach_exc_server` callback function `catch_mach_exception_raise_state` to push the `raiseBadInstructionException` function onto the stack. @objc(receiveReply:) public class func receiveReply(_ value: NSValue) -> NSNumber { - #if arch(x86_64) - var reply = bad_instruction_exception_reply_t(exception_port: 0, exception: 0, code: nil, codeCnt: 0, flavor: nil, old_state: nil, old_stateCnt: 0, new_state: nil, new_stateCnt: nil) - withUnsafeMutablePointer(to: &reply) { value.getValue(UnsafeMutableRawPointer($0)) } - - let old_state: UnsafePointer = reply.old_state! - let old_stateCnt: mach_msg_type_number_t = reply.old_stateCnt - let new_state: thread_state_t = reply.new_state! - let new_stateCnt: UnsafeMutablePointer = reply.new_stateCnt! - - // Make sure we've been given enough memory - if old_stateCnt != x86_THREAD_STATE64_COUNT || new_stateCnt.pointee < x86_THREAD_STATE64_COUNT { - return NSNumber(value: KERN_INVALID_ARGUMENT) - } - - // Read the old thread state - var state = old_state.withMemoryRebound(to: x86_thread_state64_t.self, capacity: 1) { return $0.pointee } - - // 1. Decrement the stack pointer - state.__rsp -= __uint64_t(MemoryLayout.size) - - // 2. Save the old Instruction Pointer to the stack. - if let pointer = UnsafeMutablePointer<__uint64_t>(bitPattern: UInt(state.__rsp)) { - pointer.pointee = state.__rip - } else { - return NSNumber(value: KERN_INVALID_ARGUMENT) - } - - // 3. Set the Instruction Pointer to the new function's address - var f: @convention(c) () -> Void = raiseBadInstructionException - withUnsafePointer(to: &f) { - state.__rip = $0.withMemoryRebound(to: __uint64_t.self, capacity: 1) { return $0.pointee } - } - - // Write the new thread state - new_state.withMemoryRebound(to: x86_thread_state64_t.self, capacity: 1) { $0.pointee = state } - new_stateCnt.pointee = x86_THREAD_STATE64_COUNT - - return NSNumber(value: KERN_SUCCESS) - #else - fatalError("Unavailable for this CPU architecture") - #endif + var reply = bad_instruction_exception_reply_t(exception_port: 0, exception: 0, code: nil, codeCnt: 0, flavor: nil, old_state: nil, old_stateCnt: 0, new_state: nil, new_stateCnt: nil) + withUnsafeMutablePointer(to: &reply) { value.getValue(UnsafeMutableRawPointer($0)) } + + let old_state: UnsafePointer = reply.old_state! + let old_stateCnt: mach_msg_type_number_t = reply.old_stateCnt + let new_state: thread_state_t = reply.new_state! + let new_stateCnt: UnsafeMutablePointer = reply.new_stateCnt! + + // Make sure we've been given enough memory + if old_stateCnt != x86_THREAD_STATE64_COUNT || new_stateCnt.pointee < x86_THREAD_STATE64_COUNT { + return NSNumber(value: KERN_INVALID_ARGUMENT) + } + + // Read the old thread state + var state = old_state.withMemoryRebound(to: x86_thread_state64_t.self, capacity: 1) { return $0.pointee } + + // 1. Decrement the stack pointer + state.__rsp -= __uint64_t(MemoryLayout.size) + + // 2. Save the old Instruction Pointer to the stack. + if let pointer = UnsafeMutablePointer<__uint64_t>(bitPattern: UInt(state.__rsp)) { + pointer.pointee = state.__rip + } else { + return NSNumber(value: KERN_INVALID_ARGUMENT) + } + + // 3. Set the Instruction Pointer to the new function's address + var f: @convention(c) () -> Void = raiseBadInstructionException + withUnsafePointer(to: &f) { + state.__rip = $0.withMemoryRebound(to: __uint64_t.self, capacity: 1) { return $0.pointee } + } + + // Write the new thread state + new_state.withMemoryRebound(to: x86_thread_state64_t.self, capacity: 1) { $0.pointee = state } + new_stateCnt.pointee = x86_THREAD_STATE64_COUNT + + return NSNumber(value: KERN_SUCCESS) } } + +#endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift index f96ec63..521b2a1 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -18,180 +18,192 @@ // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // +#if (os(macOS) || os(iOS)) && arch(x86_64) + import Foundation +import Swift #if SWIFT_PACKAGE import CwlMachBadInstructionHandler #endif -#if arch(x86_64) - - private enum PthreadError: Error { case code(Int32) } - private enum MachExcServer: Error { case code(kern_return_t) } - - /// A quick function for converting Mach error results into Swift errors - private func kernCheck(_ f: () -> Int32) throws { - let r = f() - guard r == KERN_SUCCESS else { - throw NSError(domain: NSMachErrorDomain, code: Int(r), userInfo: nil) - } +private enum PthreadError: Error { case code(Int32) } +private enum MachExcServer: Error { case code(kern_return_t) } + +/// A quick function for converting Mach error results into Swift errors +private func kernCheck(_ f: () -> Int32) throws { + let r = f() + guard r == KERN_SUCCESS else { + throw NSError(domain: NSMachErrorDomain, code: Int(r), userInfo: nil) } - - extension request_mach_exception_raise_t { - mutating func withMsgHeaderPointer(in block: (UnsafeMutablePointer) -> R) -> R { - return withUnsafeMutablePointer(to: &self) { p -> R in - return p.withMemoryRebound(to: mach_msg_header_t.self, capacity: 1) { ptr -> R in - return block(ptr) - } +} + +extension request_mach_exception_raise_t { + mutating func withMsgHeaderPointer(in block: (UnsafeMutablePointer) -> R) -> R { + return withUnsafeMutablePointer(to: &self) { p -> R in + return p.withMemoryRebound(to: mach_msg_header_t.self, capacity: 1) { ptr -> R in + return block(ptr) } } } - - extension reply_mach_exception_raise_state_t { - mutating func withMsgHeaderPointer(in block: (UnsafeMutablePointer) -> R) -> R { - return withUnsafeMutablePointer(to: &self) { p -> R in - return p.withMemoryRebound(to: mach_msg_header_t.self, capacity: 1) { ptr -> R in - return block(ptr) - } +} + +extension reply_mach_exception_raise_state_t { + mutating func withMsgHeaderPointer(in block: (UnsafeMutablePointer) -> R) -> R { + return withUnsafeMutablePointer(to: &self) { p -> R in + return p.withMemoryRebound(to: mach_msg_header_t.self, capacity: 1) { ptr -> R in + return block(ptr) } } } +} + +/// A structure used to store context associated with the Mach message port +private struct MachContext { + var masks = execTypesCountTuple() + var count: mach_msg_type_number_t = 0 + var ports = execTypesCountTuple() + var behaviors = execTypesCountTuple() + var flavors = execTypesCountTuple() + var currentExceptionPort: mach_port_t = 0 + var handlerThread: pthread_t? = nil - /// A structure used to store context associated with the Mach message port - private struct MachContext { - var masks = execTypesCountTuple() - var count: mach_msg_type_number_t = 0 - var ports = execTypesCountTuple() - var behaviors = execTypesCountTuple() - var flavors = execTypesCountTuple() - var currentExceptionPort: mach_port_t = 0 - var handlerThread: pthread_t? = nil - - static func internalMutablePointers(_ m: UnsafeMutablePointer>, _ c: UnsafeMutablePointer, _ p: UnsafeMutablePointer>, _ b: UnsafeMutablePointer>, _ f: UnsafeMutablePointer>, _ block: (UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer) -> R) -> R { - return m.withMemoryRebound(to: exception_mask_t.self, capacity: 1) { masksPtr in - return c.withMemoryRebound(to: mach_msg_type_number_t.self, capacity: 1) { countPtr in - return p.withMemoryRebound(to: mach_port_t.self, capacity: 1) { portsPtr in - return b.withMemoryRebound(to: exception_behavior_t.self, capacity: 1) { behaviorsPtr in - return f.withMemoryRebound(to: thread_state_flavor_t.self, capacity: 1) { flavorsPtr in - return block(masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) - } + static func internalMutablePointers(_ m: UnsafeMutablePointer>, _ c: UnsafeMutablePointer, _ p: UnsafeMutablePointer>, _ b: UnsafeMutablePointer>, _ f: UnsafeMutablePointer>, _ block: (UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer) -> R) -> R { + return m.withMemoryRebound(to: exception_mask_t.self, capacity: 1) { masksPtr in + return c.withMemoryRebound(to: mach_msg_type_number_t.self, capacity: 1) { countPtr in + return p.withMemoryRebound(to: mach_port_t.self, capacity: 1) { portsPtr in + return b.withMemoryRebound(to: exception_behavior_t.self, capacity: 1) { behaviorsPtr in + return f.withMemoryRebound(to: thread_state_flavor_t.self, capacity: 1) { flavorsPtr in + return block(masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) } } } } } - - mutating func withUnsafeMutablePointers(in block: @escaping (UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer) -> R) -> R { - return MachContext.internalMutablePointers(&masks, &count, &ports, &behaviors, &flavors, block) - } } - /// A function for receiving mach messages and parsing the first with mach_exc_server (and if any others are received, throwing them away). - private func machMessageHandler(_ arg: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer? { - let context = arg.assumingMemoryBound(to: MachContext.self).pointee - var request = request_mach_exception_raise_t() - var reply = reply_mach_exception_raise_state_t() + mutating func withUnsafeMutablePointers(in block: @escaping (UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer) -> R) -> R { + return MachContext.internalMutablePointers(&masks, &count, &ports, &behaviors, &flavors, block) + } +} + +/// A function for receiving mach messages and parsing the first with mach_exc_server (and if any others are received, throwing them away). +private func machMessageHandler(_ arg: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer? { + let context = arg.assumingMemoryBound(to: MachContext.self).pointee + var request = request_mach_exception_raise_t() + var reply = reply_mach_exception_raise_state_t() + + var handledfirstException = false + repeat { do { + // Request the next mach message from the port + request.Head.msgh_local_port = context.currentExceptionPort + request.Head.msgh_size = UInt32(MemoryLayout.size) + let requestSize = request.Head.msgh_size + try kernCheck { request.withMsgHeaderPointer { requestPtr in + mach_msg(requestPtr, MACH_RCV_MSG | MACH_RCV_INTERRUPT, 0, requestSize, context.currentExceptionPort, 0, UInt32(MACH_PORT_NULL)) + } } - var handledfirstException = false - repeat { do { - // Request the next mach message from the port - request.Head.msgh_local_port = context.currentExceptionPort - request.Head.msgh_size = UInt32(MemoryLayout.size) - let requestSize = request.Head.msgh_size - try kernCheck { request.withMsgHeaderPointer { requestPtr in - mach_msg(requestPtr, MACH_RCV_MSG | MACH_RCV_INTERRUPT, 0, requestSize, context.currentExceptionPort, 0, UInt32(MACH_PORT_NULL)) - } } + // Prepare the reply structure + reply.Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(request.Head.msgh_bits), 0) + reply.Head.msgh_local_port = UInt32(MACH_PORT_NULL) + reply.Head.msgh_remote_port = request.Head.msgh_remote_port + reply.Head.msgh_size = UInt32(MemoryLayout.size) + reply.NDR = NDR_record + + if !handledfirstException { + // Use the MiG generated server to invoke our handler for the request and fill in the rest of the reply structure + guard request.withMsgHeaderPointer(in: { requestPtr in reply.withMsgHeaderPointer { replyPtr in + mach_exc_server(requestPtr, replyPtr) + } }) != 0 else { throw MachExcServer.code(reply.RetCode) } - // Prepare the reply structure - reply.Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(request.Head.msgh_bits), 0) - reply.Head.msgh_local_port = UInt32(MACH_PORT_NULL) - reply.Head.msgh_remote_port = request.Head.msgh_remote_port - reply.Head.msgh_size = UInt32(MemoryLayout.size) - reply.NDR = NDR_record - - if !handledfirstException { - // Use the MiG generated server to invoke our handler for the request and fill in the rest of the reply structure - guard request.withMsgHeaderPointer(in: { requestPtr in reply.withMsgHeaderPointer { replyPtr in - mach_exc_server(requestPtr, replyPtr) - } }) != 0 else { throw MachExcServer.code(reply.RetCode) } - - handledfirstException = true - } else { - // If multiple fatal errors occur, don't handle subsquent errors (let the program crash) - reply.RetCode = KERN_FAILURE - } - - // Send the reply - let replySize = reply.Head.msgh_size - try kernCheck { reply.withMsgHeaderPointer { replyPtr in - mach_msg(replyPtr, MACH_SEND_MSG, replySize, 0, UInt32(MACH_PORT_NULL), 0, UInt32(MACH_PORT_NULL)) - } } - } catch let error as NSError where (error.domain == NSMachErrorDomain && (error.code == Int(MACH_RCV_PORT_CHANGED) || error.code == Int(MACH_RCV_INVALID_NAME))) { - // Port was already closed before we started or closed while we were listening. - // This means the controlling thread shut down. - return nil - } catch { - // Should never be reached but this is testing code, don't try to recover, just abort - fatalError("Mach message error: \(error)") - } } while true + handledfirstException = true + } else { + // If multiple fatal errors occur, don't handle subsquent errors (let the program crash) + reply.RetCode = KERN_FAILURE + } + + // Send the reply + let replySize = reply.Head.msgh_size + try kernCheck { reply.withMsgHeaderPointer { replyPtr in + mach_msg(replyPtr, MACH_SEND_MSG, replySize, 0, UInt32(MACH_PORT_NULL), 0, UInt32(MACH_PORT_NULL)) + } } + } catch let error as NSError where (error.domain == NSMachErrorDomain && (error.code == Int(MACH_RCV_PORT_CHANGED) || error.code == Int(MACH_RCV_INVALID_NAME))) { + // Port was already closed before we started or closed while we were listening. + // This means the controlling thread shut down. + return nil + } catch { + // Should never be reached but this is testing code, don't try to recover, just abort + fatalError("Mach message error: \(error)") + } } while true +} + +/// Run the provided block. If a mach "BAD_INSTRUCTION" exception is raised, catch it and return a BadInstructionException (which captures stack information about the throw site, if desired). Otherwise return nil. +/// NOTE: This function is only intended for use in test harnesses – use in a distributed build is almost certainly a bad choice. If a "BAD_INSTRUCTION" exception is raised, the block will be exited before completion via Objective-C exception. The risks associated with an Objective-C exception apply here: most Swift/Objective-C functions are *not* exception-safe. Memory may be leaked and the program will not necessarily be left in a safe state. +/// - parameter block: a function without parameters that will be run +/// - returns: if an EXC_BAD_INSTRUCTION is raised during the execution of `block` then a BadInstructionException will be returned, otherwise `nil`. +public func catchBadInstruction(in block: @escaping () -> Void) -> BadInstructionException? { + // Suppress Swift runtime's direct triggering of the debugger and exclusivity checking which crashes when we throw past it + let previousExclusivity = _swift_disableExclusivityChecking + let previousReporting = _swift_reportFatalErrorsToDebugger + _swift_disableExclusivityChecking = true + _swift_reportFatalErrorsToDebugger = false + defer { + _swift_reportFatalErrorsToDebugger = previousReporting + _swift_disableExclusivityChecking = previousExclusivity } - /// Run the provided block. If a mach "BAD_INSTRUCTION" exception is raised, catch it and return a BadInstructionException (which captures stack information about the throw site, if desired). Otherwise return nil. - /// NOTE: This function is only intended for use in test harnesses – use in a distributed build is almost certainly a bad choice. If a "BAD_INSTRUCTION" exception is raised, the block will be exited before completion via Objective-C exception. The risks associated with an Objective-C exception apply here: most Swift/Objective-C functions are *not* exception-safe. Memory may be leaked and the program will not necessarily be left in a safe state. - /// - parameter block: a function without parameters that will be run - /// - returns: if an EXC_BAD_INSTRUCTION is raised during the execution of `block` then a BadInstructionException will be returned, otherwise `nil`. - public func catchBadInstruction(in block: () -> Void) -> BadInstructionException? { - var context = MachContext() - var result: BadInstructionException? = nil - do { - var handlerThread: pthread_t? = nil - defer { - // 8. Wait for the thread to terminate *if* we actually made it to the creation point - // The mach port should be destroyed *before* calling pthread_join to avoid a deadlock. - if handlerThread != nil { - pthread_join(handlerThread!, nil) - } + var context = MachContext() + var result: BadInstructionException? = nil + do { + var handlerThread: pthread_t? = nil + defer { + // 8. Wait for the thread to terminate *if* we actually made it to the creation point + // The mach port should be destroyed *before* calling pthread_join to avoid a deadlock. + if handlerThread != nil { + pthread_join(handlerThread!, nil) } - - try kernCheck { - // 1. Create the mach port - mach_port_allocate(mach_task_self_, MACH_PORT_RIGHT_RECEIVE, &context.currentExceptionPort) - } - defer { - // 7. Cleanup the mach port - mach_port_destroy(mach_task_self_, context.currentExceptionPort) - } - - try kernCheck { - // 2. Configure the mach port - mach_port_insert_right(mach_task_self_, context.currentExceptionPort, context.currentExceptionPort, MACH_MSG_TYPE_MAKE_SEND) - } - - let currentExceptionPtr = context.currentExceptionPort - try kernCheck { context.withUnsafeMutablePointers { masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr in - // 3. Apply the mach port as the handler for this thread - thread_swap_exception_ports(mach_thread_self(), EXC_MASK_BAD_INSTRUCTION, currentExceptionPtr, Int32(bitPattern: UInt32(EXCEPTION_STATE) | MACH_EXCEPTION_CODES), x86_THREAD_STATE64, masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) - } } - - defer { context.withUnsafeMutablePointers { masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr in - // 6. Unapply the mach port - _ = thread_swap_exception_ports(mach_thread_self(), EXC_MASK_BAD_INSTRUCTION, 0, EXCEPTION_DEFAULT, THREAD_STATE_NONE, masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) - } } - - try withUnsafeMutablePointer(to: &context) { c throws in - // 4. Create the thread - let e = pthread_create(&handlerThread, nil, machMessageHandler, c) - guard e == 0 else { throw PthreadError.code(e) } - - // 5. Run the block - result = BadInstructionException.catchException(in: block) - } - } catch { - // Should never be reached but this is testing code, don't try to recover, just abort - fatalError("Mach port error: \(error)") } - return result + + try kernCheck { + // 1. Create the mach port + mach_port_allocate(mach_task_self_, MACH_PORT_RIGHT_RECEIVE, &context.currentExceptionPort) + } + defer { + // 7. Cleanup the mach port + mach_port_destroy(mach_task_self_, context.currentExceptionPort) + } + + try kernCheck { + // 2. Configure the mach port + mach_port_insert_right(mach_task_self_, context.currentExceptionPort, context.currentExceptionPort, MACH_MSG_TYPE_MAKE_SEND) + } + + let currentExceptionPtr = context.currentExceptionPort + try kernCheck { context.withUnsafeMutablePointers { masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr in + // 3. Apply the mach port as the handler for this thread + thread_swap_exception_ports(mach_thread_self(), EXC_MASK_BAD_INSTRUCTION, currentExceptionPtr, Int32(bitPattern: UInt32(EXCEPTION_STATE) | MACH_EXCEPTION_CODES), x86_THREAD_STATE64, masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) + } } + + defer { context.withUnsafeMutablePointers { masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr in + // 6. Unapply the mach port + _ = thread_swap_exception_ports(mach_thread_self(), EXC_MASK_BAD_INSTRUCTION, 0, EXCEPTION_DEFAULT, THREAD_STATE_NONE, masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) + } } + + try withUnsafeMutablePointer(to: &context) { c throws in + // 4. Create the thread + let e = pthread_create(&handlerThread, nil, machMessageHandler, c) + guard e == 0 else { throw PthreadError.code(e) } + + // 5. Run the block + result = BadInstructionException.catchException(in: block) + } + } catch { + // Should never be reached but this is testing code, don't try to recover, just abort + fatalError("Mach port error: \(error)") } + + return result +} #endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift deleted file mode 100644 index eb9bc19..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift +++ /dev/null @@ -1,108 +0,0 @@ -// -// CwlCatchBadInstructionPosix.swift -// CwlPreconditionTesting -// -// Created by Matt Gallagher on 8/02/2016. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// - -import Foundation - -#if arch(x86_64) - - // This file is an alternative implementation to CwlCatchBadInstruction.swift that uses a SIGILL signal action and setenv/longjmp instead of a Mach exception handler and Objective-C exception raising. - // - // WARNING: - // This code is quick and dirty. It's a proof of concept for using a SIGILL handler and setjmp/longjmp where Mach exceptions and the Obj-C runtime aren't available. I ran the automated tests when I first wrote this code but I don't personally use it at all so by the time you're reading this comment, it probably broke and I didn't notice. - // Obvious limitations: - // * It doesn't work when debugging with lldb. - // * It doesn't scope correctly to the thread (it's global) - // * In violation of rules for signal handlers, it writes to the "red zone" on the stack - // * It isn't re-entrant - // * Plus all of the same caveats as the Mach exceptions version (doesn't play well with other handlers, probably leaks ARC memory, etc) - // Treat it like a loaded shotgun. Don't point it at your face. - - // This function is called from the signal handler to shut down the thread and return 1 (indicating a SIGILL was received). - private func callThreadExit() { - pthread_exit(UnsafeMutableRawPointer(bitPattern: 1)) - } - - // When called, this signal handler simulates a function call to `callThreadExit` - private func sigIllHandler(code: Int32, info: UnsafeMutablePointer<__siginfo>?, uap: UnsafeMutableRawPointer?) -> Void { - guard let context = uap?.assumingMemoryBound(to: ucontext64_t.self) else { return } - - // 1. Decrement the stack pointer - context.pointee.uc_mcontext64.pointee.__ss.__rsp -= __uint64_t(MemoryLayout.size) - - // 2. Save the old Instruction Pointer to the stack. - let rsp = context.pointee.uc_mcontext64.pointee.__ss.__rsp - if let ump = UnsafeMutablePointer<__uint64_t>(bitPattern: UInt(rsp)) { - ump.pointee = rsp - } - - // 3. Set the Instruction Pointer to the new function's address - var f: @convention(c) () -> Void = callThreadExit - withUnsafePointer(to: &f) { $0.withMemoryRebound(to: __uint64_t.self, capacity: 1) { ptr in - context.pointee.uc_mcontext64.pointee.__ss.__rip = ptr.pointee - } } - } - - /// Without Mach exceptions or the Objective-C runtime, there's nothing to put in the exception object. It's really just a boolean – either a SIGILL was caught or not. - public class BadInstructionException { - } - - /// Run the provided block. If a POSIX SIGILL is received, handle it and return a BadInstructionException (which is just an empty object in this POSIX signal version). Otherwise return nil. - /// NOTE: This function is only intended for use in test harnesses – use in a distributed build is almost certainly a bad choice. If a SIGILL is received, the block will be interrupted using a C `longjmp`. The risks associated with abrupt jumps apply here: most Swift functions are *not* interrupt-safe. Memory may be leaked and the program will not necessarily be left in a safe state. - /// - parameter block: a function without parameters that will be run - /// - returns: if an SIGILL is raised during the execution of `block` then a BadInstructionException will be returned, otherwise `nil`. - public func catchBadInstruction(block: @escaping () -> Void) -> BadInstructionException? { - // Construct the signal action - var sigActionPrev = sigaction() - let action = __sigaction_u(__sa_sigaction: sigIllHandler) - var sigActionNew = sigaction(__sigaction_u: action, sa_mask: sigset_t(), sa_flags: SA_SIGINFO) - - // Install the signal action - if sigaction(SIGILL, &sigActionNew, &sigActionPrev) != 0 { - fatalError("Sigaction error: \(errno)") - } - - defer { - // Restore the previous signal action - if sigaction(SIGILL, &sigActionPrev, nil) != 0 { - fatalError("Sigaction error: \(errno)") - } - } - - var b = block - let caught: Bool = withUnsafeMutablePointer(to: &b) { blockPtr in - // Run the block on its own thread - var handlerThread: pthread_t? = nil - let e = pthread_create(&handlerThread, nil, { arg in - (arg.assumingMemoryBound(to: (() -> Void).self).pointee)() - return nil - }, blockPtr) - precondition(e == 0, "Unable to create thread") - - // Wait for completion and get the result. It will be either `nil` or bitPattern 1 - var rawResult: UnsafeMutableRawPointer? = nil - let e2 = pthread_join(handlerThread!, &rawResult) - precondition(e2 == 0, "Thread join failed") - return Int(bitPattern: rawResult) != 0 - } - - return caught ? BadInstructionException() : nil - } - -#endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift index 8d99d5e..f22ed1f 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift @@ -3,7 +3,7 @@ // CwlPreconditionTesting // // Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -18,38 +18,38 @@ // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // +#if (os(macOS) || os(iOS)) && arch(x86_64) + import Darwin -#if arch(x86_64) - - // From /usr/include/mach/message.h - // #define MACH_MSG_TYPE_MAKE_SEND 20 /* Must hold receive right */ - // #define MACH_MSGH_BITS_REMOTE(bits) \ - // ((bits) & MACH_MSGH_BITS_REMOTE_MASK) - // #define MACH_MSGH_BITS(remote, local) /* legacy */ \ - // ((remote) | ((local) << 8)) - public let MACH_MSG_TYPE_MAKE_SEND: UInt32 = 20 - public func MACH_MSGH_BITS_REMOTE(_ bits: UInt32) -> UInt32 { return bits & UInt32(MACH_MSGH_BITS_REMOTE_MASK) } - public func MACH_MSGH_BITS(_ remote: UInt32, _ local: UInt32) -> UInt32 { return ((remote) | ((local) << 8)) } - - // From /usr/include/mach/exception_types.h - // #define EXC_BAD_INSTRUCTION 2 /* Instruction failed */ - // #define EXC_MASK_BAD_INSTRUCTION (1 << EXC_BAD_INSTRUCTION) - public let EXC_BAD_INSTRUCTION: UInt32 = 2 - public let EXC_MASK_BAD_INSTRUCTION: UInt32 = 1 << EXC_BAD_INSTRUCTION - - // From /usr/include/mach/i386/thread_status.h - // #define x86_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \ - // ( sizeof (x86_thread_state64_t) / sizeof (int) )) - public let x86_THREAD_STATE64_COUNT = UInt32(MemoryLayout.size / MemoryLayout.size) - - public let EXC_TYPES_COUNT = 14 - public struct execTypesCountTuple { - // From /usr/include/mach/i386/exception.h - // #define EXC_TYPES_COUNT 14 /* incl. illegal exception 0 */ - public var value: (T, T, T, T, T, T, T, T, T, T, T, T, T, T) = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) - public init() { - } +// From /usr/include/mach/message.h +// #define MACH_MSG_TYPE_MAKE_SEND 20 /* Must hold receive right */ +// #define MACH_MSGH_BITS_REMOTE(bits) \ +// ((bits) & MACH_MSGH_BITS_REMOTE_MASK) +// #define MACH_MSGH_BITS(remote, local) /* legacy */ \ +// ((remote) | ((local) << 8)) +public let MACH_MSG_TYPE_MAKE_SEND: UInt32 = 20 +public func MACH_MSGH_BITS_REMOTE(_ bits: UInt32) -> UInt32 { return bits & UInt32(MACH_MSGH_BITS_REMOTE_MASK) } +public func MACH_MSGH_BITS(_ remote: UInt32, _ local: UInt32) -> UInt32 { return ((remote) | ((local) << 8)) } + +// From /usr/include/mach/exception_types.h +// #define EXC_BAD_INSTRUCTION 2 /* Instruction failed */ +// #define EXC_MASK_BAD_INSTRUCTION (1 << EXC_BAD_INSTRUCTION) +public let EXC_BAD_INSTRUCTION: UInt32 = 2 +public let EXC_MASK_BAD_INSTRUCTION: UInt32 = 1 << EXC_BAD_INSTRUCTION + +// From /usr/include/mach/i386/thread_status.h +// #define x86_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \ +// ( sizeof (x86_thread_state64_t) / sizeof (int) )) +public let x86_THREAD_STATE64_COUNT = UInt32(MemoryLayout.size / MemoryLayout.size) + +public let EXC_TYPES_COUNT = 14 +public struct execTypesCountTuple { + // From /usr/include/mach/i386/exception.h + // #define EXC_TYPES_COUNT 14 /* incl. illegal exception 0 */ + public var value: (T, T, T, T, T, T, T, T, T, T, T, T, T, T) = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + public init() { } +} #endif diff --git a/Carthage/Checkouts/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 deleted file mode 100644 index 7c50da1..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// CwlPreconditionTesting.h -// CwlPreconditionTesting -// -// Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// - -#import - -extern bool _swift_reportFatalErrorsToDebugger; - -//! Project version number for CwlUtils. -FOUNDATION_EXPORT double CwlPreconditionTestingVersionNumber; - -//! Project version string for CwlUtils. -FOUNDATION_EXPORT const unsigned char CwlAssertingTestingVersionString[]; - -#include "CwlMachBadInstructionHandler.h" -#include "CwlCatchException.h" diff --git a/Carthage/Checkouts/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 deleted file mode 100644 index 4e28f95..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// CwlPreconditionTesting.h -// CwlPreconditionTesting -// -// Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// - -#import - -extern bool _swift_reportFatalErrorsToDebugger; - -//! Project version number for CwlUtils. -FOUNDATION_EXPORT double CwlPreconditionTesting_POSIXVersionNumber; - -//! Project version string for CwlUtils. -FOUNDATION_EXPORT const unsigned char CwlAssertingTesting_POSIXVersionString[]; diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile index 206f109..847d7ea 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.6.0.rc.2' +gem 'cocoapods', '~> 1.9' 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 cc03cbf..e480070 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile.lock +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Gemfile.lock @@ -1,76 +1,90 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.0) - activesupport (4.2.11) + CFPropertyList (3.0.2) + activesupport (4.2.11.3) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) + algoliasearch (1.27.3) + httpclient (~> 2.8, >= 2.8.3) + json (>= 1.5.1) atomos (0.1.3) - claide (1.0.2) - cocoapods (1.6.0.rc.2) + claide (1.0.3) + cocoapods (1.9.3) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.6.0.rc.2) - cocoapods-deintegrate (>= 1.0.2, < 2.0) + cocoapods-core (= 1.9.3) + 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.1, < 2.0) + cocoapods-trunk (>= 1.4.0, < 2.0) cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) - fourflusher (>= 2.2.0, < 3.0) + fourflusher (>= 2.3.0, < 3.0) gh_inspector (~> 1.0) molinillo (~> 0.6.6) nap (~> 1.0) - ruby-macho (~> 1.3, >= 1.3.1) - xcodeproj (>= 1.8.0, < 2.0) - cocoapods-core (1.6.0.rc.2) + ruby-macho (~> 1.4) + xcodeproj (>= 1.14.0, < 2.0) + cocoapods-core (1.9.3) activesupport (>= 4.0.2, < 6) + algoliasearch (~> 1.0) + concurrent-ruby (~> 1.1) fuzzy_match (~> 2.0.4) nap (~> 1.0) - cocoapods-deintegrate (1.0.2) - cocoapods-downloader (1.2.2) + netrc (~> 0.11) + typhoeus (~> 1.0) + cocoapods-deintegrate (1.0.4) + cocoapods-downloader (1.4.0) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) cocoapods-stats (1.1.0) - cocoapods-trunk (1.3.1) + cocoapods-trunk (1.5.0) nap (>= 0.8, < 2.0) netrc (~> 0.11) - cocoapods-try (1.1.0) + cocoapods-try (1.2.0) colored2 (3.1.2) - concurrent-ruby (1.1.4) + concurrent-ruby (1.1.6) escape (0.0.4) - fourflusher (2.2.0) + ethon (0.12.0) + ffi (>= 1.3.0) + ffi (1.13.1) + fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) + httpclient (2.8.3) i18n (0.9.5) concurrent-ruby (~> 1.0) - minitest (5.11.3) + json (2.3.1) + minitest (5.14.1) molinillo (0.6.6) - nanaimo (0.2.6) + nanaimo (0.3.0) nap (1.1.0) netrc (0.11.0) - ruby-macho (1.3.1) + ruby-macho (1.4.0) thread_safe (0.3.6) - tzinfo (1.2.5) + typhoeus (1.4.0) + ethon (>= 0.9.0) + tzinfo (1.2.7) thread_safe (~> 0.1) - xcodeproj (1.8.0) + xcodeproj (1.17.1) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) - nanaimo (~> 0.2.6) + nanaimo (~> 0.3.0) PLATFORMS ruby DEPENDENCIES - cocoapods (~> 1.6.0.rc.2) + cocoapods (~> 1.9) BUNDLED WITH - 1.17.2 + 2.1.4 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 d66190b..469901f 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 = "8.0.0" + s.version = "9.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. @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.homepage = "https://github.com/Quick/Nimble" s.license = { :type => "Apache 2.0", :file => "LICENSE" } s.author = "Quick Contributors" - s.ios.deployment_target = "8.0" + s.ios.deployment_target = "9.0" s.osx.deployment_target = "10.10" s.tvos.deployment_target = "9.0" s.source = { :git => "https://github.com/Quick/Nimble.git", @@ -21,15 +21,13 @@ Pod::Spec.new do |s| ] s.osx.exclude_files = [ - "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift", - "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h", + "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPosixPreconditionTesting/CwlCatchBadInstructionPosix.swift", ] s.ios.exclude_files = [ - "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstructionPosix.swift", - "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h", + "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPosixPreconditionTesting/CwlCatchBadInstructionPosix.swift", ] s.tvos.exclude_files = [ - "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h", + "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h", "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift", "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift", "Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift", @@ -44,12 +42,17 @@ Pod::Spec.new do |s| s.compiler_flags = '-DPRODUCT_NAME=Nimble/Nimble' s.pod_target_xcconfig = { 'APPLICATION_EXTENSION_API_ONLY' => 'YES', + 'DEFINES_MODULE' => 'YES', 'ENABLE_BITCODE' => 'NO', + 'ENABLE_TESTING_SEARCH_PATHS' => 'YES', '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' + if s.respond_to?(:swift_versions) then + s.swift_versions = ['5.0'] + else + s.swift_version = '5.0' + end 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 2bf9a6a..221dee0 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 @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 53; objects = { /* Begin PBXAggregateTarget section */ @@ -21,6 +21,9 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + 0477153523B740AD00402D4E /* DispatchTimeInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477153423B740AD00402D4E /* DispatchTimeInterval.swift */; }; + 0477153623B740B700402D4E /* DispatchTimeInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477153423B740AD00402D4E /* DispatchTimeInterval.swift */; }; + 0477153723B740B800402D4E /* DispatchTimeInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477153423B740AD00402D4E /* DispatchTimeInterval.swift */; }; 1F0648CC19639F5A001F9C46 /* ObjectWithLazyProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */; }; 1F0648CD19639F5A001F9C46 /* ObjectWithLazyProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */; }; 1F0648D41963AAB2001F9C46 /* SynchronousTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */; }; @@ -62,8 +65,6 @@ 1F1B5AD51963E13900CA8BF9 /* BeAKindOfTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1B5AD31963E13900CA8BF9 /* BeAKindOfTest.swift */; }; 1F299EAB19627B2D002641AF /* BeEmptyTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F299EAA19627B2D002641AF /* BeEmptyTest.swift */; }; 1F299EAC19627B2D002641AF /* BeEmptyTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F299EAA19627B2D002641AF /* BeEmptyTest.swift */; }; - 1F43728A1A1B343800EB80F8 /* Functional.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD251968AB07008ED995 /* Functional.swift */; }; - 1F43728B1A1B343900EB80F8 /* Functional.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD251968AB07008ED995 /* Functional.swift */; }; 1F43728C1A1B343C00EB80F8 /* SourceLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD271968AB07008ED995 /* SourceLocation.swift */; }; 1F43728D1A1B343D00EB80F8 /* SourceLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD271968AB07008ED995 /* SourceLocation.swift */; }; 1F43728E1A1B343F00EB80F8 /* Stringers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD281968AB07008ED995 /* Stringers.swift */; }; @@ -142,7 +143,6 @@ 1F5DF1871BDCA0F500C3A531 /* Match.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDB4D5EC19FE43C200E9D9FE /* Match.swift */; }; 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 /* 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 */; }; @@ -284,15 +284,18 @@ 29EA59641B551ED2002D767E /* ThrowErrorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29EA59621B551ED2002D767E /* ThrowErrorTest.swift */; }; 29EA59661B551EE6002D767E /* ThrowError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29EA59651B551EE6002D767E /* ThrowError.swift */; }; 29EA59671B551EE6002D767E /* ThrowError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29EA59651B551EE6002D767E /* ThrowError.swift */; }; - 347155CA1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 347155C91C337C8900549F03 /* XCTestCaseProvider.swift */; }; - 347155CB1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 347155C91C337C8900549F03 /* XCTestCaseProvider.swift */; }; - 347155CC1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 347155C91C337C8900549F03 /* XCTestCaseProvider.swift */; }; 472FD1351B9E085700C7B8DA /* HaveCount.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472FD1341B9E085700C7B8DA /* HaveCount.swift */; }; 472FD1391B9E0A9700C7B8DA /* HaveCount.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472FD1341B9E085700C7B8DA /* HaveCount.swift */; }; 472FD13A1B9E0A9F00C7B8DA /* HaveCountTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472FD1361B9E094B00C7B8DA /* HaveCountTest.swift */; }; 472FD13B1B9E0CFE00C7B8DA /* HaveCountTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472FD1361B9E094B00C7B8DA /* HaveCountTest.swift */; }; 4793854D1BA0BB2500296F85 /* ObjCHaveCountTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4793854C1BA0BB2500296F85 /* ObjCHaveCountTest.m */; }; 4793854E1BA0BB2500296F85 /* ObjCHaveCountTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4793854C1BA0BB2500296F85 /* ObjCHaveCountTest.m */; }; + 62FB326223B78BF90047BED9 /* BeginWithPrefix.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62FB326123B78BF90047BED9 /* BeginWithPrefix.swift */; }; + 62FB326323B78BF90047BED9 /* BeginWithPrefix.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62FB326123B78BF90047BED9 /* BeginWithPrefix.swift */; }; + 62FB326423B78BF90047BED9 /* BeginWithPrefix.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62FB326123B78BF90047BED9 /* BeginWithPrefix.swift */; }; + 62FB326923B78D4F0047BED9 /* BeginWithPrefixTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62FB326523B78D4A0047BED9 /* BeginWithPrefixTest.swift */; }; + 62FB326A23B78D500047BED9 /* BeginWithPrefixTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62FB326523B78D4A0047BED9 /* BeginWithPrefixTest.swift */; }; + 62FB326B23B78D510047BED9 /* BeginWithPrefixTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62FB326523B78D4A0047BED9 /* BeginWithPrefixTest.swift */; }; 6CAEDD0A1CAEA86F003F1584 /* LinuxSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CAEDD091CAEA86F003F1584 /* LinuxSupport.swift */; }; 6CAEDD0B1CAEA86F003F1584 /* LinuxSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CAEDD091CAEA86F003F1584 /* LinuxSupport.swift */; }; 6CAEDD0C1CAEA86F003F1584 /* LinuxSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CAEDD091CAEA86F003F1584 /* LinuxSupport.swift */; }; @@ -353,7 +356,10 @@ 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 */; }; + CD3D9A79232647BC00802581 /* CwlCatchBadInstructionPosix.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD3D9A78232647BC00802581 /* CwlCatchBadInstructionPosix.swift */; }; + CD4C8F092464365300A7BDE0 /* SynchronousDeprecatedTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD4C8F082464365300A7BDE0 /* SynchronousDeprecatedTest.swift */; }; + CD4C8F0A2464365300A7BDE0 /* SynchronousDeprecatedTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD4C8F082464365300A7BDE0 /* SynchronousDeprecatedTest.swift */; }; + CD4C8F0B2464365300A7BDE0 /* SynchronousDeprecatedTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD4C8F082464365300A7BDE0 /* SynchronousDeprecatedTest.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 */; }; @@ -380,6 +386,12 @@ CD79C9B51D2CC848004B6F9A /* ObjCUserDescriptionTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 965B0D081B62B8ED0005AE66 /* ObjCUserDescriptionTest.m */; }; CD79C9B61D2CC848004B6F9A /* ObjCAllPassTest.m in Sources */ = {isa = PBXBuildFile; fileRef = DDEFAEB31A93CBE6005CA37A /* ObjCAllPassTest.m */; }; CD79C9B71D2CC848004B6F9A /* ObjCSatisfyAnyOfTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B5358C11C39155600A23FAA /* ObjCSatisfyAnyOfTest.m */; }; + CDBC39B92462EA7D00069677 /* PredicateTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDBC39B82462EA7D00069677 /* PredicateTest.swift */; }; + CDBC39BA2462EA7D00069677 /* PredicateTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDBC39B82462EA7D00069677 /* PredicateTest.swift */; }; + CDBC39BB2462EA7D00069677 /* PredicateTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDBC39B82462EA7D00069677 /* PredicateTest.swift */; }; + CDC157912511957100EAA480 /* DSLTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC157902511957100EAA480 /* DSLTest.swift */; }; + CDC157922511957100EAA480 /* DSLTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC157902511957100EAA480 /* DSLTest.swift */; }; + CDC157932511957100EAA480 /* DSLTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC157902511957100EAA480 /* DSLTest.swift */; }; CDD80B831F2030790002CD65 /* MatcherProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1D1968AB07008ED995 /* MatcherProtocols.swift */; }; CDD80B841F20307A0002CD65 /* MatcherProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1D1968AB07008ED995 /* MatcherProtocols.swift */; }; CDD80B851F20307B0002CD65 /* MatcherProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1D1968AB07008ED995 /* MatcherProtocols.swift */; }; @@ -395,8 +407,6 @@ CDFB6A3C1F7E082500AD8CC7 /* CwlCatchBadInstruction.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A2B1F7E082400AD8CC7 /* CwlCatchBadInstruction.swift */; }; CDFB6A3F1F7E082500AD8CC7 /* CwlDarwinDefinitions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A2D1F7E082400AD8CC7 /* CwlDarwinDefinitions.swift */; }; CDFB6A401F7E082500AD8CC7 /* CwlDarwinDefinitions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A2D1F7E082400AD8CC7 /* CwlDarwinDefinitions.swift */; }; - CDFB6A431F7E082500AD8CC7 /* CwlPreconditionTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A301F7E082400AD8CC7 /* CwlPreconditionTesting.h */; settings = {ATTRIBUTES = (Public, ); }; }; - CDFB6A441F7E082500AD8CC7 /* CwlPreconditionTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A301F7E082400AD8CC7 /* CwlPreconditionTesting.h */; settings = {ATTRIBUTES = (Public, ); }; }; CDFB6A471F7E082500AD8CC7 /* CwlMachBadInstructionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A341F7E082400AD8CC7 /* CwlMachBadInstructionHandler.m */; }; CDFB6A481F7E082500AD8CC7 /* CwlMachBadInstructionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A341F7E082400AD8CC7 /* CwlMachBadInstructionHandler.m */; }; CDFB6A491F7E082500AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A361F7E082400AD8CC7 /* CwlMachBadInstructionHandler.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -404,9 +414,6 @@ CDFB6A4B1F7E082500AD8CC7 /* mach_excServer.c in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A371F7E082400AD8CC7 /* mach_excServer.c */; }; CDFB6A4C1F7E082500AD8CC7 /* mach_excServer.c in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A371F7E082400AD8CC7 /* mach_excServer.c */; }; CDFB6A4F1F7E084600AD8CC7 /* CwlMachBadInstructionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A341F7E082400AD8CC7 /* CwlMachBadInstructionHandler.m */; }; - CDFB6A501F7E085600AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A361F7E082400AD8CC7 /* CwlMachBadInstructionHandler.h */; }; - CDFB6A511F7E087500AD8CC7 /* CwlCatchBadInstructionPosix.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDFB6A2C1F7E082400AD8CC7 /* CwlCatchBadInstructionPosix.swift */; }; - CDFB6A521F7E089F00AD8CC7 /* CwlPreconditionTesting_POSIX.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFB6A321F7E082400AD8CC7 /* CwlPreconditionTesting_POSIX.h */; settings = {ATTRIBUTES = (Public, ); }; }; DA9E8C821A414BB9002633C2 /* DSL+Wait.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9E8C811A414BB9002633C2 /* DSL+Wait.swift */; }; DA9E8C831A414BB9002633C2 /* DSL+Wait.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9E8C811A414BB9002633C2 /* DSL+Wait.swift */; }; DD72EC641A93874A002F7651 /* AllPassTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD72EC631A93874A002F7651 /* AllPassTest.swift */; }; @@ -493,6 +500,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 0477153423B740AD00402D4E /* DispatchTimeInterval.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DispatchTimeInterval.swift; sourceTree = ""; }; 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectWithLazyProperty.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 = ""; }; @@ -588,7 +596,6 @@ 1FD8CD1C1968AB07008ED995 /* Equal.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Equal.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 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 /* 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 = ""; }; @@ -596,10 +603,11 @@ 1FE661561E6574E20035F243 /* ExpectationMessage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExpectationMessage.swift; sourceTree = ""; }; 29EA59621B551ED2002D767E /* ThrowErrorTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ThrowErrorTest.swift; sourceTree = ""; }; 29EA59651B551EE6002D767E /* ThrowError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ThrowError.swift; sourceTree = ""; }; - 347155C91C337C8900549F03 /* XCTestCaseProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTestCaseProvider.swift; sourceTree = ""; }; 472FD1341B9E085700C7B8DA /* HaveCount.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HaveCount.swift; sourceTree = ""; }; 472FD1361B9E094B00C7B8DA /* HaveCountTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HaveCountTest.swift; sourceTree = ""; }; 4793854C1BA0BB2500296F85 /* ObjCHaveCountTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ObjCHaveCountTest.m; sourceTree = ""; }; + 62FB326123B78BF90047BED9 /* BeginWithPrefix.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BeginWithPrefix.swift; sourceTree = ""; }; + 62FB326523B78D4A0047BED9 /* BeginWithPrefixTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BeginWithPrefixTest.swift; sourceTree = ""; }; 6CAEDD091CAEA86F003F1584 /* LinuxSupport.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LinuxSupport.swift; sourceTree = ""; }; 7A0A26221E7F52360092A34E /* ToSucceed.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToSucceed.swift; sourceTree = ""; }; 7A6AB2C11E7F547E00A2F694 /* ToSucceedTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToSucceedTest.swift; sourceTree = ""; }; @@ -621,16 +629,16 @@ 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 = ""; }; + CD3D9A78232647BC00802581 /* CwlCatchBadInstructionPosix.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlCatchBadInstructionPosix.swift; sourceTree = ""; }; + CD4C8F082464365300A7BDE0 /* SynchronousDeprecatedTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SynchronousDeprecatedTest.swift; sourceTree = ""; }; + CDBC39B82462EA7D00069677 /* PredicateTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PredicateTest.swift; sourceTree = ""; }; + CDC157902511957100EAA480 /* DSLTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DSLTest.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 = ""; }; CDFB6A2A1F7E082400AD8CC7 /* CwlBadInstructionException.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlBadInstructionException.swift; sourceTree = ""; }; CDFB6A2B1F7E082400AD8CC7 /* CwlCatchBadInstruction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlCatchBadInstruction.swift; sourceTree = ""; }; - CDFB6A2C1F7E082400AD8CC7 /* CwlCatchBadInstructionPosix.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlCatchBadInstructionPosix.swift; sourceTree = ""; }; CDFB6A2D1F7E082400AD8CC7 /* CwlDarwinDefinitions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlDarwinDefinitions.swift; sourceTree = ""; }; - CDFB6A301F7E082400AD8CC7 /* CwlPreconditionTesting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlPreconditionTesting.h; sourceTree = ""; }; - CDFB6A321F7E082400AD8CC7 /* CwlPreconditionTesting_POSIX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlPreconditionTesting_POSIX.h; sourceTree = ""; }; CDFB6A341F7E082400AD8CC7 /* CwlMachBadInstructionHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CwlMachBadInstructionHandler.m; sourceTree = ""; }; CDFB6A361F7E082400AD8CC7 /* CwlMachBadInstructionHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlMachBadInstructionHandler.h; sourceTree = ""; }; CDFB6A371F7E082400AD8CC7 /* mach_excServer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mach_excServer.c; sourceTree = ""; }; @@ -699,7 +707,6 @@ children = ( 1F14FB63194180C5009F2A08 /* utils.swift */, 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */, - 347155C91C337C8900549F03 /* XCTestCaseProvider.swift */, ); path = Helpers; sourceTree = ""; @@ -777,11 +784,13 @@ 1F1A74381940169200FFFC47 /* NimbleTests */ = { isa = PBXGroup; children = ( - 1F925EE5195C121200ED456B /* AsynchronousTest.swift */, + CDC157902511957100EAA480 /* DSLTest.swift */, + CDBC39B82462EA7D00069677 /* PredicateTest.swift */, 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */, + CD4C8F082464365300A7BDE0 /* SynchronousDeprecatedTest.swift */, + 1F925EE5195C121200ED456B /* AsynchronousTest.swift */, 965B0D0B1B62C06D0005AE66 /* UserDescriptionTest.swift */, 6CAEDD091CAEA86F003F1584 /* LinuxSupport.swift */, - CD037212207DCC580047AF28 /* XCTestManifests.swift */, 1FFD729A1963FC8200CD29A2 /* objc */, 1F14FB61194180A7009F2A08 /* Helpers */, 1F925EE3195C11B000ED456B /* Matchers */, @@ -807,6 +816,7 @@ 1F925EE8195C124400ED456B /* BeAnInstanceOfTest.swift */, 1F925EF5195C147800ED456B /* BeCloseToTest.swift */, 1F299EAA19627B2D002641AF /* BeEmptyTest.swift */, + 62FB326523B78D4A0047BED9 /* BeginWithPrefixTest.swift */, 1F925EFB195C186800ED456B /* BeginWithTest.swift */, 1F925F10195C190B00ED456B /* BeGreaterThanOrEqualToTest.swift */, 1F925F07195C18CF00ED456B /* BeGreaterThanTest.swift */, @@ -819,18 +829,18 @@ 1F91DD2C1C74BF36002C309F /* BeVoidTest.swift */, 7B13BA091DD360DE00C9098C /* ContainElementSatisfyingTest.swift */, 1F925F01195C189500ED456B /* ContainTest.swift */, + B20058C420E92CE400C1264D /* ElementsEqualTest.swift */, 1F925EFE195C187600ED456B /* EndWithTest.swift */, 1F925F04195C18B700ED456B /* EqualTest.swift */, - B20058C420E92CE400C1264D /* ElementsEqualTest.swift */, 472FD1361B9E094B00C7B8DA /* HaveCountTest.swift */, - DDB4D5EF19FE442800E9D9FE /* MatchTest.swift */, - 1F925EEB195C12C800ED456B /* RaisesExceptionTest.swift */, - 29EA59621B551ED2002D767E /* ThrowErrorTest.swift */, - 7B5358B91C3846C900A23FAA /* SatisfyAnyOfTest.swift */, - A8A3B6E920712FC100E25A08 /* SatisfyAllOfTest.swift */, - 1FCF914E1C61C85A00B15DCB /* PostNotificationTest.swift */, AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */, + DDB4D5EF19FE442800E9D9FE /* MatchTest.swift */, + 1FCF914E1C61C85A00B15DCB /* PostNotificationTest.swift */, + 1F925EEB195C12C800ED456B /* RaisesExceptionTest.swift */, + A8A3B6E920712FC100E25A08 /* SatisfyAllOfTest.swift */, + 7B5358B91C3846C900A23FAA /* SatisfyAnyOfTest.swift */, 1F4BB8B31DACA0D00048464B /* ThrowAssertionTest.swift */, + 29EA59621B551ED2002D767E /* ThrowErrorTest.swift */, 7A6AB2C11E7F547E00A2F694 /* ToSucceedTest.swift */, ); path = Matchers; @@ -861,6 +871,7 @@ 1FD8CD0F1968AB07008ED995 /* BeCloseTo.swift */, 1FD8CD101968AB07008ED995 /* BeEmpty.swift */, 1FD8CD111968AB07008ED995 /* BeginWith.swift */, + 62FB326123B78BF90047BED9 /* BeginWithPrefix.swift */, 1FD8CD121968AB07008ED995 /* BeGreaterThan.swift */, 1FD8CD131968AB07008ED995 /* BeGreaterThanOrEqualTo.swift */, 1FD8CD141968AB07008ED995 /* BeIdenticalTo.swift */, @@ -871,9 +882,9 @@ 1F91DD301C74BF61002C309F /* BeVoid.swift */, 1FD8CD1A1968AB07008ED995 /* Contain.swift */, 7B13BA051DD360AA00C9098C /* ContainElementSatisfying.swift */, + B20058C020E92C7500C1264D /* ElementsEqual.swift */, 1FD8CD1B1968AB07008ED995 /* EndWith.swift */, 1FD8CD1C1968AB07008ED995 /* Equal.swift */, - B20058C020E92C7500C1264D /* ElementsEqual.swift */, 472FD1341B9E085700C7B8DA /* HaveCount.swift */, DDB4D5EC19FE43C200E9D9FE /* Match.swift */, 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */, @@ -882,8 +893,8 @@ 1FCF91521C61C8A400B15DCB /* PostNotification.swift */, 1FA0C3FE1E30B14500623165 /* Predicate.swift */, 1FD8CD1E1968AB07008ED995 /* RaisesException.swift */, - 7B5358BD1C38479700A23FAA /* SatisfyAnyOf.swift */, A8F6B5BC2070186D00FCB5ED /* SatisfyAllOf.swift */, + 7B5358BD1C38479700A23FAA /* SatisfyAnyOf.swift */, 964CFEFC1C4FF48900513336 /* ThrowAssertion.swift */, 29EA59651B551EE6002D767E /* ThrowError.swift */, 7A0A26221E7F52360092A34E /* ToSucceed.swift */, @@ -894,11 +905,11 @@ 1FD8CD241968AB07008ED995 /* Utils */ = { isa = PBXGroup; children = ( - 1FD8CD251968AB07008ED995 /* Functional.swift */, 1FD8CD261968AB07008ED995 /* Await.swift */, 1FD8CD271968AB07008ED995 /* SourceLocation.swift */, 1FD8CD281968AB07008ED995 /* Stringers.swift */, AE4BA9AC1C88DDB500B73906 /* Errors.swift */, + 0477153423B740AD00402D4E /* DispatchTimeInterval.swift */, ); path = Utils; sourceTree = ""; @@ -940,6 +951,14 @@ path = objc; sourceTree = ""; }; + CD3D9A77232647BC00802581 /* CwlPosixPreconditionTesting */ = { + isa = PBXGroup; + children = ( + CD3D9A78232647BC00802581 /* CwlCatchBadInstructionPosix.swift */, + ); + path = CwlPosixPreconditionTesting; + sourceTree = ""; + }; CDFB69521F7E06E600AD8CC7 /* Carthage-Checkouts */ = { isa = PBXGroup; children = ( @@ -965,6 +984,7 @@ children = ( CDFB6A331F7E082400AD8CC7 /* CwlMachBadInstructionHandler */, CDFB6A291F7E082400AD8CC7 /* CwlPreconditionTesting */, + CD3D9A77232647BC00802581 /* CwlPosixPreconditionTesting */, ); name = CwlPreconditionTesting; path = CwlPreconditionTesting/Sources; @@ -1000,30 +1020,11 @@ children = ( CDFB6A2A1F7E082400AD8CC7 /* CwlBadInstructionException.swift */, CDFB6A2B1F7E082400AD8CC7 /* CwlCatchBadInstruction.swift */, - CDFB6A2C1F7E082400AD8CC7 /* CwlCatchBadInstructionPosix.swift */, CDFB6A2D1F7E082400AD8CC7 /* CwlDarwinDefinitions.swift */, - CDFB6A2F1F7E082400AD8CC7 /* Mach */, - CDFB6A311F7E082400AD8CC7 /* Posix */, ); path = CwlPreconditionTesting; sourceTree = ""; }; - CDFB6A2F1F7E082400AD8CC7 /* Mach */ = { - isa = PBXGroup; - children = ( - CDFB6A301F7E082400AD8CC7 /* CwlPreconditionTesting.h */, - ); - path = Mach; - sourceTree = ""; - }; - CDFB6A311F7E082400AD8CC7 /* Posix */ = { - isa = PBXGroup; - children = ( - CDFB6A321F7E082400AD8CC7 /* CwlPreconditionTesting_POSIX.h */, - ); - path = Posix; - sourceTree = ""; - }; CDFB6A331F7E082400AD8CC7 /* CwlMachBadInstructionHandler */ = { isa = PBXGroup; children = ( @@ -1052,7 +1053,6 @@ files = ( CDFB6A4A1F7E082500AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */, CDFB6A281F7E07C700AD8CC7 /* CwlCatchException.h in Headers */, - CDFB6A441F7E082500AD8CC7 /* CwlPreconditionTesting.h in Headers */, 1F1871C91CA89EDB00A34BF2 /* NMBStringify.h in Headers */, 1F1871C51CA89EDB00A34BF2 /* DSL.h in Headers */, 1F1871C71CA89EDB00A34BF2 /* NMBExceptionCapture.h in Headers */, @@ -1064,11 +1064,9 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - CDFB6A521F7E089F00AD8CC7 /* CwlPreconditionTesting_POSIX.h in Headers */, 1F1871E21CA89EF600A34BF2 /* NMBStringify.h in Headers */, 1F1871E01CA89EF600A34BF2 /* DSL.h in Headers */, 1F1871E11CA89EF600A34BF2 /* NMBExceptionCapture.h in Headers */, - CDFB6A501F7E085600AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */, 1F4999A61DBF2DD100BF8877 /* Nimble.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1080,7 +1078,6 @@ CDFB6A491F7E082500AD8CC7 /* CwlMachBadInstructionHandler.h in Headers */, CDFB6A271F7E07C700AD8CC7 /* CwlCatchException.h in Headers */, 1F1871DF1CA89EF500A34BF2 /* NMBStringify.h in Headers */, - CDFB6A431F7E082500AD8CC7 /* CwlPreconditionTesting.h in Headers */, 1F1871DD1CA89EF500A34BF2 /* DSL.h in Headers */, 1F1871DE1CA89EF500A34BF2 /* NMBExceptionCapture.h in Headers */, 1F925EC7195C0DD100ED456B /* Nimble.h in Headers */, @@ -1211,7 +1208,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "Jeff Hui"; TargetAttributes = { 1F1A74281940169200FFFC47 = { @@ -1247,11 +1244,12 @@ }; }; buildConfigurationList = 1F1A74231940169200FFFC47 /* Build configuration list for PBXProject "Nimble" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + compatibilityVersion = "Xcode 11.4"; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = 1F1A741F1940169200FFFC47; productRefGroup = 1F1A742A1940169200FFFC47 /* Products */; @@ -1344,9 +1342,9 @@ 1F43728D1A1B343D00EB80F8 /* SourceLocation.swift in Sources */, 1FD8CD4E1968AB07008ED995 /* BeLessThanOrEqual.swift in Sources */, 1FDBD8671AF8A4FF0089F27B /* AssertionDispatcher.swift in Sources */, - 1F43728A1A1B343800EB80F8 /* Functional.swift in Sources */, AE4BA9AD1C88DDB500B73906 /* Errors.swift in Sources */, 1FD8CD3C1968AB07008ED995 /* BeAnInstanceOf.swift in Sources */, + 0477153623B740B700402D4E /* DispatchTimeInterval.swift in Sources */, 7A6AB2C51E7F628900A2F694 /* ToSucceed.swift in Sources */, 1FD8CD501968AB07008ED995 /* BeLogical.swift in Sources */, 1F1871CB1CA89EDB00A34BF2 /* NMBExpectation.swift in Sources */, @@ -1360,6 +1358,7 @@ 1FCF91531C61C8A400B15DCB /* PostNotification.swift in Sources */, 1FD8CD2E1968AB07008ED995 /* AssertionRecorder.swift in Sources */, 29EA59661B551EE6002D767E /* ThrowError.swift in Sources */, + 62FB326323B78BF90047BED9 /* BeginWithPrefix.swift in Sources */, 1FD8CD5A1968AB07008ED995 /* Equal.swift in Sources */, 1FD8CD4C1968AB07008ED995 /* BeLessThan.swift in Sources */, 1F1871CC1CA89EDB00A34BF2 /* NMBObjCMatcher.swift in Sources */, @@ -1406,9 +1405,11 @@ files = ( 1F4A569A1A3B3539009E1637 /* ObjCEqualTest.m in Sources */, 1F925EEC195C12C800ED456B /* RaisesExceptionTest.swift in Sources */, + 62FB326A23B78D500047BED9 /* BeginWithPrefixTest.swift in Sources */, 1F925EFF195C187600ED456B /* EndWithTest.swift in Sources */, 1F1B5AD41963E13900CA8BF9 /* BeAKindOfTest.swift in Sources */, 1F925F0E195C18F500ED456B /* BeLessThanOrEqualToTest.swift in Sources */, + CDBC39BA2462EA7D00069677 /* PredicateTest.swift in Sources */, 1F4A56661A3B305F009E1637 /* ObjCAsyncTest.m in Sources */, 1F925EFC195C186800ED456B /* BeginWithTest.swift in Sources */, 1F14FB64194180C5009F2A08 /* utils.swift in Sources */, @@ -1430,7 +1431,9 @@ 1F91DD2D1C74BF36002C309F /* BeVoidTest.swift in Sources */, 1F4A56761A3B3253009E1637 /* ObjCBeGreaterThanTest.m in Sources */, 1F925EF9195C175000ED456B /* BeNilTest.swift in Sources */, + CDC157922511957100EAA480 /* DSLTest.swift in Sources */, 7A6AB2C31E7F547E00A2F694 /* ToSucceedTest.swift in Sources */, + CD4C8F0A2464365300A7BDE0 /* SynchronousDeprecatedTest.swift in Sources */, A8A3B707207368F000E25A08 /* ObjCSatisfyAllOfTest.m in Sources */, 1F4A56701A3B319F009E1637 /* ObjCBeCloseToTest.m in Sources */, 1F4A56971A3B34AA009E1637 /* ObjCEndWithTest.m in Sources */, @@ -1457,7 +1460,6 @@ DD9A9A8F19CF439B00706F49 /* BeIdenticalToObjectTest.swift in Sources */, 1F4BB8B71DACA0E40048464B /* ThrowAssertionTest.swift in Sources */, 1F0648D41963AAB2001F9C46 /* SynchronousTest.swift in Sources */, - 347155CA1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */, 4793854D1BA0BB2500296F85 /* ObjCHaveCountTest.m in Sources */, 1F925F08195C18CF00ED456B /* BeGreaterThanTest.swift in Sources */, 7B5358BA1C3846C900A23FAA /* SatisfyAnyOfTest.swift in Sources */, @@ -1482,8 +1484,10 @@ 1F1871D71CA89EEF00A34BF2 /* NMBExceptionCapture.m in Sources */, 1F5DF16E1BDCA0F500C3A531 /* NimbleXCTestHandler.swift in Sources */, 7A6AB2C61E7F628A00A2F694 /* ToSucceed.swift in Sources */, + 62FB326423B78BF90047BED9 /* BeginWithPrefix.swift in Sources */, 1F5DF1751BDCA0F500C3A531 /* FailureMessage.swift in Sources */, A8A3B6EC2071487F00E25A08 /* SatisfyAllOf.swift in Sources */, + CD3D9A79232647BC00802581 /* CwlCatchBadInstructionPosix.swift in Sources */, 1F5DF1801BDCA0F500C3A531 /* BeLessThanOrEqual.swift in Sources */, 1F1871E81CA8A18400A34BF2 /* Async.swift in Sources */, 1F5DF18A1BDCA0F500C3A531 /* ThrowError.swift in Sources */, @@ -1518,7 +1522,6 @@ 1F5DF17E1BDCA0F500C3A531 /* BeIdenticalTo.swift in Sources */, 1F1871E91CA8A18700A34BF2 /* MatcherFunc.swift in Sources */, 1F5DF17A1BDCA0F500C3A531 /* BeEmpty.swift in Sources */, - CDFB6A511F7E087500AD8CC7 /* CwlCatchBadInstructionPosix.swift in Sources */, 1F5DF18C1BDCA0F500C3A531 /* Await.swift in Sources */, 1F1871D81CA89EEF00A34BF2 /* NMBStringify.m in Sources */, 1F5DF1821BDCA0F500C3A531 /* BeNil.swift in Sources */, @@ -1531,8 +1534,8 @@ CDD80B851F20307B0002CD65 /* MatcherProtocols.swift in Sources */, 1F5DF1721BDCA0F500C3A531 /* Expectation.swift in Sources */, 7B5358C01C38479700A23FAA /* SatisfyAnyOf.swift in Sources */, + 0477153723B740B800402D4E /* DispatchTimeInterval.swift in Sources */, 7B13BA0C1DD361D300C9098C /* ContainElementSatisfying.swift in Sources */, - 1F5DF18B1BDCA0F500C3A531 /* Functional.swift in Sources */, 1F5DF1871BDCA0F500C3A531 /* Match.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1543,9 +1546,11 @@ files = ( CD79C9AD1D2CC848004B6F9A /* ObjCBeTrueTest.m in Sources */, CD79C9B41D2CC848004B6F9A /* ObjCRaiseExceptionTest.m in Sources */, + 62FB326923B78D4F0047BED9 /* BeginWithPrefixTest.swift in Sources */, 1F5DF1A31BDCA10200C3A531 /* BeLogicalTest.swift in Sources */, 1F5DF1951BDCA10200C3A531 /* utils.swift in Sources */, CD79C9B01D2CC848004B6F9A /* ObjCEndWithTest.m in Sources */, + CDBC39BB2462EA7D00069677 /* PredicateTest.swift in Sources */, CD79C9B21D2CC848004B6F9A /* ObjCHaveCountTest.m in Sources */, CD79C9A41D2CC848004B6F9A /* ObjCBeFalsyTest.m in Sources */, 1F5DF1981BDCA10200C3A531 /* BeAKindOfTest.swift in Sources */, @@ -1567,7 +1572,9 @@ CD79C9A81D2CC848004B6F9A /* ObjCBeIdenticalToTest.m in Sources */, CD79C9AE1D2CC848004B6F9A /* ObjCBeTruthyTest.m in Sources */, 1F5DF1921BDCA10200C3A531 /* AsynchronousTest.swift in Sources */, + CDC157932511957100EAA480 /* DSLTest.swift in Sources */, 1F5DF1A91BDCA10200C3A531 /* MatchTest.swift in Sources */, + CD4C8F0B2464365300A7BDE0 /* SynchronousDeprecatedTest.swift in Sources */, A8A3B708207368F100E25A08 /* ObjCSatisfyAllOfTest.m in Sources */, 1F5DF1A81BDCA10200C3A531 /* HaveCountTest.swift in Sources */, 1F5DF1971BDCA10200C3A531 /* AllPassTest.swift in Sources */, @@ -1591,7 +1598,6 @@ 7A6AB2C41E7F547E00A2F694 /* ToSucceedTest.swift in Sources */, CD79C9A71D2CC848004B6F9A /* ObjCBeGreaterThanTest.m in Sources */, CD79C9A51D2CC848004B6F9A /* ObjCBeginWithTest.m in Sources */, - 347155CC1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */, 1F5DF1AA1BDCA10200C3A531 /* RaisesExceptionTest.swift in Sources */, 1F5DF1941BDCA10200C3A531 /* UserDescriptionTest.swift in Sources */, CD79C9AF1D2CC848004B6F9A /* ObjCContainTest.m in Sources */, @@ -1624,8 +1630,8 @@ 1FD8CD4F1968AB07008ED995 /* BeLessThanOrEqual.swift in Sources */, 1F1871E71CA8A18400A34BF2 /* Async.swift in Sources */, 1FDBD8681AF8A4FF0089F27B /* AssertionDispatcher.swift in Sources */, - 1F43728B1A1B343900EB80F8 /* Functional.swift in Sources */, AE4BA9AE1C88DDB500B73906 /* Errors.swift in Sources */, + 0477153523B740AD00402D4E /* DispatchTimeInterval.swift in Sources */, 1FD8CD3D1968AB07008ED995 /* BeAnInstanceOf.swift in Sources */, 1FD8CD511968AB07008ED995 /* BeLogical.swift in Sources */, 1F1871D91CA89EF100A34BF2 /* NMBExpectation.swift in Sources */, @@ -1639,6 +1645,7 @@ 1FCF91541C61C8A400B15DCB /* PostNotification.swift in Sources */, DDB4D5EE19FE43C200E9D9FE /* Match.swift in Sources */, 29EA59671B551EE6002D767E /* ThrowError.swift in Sources */, + 62FB326223B78BF90047BED9 /* BeginWithPrefix.swift in Sources */, 1FD8CD5B1968AB07008ED995 /* Equal.swift in Sources */, 1FD8CD4D1968AB07008ED995 /* BeLessThan.swift in Sources */, 1FD8CD471968AB07008ED995 /* BeGreaterThan.swift in Sources */, @@ -1685,16 +1692,17 @@ files = ( 1F4A569B1A3B3539009E1637 /* ObjCEqualTest.m in Sources */, 1F925EED195C12C800ED456B /* RaisesExceptionTest.swift in Sources */, + 62FB326B23B78D510047BED9 /* BeginWithPrefixTest.swift in Sources */, 1F925F00195C187600ED456B /* EndWithTest.swift in Sources */, 1F1B5AD51963E13900CA8BF9 /* BeAKindOfTest.swift in Sources */, 1F925F0F195C18F500ED456B /* BeLessThanOrEqualToTest.swift in Sources */, + CDBC39B92462EA7D00069677 /* PredicateTest.swift in Sources */, 1F4A56671A3B305F009E1637 /* ObjCAsyncTest.m in Sources */, 1F925EFD195C186800ED456B /* BeginWithTest.swift in Sources */, 1F925EE2195C0DFD00ED456B /* utils.swift in Sources */, 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 */, @@ -1710,7 +1718,9 @@ 1FB90099195EC4B8001D7FAE /* BeIdenticalToTest.swift in Sources */, 1F91DD2E1C74BF36002C309F /* BeVoidTest.swift in Sources */, 1F4A56771A3B3253009E1637 /* ObjCBeGreaterThanTest.m in Sources */, + CDC157912511957100EAA480 /* DSLTest.swift in Sources */, 1F925EFA195C175000ED456B /* BeNilTest.swift in Sources */, + CD4C8F092464365300A7BDE0 /* SynchronousDeprecatedTest.swift in Sources */, 7A6AB2C21E7F547E00A2F694 /* ToSucceedTest.swift in Sources */, A8A3B706207368EF00E25A08 /* ObjCSatisfyAllOfTest.m in Sources */, 1F4A56711A3B319F009E1637 /* ObjCBeCloseToTest.m in Sources */, @@ -1737,7 +1747,6 @@ DD9A9A9019CF43AD00706F49 /* BeIdenticalToObjectTest.swift in Sources */, 1F4BB8B61DACA0E30048464B /* ThrowAssertionTest.swift in Sources */, 1F0648D51963AAB2001F9C46 /* SynchronousTest.swift in Sources */, - 347155CB1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */, 4793854E1BA0BB2500296F85 /* ObjCHaveCountTest.m in Sources */, 1F925F09195C18CF00ED456B /* BeGreaterThanTest.swift in Sources */, 7B5358BB1C3846C900A23FAA /* SatisfyAnyOfTest.swift in Sources */, @@ -1809,6 +1818,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; APPLICATION_EXTENSION_API_ONLY = YES; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -1839,6 +1849,7 @@ CURRENT_PROJECT_VERSION = 1; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_TESTING_SEARCH_PATHS = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -1855,16 +1866,18 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; + OTHER_LDFLAGS = ( + "$(inherited)", + "-Xlinker", + "-no_application_extension", + ); + SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; - TARGETED_DEVICE_FAMILY = "1,2"; - TVOS_DEPLOYMENT_TARGET = 9.0; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -1875,6 +1888,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; APPLICATION_EXTENSION_API_ONLY = YES; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -1905,6 +1919,7 @@ CURRENT_PROJECT_VERSION = 1; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTING_SEARCH_PATHS = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -1914,15 +1929,19 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + OTHER_LDFLAGS = ( + "$(inherited)", + "-Xlinker", + "-no_application_extension", + ); + OTHER_SWIFT_FLAGS = "$(inherited) -suppress-warnings"; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; - TARGETED_DEVICE_FAMILY = "1,2"; - TVOS_DEPLOYMENT_TARGET = 9.0; + SWIFT_VERSION = 5.0; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1932,16 +1951,13 @@ 1F1A74401940169200FFFC47 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "PRODUCT_NAME=$(PRODUCT_NAME)/$(PRODUCT_NAME)", @@ -1950,37 +1966,38 @@ GCC_TREAT_WARNINGS_AS_ERRORS = YES; INFOPLIST_FILE = Sources/Nimble/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - ONLY_ACTIVE_ARCH = NO; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + 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; PRODUCT_NAME = Nimble; + SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; 1F1A74411940169200FFFC47 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); GCC_PREPROCESSOR_DEFINITIONS = ( "PRODUCT_NAME=$(PRODUCT_NAME)/$(PRODUCT_NAME)", "$(inherited)", @@ -1988,20 +2005,26 @@ GCC_TREAT_WARNINGS_AS_ERRORS = YES; INFOPLIST_FILE = Sources/Nimble/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + 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; PRODUCT_NAME = Nimble; + SDKROOT = iphoneos; SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; }; @@ -2009,20 +2032,22 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(inherited)", - ); GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); INFOPLIST_FILE = Tests/NimbleTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); METAL_ENABLE_DEBUG_INFO = YES; OTHER_CODE_SIGN_FLAGS = "--verbose"; PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = NimbleTests; + SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -2031,33 +2056,33 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(inherited)", - ); INFOPLIST_FILE = Tests/NimbleTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); METAL_ENABLE_DEBUG_INFO = NO; OTHER_CODE_SIGN_FLAGS = "--verbose"; PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = NimbleTests; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; }; name = Release; }; 1F5DF1661BDCA0CE00C3A531 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); GCC_NO_COMMON_BLOCKS = YES; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -2066,15 +2091,17 @@ ); INFOPLIST_FILE = Sources/Nimble/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + 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; @@ -2082,12 +2109,14 @@ SDKROOT = appletvos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; }; 1F5DF1671BDCA0CE00C3A531 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; @@ -2095,10 +2124,6 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); GCC_NO_COMMON_BLOCKS = YES; GCC_PREPROCESSOR_DEFINITIONS = ( "PRODUCT_NAME=$(PRODUCT_NAME)/$(PRODUCT_NAME)", @@ -2106,23 +2131,27 @@ ); INFOPLIST_FILE = Sources/Nimble/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + 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; PRODUCT_NAME = Nimble; SDKROOT = appletvos; SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Release; }; @@ -2130,19 +2159,20 @@ isa = XCBuildConfiguration; buildSettings = { DEBUG_INFORMATION_FORMAT = dwarf; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(inherited)", - ); GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = Tests/NimbleTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); MTL_ENABLE_DEBUG_INFO = YES; OTHER_CODE_SIGN_FLAGS = "--verbose"; PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = NimbleTests; SDKROOT = appletvos; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; }; @@ -2151,35 +2181,34 @@ buildSettings = { COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(inherited)", - ); GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = Tests/NimbleTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); MTL_ENABLE_DEBUG_INFO = NO; OTHER_CODE_SIGN_FLAGS = "--verbose"; PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = NimbleTests; SDKROOT = appletvos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Release; }; 1F925EC1195C0D6300ED456B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); FRAMEWORK_VERSION = A; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -2189,38 +2218,37 @@ GCC_TREAT_WARNINGS_AS_ERRORS = YES; INFOPLIST_FILE = Sources/Nimble/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = ( "$(inherited)", "-weak_framework", XCTest, "-weak-lswiftXCTest", - "-Xlinker", - "-no_application_extension", ); PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Nimble; PRODUCT_NAME = Nimble; SDKROOT = macosx; SKIP_INSTALL = YES; - VALID_ARCHS = x86_64; }; name = Debug; }; 1F925EC2195C0D6300ED456B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); FRAMEWORK_VERSION = A; GCC_PREPROCESSOR_DEFINITIONS = ( "PRODUCT_NAME=$(PRODUCT_NAME)/$(PRODUCT_NAME)", @@ -2229,23 +2257,26 @@ GCC_TREAT_WARNINGS_AS_ERRORS = YES; INFOPLIST_FILE = Sources/Nimble/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = NO; OTHER_LDFLAGS = ( "$(inherited)", "-weak_framework", XCTest, "-weak-lswiftXCTest", - "-Xlinker", - "-no_application_extension", ); PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = Nimble; PRODUCT_NAME = Nimble; SDKROOT = macosx; SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - VALID_ARCHS = x86_64; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; }; name = Release; }; @@ -2254,16 +2285,17 @@ buildSettings = { CLANG_ENABLE_MODULES = YES; COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(DEVELOPER_FRAMEWORKS_DIR)", - "$(inherited)", - ); GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); INFOPLIST_FILE = Tests/NimbleTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = NimbleTests; @@ -2278,17 +2310,19 @@ CLANG_ENABLE_MODULES = YES; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - FRAMEWORK_SEARCH_PATHS = ( - "$(DEVELOPER_FRAMEWORKS_DIR)", - "$(inherited)", - ); INFOPLIST_FILE = Tests/NimbleTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.10; METAL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = NimbleTests; SDKROOT = macosx; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; }; name = Release; }; diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/xcshareddata/xcschemes/Nimble-iOS.xcscheme b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/xcshareddata/xcschemes/Nimble-iOS.xcscheme index 80405c9..2175cc3 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/xcshareddata/xcschemes/Nimble-iOS.xcscheme +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Nimble.xcodeproj/xcshareddata/xcschemes/Nimble-iOS.xcscheme @@ -1,6 +1,6 @@ + skipped = "NO" + parallelizable = "YES"> - - - - + skipped = "NO" + parallelizable = "YES"> - - - - - - - - - - - - + + + + + + - - @@ -344,10 +345,10 @@ cases, use the `timeout` parameter: // Swift // Waits three seconds for ocean to contain "starfish": -expect(ocean).toEventually(contain("starfish"), timeout: 3) +expect(ocean).toEventually(contain("starfish"), timeout: .seconds(3)) // Evaluate someValue every 0.2 seconds repeatedly until it equals 100, or fails if it timeouts after 5.5 seconds. -expect(someValue).toEventually(equal(100), timeout: 5.5, pollInterval: 0.2) +expect(someValue).toEventually(equal(100), timeout: .milliseconds(5500), pollInterval: .milliseconds(200)) ``` ```objc @@ -386,7 +387,7 @@ waitUntil(^(void (^done)(void)){ ```swift // Swift -waitUntil(timeout: 10) { done in +waitUntil(timeout: .seconds(10)) { done in ocean.goFish { success in expect(success).to(beTrue()) done() @@ -418,10 +419,10 @@ the default timeout and poll interval values. This can be done as follows: // Swift // Increase the global timeout to 5 seconds: -Nimble.AsyncDefaults.Timeout = 5 +Nimble.AsyncDefaults.timeout = .seconds(1) // Slow the polling interval to 0.1 seconds: -Nimble.AsyncDefaults.PollInterval = 0.1 +Nimble.AsyncDefaults.pollInterval = .milliseconds(100) ``` ## Objective-C Support @@ -1171,20 +1172,31 @@ For Objective-C, the actual value must be one of the following classes, or their ```swift // Swift -let testNotification = Notification(name: "Foo", object: nil) +let testNotification = Notification(name: Notification.Name("Foo"), object: nil) -// passes if the closure in expect { ... } posts a notification to the default +// Passes if the closure in expect { ... } posts a notification to the default // notification center. expect { - NotificationCenter.default.postNotification(testNotification) -}.to(postNotifications(equal([testNotification])) + NotificationCenter.default.post(testNotification) +}.to(postNotifications(equal([testNotification]))) -// passes if the closure in expect { ... } posts a notification to a given +// Passes if the closure in expect { ... } posts a notification to a given // notification center let notificationCenter = NotificationCenter() expect { - notificationCenter.postNotification(testNotification) -}.to(postNotifications(equal([testNotification]), fromNotificationCenter: notificationCenter)) + notificationCenter.post(testNotification) +}.to(postNotifications(equal([testNotification]), from: notificationCenter)) + +// Passes if the closure in expect { ... } posts a notification with the provided names to a given +// notification center. Make sure to use this when running tests on Catalina, +// using DistributedNotificationCenter as there is currently no way +// of observing notifications without providing specific names. +let distributedNotificationCenter = DistributedNotificationCenter() +expect { + distributedNotificationCenter.post(testNotification) +}.toEventually(postDistributedNotifications(equal([testNotification]), + from: distributedNotificationCenter, + names: [testNotification.name])) ``` > This matcher is only available in Swift. @@ -1503,19 +1515,17 @@ For a more comprehensive message that spans multiple lines, use ## Supporting Objective-C To use a custom matcher written in Swift from Objective-C, you'll have -to extend the `NMBObjCMatcher` class, adding a new class method for your +to extend the `NMBPredicate` class, adding a new class method for your custom matcher. The example below defines the class method -`+[NMBObjCMatcher beNilMatcher]`: +`+[NMBPredicate beNilMatcher]`: ```swift // Swift -extension NMBObjCMatcher { - public class func beNilMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualBlock, failureMessage, location in - let block = ({ actualBlock() as NSObject? }) - let expr = Expression(expression: block, location: location) - return beNil().matches(expr, failureMessage: failureMessage) +extension NMBPredicate { + @objc public class func beNilMatcher() -> NMBPredicate { + return NMBPredicate { actualExpression in + return try beNil().satisfies(actualExpression).toObjectiveC() } } } @@ -1526,7 +1536,7 @@ The above allows you to use the matcher from Objective-C: ```objc // Objective-C -expect(actual).to([NMBObjCMatcher beNilMatcher]()); +expect(actual).to([NMBPredicate beNilMatcher]()); ``` To make the syntax easier to use, define a C function that calls the @@ -1535,8 +1545,8 @@ class method: ```objc // Objective-C -FOUNDATION_EXPORT id beNil() { - return [NMBObjCMatcher beNilMatcher]; +FOUNDATION_EXPORT NMBPredicate *beNil() { + return [NMBPredicate beNilMatcher]; } ``` @@ -1558,29 +1568,25 @@ expect(nil).to(equal(nil)); // fails expect(nil).to(beNil()); // passes ``` -If your matcher does not want to match with nil, you use `NonNilMatcherFunc` -and the `canMatchNil` constructor on `NMBObjCMatcher`. Using both types will -automatically generate expected value failure messages when they're nil. +If your matcher does not want to match with nil, you use `Predicate.define` or `Predicate.simple`. +Using those factory methods will automatically generate expected value failure messages when they're nil. ```swift +public func beginWith(_ startingElement: S.Element) -> Predicate where S.Element: Equatable { + return Predicate.simple("begin with <\(startingElement)>") { actualExpression in + guard let actualValue = try actualExpression.evaluate() else { return .fail } -public func beginWith(startingElement: T) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "begin with <\(startingElement)>" - if let actualValue = actualExpression.evaluate() { - var actualGenerator = actualValue.makeIterator() - return actualGenerator.next() == startingElement - } - return false + var actualGenerator = actualValue.makeIterator() + return PredicateStatus(bool: actualGenerator.next() == startingElement) } } -extension NMBObjCMatcher { - public class func beginWithMatcher(expected: AnyObject) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let actual = actualExpression.evaluate() +extension NMBPredicate { + @objc public class func beginWithMatcher(_ expected: Any) -> NMBPredicate { + return NMBPredicate { actualExpression in + let actual = try actualExpression.evaluate() let expr = actualExpression.cast { $0 as? NMBOrderedCollection } - return beginWith(expected).matches(expr, failureMessage: failureMessage) + return try beginWith(expected).satisfies(expr).toObjectiveC() } } } @@ -1605,7 +1611,7 @@ converts those types to the newer `Predicate`. ```swift // Swift -public func beginWith(startingElement: T) -> Predicate { +public func beginWith(_ startingElement: S.Element) -> Predicate where S.Element: Equatable { return NonNilMatcherFunc { actualExpression, failureMessage in failureMessage.postfixMessage = "begin with <\(startingElement)>" if let actualValue = actualExpression.evaluate() { @@ -1628,7 +1634,7 @@ matcher types. ```swift // Swift -public func beginWith(startingElement: T) -> Predicate { +public func beginWith(_ startingElement: S.Element) -> Predicate where S.Element: Equatable { return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in failureMessage.postfixMessage = "begin with <\(startingElement)>" if let actualValue = actualExpression.evaluate() { @@ -1705,12 +1711,33 @@ source 'https://github.com/CocoaPods/Specs.git' target 'YOUR_APP_NAME_HERE_Tests', :exclusive => true do use_frameworks! - pod 'Nimble', '~> 6.0.0' + pod 'Nimble' end ``` Finally run `pod install`. +## Installing Nimble via Accio + +Add the following to your Package.swift: + +```swift +.package(url: "https://github.com/Quick/Nimble.git", .upToNextMajor(from: "8.0.1")), +``` + +Next, add `Nimble` to your App targets dependencies like so: + +```swift +.testTarget( + name: "AppTests", + dependencies: [ + "Nimble", + ] +), +``` + +Then run `accio update`. + ## Using Nimble without XCTest Nimble is integrated with XCTest to allow it work well when used in Xcode test diff --git a/Carthage/Checkouts/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 abaf532..a28bf2b 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 @@ -1,5 +1,3 @@ -import Foundation - /// Protocol for the assertion handler that Nimble uses for all expectations. public protocol AssertionHandler { func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) 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 0f5df59..ac75467 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 @@ -1,5 +1,3 @@ -import Foundation - /// A data structure that stores information about an assertion when /// AssertionRecorder is set as the Nimble assertion handler. /// 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 b3eb09a..32d9b60 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,6 +1,7 @@ -import Foundation - #if canImport(Darwin) && !SWIFT_PACKAGE +import class Foundation.NSObject +import typealias Foundation.TimeInterval +import enum Dispatch.DispatchTimeInterval private func from(objcPredicate: NMBPredicate) -> Predicate { return Predicate { actualExpression in @@ -10,24 +11,27 @@ private func from(objcPredicate: NMBPredicate) -> Predicate { } } -internal struct ObjCMatcherWrapper: Matcher { - let matcher: NMBMatcher - - func matches(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { - return matcher.matches( - // swiftlint:disable:next force_try - ({ try! actualExpression.evaluate() }), - failureMessage: failureMessage, - location: actualExpression.location) - } - - func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { - return matcher.doesNotMatch( - // swiftlint:disable:next force_try - ({ try! actualExpression.evaluate() }), - failureMessage: failureMessage, - location: actualExpression.location) +private func from(matcher: NMBMatcher, style: ExpectationStyle) -> Predicate { + // Almost same as `Matcher.toClosure` + let closure: (Expression, FailureMessage) throws -> Bool = { expr, msg in + switch style { + case .toMatch: + return matcher.matches( + // swiftlint:disable:next force_try + ({ try! expr.evaluate() }), + failureMessage: msg, + location: expr.location + ) + case .toNotMatch: + return !matcher.doesNotMatch( + // swiftlint:disable:next force_try + ({ try! expr.evaluate() }), + failureMessage: msg, + location: expr.location + ) + } } + return Predicate._fromDeprecatedClosure(closure) } // Equivalent to Expectation, but for Nimble's Objective-C interface @@ -37,7 +41,7 @@ public class NMBExpectation: NSObject { internal var _negative: Bool internal let _file: FileString internal let _line: UInt - internal var _timeout: TimeInterval = 1.0 + internal var _timeout: DispatchTimeInterval = .seconds(1) // swiftlint:enable identifier_name @objc public init(actualBlock: @escaping () -> NSObject?, negative: Bool, file: FileString, line: UInt) { @@ -48,63 +52,65 @@ public class NMBExpectation: NSObject { } private var expectValue: Expectation { - return expect(_file, line: _line) { - self._actualBlock() as NSObject? - } + return expect(file: _file, line: _line, self._actualBlock() as NSObject?) } @objc public var withTimeout: (TimeInterval) -> NMBExpectation { - return ({ timeout in self._timeout = timeout + return { timeout in self._timeout = timeout.dispatchInterval return self - }) + } } - @objc public var to: (NMBMatcher) -> Void { - return ({ matcher in + @objc public var to: (NMBMatcher) -> NMBExpectation { + return { matcher in if let pred = matcher as? NMBPredicate { self.expectValue.to(from(objcPredicate: pred)) } else { - self.expectValue.to(ObjCMatcherWrapper(matcher: matcher)) + self.expectValue.to(from(matcher: matcher, style: .toMatch)) } - }) + return self + } } - @objc public var toWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in + @objc public var toWithDescription: (NMBMatcher, String) -> NMBExpectation { + return { matcher, description in if let pred = matcher as? NMBPredicate { self.expectValue.to(from(objcPredicate: pred), description: description) } else { - self.expectValue.to(ObjCMatcherWrapper(matcher: matcher), description: description) + self.expectValue.to(from(matcher: matcher, style: .toMatch), description: description) } - }) + return self + } } - @objc public var toNot: (NMBMatcher) -> Void { - return ({ matcher in + @objc public var toNot: (NMBMatcher) -> NMBExpectation { + return { matcher in if let pred = matcher as? NMBPredicate { self.expectValue.toNot(from(objcPredicate: pred)) } else { - self.expectValue.toNot(ObjCMatcherWrapper(matcher: matcher)) + self.expectValue.toNot(from(matcher: matcher, style: .toNotMatch)) } - }) + return self + } } - @objc public var toNotWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in + @objc public var toNotWithDescription: (NMBMatcher, String) -> NMBExpectation { + return { matcher, description in if let pred = matcher as? NMBPredicate { self.expectValue.toNot(from(objcPredicate: pred), description: description) } else { - self.expectValue.toNot(ObjCMatcherWrapper(matcher: matcher), description: description) + self.expectValue.toNot(from(matcher: matcher, style: .toNotMatch), description: description) } - }) + return self + } } - @objc public var notTo: (NMBMatcher) -> Void { return toNot } + @objc public var notTo: (NMBMatcher) -> NMBExpectation { return toNot } - @objc public var notToWithDescription: (NMBMatcher, String) -> Void { return toNotWithDescription } + @objc public var notToWithDescription: (NMBMatcher, String) -> NMBExpectation { return toNotWithDescription } @objc public var toEventually: (NMBMatcher) -> Void { - return ({ matcher in + return { matcher in if let pred = matcher as? NMBPredicate { self.expectValue.toEventually( from(objcPredicate: pred), @@ -113,16 +119,16 @@ public class NMBExpectation: NSObject { ) } else { self.expectValue.toEventually( - ObjCMatcherWrapper(matcher: matcher), + from(matcher: matcher, style: .toMatch), timeout: self._timeout, description: nil ) } - }) + } } @objc public var toEventuallyWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in + return { matcher, description in if let pred = matcher as? NMBPredicate { self.expectValue.toEventually( from(objcPredicate: pred), @@ -131,16 +137,16 @@ public class NMBExpectation: NSObject { ) } else { self.expectValue.toEventually( - ObjCMatcherWrapper(matcher: matcher), + from(matcher: matcher, style: .toMatch), timeout: self._timeout, description: description ) } - }) + } } @objc public var toEventuallyNot: (NMBMatcher) -> Void { - return ({ matcher in + return { matcher in if let pred = matcher as? NMBPredicate { self.expectValue.toEventuallyNot( from(objcPredicate: pred), @@ -149,16 +155,16 @@ public class NMBExpectation: NSObject { ) } else { self.expectValue.toEventuallyNot( - ObjCMatcherWrapper(matcher: matcher), + from(matcher: matcher, style: .toNotMatch), timeout: self._timeout, description: nil ) } - }) + } } @objc public var toEventuallyNotWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in + return { matcher, description in if let pred = matcher as? NMBPredicate { self.expectValue.toEventuallyNot( from(objcPredicate: pred), @@ -167,12 +173,12 @@ public class NMBExpectation: NSObject { ) } else { self.expectValue.toEventuallyNot( - ObjCMatcherWrapper(matcher: matcher), + from(matcher: matcher, style: .toNotMatch), timeout: self._timeout, description: description ) } - }) + } } @objc public var toNotEventually: (NMBMatcher) -> Void { 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 a91efe3..8b8258d 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,12 +1,12 @@ -import Foundation - #if canImport(Darwin) +import class Foundation.NSObject // swiftlint:disable line_length public typealias MatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage) throws -> Bool public typealias FullMatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage, _ shouldNotMatch: Bool) throws -> Bool // swiftlint:enable line_length +@available(*, deprecated, message: "Use NMBPredicate instead") public class NMBObjCMatcher: NSObject, NMBMatcher { // swiftlint:disable identifier_name let _match: MatcherBlock 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 1b2e8c0..06bde8a 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 @@ -1,5 +1,6 @@ import Dispatch -import Foundation +import class Foundation.NSObject +import class Foundation.Thread /// "Global" state of Nimble is stored here. Only DSL functions should access / be aware of this /// class' existence 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 719bf44..5f29628 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 @@ -45,7 +45,7 @@ class NimbleXCTestUnavailableHandler: AssertionHandler { private var stashed_swift_reportFatalErrorsToDebugger: Bool = false @objc func testCaseWillStart(_ testCase: XCTestCase) { - #if swift(>=3.2) + #if os(macOS) || os(iOS) stashed_swift_reportFatalErrorsToDebugger = _swift_reportFatalErrorsToDebugger _swift_reportFatalErrorsToDebugger = false #endif @@ -56,7 +56,7 @@ class NimbleXCTestUnavailableHandler: AssertionHandler { @objc func testCaseDidFinish(_ testCase: XCTestCase) { currentTestCase = nil - #if swift(>=3.2) + #if os(macOS) || os(iOS) _swift_reportFatalErrorsToDebugger = stashed_swift_reportFatalErrorsToDebugger #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 d0871fc..8cb8e16 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 !canImport(Darwin) +#if canImport(Darwin) +import class Foundation.NSException +#else // 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 c049417..4be4524 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 @@ -21,13 +21,13 @@ internal class NMBWait: NSObject { file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) -> Void) { - return throwableUntil(timeout: timeout, file: file, line: line) { done in - action(done) - } + // Convert TimeInterval to DispatchTimeInterval + until(timeout: timeout.dispatchInterval, file: file, line: line, action: action) } -#else +#endif + internal class func until( - timeout: TimeInterval, + timeout: DispatchTimeInterval, file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) -> Void) { @@ -35,16 +35,15 @@ internal class NMBWait: NSObject { action(done) } } -#endif // Using a throwable closure makes this method not objc compatible. internal class func throwableUntil( - timeout: TimeInterval, + timeout: DispatchTimeInterval, file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) throws -> Void) { let awaiter = NimbleEnvironment.activeInstance.awaiter - let leeway = timeout / 2.0 + let leeway = timeout.divided // swiftlint:disable:next line_length let result = awaiter.performBlock(file: file, line: line) { (done: @escaping (ErrorResult) -> Void) throws -> Void in DispatchQueue.main.async { @@ -72,8 +71,7 @@ internal class NMBWait: NSObject { fail(blockedRunLoopErrorMessageFor("-waitUntil()", leeway: leeway), file: file, line: line) case .timedOut: - let pluralize = (timeout == 1 ? "" : "s") - fail("Waited more than \(timeout) second\(pluralize)", file: file, line: line) + fail("Waited more than \(timeout.description)", file: file, line: line) case let .raisedException(exception): fail("Unexpected exception raised: \(exception)") case let .errorThrown(error): @@ -93,21 +91,21 @@ internal class NMBWait: NSObject { _ file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) -> Void) { - until(timeout: 1, file: file, line: line, action: action) + until(timeout: .seconds(1), file: file, line: line, action: action) } #else internal class func until( _ file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) -> Void) { - until(timeout: 1, file: file, line: line, action: action) + until(timeout: .seconds(1), file: file, line: line, action: action) } #endif } -internal func blockedRunLoopErrorMessageFor(_ fnName: String, leeway: TimeInterval) -> String { +internal func blockedRunLoopErrorMessageFor(_ fnName: String, leeway: DispatchTimeInterval) -> String { // swiftlint:disable:next line_length - return "\(fnName) timed out but was unable to run the timeout handler because the main thread is unresponsive (\(leeway) seconds is allow after the wait times out). Conditions that may cause this include processing blocking IO on the main thread, calls to sleep(), deadlocks, and synchronous IPC. Nimble forcefully stopped run loop which may cause future failures in test run." + return "\(fnName) timed out but was unable to run the timeout handler because the main thread is unresponsive (\(leeway.description) is allow after the wait times out). Conditions that may cause this include processing blocking IO on the main thread, calls to sleep(), deadlocks, and synchronous IPC. Nimble forcefully stopped run loop which may cause future failures in test run." } /// Wait asynchronously until the done closure is called or the timeout has been reached. @@ -117,6 +115,6 @@ internal func blockedRunLoopErrorMessageFor(_ fnName: String, leeway: TimeInterv /// /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. -public func waitUntil(timeout: TimeInterval = AsyncDefaults.Timeout, file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) -> Void) { +public func waitUntil(timeout: DispatchTimeInterval = AsyncDefaults.timeout, file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) -> Void) { NMBWait.until(timeout: timeout, file: file, line: line, action: action) } 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 d6dc9cc..e481f87 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 @@ -1,7 +1,5 @@ -import Foundation - /// Make an expectation on a given actual value. The value given is lazily evaluated. -public func expect(_ expression: @autoclosure @escaping () throws -> T?, file: FileString = #file, line: UInt = #line) -> Expectation { +public func expect(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure @escaping () throws -> T?) -> Expectation { return Expectation( expression: Expression( expression: expression, @@ -10,10 +8,28 @@ public func expect(_ expression: @autoclosure @escaping () throws -> T?, file } /// Make an expectation on a given actual value. The closure is lazily invoked. -public func expect(_ file: FileString = #file, line: UInt = #line, expression: @escaping () throws -> T?) -> Expectation { +public func expect(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure () -> (() throws -> T)) -> Expectation { return Expectation( expression: Expression( - expression: expression, + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +/// Make an expectation on a given actual value. The closure is lazily invoked. +public func expect(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure () -> (() throws -> T?)) -> Expectation { + return Expectation( + expression: Expression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +/// Make an expectation on a given actual value. The closure is lazily invoked. +public func expect(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure () -> (() throws -> Void)) -> Expectation { + return Expectation( + expression: Expression( + expression: expression(), location: SourceLocation(file: file, line: line), isClosure: true)) } @@ -36,24 +52,16 @@ public func fail(_ file: FileString = #file, line: UInt = #line) { /// Like Swift's precondition(), but raises NSExceptions instead of sigaborts internal func nimblePrecondition( - _ expr: @autoclosure() -> Bool, - _ name: @autoclosure() -> String, - _ message: @autoclosure() -> String, + _ expr: @autoclosure () -> Bool, + _ name: @autoclosure () -> String, + _ message: @autoclosure () -> String, file: StaticString = #file, - line: UInt = #line) { - let result = expr() - if !result { -#if canImport(Darwin) - let exception = NSException( - name: NSExceptionName(name()), - reason: message(), - userInfo: nil - ) - exception.raise() -#else - preconditionFailure("\(name()) - \(message())", file: file, line: line) -#endif - } + line: UInt = #line +) { + let result = expr() + if !result { + _nimblePrecondition(name(), message(), file, line) + } } internal func internalError(_ msg: String, file: FileString = #file, line: UInt = #line) -> Never { @@ -66,3 +74,31 @@ internal func internalError(_ msg: String, file: FileString = #file, line: UInt ) // swiftlint:enable line_length } + +#if canImport(Darwin) +import class Foundation.NSException +import struct Foundation.NSExceptionName + +private func _nimblePrecondition( + _ name: String, + _ message: String, + _ file: StaticString, + _ line: UInt +) { + let exception = NSException( + name: NSExceptionName(name), + reason: message, + userInfo: nil + ) + exception.raise() +} +#else +private func _nimblePrecondition( + _ name: String, + _ message: String, + _ file: StaticString, + _ line: UInt +) { + preconditionFailure("\(name) - \(message)", file: file, line: line) +} +#endif 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 41625a1..9906c70 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,6 +1,4 @@ -import Foundation - -// Deprecated +@available(*, deprecated) internal func expressionDoesNotMatch(_ expression: Expression, matcher: U, toNot: String, description: String?) -> (Bool, FailureMessage) where U: Matcher, U.ValueType == T { let msg = FailureMessage() @@ -69,7 +67,9 @@ public struct Expectation { ////////////////// OLD API ///////////////////// /// DEPRECATED: Tests the actual value using a matcher to match. - public func to(_ matcher: U, description: String? = nil) + @available(*, deprecated, message: "Use Predicate instead") + @discardableResult + public func to(_ matcher: U, description: String? = nil) -> Self where U: Matcher, U.ValueType == T { let (pass, msg) = execute( expression, @@ -80,43 +80,54 @@ public struct Expectation { captureExceptions: false ) verify(pass, msg) + return self } /// DEPRECATED: Tests the actual value using a matcher to not match. - public func toNot(_ matcher: U, description: String? = nil) + @available(*, deprecated, message: "Use Predicate instead") + @discardableResult + public func toNot(_ matcher: U, description: String? = nil) -> Self where U: Matcher, U.ValueType == T { // swiftlint:disable:next line_length let (pass, msg) = expressionDoesNotMatch(expression, matcher: matcher, toNot: "to not", description: description) verify(pass, msg) + return self } /// DEPRECATED: Tests the actual value using a matcher to not match. /// /// Alias to toNot(). - public func notTo(_ matcher: U, description: String? = nil) + @available(*, deprecated, message: "Use Predicate instead") + @discardableResult + public func notTo(_ matcher: U, description: String? = nil) -> Self where U: Matcher, U.ValueType == T { - toNot(matcher, description: description) + return toNot(matcher, description: description) } ////////////////// NEW API ///////////////////// /// Tests the actual value using a matcher to match. - public func to(_ predicate: Predicate, description: String? = nil) { + @discardableResult + public func to(_ predicate: Predicate, description: String? = nil) -> Self { let (pass, msg) = execute(expression, .toMatch, predicate, to: "to", description: description) verify(pass, msg) + return self } /// Tests the actual value using a matcher to not match. - public func toNot(_ predicate: Predicate, description: String? = nil) { + @discardableResult + public func toNot(_ predicate: Predicate, description: String? = nil) -> Self { let (pass, msg) = execute(expression, .toNotMatch, predicate, to: "to not", description: description) verify(pass, msg) + return self } /// Tests the actual value using a matcher to not match. /// /// Alias to toNot(). - public func notTo(_ predicate: Predicate, description: String? = nil) { - toNot(predicate, description: description) + @discardableResult + public func notTo(_ predicate: Predicate, description: String? = nil) -> Self { + return toNot(predicate, description: description) } // see: 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 b0cbcc3..4efda7c 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 @@ -1,11 +1,9 @@ -import Foundation - public indirect enum ExpectationMessage { // --- Primary Expectations --- /// includes actual value in output ("expected to , got ") case expectedActualValueTo(/* message: */ String) /// uses a custom actual value string in output ("expected to , got ") - case expectedCustomValueTo(/* message: */ String, /* actual: */ String) + case expectedCustomValueTo(/* message: */ String, actual: String) /// excludes actual value in output ("expected to ") case expectedTo(/* message: */ String) /// allows any free-form message ("") @@ -23,14 +21,6 @@ public indirect enum ExpectationMessage { /// provides long-form multi-line explainations ("\n\n") case details(ExpectationMessage, String) - internal var sampleMessage: String { - let asStr = toString(actual: "", expected: "expected", to: "to") - let asFailureMessage = FailureMessage() - update(failureMessage: asFailureMessage) - // swiftlint:disable:next line_length - return "(toString(actual:expected:to:) -> \(asStr) || update(failureMessage:) -> \(asFailureMessage.stringValue))" - } - /// Returns the smallest message after the "expected to" string that summarizes the error. /// /// Returns the message part from ExpectationMessage, ignoring all .appends and .details. @@ -118,7 +108,7 @@ public indirect enum ExpectationMessage { case let .expectedActualValueTo(msg): return .expectedActualValueTo(message + msg) case let .expectedCustomValueTo(msg, actual): - return .expectedCustomValueTo(message + msg, actual) + return .expectedCustomValueTo(message + msg, actual: actual) default: return msg.visitLeafs(walk) } @@ -193,7 +183,7 @@ extension FailureMessage { var message: ExpectationMessage = .fail(userDescription ?? "") if actualValue != "" && actualValue != nil { - message = .expectedCustomValueTo(postfixMessage, actualValue ?? "") + message = .expectedCustomValueTo(postfixMessage, actual: actualValue ?? "") } else if postfixMessage != defaultMessage.postfixMessage { if actualValue == nil { message = .expectedTo(postfixMessage) @@ -212,6 +202,7 @@ extension FailureMessage { } #if canImport(Darwin) +import class Foundation.NSObject public class NMBExpectationMessage: NSObject { private let msg: ExpectationMessage @@ -228,7 +219,7 @@ public class NMBExpectationMessage: NSObject { } public init(expectedActualValueTo message: String, customActualValue actual: String) { - self.msg = .expectedCustomValueTo(message, actual) + self.msg = .expectedCustomValueTo(message, actual: actual) } public init(fail message: String) { 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 b6b2ee3..40dde89 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 @@ -1,15 +1,13 @@ -import Foundation - // Memoizes the given closure, only calling the passed // closure once; even if repeat calls to the returned closure internal func memoizedClosure(_ closure: @escaping () throws -> T) -> (Bool) throws -> T { var cache: T? - return ({ withoutCaching in + return { withoutCaching in if withoutCaching || cache == nil { cache = try closure() } return cache! - }) + } } /// Expression represents the closure of the value inside expect(...). diff --git a/Carthage/Checkouts/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 dbbccb9..f067aff 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 @@ -1,70 +1,71 @@ -import Foundation +public func allPass( + _ passFunc: @escaping (S.Element?) throws -> Bool +) -> Predicate { + let matcher = Predicate.simpleNilable("pass a condition") { actualExpression in + return PredicateStatus(bool: try passFunc(try actualExpression.evaluate())) + } + return createPredicate(matcher) +} -public func allPass - (_ passFunc: @escaping (T?) throws -> Bool) -> Predicate - where U: Sequence, T == U.Iterator.Element { - let matcher = Predicate.simpleNilable("pass a condition") { actualExpression in - return PredicateStatus(bool: try passFunc(try actualExpression.evaluate())) +public func allPass( + _ passName: String, + _ passFunc: @escaping (S.Element?) throws -> Bool +) -> Predicate { + let matcher = Predicate.simpleNilable(passName) { actualExpression in + return PredicateStatus(bool: try passFunc(try actualExpression.evaluate())) + } + return createPredicate(matcher) +} + +@available(*, deprecated, message: "Use Predicate instead") +public func allPass(_ elementMatcher: M) -> Predicate where S.Element == M.ValueType { + return createPredicate(elementMatcher.predicate) +} + +public func allPass(_ elementPredicate: Predicate) -> Predicate { + return createPredicate(elementPredicate) +} + +private func createPredicate(_ elementMatcher: Predicate) -> Predicate { + return Predicate { actualExpression in + guard let actualValue = try actualExpression.evaluate() else { + return PredicateResult( + status: .fail, + message: .appends(.expectedTo("all pass"), " (use beNil() to match nils)") + ) } - return createPredicate(matcher) -} -public func allPass - (_ passName: String, _ passFunc: @escaping (T?) throws -> Bool) -> Predicate - where U: Sequence, T == U.Iterator.Element { - let matcher = Predicate.simpleNilable(passName) { actualExpression in - return PredicateStatus(bool: try passFunc(try actualExpression.evaluate())) - } - return createPredicate(matcher) -} - -public func allPass(_ elementMatcher: M) -> Predicate - where S: Sequence, M: Matcher, S.Iterator.Element == M.ValueType { - return createPredicate(elementMatcher.predicate) -} - -public func allPass(_ elementPredicate: Predicate) -> Predicate - where S: Sequence { - return createPredicate(elementPredicate) -} - -private func createPredicate(_ elementMatcher: Predicate) -> Predicate - where S: Sequence { - return Predicate { actualExpression in - guard let actualValue = try actualExpression.evaluate() else { - return PredicateResult( - status: .fail, - message: .appends(.expectedTo("all pass"), " (use beNil() to match nils)") + var failure: ExpectationMessage = .expectedTo("all pass") + for currentElement in actualValue { + let exp = Expression( + expression: {currentElement}, location: actualExpression.location) + let predicateResult = try elementMatcher.satisfies(exp) + if predicateResult.status == .matches { + failure = predicateResult.message.prepended(expectation: "all ") + } else { + failure = predicateResult.message + .replacedExpectation({ .expectedTo($0.expectedMessage) }) + .wrappedExpectation( + before: "all ", + after: ", but failed first at element <\(stringify(currentElement))>" + + " in <\(stringify(actualValue))>" ) + return PredicateResult(status: .doesNotMatch, message: failure) } - - var failure: ExpectationMessage = .expectedTo("all pass") - for currentElement in actualValue { - let exp = Expression( - expression: {currentElement}, location: actualExpression.location) - let predicateResult = try elementMatcher.satisfies(exp) - if predicateResult.status == .matches { - failure = predicateResult.message.prepended(expectation: "all ") - } else { - failure = predicateResult.message - .replacedExpectation({ .expectedTo($0.expectedMessage) }) - .wrappedExpectation( - before: "all ", - after: ", but failed first at element <\(stringify(currentElement))>" - + " in <\(stringify(actualValue))>" - ) - return PredicateResult(status: .doesNotMatch, message: failure) - } - } - failure = failure.replacedExpectation({ expectation in - return .expectedTo(expectation.expectedMessage) - }) - return PredicateResult(status: .matches, message: failure) } + failure = failure.replacedExpectation({ expectation in + return .expectedTo(expectation.expectedMessage) + }) + return PredicateResult(status: .matches, message: failure) + } } #if canImport(Darwin) -extension NMBObjCMatcher { +import class Foundation.NSObject +import struct Foundation.NSFastEnumerationIterator +import protocol Foundation.NSFastEnumeration + +extension NMBPredicate { @objc public class func allPassMatcher(_ matcher: NMBMatcher) -> NMBPredicate { return NMBPredicate { actualExpression in let location = actualExpression.location diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Async.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Async.swift index 5022fe2..dc5e5ed 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Async.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/Async.swift @@ -1,13 +1,21 @@ import Foundation +import Dispatch /// If you are running on a slower machine, it could be useful to increase the default timeout value /// or slow down poll interval. Default timeout interval is 1, and poll interval is 0.01. public struct AsyncDefaults { + public static var timeout: DispatchTimeInterval = .seconds(1) + public static var pollInterval: DispatchTimeInterval = .milliseconds(10) +} + +extension AsyncDefaults { + @available(*, unavailable, renamed: "timeout") public static var Timeout: TimeInterval = 1 + @available(*, unavailable, renamed: "pollInterval") public static var PollInterval: TimeInterval = 0.01 } -private func async(style: ExpectationStyle, predicate: Predicate, timeout: TimeInterval, poll: TimeInterval, fnName: String) -> Predicate { +private func async(style: ExpectationStyle, predicate: Predicate, timeout: DispatchTimeInterval, poll: DispatchTimeInterval, fnName: String) -> Predicate { return Predicate { actualExpression in let uncachedExpression = actualExpression.withoutCaching() let fnName = "expect(...).\(fnName)(...)" @@ -55,7 +63,7 @@ extension Expectation { /// @discussion /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. - public func toEventually(_ predicate: Predicate, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) { + public func toEventually(_ predicate: Predicate, timeout: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) { nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) let (pass, msg) = execute( @@ -75,7 +83,7 @@ extension Expectation { /// @discussion /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. - public func toEventuallyNot(_ predicate: Predicate, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) { + public func toEventuallyNot(_ predicate: Predicate, timeout: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) { nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) let (pass, msg) = execute( @@ -103,12 +111,12 @@ extension Expectation { /// @discussion /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. - public func toNotEventually(_ predicate: Predicate, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) { + public func toNotEventually(_ predicate: Predicate, timeout: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) { return toEventuallyNot(predicate, timeout: timeout, pollInterval: pollInterval, description: description) } } -// Deprecated +@available(*, deprecated, message: "Use Predicate instead") extension Expectation { /// Tests the actual value using a matcher to match by checking continuously /// at each pollInterval until the timeout is reached. @@ -116,7 +124,7 @@ extension Expectation { /// @discussion /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. - public func toEventually(_ matcher: U, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) + public func toEventually(_ matcher: U, timeout: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) where U: Matcher, U.ValueType == T { if expression.isClosure { let (pass, msg) = execute( @@ -145,7 +153,7 @@ extension Expectation { /// @discussion /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. - public func toEventuallyNot(_ matcher: U, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) + public func toEventuallyNot(_ matcher: U, timeout: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) where U: Matcher, U.ValueType == T { if expression.isClosure { let (pass, msg) = expressionDoesNotMatch( @@ -174,7 +182,7 @@ extension Expectation { /// @discussion /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. - public func toNotEventually(_ matcher: U, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) + public func toNotEventually(_ matcher: U, timeout: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) where U: Matcher, U.ValueType == T { return toEventuallyNot(matcher, timeout: timeout, pollInterval: pollInterval, 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 3a68b09..f01ca77 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 @@ -1,5 +1,3 @@ -import Foundation - private func matcherMessage(forType expectedType: T.Type) -> String { return "be a kind of \(String(describing: expectedType))" } @@ -14,12 +12,12 @@ public func beAKindOf(_ expectedType: T.Type) -> Predicate { let instance = try actualExpression.evaluate() guard let validInstance = instance else { - message = .expectedCustomValueTo(matcherMessage(forType: expectedType), "") + message = .expectedCustomValueTo(matcherMessage(forType: expectedType), actual: "") return PredicateResult(status: .fail, message: message) } message = .expectedCustomValueTo( "be a kind of \(String(describing: expectedType))", - "<\(String(describing: type(of: validInstance))) instance>" + actual: "<\(String(describing: type(of: validInstance))) instance>" ) return PredicateResult( @@ -30,6 +28,7 @@ public func beAKindOf(_ expectedType: T.Type) -> Predicate { } #if canImport(Darwin) +import class Foundation.NSObject /// 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 @@ -43,13 +42,13 @@ public func beAKindOf(_ expectedClass: AnyClass) -> Predicate { status = PredicateStatus(bool: instance != nil && instance!.isKind(of: expectedClass)) message = .expectedCustomValueTo( matcherMessage(forClass: expectedClass), - "<\(String(describing: type(of: validInstance))) instance>" + actual: "<\(String(describing: type(of: validInstance))) instance>" ) } else { status = .fail message = .expectedCustomValueTo( matcherMessage(forClass: expectedClass), - "" + actual: "" ) } @@ -57,8 +56,8 @@ public func beAKindOf(_ expectedClass: AnyClass) -> Predicate { } } -extension NMBObjCMatcher { - @objc public class func beAKindOfMatcher(_ expected: AnyClass) -> NMBMatcher { +extension NMBPredicate { + @objc public class func beAKindOfMatcher(_ expected: AnyClass) -> NMBPredicate { 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 3cef3a7..47ea663 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 @@ -16,7 +16,7 @@ public func beAnInstanceOf(_ expectedType: T.Type) -> Predicate { return PredicateResult( status: PredicateStatus(bool: type(of: validInstance) == expectedType), - message: .expectedCustomValueTo(errorMessage, actualString) + message: .expectedCustomValueTo(errorMessage, actual: actualString) ) } } @@ -40,14 +40,14 @@ public func beAnInstanceOf(_ expectedClass: AnyClass) -> Predicate { #endif return PredicateResult( status: PredicateStatus(bool: matches), - message: .expectedCustomValueTo(errorMessage, actualString) + message: .expectedCustomValueTo(errorMessage, actual: actualString) ) } } #if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func beAnInstanceOfMatcher(_ expected: AnyClass) -> NMBMatcher { +extension NMBPredicate { + @objc public class func beAnInstanceOfMatcher(_ expected: AnyClass) -> NMBPredicate { 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 d6fd1ee..891193f 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 @@ -11,7 +11,7 @@ internal func isCloseTo(_ actualValue: NMBDoubleConvertible?, return PredicateResult( bool: actualValue != nil && abs(actualValue!.doubleValue - expectedValue.doubleValue) < delta, - message: .expectedCustomValueTo(errorMessage, "<\(stringify(actualValue))>") + message: .expectedCustomValueTo(errorMessage, actual: "<\(stringify(actualValue))>") ) } @@ -19,73 +19,44 @@ internal func isCloseTo(_ actualValue: NMBDoubleConvertible?, /// point values which can have imprecise results when doing arithmetic on them. /// /// @see equal -public func beCloseTo(_ expectedValue: Double, within delta: Double = DefaultDelta) -> Predicate { +public func beCloseTo(_ expectedValue: Value, within delta: Double = DefaultDelta) -> Predicate { return Predicate.define { actualExpression in return isCloseTo(try actualExpression.evaluate(), expectedValue: expectedValue, delta: delta) } } -/// A Nimble matcher that succeeds when a value is close to another. This is used for floating -/// point values which can have imprecise results when doing arithmetic on them. -/// -/// @see equal -public func beCloseTo(_ expectedValue: NMBDoubleConvertible, within delta: Double = DefaultDelta) -> Predicate { +private func beCloseTo(_ expectedValue: NMBDoubleConvertible, within delta: Double = DefaultDelta) -> Predicate { return Predicate.define { actualExpression in return isCloseTo(try actualExpression.evaluate(), expectedValue: expectedValue, delta: delta) } } #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) { +public class NMBObjCBeCloseToPredicate: NMBPredicate { + private let _expected: NSNumber + + fileprivate init(expected: NSNumber, within: CDouble) { _expected = expected - _delta = within - } - @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) - - do { - return try matcher.matches(expr, failureMessage: failureMessage) - } catch let error { - failureMessage.stringValue = "unexpected error thrown: <\(error)>" - return false + let predicate = beCloseTo(expected, within: within) + let predicateBlock: PredicateBlock = { actualExpression in + let expr = actualExpression.cast { $0 as? NMBDoubleConvertible } + return try predicate.satisfies(expr).toObjectiveC() } + super.init(predicate: predicateBlock) } - @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) - - do { - return try matcher.doesNotMatch(expr, failureMessage: failureMessage) - } catch let error { - failureMessage.stringValue = "unexpected error thrown: <\(error)>" - return false + @objc public var within: (CDouble) -> NMBObjCBeCloseToPredicate { + let expected = _expected + return { delta in + return NMBObjCBeCloseToPredicate(expected: expected, within: delta) } } - - @objc public var within: (CDouble) -> NMBObjCBeCloseToMatcher { - return ({ delta in - return NMBObjCBeCloseToMatcher(expected: self._expected, within: delta) - }) - } } -extension NMBObjCMatcher { - @objc public class func beCloseToMatcher(_ expected: NSNumber, within: CDouble) -> NMBObjCBeCloseToMatcher { - return NMBObjCBeCloseToMatcher(expected: expected, within: within) +extension NMBPredicate { + @objc public class func beCloseToMatcher(_ expected: NSNumber, within: CDouble) -> NMBObjCBeCloseToPredicate { + return NMBObjCBeCloseToPredicate(expected: expected, within: within) } } #endif @@ -113,23 +84,27 @@ 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)) +extension Expectation where T == [Double] { + // swiftlint:disable:next identifier_name + public static func ≈(lhs: Expectation, rhs: [Double]) { + lhs.to(beCloseTo(rhs)) + } } -// swiftlint:disable:next identifier_name -public func ≈(lhs: Expectation, rhs: NMBDoubleConvertible) { - lhs.to(beCloseTo(rhs)) -} +extension Expectation where T == NMBDoubleConvertible { + // swiftlint:disable:next identifier_name + public static 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)) -} + // swiftlint:disable:next identifier_name + public static func ≈(lhs: Expectation, rhs: (expected: NMBDoubleConvertible, delta: Double)) { + lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) + } -public func == (lhs: Expectation, rhs: (expected: NMBDoubleConvertible, delta: Double)) { - lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) + public static func == (lhs: Expectation, rhs: (expected: NMBDoubleConvertible, delta: Double)) { + lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) + } } // make this higher precedence than exponents so the Doubles either end aren't pulled in 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 79bf923..3e890d5 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 @@ -4,11 +4,9 @@ import Foundation /// means the are no items in that collection. For strings, it is an empty string. public func beEmpty() -> Predicate { return Predicate.simple("be empty") { actualExpression in - let actualSeq = try actualExpression.evaluate() - if actualSeq == nil { - return .fail - } - var generator = actualSeq!.makeIterator() + guard let actual = try actualExpression.evaluate() else { return .fail } + + var generator = actual.makeIterator() return PredicateStatus(bool: generator.next() == nil) } } @@ -17,9 +15,16 @@ public func beEmpty() -> Predicate { /// 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 - } + guard let actual = try actualExpression.evaluate() else { return .fail } + return PredicateStatus(bool: actual.isEmpty) + } +} + +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For strings, it is an empty string. +public func beEmpty() -> Predicate { + return Predicate.simple("be empty") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } return PredicateStatus(bool: actual.isEmpty) } } @@ -28,8 +33,8 @@ public func beEmpty() -> Predicate { /// means the are no items in that collection. For strings, it is an empty string. public func beEmpty() -> Predicate { return Predicate.simple("be empty") { actualExpression in - let actualString = try actualExpression.evaluate() - return PredicateStatus(bool: actualString == nil || NSString(string: actualString!).length == 0) + guard let actual = try actualExpression.evaluate() else { return .fail } + return PredicateStatus(bool: actual.isEmpty) } } @@ -37,8 +42,8 @@ public func beEmpty() -> Predicate { /// means the are no items in that collection. For NSString instances, it is an empty string. public func beEmpty() -> Predicate { return Predicate.simple("be empty") { actualExpression in - let actualString = try actualExpression.evaluate() - return PredicateStatus(bool: actualString == nil || actualString!.length == 0) + guard let actual = try actualExpression.evaluate() else { return .fail } + return PredicateStatus(bool: actual.length == 0) } } @@ -48,42 +53,42 @@ 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 - let actualDictionary = try actualExpression.evaluate() - return PredicateStatus(bool: actualDictionary == nil || actualDictionary!.count == 0) - } + return Predicate.simple("be empty") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + return PredicateStatus(bool: actual.count == 0) + } } /// 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 - let actualArray = try actualExpression.evaluate() - return PredicateStatus(bool: actualArray == nil || actualArray!.count == 0) - } + return Predicate.simple("be empty") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + return PredicateStatus(bool: actual.count == 0) + } } /// 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 - let actual = try actualExpression.evaluate() - return PredicateStatus(bool: actual == nil || actual!.count == 0) + guard let actual = try actualExpression.evaluate() else { return .fail } + return PredicateStatus(bool: actual.count == 0) } } #if canImport(Darwin) -extension NMBObjCMatcher { +extension NMBPredicate { @objc public class func beEmptyMatcher() -> NMBPredicate { return NMBPredicate { actualExpression in let location = actualExpression.location let actualValue = try actualExpression.evaluate() if let value = actualValue as? NMBCollection { - let expr = Expression(expression: ({ value as NMBCollection }), location: location) + let expr = Expression(expression: ({ value }), location: location) return try beEmpty().satisfies(expr).toObjectiveC() } else if let value = actualValue as? NSString { - let expr = Expression(expression: ({ value as String }), location: location) + let expr = Expression(expression: ({ value }), location: location) return try beEmpty().satisfies(expr).toObjectiveC() } else if let actualValue = actualValue { // swiftlint:disable:next line_length 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 4a4cdd2..a8d1212 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 @@ -1,16 +1,20 @@ -import Foundation - /// A Nimble matcher that succeeds when the actual value is greater than the expected value. public func beGreaterThan(_ expectedValue: T?) -> Predicate { let errorMessage = "be greater than <\(stringify(expectedValue))>" return Predicate.simple(errorMessage) { actualExpression in - if let actual = try actualExpression.evaluate(), let expected = expectedValue { - return PredicateStatus(bool: actual > expected) - } - return .fail + guard let actual = try actualExpression.evaluate(), let expected = expectedValue else { return .fail } + + return PredicateStatus(bool: actual > expected) } } +public func >(lhs: Expectation, rhs: T) { + lhs.to(beGreaterThan(rhs)) +} + +#if canImport(Darwin) +import enum Foundation.ComparisonResult + /// A Nimble matcher that succeeds when the actual value is greater than the expected value. public func beGreaterThan(_ expectedValue: NMBComparable?) -> Predicate { let errorMessage = "be greater than <\(stringify(expectedValue))>" @@ -22,17 +26,12 @@ public func beGreaterThan(_ expectedValue: NMBComparable?) -> Predicate(lhs: Expectation, rhs: T) { - lhs.to(beGreaterThan(rhs)) -} - public func > (lhs: Expectation, rhs: NMBComparable?) { lhs.to(beGreaterThan(rhs)) } -#if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBMatcher { +extension NMBPredicate { + @objc public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBPredicate { return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } 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 39d9e63..affa58c 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 @@ -1,18 +1,21 @@ -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 { 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 PredicateStatus(bool: actual >= expected) - } - return .fail + guard let actual = try actualExpression.evaluate(), let expected = expectedValue else { return .fail } + + return PredicateStatus(bool: actual >= expected) } } +public func >=(lhs: Expectation, rhs: T) { + lhs.to(beGreaterThanOrEqualTo(rhs)) +} + +#if canImport(Darwin) +import enum Foundation.ComparisonResult + /// A Nimble matcher that succeeds when the actual value is greater than /// or equal to the expected value. public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Predicate { @@ -24,17 +27,12 @@ public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Pre } } -public func >=(lhs: Expectation, rhs: T) { - lhs.to(beGreaterThanOrEqualTo(rhs)) -} - public func >=(lhs: Expectation, rhs: T) { lhs.to(beGreaterThanOrEqualTo(rhs)) } -#if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func beGreaterThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBMatcher { +extension NMBPredicate { + @objc public class func beGreaterThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBPredicate { return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } 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 49e503e..85e14f9 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 @@ -1,36 +1,28 @@ -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.define { actualExpression in - #if os(Linux) && !swift(>=4.1.50) - let actual = try actualExpression.evaluate() as? AnyObject - #else - let actual = try actualExpression.evaluate() as AnyObject? - #endif + let actual = try actualExpression.evaluate() as AnyObject? - let bool: Bool - #if os(Linux) && !swift(>=4.1.50) - bool = actual === (expected as? AnyObject) && actual !== nil - #else - bool = actual === (expected as AnyObject?) && actual !== nil - #endif + let bool = actual === (expected as AnyObject?) && actual !== nil return PredicateResult( bool: bool, message: .expectedCustomValueTo( "be identical to \(identityAsString(expected))", - "\(identityAsString(actual))" + actual: "\(identityAsString(actual))" ) ) } } -public func === (lhs: Expectation, rhs: Any?) { - lhs.to(beIdenticalTo(rhs)) -} -public func !== (lhs: Expectation, rhs: Any?) { - lhs.toNot(beIdenticalTo(rhs)) +extension Expectation where T == Any { + public static func === (lhs: Expectation, rhs: Any?) { + lhs.to(beIdenticalTo(rhs)) + } + + public static func !== (lhs: Expectation, rhs: Any?) { + lhs.toNot(beIdenticalTo(rhs)) + } } /// A Nimble matcher that succeeds when the actual value is the same instance @@ -42,8 +34,10 @@ public func be(_ expected: Any?) -> Predicate { } #if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func beIdenticalToMatcher(_ expected: NSObject?) -> NMBMatcher { +import class Foundation.NSObject + +extension NMBPredicate { + @objc public class func beIdenticalToMatcher(_ expected: NSObject?) -> NMBPredicate { return NMBPredicate { actualExpression in let aExpr = actualExpression.cast { $0 as Any? } 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 ef0a7d4..256f3a6 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 @@ -1,16 +1,20 @@ -import Foundation - /// A Nimble matcher that succeeds when the actual value is less than the expected value. public func beLessThan(_ expectedValue: T?) -> Predicate { let message = "be less than <\(stringify(expectedValue))>" return Predicate.simple(message) { actualExpression in - if let actual = try actualExpression.evaluate(), let expected = expectedValue { - return PredicateStatus(bool: actual < expected) - } - return .fail + guard let actual = try actualExpression.evaluate(), let expected = expectedValue else { return .fail } + + return PredicateStatus(bool: actual < expected) } } +public func <(lhs: Expectation, rhs: T) { + lhs.to(beLessThan(rhs)) +} + +#if canImport(Darwin) +import enum Foundation.ComparisonResult + /// A Nimble matcher that succeeds when the actual value is less than the expected value. public func beLessThan(_ expectedValue: NMBComparable?) -> Predicate { let message = "be less than <\(stringify(expectedValue))>" @@ -21,17 +25,12 @@ public func beLessThan(_ expectedValue: NMBComparable?) -> Predicate(lhs: Expectation, rhs: T) { - lhs.to(beLessThan(rhs)) -} - public func < (lhs: Expectation, rhs: NMBComparable?) { lhs.to(beLessThan(rhs)) } -#if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func beLessThanMatcher(_ expected: NMBComparable?) -> NMBMatcher { +extension NMBPredicate { + @objc public class func beLessThanMatcher(_ expected: NMBComparable?) -> NMBPredicate { return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } 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 30ce043..6174be5 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 @@ -1,16 +1,20 @@ -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.simple("be less than or equal to <\(stringify(expectedValue))>") { actualExpression in - if let actual = try actualExpression.evaluate(), let expected = expectedValue { - return PredicateStatus(bool: actual <= expected) - } - return .fail + guard let actual = try actualExpression.evaluate(), let expected = expectedValue else { return .fail } + + return PredicateStatus(bool: actual <= expected) } } +public func <=(lhs: Expectation, rhs: T) { + lhs.to(beLessThanOrEqualTo(rhs)) +} + +#if canImport(Darwin) +import enum Foundation.ComparisonResult + /// A Nimble matcher that succeeds when the actual value is less than /// or equal to the expected value. public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predicate { @@ -21,17 +25,12 @@ public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predic } } -public func <=(lhs: Expectation, rhs: T) { - lhs.to(beLessThanOrEqualTo(rhs)) -} - public func <=(lhs: Expectation, rhs: T) { lhs.to(beLessThanOrEqualTo(rhs)) } -#if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func beLessThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBMatcher { +extension NMBPredicate { + @objc public class func beLessThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBPredicate { return NMBPredicate { actualExpression in let expr = actualExpression.cast { $0 as? NMBComparable } 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 788234b..1676ba4 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 @@ -119,29 +119,29 @@ public func beFalsy() -> Predicate NMBMatcher { +extension NMBPredicate { + @objc public class func beTruthyMatcher() -> NMBPredicate { return NMBPredicate { actualExpression in let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } return try beTruthy().satisfies(expr).toObjectiveC() } } - @objc public class func beFalsyMatcher() -> NMBMatcher { + @objc public class func beFalsyMatcher() -> NMBPredicate { return NMBPredicate { actualExpression in let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } return try beFalsy().satisfies(expr).toObjectiveC() } } - @objc public class func beTrueMatcher() -> NMBMatcher { + @objc public class func beTrueMatcher() -> NMBPredicate { return NMBPredicate { actualExpression in let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } return try beTrue().satisfies(expr).toObjectiveC() } } - @objc public class func beFalseMatcher() -> NMBMatcher { + @objc public class func beFalseMatcher() -> NMBPredicate { return NMBPredicate { actualExpression in let expr = actualExpression.cast { value -> Bool? in guard let value = value else { return nil } 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 0f21d41..270bd35 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 @@ -1,5 +1,3 @@ -import Foundation - /// A Nimble matcher that succeeds when the actual value is nil. public func beNil() -> Predicate { return Predicate.simpleNilable("be nil") { actualExpression in @@ -9,8 +7,10 @@ public func beNil() -> Predicate { } #if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func beNilMatcher() -> NMBMatcher { +import Foundation + +extension NMBPredicate { + @objc public class func beNilMatcher() -> NMBPredicate { 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 9a7eafd..c4bbaf6 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 @@ -1,5 +1,3 @@ -import Foundation - /// A Nimble matcher that succeeds when the actual value is Void. public func beVoid() -> Predicate<()> { return Predicate.simpleNilable("be void") { actualExpression in 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 3183eb9..1da7818 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 @@ -2,14 +2,12 @@ import Foundation /// A Nimble matcher that succeeds when the actual sequence's first element /// is equal to the expected value. -public func beginWith(_ startingElement: T) -> Predicate - where S.Iterator.Element == T { +public func beginWith(_ startingElement: S.Element) -> Predicate where S.Element: Equatable { return Predicate.simple("begin with <\(startingElement)>") { actualExpression in - if let actualValue = try actualExpression.evaluate() { - var actualGenerator = actualValue.makeIterator() - return PredicateStatus(bool: actualGenerator.next() == startingElement) - } - return .fail + guard let actualValue = try actualExpression.evaluate() else { return .fail } + + var actualGenerator = actualValue.makeIterator() + return PredicateStatus(bool: actualGenerator.next() == startingElement) } } @@ -34,16 +32,15 @@ public func beginWith(_ startingElement: Any) -> Predicate /// where the expected substring's location is zero. public func beginWith(_ startingSubstring: String) -> Predicate { return Predicate.simple("begin with <\(startingSubstring)>") { actualExpression in - if let actual = try actualExpression.evaluate() { - return PredicateStatus(bool: actual.hasPrefix(startingSubstring)) - } - return .fail + guard let actual = try actualExpression.evaluate() else { return .fail } + + return PredicateStatus(bool: actual.hasPrefix(startingSubstring)) } } #if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func beginWithMatcher(_ expected: Any) -> NMBMatcher { +extension NMBPredicate { + @objc public class func beginWithMatcher(_ expected: Any) -> NMBPredicate { return NMBPredicate { actualExpression in let actual = try actualExpression.evaluate() if actual is String { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeginWithPrefix.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeginWithPrefix.swift new file mode 100644 index 0000000..c3a79b1 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/BeginWithPrefix.swift @@ -0,0 +1,39 @@ +/// A Nimble matcher that succeeds when the exepected sequence is a prefix of the actual sequence. +/// +/// This is a matcher abstraction for https://developer.apple.com/documentation/swift/sequence/2854218-starts +public func beginWith(prefix expectedPrefix: Seq2?) + -> Predicate where Seq1.Element: Equatable, Seq1.Element == Seq2.Element { + return Predicate.define("begin with <\(stringify(expectedPrefix))>") { (actualExpression, msg) in + let actualPrefix = try actualExpression.evaluate() + switch (expectedPrefix, actualPrefix) { + 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 = actual.starts(with: expected) + return PredicateResult(bool: matches, message: msg) + } + } +} + +/// A Nimble matcher that succeeds when the expected sequence is the prefix of the actual sequence, using the given predicate as the equivalence test. +/// +/// This is a matcher abstraction for https://developer.apple.com/documentation/swift/sequence/2996828-starts +public func beginWith( + prefix expectedPrefix: Seq2?, + by areEquivalent: @escaping (Seq1.Element, Seq2.Element) -> Bool +) -> Predicate { + return Predicate.define("begin with <\(stringify(expectedPrefix))>") { (actualExpression, msg) in + let actualPrefix = try actualExpression.evaluate() + switch (expectedPrefix, actualPrefix) { + 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 = actual.starts(with: expected, by: areEquivalent) + return PredicateResult(bool: matches, message: msg) + } + } +} 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 1d16fb1..c7fc15b 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,43 +1,56 @@ +#if canImport(Foundation) import Foundation +#endif /// A Nimble matcher that succeeds when the actual sequence contains the expected values. -public func contain(_ items: T...) -> Predicate - where S.Element == T { +public func contain(_ items: S.Element...) -> Predicate where S.Element: Equatable { return contain(items) } /// A Nimble matcher that succeeds when the actual sequence contains the expected values. -public func contain(_ items: [T]) -> Predicate - where S.Element == T { +public func contain(_ items: [S.Element]) -> Predicate where S.Element: Equatable { 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) + guard let actual = try actualExpression.evaluate() else { return .fail } + + let matches = items.allSatisfy { + return actual.contains($0) } - return .fail + return PredicateStatus(bool: matches) } } /// 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) +public func contain(_ items: S.Element...) -> Predicate where S.Element: Equatable { + 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 +public func contain(_ items: [S.Element]) -> Predicate where S.Element: Equatable { + return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + + let matches = items.allSatisfy { + return actual.contains($0) } + return PredicateStatus(bool: matches) + } +} + +/// A Nimble matcher that succeeds when the actual set contains the expected values. +public func contain(_ items: S.Element...) -> Predicate where S.Element: Equatable { + return contain(items) +} + +/// A Nimble matcher that succeeds when the actual set contains the expected values. +public func contain(_ items: [S.Element]) -> Predicate where S.Element: Equatable { + return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + + let matches = items.allSatisfy { + return actual.contains($0) + } + return PredicateStatus(bool: matches) + } } /// A Nimble matcher that succeeds when the actual string contains the expected substring. @@ -47,17 +60,17 @@ public func contain(_ substrings: String...) -> Predicate { public func contain(_ substrings: [String]) -> Predicate { return Predicate.simple("contain <\(arrayAsString(substrings))>") { actualExpression in - if let actual = try actualExpression.evaluate() { - let matches = substrings.allSatisfy { - let range = actual.range(of: $0) - return range != nil && !range!.isEmpty - } - return PredicateStatus(bool: matches) + guard let actual = try actualExpression.evaluate() else { return .fail } + + let matches = substrings.allSatisfy { + let range = actual.range(of: $0) + return range != nil && !range!.isEmpty } - return .fail + return PredicateStatus(bool: matches) } } +#if canImport(Foundation) /// A Nimble matcher that succeeds when the actual string contains the expected substring. public func contain(_ substrings: NSString...) -> Predicate { return contain(substrings) @@ -65,13 +78,13 @@ public func contain(_ substrings: NSString...) -> Predicate { public func contain(_ substrings: [NSString]) -> Predicate { return Predicate.simple("contain <\(arrayAsString(substrings))>") { actualExpression in - if let actual = try actualExpression.evaluate() { - let matches = substrings.allSatisfy { actual.range(of: $0.description).length != 0 } - return PredicateStatus(bool: matches) - } - return .fail + guard let actual = try actualExpression.evaluate() else { return .fail } + + let matches = substrings.allSatisfy { actual.range(of: $0.description).length != 0 } + return PredicateStatus(bool: matches) } } +#endif /// A Nimble matcher that succeeds when the actual collection contains the expected object. public func contain(_ items: Any?...) -> Predicate { @@ -81,6 +94,7 @@ public func contain(_ items: Any?...) -> Predicate { public func contain(_ items: [Any?]) -> Predicate { return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in guard let actual = try actualExpression.evaluate() else { return .fail } + let matches = items.allSatisfy { item in return item.map { actual.contains($0) } ?? false } @@ -89,8 +103,8 @@ public func contain(_ items: [Any?]) -> Predicate { } #if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func containMatcher(_ expected: [NSObject]) -> NMBMatcher { +extension NMBPredicate { + @objc public class func containMatcher(_ expected: [NSObject]) -> NMBPredicate { return NMBPredicate { actualExpression in let location = actualExpression.location let actualValue = try actualExpression.evaluate() 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 331f3bc..2e7875b 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 @@ -1,7 +1,6 @@ -import Foundation - -public func containElementSatisfying(_ predicate: @escaping ((T) -> Bool), _ predicateDescription: String = "") -> Predicate where S.Iterator.Element == T { - +public func containElementSatisfying( + _ predicate: @escaping ((S.Element) -> Bool), _ predicateDescription: String = "" +) -> Predicate { return Predicate.define { actualExpression in let message: ExpectationMessage if predicateDescription == "" { @@ -25,34 +24,38 @@ public func containElementSatisfying(_ predicate: @escaping ((T) } #if canImport(Darwin) - extension NMBObjCMatcher { - @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 { - let message = ExpectationMessage.fail( - "containElementSatisfying must be provided an NSFastEnumeration object" - ) - return NMBPredicateResult(status: .fail, message: message.toObjectiveC()) - } +import class Foundation.NSObject +import struct Foundation.NSFastEnumerationIterator +import protocol Foundation.NSFastEnumeration - 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 { - continue - } - - if predicate(object) { - return NMBPredicateResult(status: .matches, message: message) - } - } - - return NMBPredicateResult(status: .doesNotMatch, message: message) +extension NMBPredicate { + @objc public class func containElementSatisfyingMatcher(_ predicate: @escaping ((NSObject) -> Bool)) -> NMBPredicate { + return NMBPredicate { actualExpression in + let value = try actualExpression.evaluate() + guard let enumeration = value as? NSFastEnumeration else { + 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 { + continue + } + + if predicate(object) { + return NMBPredicateResult(status: .matches, message: message) + } + } + + return NMBPredicateResult(status: .doesNotMatch, message: message) } } +} #endif 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 index 1704e94..708cf1c 100644 --- 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 @@ -1,6 +1,10 @@ -/// 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 +/// A Nimble matcher that succeeds when the actual sequence and the exepected sequence contain the same elements in +/// the same order. +/// +/// This is a matcher abstraction for https://developer.apple.com/documentation/swift/sequence/2854213-elementsequal +public func elementsEqual( + _ expectedValue: Seq2? +) -> Predicate where Seq1.Element: Equatable, Seq1.Element == Seq2.Element { return Predicate.define("elementsEqual <\(stringify(expectedValue))>") { (actualExpression, msg) in let actualValue = try actualExpression.evaluate() switch (expectedValue, actualValue) { @@ -14,3 +18,25 @@ public func elementsEqual(_ expectedValue: S?) -> Predicate wher } } } + +/// A Nimble matcher that succeeds when the actual sequence and the exepected sequence contain equivalent elements in +/// the same order, using the given predicate as the equivalence test. +/// +/// This is a matcher abstraction for https://developer.apple.com/documentation/swift/sequence/2949668-elementsequal +public func elementsEqual( + _ expectedValue: Seq2?, + by areEquivalent: @escaping (Seq1.Element, Seq2.Element) -> Bool +) -> Predicate { + 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 = actual.elementsEqual(expected, by: areEquivalent) + 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 13bdb31..16c4d06 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 @@ -2,21 +2,19 @@ import Foundation /// A Nimble matcher that succeeds when the actual sequence's last element /// is equal to the expected value. -public func endWith(_ endingElement: T) -> Predicate - where S.Iterator.Element == T { +public func endWith(_ endingElement: S.Element) -> Predicate where S.Element: Equatable { return Predicate.simple("end with <\(endingElement)>") { actualExpression in - if let actualValue = try actualExpression.evaluate() { - var actualGenerator = actualValue.makeIterator() - var lastItem: T? - var item: T? - repeat { - lastItem = item - item = actualGenerator.next() - } while(item != nil) + guard let actualValue = try actualExpression.evaluate() else { return .fail } - return PredicateStatus(bool: lastItem == endingElement) - } - return .fail + var actualGenerator = actualValue.makeIterator() + var lastItem: S.Element? + var item: S.Element? + repeat { + lastItem = item + item = actualGenerator.next() + } while(item != nil) + + return PredicateStatus(bool: lastItem == endingElement) } } @@ -25,6 +23,7 @@ public func endWith(_ endingElement: T) -> Predicate< public func endWith(_ endingElement: Any) -> Predicate { 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 { @@ -43,16 +42,15 @@ public func endWith(_ endingElement: Any) -> Predicate { /// expected substring's length. public func endWith(_ endingSubstring: String) -> Predicate { return Predicate.simple("end with <\(endingSubstring)>") { actualExpression in - if let collection = try actualExpression.evaluate() { - return PredicateStatus(bool: collection.hasSuffix(endingSubstring)) - } - return .fail + guard let collection = try actualExpression.evaluate() else { return .fail } + + return PredicateStatus(bool: collection.hasSuffix(endingSubstring)) } } #if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func endWithMatcher(_ expected: Any) -> NMBMatcher { +extension NMBPredicate { + @objc public class func endWithMatcher(_ expected: Any) -> NMBPredicate { return NMBPredicate { actualExpression in let actual = try actualExpression.evaluate() if actual is String { 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 b08d5f6..190edb4 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 @@ -1,5 +1,3 @@ -import Foundation - /// A Nimble matcher that succeeds when the actual value is equal to the expected value. /// Values can support equal by supporting the Equatable protocol. /// @@ -71,7 +69,7 @@ private func equal(_ expectedValue: Set?, stringify: @escaping (Set?) - errorMessage = .expectedCustomValueTo( "equal <\(stringify(expectedValue))>", - "<\(stringify(actualValue))>" + actual: "<\(stringify(actualValue))>" ) if expectedValue == actualValue { @@ -138,8 +136,10 @@ public func !=(lhs: Expectation<[T: C]>, rhs: [T: C]?) { } #if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func equalMatcher(_ expected: NSObject) -> NMBMatcher { +import class Foundation.NSObject + +extension NMBPredicate { + @objc public class func equalMatcher(_ expected: NSObject) -> NMBPredicate { 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 984e2d4..20397f5 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 @@ -1,5 +1,3 @@ -import Foundation - // The `haveCount` matchers do not print the full string representation of the collection value, // instead they only print the type name and the expected count. This makes it easier to understand // the reason for failed expectations. See: https://github.com/Quick/Nimble/issues/308. @@ -13,7 +11,7 @@ public func haveCount(_ expectedValue: Int) -> Predicate { let message = ExpectationMessage .expectedCustomValueTo( "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))", - "\(actualValue.count)" + actual: "\(actualValue.count)" ) .appended(details: "Actual Value: \(stringify(actualValue))") @@ -33,7 +31,7 @@ public func haveCount(_ expectedValue: Int) -> Predicate { let message = ExpectationMessage .expectedCustomValueTo( "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))", - "\(actualValue.count)" + actual: "\(actualValue.count)" ) .appended(details: "Actual Value: \(stringify(actualValue))") @@ -46,8 +44,10 @@ public func haveCount(_ expectedValue: Int) -> Predicate { } #if canImport(Darwin) -extension NMBObjCMatcher { - @objc public class func haveCountMatcher(_ expected: NSNumber) -> NMBMatcher { +import Foundation + +extension NMBPredicate { + @objc public class func haveCountMatcher(_ expected: NSNumber) -> NMBPredicate { return NMBPredicate { actualExpression in let location = actualExpression.location let actualValue = try actualExpression.evaluate() @@ -60,7 +60,7 @@ extension NMBObjCMatcher { if let actualValue = actualValue { message = ExpectationMessage.expectedCustomValueTo( "get type of NSArray, NSSet, NSDictionary, or NSHashTable", - "\(String(describing: type(of: actualValue)))" + actual: "\(String(describing: type(of: actualValue)))" ) } else { message = ExpectationMessage 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 dbcff09..93363b3 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 @@ -1,29 +1,23 @@ -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.simple("match <\(stringify(expectedValue))>") { actualExpression in - if let actual = try actualExpression.evaluate() { - if let regexp = expectedValue { - let bool = actual.range(of: regexp, options: .regularExpression) != nil - return PredicateStatus(bool: bool) - } - } + guard let actual = try actualExpression.evaluate(), let regexp = expectedValue else { return .fail } - return .fail + let bool = actual.range(of: regexp, options: .regularExpression) != nil + return PredicateStatus(bool: bool) } } #if canImport(Darwin) +import class Foundation.NSString -extension NMBObjCMatcher { - @objc public class func matchMatcher(_ expected: NSString) -> NMBMatcher { +extension NMBPredicate { + @objc public class func matchMatcher(_ expected: NSString) -> NMBPredicate { return NMBPredicate { actualExpression in let actual = actualExpression.cast { $0 as? String } return try match(expected.description).satisfies(actual).toObjectiveC() } } } - #endif 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 4ad71d4..3edc99b 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 @@ -1,5 +1,3 @@ -import Foundation - /// A Nimble matcher that succeeds when the actual expression evaluates to an /// error from the specified case. /// @@ -9,9 +7,7 @@ public func matchError(_ error: T) -> Predicate { return Predicate.define { actualExpression in let actualError = try actualExpression.evaluate() - let failureMessage = FailureMessage() - setFailureMessageForError( - failureMessage, + let message = messageForError( postfixMessageVerb: "match", actualError: actualError, error: error @@ -22,7 +18,7 @@ public func matchError(_ error: T) -> Predicate { matches = true } - return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + return PredicateResult(bool: matches, message: message) } } @@ -35,9 +31,7 @@ public func matchError(_ error: T) -> Predicate { return Predicate.define { actualExpression in let actualError = try actualExpression.evaluate() - let failureMessage = FailureMessage() - setFailureMessageForError( - failureMessage, + let message = messageForError( postfixMessageVerb: "match", actualError: actualError, error: error @@ -48,7 +42,7 @@ public func matchError(_ error: T) -> Predicate { matches = true } - return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + return PredicateResult(bool: matches, message: message) } } @@ -58,9 +52,7 @@ public func matchError(_ errorType: T.Type) -> Predicate { return Predicate.define { actualExpression in let actualError = try actualExpression.evaluate() - let failureMessage = FailureMessage() - setFailureMessageForError( - failureMessage, + let message = messageForError( postfixMessageVerb: "match", actualError: actualError, errorType: errorType @@ -71,6 +63,6 @@ public func matchError(_ errorType: T.Type) -> Predicate { matches = true } - return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + return PredicateResult(bool: matches, message: message) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatcherFunc.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatcherFunc.swift index abcafa9..cba4d33 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatcherFunc.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/MatcherFunc.swift @@ -9,7 +9,7 @@ /// Use the Matcher protocol instead of this type to accept custom matchers as /// input parameters. /// @see allPass for an example that uses accepts other matchers as input. -@available(*, deprecated, message: "Use to Predicate instead") +@available(*, deprecated, message: "Use Predicate instead") public struct MatcherFunc: Matcher { public let matcher: (Expression, FailureMessage) throws -> Bool @@ -28,6 +28,7 @@ public struct MatcherFunc: Matcher { /// Compatibility layer to new Matcher API. Converts an old-style matcher to a new one. /// Note: You should definitely spend the time to convert to the new api as soon as possible /// since this struct type is deprecated. + @available(*, deprecated, message: "Use Predicate directly instead") public var predicate: Predicate { return Predicate.fromDeprecatedMatcher(self) } @@ -44,7 +45,7 @@ public struct MatcherFunc: Matcher { /// Use the Matcher protocol instead of this type to accept custom matchers as /// input parameters. /// @see allPass for an example that uses accepts other matchers as input. -@available(*, deprecated, message: "Use to Predicate instead") +@available(*, deprecated, message: "Use Predicate instead") public struct NonNilMatcherFunc: Matcher { public let matcher: (Expression, FailureMessage) throws -> Bool @@ -79,6 +80,7 @@ public struct NonNilMatcherFunc: Matcher { /// Compatibility layer to new Matcher API. Converts an old-style matcher to a new one. /// Note: You should definitely spend the time to convert to the new api as soon as possible /// since this struct type is deprecated. + @available(*, deprecated, message: "Use Predicate directly instead") public var predicate: Predicate { return Predicate.fromDeprecatedMatcher(self) } 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 38bb297..720ced0 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 @@ -12,19 +12,20 @@ public protocol Matcher { func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool } +@available(*, deprecated) extension Matcher { var predicate: Predicate { return Predicate.fromDeprecatedMatcher(self) } var toClosure: (Expression, FailureMessage, Bool) throws -> Bool { - return ({ expr, msg, expectedResult in + return { expr, msg, expectedResult in if expectedResult { return try self.matches(expr, failureMessage: msg) } else { return try self.doesNotMatch(expr, failureMessage: msg) } - }) + } } } @@ -128,20 +129,14 @@ extension NSDate: TestOutputStringConvertible { } } +#if canImport(Darwin) /// Protocol for types to support beLessThan(), beLessThanOrEqualTo(), /// beGreaterThan(), beGreaterThanOrEqualTo(), and equal() matchers. /// /// Types that conform to Swift's Comparable protocol will work implicitly too -#if canImport(Darwin) @objc public protocol NMBComparable { func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult } -#else -// This should become obsolete once Corelibs Foundation adds Comparable conformance to NSNumber -public protocol NMBComparable { - func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult -} -#endif extension NSNumber: NMBComparable { public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult { @@ -155,3 +150,4 @@ extension NSString: NMBComparable { return compare(otherObject as! String) } } +#endif 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 7d3e44c..cf20186 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,48 +1,115 @@ +#if canImport(Foundation) import Foundation internal class NotificationCollector { private(set) var observedNotifications: [Notification] private let notificationCenter: NotificationCenter - #if canImport(Darwin) - private var token: AnyObject? - #else - private var token: NSObjectProtocol? - #endif + private let names: Set + private var tokens: [NSObjectProtocol] - required init(notificationCenter: NotificationCenter) { + required init(notificationCenter: NotificationCenter, names: Set = []) { self.notificationCenter = notificationCenter self.observedNotifications = [] + self.names = names + self.tokens = [] } func startObserving() { - // swiftlint:disable:next line_length - 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(notification) + func addObserver(forName name: Notification.Name?) -> NSObjectProtocol { + return notificationCenter.addObserver(forName: name, object: nil, queue: nil) { [weak self] notification in + // linux-swift gets confused by .append(n) + self?.observedNotifications.append(notification) + } + } + + if names.isEmpty { + tokens.append(addObserver(forName: nil)) + } else { + names.forEach { name in + tokens.append(addObserver(forName: name)) + } } } deinit { - #if canImport(Darwin) - if let token = self.token { - self.notificationCenter.removeObserver(token) - } - #else - if let token = self.token as? AnyObject { - self.notificationCenter.removeObserver(token) - } - #endif + tokens.forEach { token in + notificationCenter.removeObserver(token) + } } } private let mainThread = pthread_self() +private func _postNotifications( + _ predicate: Predicate<[Notification]>, + from center: NotificationCenter, + names: Set = [] +) -> Predicate { + _ = mainThread // Force lazy-loading of this value + let collector = NotificationCollector(notificationCenter: center, names: names) + collector.startObserving() + var once: Bool = false + + return Predicate { actualExpression in + let collectorNotificationsExpression = Expression( + memoizedExpression: { _ in + return collector.observedNotifications + }, + location: actualExpression.location, + withoutCaching: true + ) + + assert(pthread_equal(mainThread, pthread_self()) != 0, "Only expecting closure to be evaluated on main thread.") + if !once { + once = true + _ = try actualExpression.evaluate() + } + + let actualValue: String + if collector.observedNotifications.isEmpty { + actualValue = "no notifications" + } else { + actualValue = "<\(stringify(collector.observedNotifications))>" + } + + var result = try predicate.satisfies(collectorNotificationsExpression) + result.message = result.message.replacedExpectation { message in + return .expectedCustomValueTo(message.expectedMessage, actual: actualValue) + } + return result + } +} + +public func postNotifications( + _ predicate: Predicate<[Notification]>, + from center: NotificationCenter = .default +) -> Predicate { + _postNotifications(predicate, from: center) +} + +@available(*, deprecated, renamed: "postNotifications(_:from:)") +public func postNotifications( + _ predicate: Predicate<[Notification]>, + fromNotificationCenter center: NotificationCenter +) -> Predicate { + postNotifications(predicate, from: center) +} + +#if os(macOS) +public func postDistributedNotifications( + _ predicate: Predicate<[Notification]>, + from center: DistributedNotificationCenter = .default(), + names: Set +) -> Predicate { + _postNotifications(predicate, from: center, names: names) +} +#endif + +@available(*, deprecated, message: "Use Predicate instead") public func postNotifications( _ notificationsMatcher: T, - fromNotificationCenter center: NotificationCenter = .default) - -> Predicate - where T: Matcher, T.ValueType == [Notification] -{ + from center: NotificationCenter = .default +) -> Predicate where T: Matcher, T.ValueType == [Notification] { _ = mainThread // Force lazy-loading of this value let collector = NotificationCollector(notificationCenter: center) collector.startObserving() @@ -69,3 +136,12 @@ public func postNotifications( return PredicateResult(bool: match, message: failureMessage.toExpectationMessage()) } } + +@available(*, deprecated, renamed: "postNotifications(_:from:)") +public func postNotifications( + _ notificationsMatcher: T, + fromNotificationCenter center: NotificationCenter +) -> Predicate where T: Matcher, T.ValueType == [Notification] { + return postNotifications(notificationsMatcher, from: center) +} +#endif 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 2604411..fa0128f 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 @@ -1,6 +1,5 @@ // New Matcher API // -import Foundation /// A Predicate is part of the new matcher API that provides assertions to expectations. /// @@ -45,17 +44,17 @@ extension Predicate { /// Defines a predicate with a default message that can be returned in the closure /// Also ensures the predicate's actual value cannot pass with `nil` given. - public static func define(_ msg: String, matcher: @escaping (Expression, ExpectationMessage) throws -> PredicateResult) -> Predicate { + public static func define(_ message: String = "match", matcher: @escaping (Expression, ExpectationMessage) throws -> PredicateResult) -> Predicate { return Predicate { actual in - return try matcher(actual, .expectedActualValueTo(msg)) + return try matcher(actual, .expectedActualValueTo(message)) }.requireNonNil } /// Defines a predicate with a default message that can be returned in the closure /// Unlike `define`, this allows nil values to succeed if the given closure chooses to. - public static func defineNilable(_ msg: String, matcher: @escaping (Expression, ExpectationMessage) throws -> PredicateResult) -> Predicate { + public static func defineNilable(_ message: String = "match", matcher: @escaping (Expression, ExpectationMessage) throws -> PredicateResult) -> Predicate { return Predicate { actual in - return try matcher(actual, .expectedActualValueTo(msg)) + return try matcher(actual, .expectedActualValueTo(message)) } } } @@ -65,9 +64,9 @@ extension Predicate { /// error message. /// /// Also ensures the predicate's actual value cannot pass with `nil` given. - public static func simple(_ msg: String, matcher: @escaping (Expression) throws -> PredicateStatus) -> Predicate { + public static func simple(_ message: String = "match", matcher: @escaping (Expression) throws -> PredicateStatus) -> Predicate { return Predicate { actual in - return PredicateResult(status: try matcher(actual), message: .expectedActualValueTo(msg)) + return PredicateResult(status: try matcher(actual), message: .expectedActualValueTo(message)) }.requireNonNil } @@ -75,9 +74,9 @@ extension Predicate { /// error message. /// /// Unlike `simple`, this allows nil values to succeed if the given closure chooses to. - public static func simpleNilable(_ msg: String, matcher: @escaping (Expression) throws -> PredicateStatus) -> Predicate { + public static func simpleNilable(_ message: String = "match", matcher: @escaping (Expression) throws -> PredicateStatus) -> Predicate { return Predicate { actual in - return PredicateResult(status: try matcher(actual), message: .expectedActualValueTo(msg)) + return PredicateResult(status: try matcher(actual), message: .expectedActualValueTo(message)) } } } @@ -166,7 +165,24 @@ public enum PredicateStatus { } } +extension Predicate { + /// Compatibility layer for old Matcher API, deprecated. + /// Emulates the MatcherFunc API + internal static func _fromDeprecatedClosure(_ matcher: @escaping (Expression, FailureMessage) throws -> Bool) -> Predicate { + // swiftlint:disable:previous identifier_name + return Predicate { actual in + let failureMessage = FailureMessage() + let result = try matcher(actual, failureMessage) + return PredicateResult( + status: PredicateStatus(bool: result), + message: failureMessage.toExpectationMessage() + ) + } + } +} + // Backwards compatibility until Old Matcher API removal +@available(*, deprecated, message: "Use Predicate directly instead") extension Predicate: Matcher { /// Compatibility layer for old Matcher API, deprecated public static func fromDeprecatedFullClosure(_ matcher: @escaping (Expression, FailureMessage, Bool) throws -> Bool) -> Predicate { @@ -183,15 +199,7 @@ extension Predicate: Matcher { /// Compatibility layer for old Matcher API, deprecated. /// Emulates the MatcherFunc API public static func fromDeprecatedClosure(_ matcher: @escaping (Expression, FailureMessage) throws -> Bool) -> Predicate { - return Predicate { actual in - let failureMessage = FailureMessage() - let result = try matcher(actual, failureMessage) - return PredicateResult( - status: PredicateStatus(bool: result), - message: failureMessage.toExpectationMessage() - ) - } - + return _fromDeprecatedClosure(matcher) } /// Compatibility layer for old Matcher API, deprecated. @@ -243,6 +251,8 @@ extension Predicate { } #if canImport(Darwin) +import class Foundation.NSObject + public typealias PredicateBlock = (_ actualExpression: Expression) throws -> NMBPredicateResult public class NMBPredicate: NSObject { 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 f44c810..7c1b2b2 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,8 @@ -import Foundation - -// This matcher requires the Objective-C, and being built by Xcode rather than the Swift Package Manager +// This matcher requires the Objective-C, and being built by Xcode rather than the Swift Package Manager #if canImport(Darwin) && !SWIFT_PACKAGE +import class Foundation.NSObject +import class Foundation.NSDictionary +import class Foundation.NSException /// A Nimble matcher that succeeds when the actual expression raises an /// exception with the specified name, reason, and/or userInfo. @@ -12,78 +13,97 @@ import Foundation /// /// nil arguments indicates that the matcher should not attempt to match against /// that parameter. -public func raiseException( - named: String? = nil, +public func raiseException( + named: NSExceptionName? = nil, reason: String? = nil, userInfo: NSDictionary? = nil, - closure: ((NSException) -> Void)? = nil) -> Predicate { - return Predicate { actualExpression in - var exception: NSException? - let capture = NMBExceptionCapture(handler: ({ e in - exception = e - }), finally: nil) - - 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, - named: named, - reason: reason, - userInfo: userInfo, - closure: closure - ) - - let matches = exceptionMatchesNonNilFieldsOrClosure( - exception, - named: named, - reason: reason, - userInfo: userInfo, - closure: closure - ) - return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) - } + closure: ((NSException) -> Void)? = nil +) -> Predicate { + return raiseException(named: named?.rawValue, reason: reason, userInfo: userInfo, closure: closure) } -// swiftlint:disable:next function_parameter_count -internal func setFailureMessageForException( - _ failureMessage: FailureMessage, +/// A Nimble matcher that succeeds when the actual expression raises an +/// exception with the specified name, reason, and/or userInfo. +/// +/// Alternatively, you can pass a closure to do any arbitrary custom matching +/// to the raised exception. The closure only gets called when an exception +/// is raised. +/// +/// nil arguments indicates that the matcher should not attempt to match against +/// that parameter. +public func raiseException( + named: String?, + reason: String? = nil, + userInfo: NSDictionary? = nil, + closure: ((NSException) -> Void)? = nil +) -> Predicate { + return Predicate { actualExpression in + var exception: NSException? + let capture = NMBExceptionCapture(handler: ({ e in + exception = e + }), finally: nil) + + do { + try capture.tryBlockThrows { + _ = try actualExpression.evaluate() + } + } catch { + return PredicateResult(status: .fail, message: .fail("unexpected error thrown: <\(error)>")) + } + + let message = messageForException( + exception: exception, + named: named, + reason: reason, + userInfo: userInfo, + closure: closure + ) + + let matches = exceptionMatchesNonNilFieldsOrClosure( + exception, + named: named, + reason: reason, + userInfo: userInfo, + closure: closure + ) + return PredicateResult(bool: matches, message: message) + } +} + +internal func messageForException( exception: NSException?, named: String?, reason: String?, userInfo: NSDictionary?, - closure: ((NSException) -> Void)?) { - failureMessage.postfixMessage = "raise exception" + closure: ((NSException) -> Void)? +) -> ExpectationMessage { + var rawMessage: String = "raise exception" - if let named = named { - failureMessage.postfixMessage += " with name <\(named)>" - } - if let reason = reason { - failureMessage.postfixMessage += " with reason <\(reason)>" - } - if let userInfo = userInfo { - failureMessage.postfixMessage += " with userInfo <\(userInfo)>" - } - if closure != nil { - failureMessage.postfixMessage += " that satisfies block" - } - if named == nil && reason == nil && userInfo == nil && closure == nil { - failureMessage.postfixMessage = "raise any exception" - } + if let named = named { + rawMessage += " with name <\(named)>" + } + if let reason = reason { + rawMessage += " with reason <\(reason)>" + } + if let userInfo = userInfo { + rawMessage += " with userInfo <\(userInfo)>" + } + if closure != nil { + rawMessage += " that satisfies block" + } + if named == nil && reason == nil && userInfo == nil && closure == nil { + rawMessage = "raise any exception" + } - if let exception = exception { - // swiftlint:disable:next line_length - failureMessage.actualValue = "\(String(describing: type(of: exception))) { name=\(exception.name), reason='\(stringify(exception.reason))', userInfo=\(stringify(exception.userInfo)) }" - } else { - failureMessage.actualValue = "no exception" - } + let actual: String + if let exception = exception { + // swiftlint:disable:next line_length + actual = "\(String(describing: type(of: exception))) { name=\(exception.name), reason='\(stringify(exception.reason))', userInfo=\(stringify(exception.userInfo)) }" + } else { + actual = "no exception" + } + + return .expectedCustomValueTo(rawMessage, actual: actual) } internal func exceptionMatchesNonNilFieldsOrClosure( @@ -121,90 +141,82 @@ internal func exceptionMatchesNonNilFieldsOrClosure( return matches } -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 +public class NMBObjCRaiseExceptionPredicate: NMBPredicate { + private let _name: String? + private let _reason: String? + private let _userInfo: NSDictionary? + private let _block: ((NSException) -> Void)? - internal init(name: String?, reason: String?, userInfo: NSDictionary?, block: ((NSException) -> Void)?) { + fileprivate init(name: String?, reason: String?, userInfo: NSDictionary?, block: ((NSException) -> Void)?) { _name = name _reason = reason _userInfo = userInfo _block = block + + let predicate: Predicate = raiseException( + named: name, + reason: reason, + userInfo: userInfo, + closure: block + ) + let predicateBlock: PredicateBlock = { actualExpression in + return try predicate.satisfies(actualExpression).toObjectiveC() + } + super.init(predicate: predicateBlock) } - @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) - - 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 var named: (_ name: String) -> NMBObjCRaiseExceptionPredicate { + let (reason, userInfo, block) = (_reason, _userInfo, _block) + return { name in + return NMBObjCRaiseExceptionPredicate( + name: name, + reason: reason, + userInfo: userInfo, + block: block + ) } } - @objc public func doesNotMatch(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool { - return !matches(actualBlock, failureMessage: failureMessage, location: location) - } - - @objc public var named: (_ name: String) -> NMBObjCRaiseExceptionMatcher { - return ({ name in - return NMBObjCRaiseExceptionMatcher( + @objc public var reason: (_ reason: String?) -> NMBObjCRaiseExceptionPredicate { + let (name, userInfo, block) = (_name, _userInfo, _block) + return { reason in + return NMBObjCRaiseExceptionPredicate( name: name, - reason: self._reason, - userInfo: self._userInfo, - block: self._block - ) - }) - } - - @objc public var reason: (_ reason: String?) -> NMBObjCRaiseExceptionMatcher { - return ({ reason in - return NMBObjCRaiseExceptionMatcher( - name: self._name, reason: reason, - userInfo: self._userInfo, - block: self._block - ) - }) - } - - @objc public var userInfo: (_ userInfo: NSDictionary?) -> NMBObjCRaiseExceptionMatcher { - return ({ userInfo in - return NMBObjCRaiseExceptionMatcher( - name: self._name, - reason: self._reason, userInfo: userInfo, - block: self._block - ) - }) - } - - @objc public var satisfyingBlock: (_ block: ((NSException) -> Void)?) -> NMBObjCRaiseExceptionMatcher { - return ({ block in - return NMBObjCRaiseExceptionMatcher( - name: self._name, - reason: self._reason, - userInfo: self._userInfo, block: block ) - }) + } + } + + @objc public var userInfo: (_ userInfo: NSDictionary?) -> NMBObjCRaiseExceptionPredicate { + let (name, reason, block) = (_name, _reason, _block) + return { userInfo in + return NMBObjCRaiseExceptionPredicate( + name: name, + reason: reason, + userInfo: userInfo, + block: block + ) + } + } + + @objc public var satisfyingBlock: (_ block: ((NSException) -> Void)?) -> NMBObjCRaiseExceptionPredicate { + let (name, reason, userInfo) = (_name, _reason, _userInfo) + return { block in + return NMBObjCRaiseExceptionPredicate( + name: name, + reason: reason, + userInfo: userInfo, + block: block + ) + } } } -extension NMBObjCMatcher { - @objc public class func raiseExceptionMatcher() -> NMBObjCRaiseExceptionMatcher { - return NMBObjCRaiseExceptionMatcher(name: nil, reason: nil, userInfo: nil, block: nil) +extension NMBPredicate { + @objc public class func raiseExceptionMatcher() -> NMBObjCRaiseExceptionPredicate { + return NMBObjCRaiseExceptionPredicate(name: nil, reason: nil, userInfo: nil, block: nil) } } #endif 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 da3ea9a..7fbeeef 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 @@ -1,7 +1,12 @@ -import Foundation +/// A Nimble matcher that succeeds when the actual value matches with all of the matchers +/// provided in the variable list of matchers. +public func satisfyAllOf(_ predicates: Predicate...) -> Predicate { + return satisfyAllOf(predicates) +} /// A Nimble matcher that succeeds when the actual value matches with all of the matchers /// provided in the variable list of matchers. +@available(*, deprecated, message: "Use Predicate instead") public func satisfyAllOf(_ matchers: U...) -> Predicate where U: Matcher, U.ValueType == T { return satisfyAllOf(matchers.map { $0.predicate }) @@ -23,7 +28,7 @@ internal func satisfyAllOf(_ predicates: [Predicate]) -> Predicate { if let actualValue = try actualExpression.evaluate() { msg = .expectedCustomValueTo( "match all of: " + postfixMessages.joined(separator: ", and "), - "\(actualValue)" + actual: "\(actualValue)" ) } else { msg = .expectedActualValueTo( @@ -40,7 +45,9 @@ public func && (left: Predicate, right: Predicate) -> Predicate { } #if canImport(Darwin) -extension NMBObjCMatcher { +import class Foundation.NSObject + +extension NMBPredicate { @objc public class func satisfyAllOfMatcher(_ matchers: [NMBMatcher]) -> NMBPredicate { return NMBPredicate { actualExpression in if matchers.isEmpty { 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 6724956..44615dc 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 @@ -1,7 +1,12 @@ -import Foundation +/// A Nimble matcher that succeeds when the actual value matches with any of the matchers +/// provided in the variable list of matchers. +public func satisfyAnyOf(_ predicates: Predicate...) -> Predicate { + return satisfyAnyOf(predicates) +} /// A Nimble matcher that succeeds when the actual value matches with any of the matchers /// provided in the variable list of matchers. +@available(*, deprecated, message: "Use Predicate instead") public func satisfyAnyOf(_ matchers: U...) -> Predicate where U: Matcher, U.ValueType == T { return satisfyAnyOf(matchers.map { $0.predicate }) @@ -23,7 +28,7 @@ internal func satisfyAnyOf(_ predicates: [Predicate]) -> Predicate { if let actualValue = try actualExpression.evaluate() { msg = .expectedCustomValueTo( "match one of: " + postfixMessages.joined(separator: ", or "), - "\(actualValue)" + actual: "\(actualValue)" ) } else { msg = .expectedActualValueTo( @@ -39,16 +44,20 @@ public func || (left: Predicate, right: Predicate) -> Predicate { return satisfyAnyOf(left, right) } +@available(*, deprecated, message: "Use Predicate instead") public func || (left: NonNilMatcherFunc, right: NonNilMatcherFunc) -> Predicate { return satisfyAnyOf(left, right) } +@available(*, deprecated, message: "Use Predicate instead") public func || (left: MatcherFunc, right: MatcherFunc) -> Predicate { return satisfyAnyOf(left, right) } #if canImport(Darwin) -extension NMBObjCMatcher { +import class Foundation.NSObject + +extension NMBPredicate { @objc public class func satisfyAnyOfMatcher(_ matchers: [NMBMatcher]) -> NMBPredicate { return NMBPredicate { actualExpression in if matchers.isEmpty { 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 53d9191..5bbe96b 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,8 +1,12 @@ -import Foundation +#if canImport(CwlPreconditionTesting) && (os(macOS) || os(iOS)) +import CwlPreconditionTesting +#elseif canImport(CwlPosixPreconditionTesting) +import CwlPosixPreconditionTesting +#endif -public func throwAssertion() -> Predicate { +public func throwAssertion() -> Predicate { return Predicate { actualExpression in - #if arch(x86_64) && canImport(Darwin) && !SWIFT_PACKAGE + #if arch(x86_64) && canImport(Darwin) let message = ExpectationMessage.expectedTo("throw an assertion") var actualError: Error? @@ -24,7 +28,7 @@ public func throwAssertion() -> Predicate { } #endif do { - try actualExpression.evaluate() + _ = try actualExpression.evaluate() } catch { actualError = error } @@ -38,10 +42,6 @@ public func throwAssertion() -> Predicate { } else { return PredicateResult(bool: caughtException != nil, message: message) } - #elseif SWIFT_PACKAGE - fatalError("The throwAssertion Nimble matcher does not currently support Swift CLI." + - " You can silence this error by placing the test case inside an #if !SWIFT_PACKAGE" + - " conditional statement") #else fatalError("The throwAssertion Nimble matcher can only run on x86_64 platforms with " + "Objective-C (e.g. macOS, iPhone 5s or later simulators). You can silence this error " + diff --git a/Carthage/Checkouts/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 d294ba3..d5ac732 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 @@ -1,5 +1,3 @@ -import Foundation - /// A Nimble matcher that succeeds when the actual expression throws an /// error of the specified type or from the specified case. /// @@ -11,7 +9,7 @@ import Foundation /// /// nil arguments indicates that the matcher should not attempt to match against /// that parameter. -public func throwError() -> Predicate { +public func throwError() -> Predicate { return Predicate { actualExpression in var actualError: Error? do { @@ -21,9 +19,15 @@ public func throwError() -> Predicate { } if let actualError = actualError { - return PredicateResult(bool: true, message: .expectedCustomValueTo("throw any error", "<\(actualError)>")) + return PredicateResult( + bool: true, + message: .expectedCustomValueTo("throw any error", actual: "<\(actualError)>") + ) } else { - return PredicateResult(bool: false, message: .expectedCustomValueTo("throw any error", "no error")) + return PredicateResult( + bool: false, + message: .expectedCustomValueTo("throw any error", actual: "no error") + ) } } } @@ -39,7 +43,7 @@ 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 { +public func throwError(_ error: T, closure: ((Error) -> Void)? = nil) -> Predicate { return Predicate { actualExpression in var actualError: Error? do { @@ -48,9 +52,7 @@ public func throwError(_ error: T, closure: ((Error) -> Void)? = nil) actualError = error } - let failureMessage = FailureMessage() - setFailureMessageForError( - failureMessage, + let message = messageForError( actualError: actualError, error: error, errorType: nil, @@ -72,7 +74,7 @@ public func throwError(_ error: T, closure: ((Error) -> Void)? = nil) } } - return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + return PredicateResult(bool: matches, message: message) } } @@ -87,7 +89,7 @@ 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 { +public func throwError(_ error: T, closure: ((T) -> Void)? = nil) -> Predicate { return Predicate { actualExpression in var actualError: Error? do { @@ -96,9 +98,7 @@ public func throwError(_ error: T, closure: ((T) -> Void)? actualError = error } - let failureMessage = FailureMessage() - setFailureMessageForError( - failureMessage, + let message = messageForError( actualError: actualError, error: error, errorType: nil, @@ -120,7 +120,7 @@ public func throwError(_ error: T, closure: ((T) -> Void)? } } - return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + return PredicateResult(bool: matches, message: message) } } @@ -135,9 +135,10 @@ public func throwError(_ error: T, closure: ((T) -> Void)? /// /// nil arguments indicates that the matcher should not attempt to match against /// that parameter. -public func throwError( +public func throwError( errorType: T.Type, - closure: ((T) -> Void)? = nil) -> Predicate { + closure: ((T) -> Void)? = nil +) -> Predicate { return Predicate { actualExpression in var actualError: Error? do { @@ -146,9 +147,7 @@ public func throwError( actualError = error } - let failureMessage = FailureMessage() - setFailureMessageForError( - failureMessage, + let message = messageForError( actualError: actualError, error: nil, errorType: errorType, @@ -187,7 +186,7 @@ public func throwError( } } - return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + return PredicateResult(bool: matches, message: message) } } @@ -198,7 +197,7 @@ public func throwError( /// values of the existential type `Error` in the closure. /// /// The closure only gets called when an error was thrown. -public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate { +public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate { return Predicate { actualExpression in var actualError: Error? do { @@ -207,8 +206,7 @@ public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate { actualError = error } - let failureMessage = FailureMessage() - setFailureMessageForError(failureMessage, actualError: actualError, closure: closure) + let message = messageForError(actualError: actualError, closure: closure) var matches = false if let actualError = actualError { @@ -223,7 +221,7 @@ public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate { } } - return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + return PredicateResult(bool: matches, message: message) } } @@ -234,7 +232,7 @@ public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate { /// values of the existential type `Error` in the closure. /// /// The closure only gets called when an error was thrown. -public func throwError(closure: @escaping ((T) -> Void)) -> Predicate { +public func throwError(closure: @escaping ((T) -> Void)) -> Predicate { return Predicate { actualExpression in var actualError: Error? do { @@ -243,8 +241,7 @@ public func throwError(closure: @escaping ((T) -> Void)) -> Predicate< actualError = error } - let failureMessage = FailureMessage() - setFailureMessageForError(failureMessage, actualError: actualError, closure: closure) + let message = messageForError(actualError: actualError, closure: closure) var matches = false if let actualError = actualError as? T { @@ -259,6 +256,6 @@ public func throwError(closure: @escaping ((T) -> Void)) -> Predicate< } } - return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) + return PredicateResult(bool: matches, message: message) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ToSucceed.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ToSucceed.swift index 01369bb..0b52ee9 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ToSucceed.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Matchers/ToSucceed.swift @@ -25,12 +25,12 @@ public func succeed() -> Predicate<() -> ToSucceedResult> { case .succeeded: return PredicateResult( bool: true, - message: .expectedCustomValueTo("succeed", "") + message: .expectedCustomValueTo("succeed", actual: "") ) case .failed(let reason): return PredicateResult( bool: false, - message: .expectedCustomValueTo("succeed", " because <\(reason)>") + message: .expectedCustomValueTo("succeed", actual: " because <\(reason)>") ) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Nimble.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Nimble.h index 2bbc693..d975a72 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Nimble.h +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Nimble.h @@ -3,10 +3,9 @@ #import "NMBStringify.h" #import "DSL.h" -#if TARGET_OS_TV - #import "CwlPreconditionTesting_POSIX.h" -#else - #import "CwlPreconditionTesting.h" +#if TARGET_OS_OSX || TARGET_OS_IOS + #import "CwlMachBadInstructionHandler.h" + #import "CwlCatchException.h" #endif FOUNDATION_EXPORT double NimbleVersionNumber; diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Await.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Await.swift index 276f618..ce1b823 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Await.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Await.swift @@ -2,10 +2,6 @@ import CoreFoundation import Dispatch import Foundation -#if canImport(CDispatch) - import CDispatch -#endif - private let timeoutLeeway = DispatchTimeInterval.milliseconds(1) private let pollLeeway = DispatchTimeInterval.milliseconds(1) @@ -32,11 +28,7 @@ internal class AssertionWaitLock: WaitLock { func acquireWaitingLock(_ fnName: String, file: FileString, line: UInt) { let info = WaitingInfo(name: fnName, file: file, lineNumber: line) - #if canImport(Darwin) - let isMainThread = Thread.isMainThread - #else - let isMainThread = _CFIsMainThread() - #endif + let isMainThread = Thread.isMainThread nimblePrecondition( isMainThread, "InvalidNimbleAPIUsage", @@ -102,7 +94,7 @@ internal enum AwaitResult { /// Holds the resulting value from an asynchronous expectation. /// This class is thread-safe at receiving an "response" to this promise. -internal class AwaitPromise { +internal final class AwaitPromise { private(set) internal var asyncResult: AwaitResult = .incomplete private var signal: DispatchSemaphore @@ -156,7 +148,7 @@ internal class AwaitPromiseBuilder { self.trigger = trigger } - func timeout(_ timeoutInterval: TimeInterval, forcefullyAbortTimeout: TimeInterval) -> Self { + func timeout(_ timeoutInterval: DispatchTimeInterval, forcefullyAbortTimeout: DispatchTimeInterval) -> Self { // = Discussion = // // There's a lot of technical decisions here that is useful to elaborate on. This is @@ -261,11 +253,7 @@ internal class AwaitPromiseBuilder { self.trigger.timeoutSource.resume() while self.promise.asyncResult.isIncomplete() { // Stopping the run loop does not work unless we run only 1 mode - #if (swift(>=4.2) && 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() @@ -305,11 +293,19 @@ internal class Awaiter { let timeoutSource = createTimerSource(timeoutQueue) var completionCount = 0 let trigger = AwaitTrigger(timeoutSource: timeoutSource, actionSource: nil) { - try closure { + try closure { result in completionCount += 1 if completionCount < 2 { - if promise.resolveResult(.completed($0)) { - CFRunLoopStop(CFRunLoopGetMain()) + func completeBlock() { + if promise.resolveResult(.completed(result)) { + CFRunLoopStop(CFRunLoopGetMain()) + } + } + + if Thread.isMainThread { + completeBlock() + } else { + DispatchQueue.main.async { completeBlock() } } } else { fail("waitUntil(..) expects its completion closure to be only called once", @@ -325,12 +321,12 @@ internal class Awaiter { trigger: trigger) } - func poll(_ pollInterval: TimeInterval, closure: @escaping () throws -> T?) -> AwaitPromiseBuilder { + func poll(_ pollInterval: DispatchTimeInterval, closure: @escaping () throws -> T?) -> AwaitPromiseBuilder { let promise = AwaitPromise() let timeoutSource = createTimerSource(timeoutQueue) let asyncSource = createTimerSource(asyncQueue) let trigger = AwaitTrigger(timeoutSource: timeoutSource, actionSource: asyncSource) { - let interval = DispatchTimeInterval.nanoseconds(Int(pollInterval * TimeInterval(NSEC_PER_SEC))) + let interval = pollInterval asyncSource.schedule(deadline: .now(), repeating: interval, leeway: pollLeeway) asyncSource.setEventHandler { do { @@ -357,8 +353,8 @@ internal class Awaiter { } internal func pollBlock( - pollInterval: TimeInterval, - timeoutInterval: TimeInterval, + pollInterval: DispatchTimeInterval, + timeoutInterval: DispatchTimeInterval, file: FileString, line: UInt, fnName: String = #function, @@ -369,7 +365,7 @@ internal func pollBlock( return true } return nil - }.timeout(timeoutInterval, forcefullyAbortTimeout: timeoutInterval / 2.0).wait(fnName, file: file, line: line) + }.timeout(timeoutInterval, forcefullyAbortTimeout: timeoutInterval.divided).wait(fnName, file: file, line: line) return result } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/DispatchTimeInterval.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/DispatchTimeInterval.swift new file mode 100644 index 0000000..a4b1d65 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/DispatchTimeInterval.swift @@ -0,0 +1,41 @@ +import Dispatch + +#if canImport(CDispatch) +import CDispatch +#endif + +extension DispatchTimeInterval { + // ** Note: We cannot simply divide the time interval because DispatchTimeInterval associated value type is Int + var divided: DispatchTimeInterval { + switch self { + case let .seconds(val): return val < 2 ? .milliseconds(Int(Float(val)/2*1000)) : .seconds(val/2) + case let .milliseconds(val): return .milliseconds(val/2) + case let .microseconds(val): return .microseconds(val/2) + case let .nanoseconds(val): return .nanoseconds(val/2) + case .never: return .never + @unknown default: fatalError("Unknown DispatchTimeInterval value") + } + } + + var description: String { + switch self { + case let .seconds(val): return val == 1 ? "\(Float(val)) second" : "\(Float(val)) seconds" + case let .milliseconds(val): return "\(Float(val)/1_000) seconds" + case let .microseconds(val): return "\(Float(val)/1_000_000) seconds" + case let .nanoseconds(val): return "\(Float(val)/1_000_000_000) seconds" + default: fatalError("Unknown DispatchTimeInterval value") + } + } +} + +#if canImport(Foundation) +import typealias Foundation.TimeInterval + +extension TimeInterval { + var dispatchInterval: DispatchTimeInterval { + let microseconds = Int64(self * TimeInterval(USEC_PER_SEC)) + // perhaps use nanoseconds, though would more often be > Int.max + return microseconds < Int.max ? .microseconds(Int(microseconds)) : .seconds(Int(self)) + } +} +#endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Errors.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Errors.swift index 074cb20..4c3e434 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Errors.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Errors.swift @@ -1,33 +1,34 @@ -import Foundation - // Generic -internal func setFailureMessageForError( - _ failureMessage: FailureMessage, +internal func messageForError( postfixMessageVerb: String = "throw", actualError: Error?, error: T? = nil, errorType: T.Type? = nil, - closure: ((T) -> Void)? = nil) { - failureMessage.postfixMessage = "\(postfixMessageVerb) error" + closure: ((T) -> Void)? = nil +) -> ExpectationMessage { + var rawMessage = "\(postfixMessageVerb) error" if let error = error { - failureMessage.postfixMessage += " <\(error)>" + rawMessage += " <\(error)>" } else if errorType != nil || closure != nil { - failureMessage.postfixMessage += " from type <\(T.self)>" + rawMessage += " from type <\(T.self)>" } if closure != nil { - failureMessage.postfixMessage += " that satisfies block" + rawMessage += " that satisfies block" } if error == nil && errorType == nil && closure == nil { - failureMessage.postfixMessage = "\(postfixMessageVerb) any error" + rawMessage = "\(postfixMessageVerb) any error" } + let actual: String if let actualError = actualError { - failureMessage.actualValue = "<\(actualError)>" + actual = "<\(actualError)>" } else { - failureMessage.actualValue = "no error" + actual = "no error" } + + return .expectedCustomValueTo(rawMessage, actual: actual) } internal func errorMatchesExpectedError( @@ -39,21 +40,24 @@ internal func errorMatchesExpectedError( // Non-generic -internal func setFailureMessageForError( - _ failureMessage: FailureMessage, +internal func messageForError( actualError: Error?, - closure: ((Error) -> Void)?) { - failureMessage.postfixMessage = "throw error" + closure: ((Error) -> Void)? +) -> ExpectationMessage { + var rawMessage = "throw error" if closure != nil { - failureMessage.postfixMessage += " that satisfies block" + rawMessage += " that satisfies block" } else { - failureMessage.postfixMessage = "throw any error" + rawMessage = "throw any error" } + let actual: String if let actualError = actualError { - failureMessage.actualValue = "<\(actualError)>" + actual = "<\(actualError)>" } else { - failureMessage.actualValue = "no error" + actual = "no error" } + + return .expectedCustomValueTo(rawMessage, actual: actual) } 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 deleted file mode 100644 index c87af76..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/Nimble/Utils/Functional.swift +++ /dev/null @@ -1,14 +0,0 @@ -import Foundation - -#if !swift(>=4.2) -extension Sequence { - internal func allSatisfy(_ predicate: (Element) throws -> Bool) rethrows -> Bool { - for item in self { - 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 4ab18d2..88e84bb 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 @@ -1,12 +1,7 @@ import Foundation internal func identityAsString(_ value: Any?) -> String { - let anyObject: AnyObject? -#if os(Linux) && !swift(>=4.1.50) - anyObject = value as? AnyObject -#else - anyObject = value as AnyObject? -#endif + let anyObject = value as AnyObject? if let value = anyObject { return NSString(format: "<%p>", unsafeBitCast(value, to: Int.self)).description } else { @@ -45,32 +40,24 @@ extension Float: TestOutputStringConvertible { } extension NSNumber: TestOutputStringConvertible { - // This is using `NSString(format:)` instead of - // `String(format:)` because the latter somehow breaks - // the travis CI build on linux. public var testDescription: String { let description = self.description if description.contains(".") { - // Travis linux swiftpm build doesn't like casting String to NSString, - // which is why this annoying nested initializer thing is here. - // Maybe this will change in a future snapshot. - let decimalPlaces = NSString(string: NSString(string: description) - .components(separatedBy: ".")[1]) - - // SeeAlso: https://bugs.swift.org/browse/SR-1464 - switch decimalPlaces.length { + let decimalPlaces = description.split(separator: ".")[1] + switch decimalPlaces.count { case 1: - return NSString(format: "%0.1f", self.doubleValue).description + return String(format: "%0.1f", doubleValue) case 2: - return NSString(format: "%0.2f", self.doubleValue).description + return String(format: "%0.2f", doubleValue) case 3: - return NSString(format: "%0.3f", self.doubleValue).description + return String(format: "%0.3f", doubleValue) default: - return NSString(format: "%0.4f", self.doubleValue).description + return String(format: "%0.4f", doubleValue) } } - return self.description + + return description } } @@ -85,7 +72,7 @@ extension AnySequence: TestOutputStringConvertible { public var testDescription: String { let generator = self.makeIterator() var strings = [String]() - var value: AnySequence.Iterator.Element? + var value: AnySequence.Element? repeat { value = generator.next() @@ -121,13 +108,7 @@ extension String: TestOutputStringConvertible { extension Data: TestOutputStringConvertible { public var testDescription: String { - #if os(Linux) - // swiftlint:disable:next todo - // FIXME: Swift on Linux triggers a segfault when calling NSData's hash() (last checked on 03-11-16) - return "Data" - #else - return "Data" - #endif + return "Data" } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/NimbleObjectiveC/DSL.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/NimbleObjectiveC/DSL.h index 9170541..9ae06a4 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/NimbleObjectiveC/DSL.h +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Sources/NimbleObjectiveC/DSL.h @@ -1,9 +1,9 @@ #import @class NMBExpectation; -@class NMBObjCBeCloseToMatcher; -@class NMBObjCRaiseExceptionMatcher; -@protocol NMBMatcher; +@class NMBPredicate; +@class NMBObjCBeCloseToPredicate; +@class NMBObjCRaiseExceptionPredicate; NS_ASSUME_NONNULL_BEGIN @@ -66,16 +66,16 @@ NIMBLE_EXPORT NMBExpectation *NMB_expectAction(void(^actualBlock)(void), NSStrin #define DEFINE_OVERLOAD(TYPE, EXPR) \ NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - id NMB_equal(TYPE expectedValue) { \ + NMBPredicate *NMB_equal(TYPE expectedValue) { \ return NMB_equal((EXPR)); \ } \ - NIMBLE_SHORT_OVERLOADED(id equal(TYPE expectedValue), NMB_equal(expectedValue)); + NIMBLE_SHORT_OVERLOADED(NMBPredicate *equal(TYPE expectedValue), NMB_equal(expectedValue)); NIMBLE_EXPORT NIMBLE_OVERLOADABLE - id NMB_equal(__nullable id expectedValue); + NMBPredicate *NMB_equal(__nullable id expectedValue); - NIMBLE_SHORT_OVERLOADED(id equal(__nullable id expectedValue), + NIMBLE_SHORT_OVERLOADED(NMBPredicate *equal(__nullable id expectedValue), NMB_equal(expectedValue)); // overloaded dispatch for nils - expect(nil) @@ -101,17 +101,17 @@ NIMBLE_EXPORT NMBExpectation *NMB_expectAction(void(^actualBlock)(void), NSStrin #define DEFINE_OVERLOAD(TYPE, EXPR) \ NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - id NMB_haveCount(TYPE expectedValue) { \ + NMBPredicate *NMB_haveCount(TYPE expectedValue) { \ return NMB_haveCount((EXPR)); \ } \ - NIMBLE_SHORT_OVERLOADED(id haveCount(TYPE expectedValue), \ + NIMBLE_SHORT_OVERLOADED(NMBPredicate *haveCount(TYPE expectedValue), \ NMB_haveCount(expectedValue)); NIMBLE_EXPORT NIMBLE_OVERLOADABLE - id NMB_haveCount(id expectedValue); + NMBPredicate *NMB_haveCount(id expectedValue); - NIMBLE_SHORT_OVERLOADED(id haveCount(id expectedValue), + NIMBLE_SHORT_OVERLOADED(NMBPredicate *haveCount(id expectedValue), NMB_haveCount(expectedValue)); DEFINE_OVERLOAD(long, @(expectedValue)) @@ -127,14 +127,14 @@ NIMBLE_EXPORT NMBExpectation *NMB_expectAction(void(^actualBlock)(void), NSStrin #define DEFINE_OVERLOAD(TYPE, EXPR) \ NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - NMBObjCBeCloseToMatcher *NMB_beCloseTo(TYPE expectedValue) { \ + NMBObjCBeCloseToPredicate *NMB_beCloseTo(TYPE expectedValue) { \ return NMB_beCloseTo((NSNumber *)(EXPR)); \ } \ - NIMBLE_SHORT_OVERLOADED(NMBObjCBeCloseToMatcher *beCloseTo(TYPE expectedValue), \ + NIMBLE_SHORT_OVERLOADED(NMBObjCBeCloseToPredicate *beCloseTo(TYPE expectedValue), \ NMB_beCloseTo(expectedValue)); - NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBObjCBeCloseToMatcher *NMB_beCloseTo(NSNumber *expectedValue); - NIMBLE_SHORT_OVERLOADED(NMBObjCBeCloseToMatcher *beCloseTo(NSNumber *expectedValue), + NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBObjCBeCloseToPredicate *NMB_beCloseTo(NSNumber *expectedValue); + NIMBLE_SHORT_OVERLOADED(NMBObjCBeCloseToPredicate *beCloseTo(NSNumber *expectedValue), NMB_beCloseTo(expectedValue)); // it would be better to only overload float & double, but zero becomes ambigious @@ -152,33 +152,33 @@ NIMBLE_EXPORT NMBExpectation *NMB_expectAction(void(^actualBlock)(void), NSStrin #undef DEFINE_OVERLOAD -NIMBLE_EXPORT id NMB_beAnInstanceOf(Class expectedClass); -NIMBLE_EXPORT_INLINE id beAnInstanceOf(Class expectedClass) { +NIMBLE_EXPORT NMBPredicate *NMB_beAnInstanceOf(Class expectedClass); +NIMBLE_EXPORT_INLINE NMBPredicate *beAnInstanceOf(Class expectedClass) { return NMB_beAnInstanceOf(expectedClass); } -NIMBLE_EXPORT id NMB_beAKindOf(Class expectedClass); -NIMBLE_EXPORT_INLINE id beAKindOf(Class expectedClass) { +NIMBLE_EXPORT NMBPredicate *NMB_beAKindOf(Class expectedClass); +NIMBLE_EXPORT_INLINE NMBPredicate *beAKindOf(Class expectedClass) { return NMB_beAKindOf(expectedClass); } -NIMBLE_EXPORT id NMB_beginWith(id itemElementOrSubstring); -NIMBLE_EXPORT_INLINE id beginWith(id itemElementOrSubstring) { +NIMBLE_EXPORT NMBPredicate *NMB_beginWith(id itemElementOrSubstring); +NIMBLE_EXPORT_INLINE NMBPredicate *beginWith(id itemElementOrSubstring) { return NMB_beginWith(itemElementOrSubstring); } #define DEFINE_OVERLOAD(TYPE, EXPR) \ NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - id NMB_beGreaterThan(TYPE expectedValue) { \ + NMBPredicate *NMB_beGreaterThan(TYPE expectedValue) { \ return NMB_beGreaterThan((EXPR)); \ } \ - NIMBLE_SHORT_OVERLOADED(id beGreaterThan(TYPE expectedValue), NMB_beGreaterThan(expectedValue)); + NIMBLE_SHORT_OVERLOADED(NMBPredicate *beGreaterThan(TYPE expectedValue), NMB_beGreaterThan(expectedValue)); NIMBLE_EXPORT NIMBLE_OVERLOADABLE - id NMB_beGreaterThan(NSNumber *expectedValue); + NMBPredicate *NMB_beGreaterThan(NSNumber *expectedValue); NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE - id beGreaterThan(NSNumber *expectedValue) { + NMBPredicate *beGreaterThan(NSNumber *expectedValue) { return NMB_beGreaterThan(expectedValue); } @@ -197,17 +197,17 @@ NIMBLE_EXPORT_INLINE id beginWith(id itemElementOrSubstring) { #define DEFINE_OVERLOAD(TYPE, EXPR) \ NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - id NMB_beGreaterThanOrEqualTo(TYPE expectedValue) { \ + NMBPredicate *NMB_beGreaterThanOrEqualTo(TYPE expectedValue) { \ return NMB_beGreaterThanOrEqualTo((EXPR)); \ } \ - NIMBLE_SHORT_OVERLOADED(id beGreaterThanOrEqualTo(TYPE expectedValue), \ + NIMBLE_SHORT_OVERLOADED(NMBPredicate *beGreaterThanOrEqualTo(TYPE expectedValue), \ NMB_beGreaterThanOrEqualTo(expectedValue)); NIMBLE_EXPORT NIMBLE_OVERLOADABLE - id NMB_beGreaterThanOrEqualTo(NSNumber *expectedValue); + NMBPredicate *NMB_beGreaterThanOrEqualTo(NSNumber *expectedValue); NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE - id beGreaterThanOrEqualTo(NSNumber *expectedValue) { + NMBPredicate *beGreaterThanOrEqualTo(NSNumber *expectedValue) { return NMB_beGreaterThanOrEqualTo(expectedValue); } @@ -225,28 +225,28 @@ NIMBLE_EXPORT_INLINE id beginWith(id itemElementOrSubstring) { #undef DEFINE_OVERLOAD -NIMBLE_EXPORT id NMB_beIdenticalTo(id expectedInstance); -NIMBLE_SHORT(id beIdenticalTo(id expectedInstance), +NIMBLE_EXPORT NMBPredicate *NMB_beIdenticalTo(id expectedInstance); +NIMBLE_SHORT(NMBPredicate *beIdenticalTo(id expectedInstance), NMB_beIdenticalTo(expectedInstance)); -NIMBLE_EXPORT id NMB_be(id expectedInstance); -NIMBLE_SHORT(id be(id expectedInstance), +NIMBLE_EXPORT NMBPredicate *NMB_be(id expectedInstance); +NIMBLE_SHORT(NMBPredicate *be(id expectedInstance), NMB_be(expectedInstance)); #define DEFINE_OVERLOAD(TYPE, EXPR) \ NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - id NMB_beLessThan(TYPE expectedValue) { \ + NMBPredicate *NMB_beLessThan(TYPE expectedValue) { \ return NMB_beLessThan((EXPR)); \ } \ - NIMBLE_SHORT_OVERLOADED(id beLessThan(TYPE expectedValue), \ + NIMBLE_SHORT_OVERLOADED(NMBPredicate *beLessThan(TYPE expectedValue), \ NMB_beLessThan(expectedValue)); NIMBLE_EXPORT NIMBLE_OVERLOADABLE - id NMB_beLessThan(NSNumber *expectedValue); + NMBPredicate *NMB_beLessThan(NSNumber *expectedValue); NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE - id beLessThan(NSNumber *expectedValue) { + NMBPredicate *beLessThan(NSNumber *expectedValue) { return NMB_beLessThan(expectedValue); } @@ -266,18 +266,18 @@ NIMBLE_SHORT(id be(id expectedInstance), #define DEFINE_OVERLOAD(TYPE, EXPR) \ NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - id NMB_beLessThanOrEqualTo(TYPE expectedValue) { \ + NMBPredicate *NMB_beLessThanOrEqualTo(TYPE expectedValue) { \ return NMB_beLessThanOrEqualTo((EXPR)); \ } \ - NIMBLE_SHORT_OVERLOADED(id beLessThanOrEqualTo(TYPE expectedValue), \ + NIMBLE_SHORT_OVERLOADED(NMBPredicate *beLessThanOrEqualTo(TYPE expectedValue), \ NMB_beLessThanOrEqualTo(expectedValue)); NIMBLE_EXPORT NIMBLE_OVERLOADABLE - id NMB_beLessThanOrEqualTo(NSNumber *expectedValue); + NMBPredicate *NMB_beLessThanOrEqualTo(NSNumber *expectedValue); NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE - id beLessThanOrEqualTo(NSNumber *expectedValue) { + NMBPredicate *beLessThanOrEqualTo(NSNumber *expectedValue) { return NMB_beLessThanOrEqualTo(expectedValue); } @@ -294,63 +294,63 @@ NIMBLE_SHORT(id be(id expectedInstance), #undef DEFINE_OVERLOAD -NIMBLE_EXPORT id NMB_beTruthy(void); -NIMBLE_SHORT(id beTruthy(void), +NIMBLE_EXPORT NMBPredicate *NMB_beTruthy(void); +NIMBLE_SHORT(NMBPredicate *beTruthy(void), NMB_beTruthy()); -NIMBLE_EXPORT id NMB_beFalsy(void); -NIMBLE_SHORT(id beFalsy(void), +NIMBLE_EXPORT NMBPredicate *NMB_beFalsy(void); +NIMBLE_SHORT(NMBPredicate *beFalsy(void), NMB_beFalsy()); -NIMBLE_EXPORT id NMB_beTrue(void); -NIMBLE_SHORT(id beTrue(void), +NIMBLE_EXPORT NMBPredicate *NMB_beTrue(void); +NIMBLE_SHORT(NMBPredicate *beTrue(void), NMB_beTrue()); -NIMBLE_EXPORT id NMB_beFalse(void); -NIMBLE_SHORT(id beFalse(void), +NIMBLE_EXPORT NMBPredicate *NMB_beFalse(void); +NIMBLE_SHORT(NMBPredicate *beFalse(void), NMB_beFalse()); -NIMBLE_EXPORT id NMB_beNil(void); -NIMBLE_SHORT(id beNil(void), +NIMBLE_EXPORT NMBPredicate *NMB_beNil(void); +NIMBLE_SHORT(NMBPredicate *beNil(void), NMB_beNil()); -NIMBLE_EXPORT id NMB_beEmpty(void); -NIMBLE_SHORT(id beEmpty(void), +NIMBLE_EXPORT NMBPredicate *NMB_beEmpty(void); +NIMBLE_SHORT(NMBPredicate *beEmpty(void), NMB_beEmpty()); -NIMBLE_EXPORT id NMB_containWithNilTermination(id itemOrSubstring, ...) NS_REQUIRES_NIL_TERMINATION; +NIMBLE_EXPORT NMBPredicate *NMB_containWithNilTermination(id itemOrSubstring, ...) NS_REQUIRES_NIL_TERMINATION; #define NMB_contain(...) NMB_containWithNilTermination(__VA_ARGS__, nil) #ifndef NIMBLE_DISABLE_SHORT_SYNTAX #define contain(...) NMB_contain(__VA_ARGS__) #endif -NIMBLE_EXPORT id NMB_containElementSatisfying(BOOL(^predicate)(id)); -NIMBLE_SHORT(id containElementSatisfying(BOOL(^predicate)(id)), +NIMBLE_EXPORT NMBPredicate *NMB_containElementSatisfying(BOOL(^predicate)(id)); +NIMBLE_SHORT(NMBPredicate *containElementSatisfying(BOOL(^predicate)(id)), NMB_containElementSatisfying(predicate)); -NIMBLE_EXPORT id NMB_endWith(id itemElementOrSubstring); -NIMBLE_SHORT(id endWith(id itemElementOrSubstring), +NIMBLE_EXPORT NMBPredicate *NMB_endWith(id itemElementOrSubstring); +NIMBLE_SHORT(NMBPredicate *endWith(id itemElementOrSubstring), NMB_endWith(itemElementOrSubstring)); -NIMBLE_EXPORT NMBObjCRaiseExceptionMatcher *NMB_raiseException(void); -NIMBLE_SHORT(NMBObjCRaiseExceptionMatcher *raiseException(void), +NIMBLE_EXPORT NMBObjCRaiseExceptionPredicate *NMB_raiseException(void); +NIMBLE_SHORT(NMBObjCRaiseExceptionPredicate *raiseException(void), NMB_raiseException()); -NIMBLE_EXPORT id NMB_match(id expectedValue); -NIMBLE_SHORT(id match(id expectedValue), +NIMBLE_EXPORT NMBPredicate *NMB_match(id expectedValue); +NIMBLE_SHORT(NMBPredicate *match(id expectedValue), NMB_match(expectedValue)); -NIMBLE_EXPORT id NMB_allPass(id matcher); -NIMBLE_SHORT(id allPass(id matcher), +NIMBLE_EXPORT NMBPredicate *NMB_allPass(id matcher); +NIMBLE_SHORT(NMBPredicate *allPass(id matcher), NMB_allPass(matcher)); -NIMBLE_EXPORT id NMB_satisfyAnyOfWithMatchers(id matchers); +NIMBLE_EXPORT NMBPredicate *NMB_satisfyAnyOfWithMatchers(id matchers); #define NMB_satisfyAnyOf(...) NMB_satisfyAnyOfWithMatchers(@[__VA_ARGS__]) #ifndef NIMBLE_DISABLE_SHORT_SYNTAX #define satisfyAnyOf(...) NMB_satisfyAnyOf(__VA_ARGS__) #endif -NIMBLE_EXPORT id NMB_satisfyAllOfWithMatchers(id matchers); +NIMBLE_EXPORT NMBPredicate *NMB_satisfyAllOfWithMatchers(id matchers); #define NMB_satisfyAllOf(...) NMB_satisfyAllOfWithMatchers(@[__VA_ARGS__]) #ifndef NIMBLE_DISABLE_SHORT_SYNTAX #define satisfyAllOf(...) NMB_satisfyAllOf(__VA_ARGS__) 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 670415b..6f7572f 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 @@ -28,71 +28,71 @@ NIMBLE_EXPORT void NMB_failWithMessage(NSString *msg, NSString *file, NSUInteger return [NMBExpectation failWithMessage:msg file:file line:line]; } -NIMBLE_EXPORT id NMB_beAnInstanceOf(Class expectedClass) { - return [NMBObjCMatcher beAnInstanceOfMatcher:expectedClass]; +NIMBLE_EXPORT NMBPredicate *NMB_beAnInstanceOf(Class expectedClass) { + return [NMBPredicate beAnInstanceOfMatcher:expectedClass]; } -NIMBLE_EXPORT id NMB_beAKindOf(Class expectedClass) { - return [NMBObjCMatcher beAKindOfMatcher:expectedClass]; +NIMBLE_EXPORT NMBPredicate *NMB_beAKindOf(Class expectedClass) { + return [NMBPredicate beAKindOfMatcher:expectedClass]; } -NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBObjCBeCloseToMatcher *NMB_beCloseTo(NSNumber *expectedValue) { - return [NMBObjCMatcher beCloseToMatcher:expectedValue within:0.001]; +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBObjCBeCloseToPredicate *NMB_beCloseTo(NSNumber *expectedValue) { + return [NMBPredicate beCloseToMatcher:expectedValue within:0.001]; } -NIMBLE_EXPORT id NMB_beginWith(id itemElementOrSubstring) { - return [NMBObjCMatcher beginWithMatcher:itemElementOrSubstring]; +NIMBLE_EXPORT NMBPredicate *NMB_beginWith(id itemElementOrSubstring) { + return [NMBPredicate beginWithMatcher:itemElementOrSubstring]; } -NIMBLE_EXPORT NIMBLE_OVERLOADABLE id NMB_beGreaterThan(NSNumber *expectedValue) { - return [NMBObjCMatcher beGreaterThanMatcher:expectedValue]; +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBPredicate *NMB_beGreaterThan(NSNumber *expectedValue) { + return [NMBPredicate beGreaterThanMatcher:expectedValue]; } -NIMBLE_EXPORT NIMBLE_OVERLOADABLE id NMB_beGreaterThanOrEqualTo(NSNumber *expectedValue) { - return [NMBObjCMatcher beGreaterThanOrEqualToMatcher:expectedValue]; +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBPredicate *NMB_beGreaterThanOrEqualTo(NSNumber *expectedValue) { + return [NMBPredicate beGreaterThanOrEqualToMatcher:expectedValue]; } -NIMBLE_EXPORT id NMB_beIdenticalTo(id expectedInstance) { - return [NMBObjCMatcher beIdenticalToMatcher:expectedInstance]; +NIMBLE_EXPORT NMBPredicate *NMB_beIdenticalTo(id expectedInstance) { + return [NMBPredicate beIdenticalToMatcher:expectedInstance]; } -NIMBLE_EXPORT id NMB_be(id expectedInstance) { - return [NMBObjCMatcher beIdenticalToMatcher:expectedInstance]; +NIMBLE_EXPORT NMBPredicate *NMB_be(id expectedInstance) { + return [NMBPredicate beIdenticalToMatcher:expectedInstance]; } -NIMBLE_EXPORT NIMBLE_OVERLOADABLE id NMB_beLessThan(NSNumber *expectedValue) { - return [NMBObjCMatcher beLessThanMatcher:expectedValue]; +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBPredicate *NMB_beLessThan(NSNumber *expectedValue) { + return [NMBPredicate beLessThanMatcher:expectedValue]; } -NIMBLE_EXPORT NIMBLE_OVERLOADABLE id NMB_beLessThanOrEqualTo(NSNumber *expectedValue) { - return [NMBObjCMatcher beLessThanOrEqualToMatcher:expectedValue]; +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBPredicate *NMB_beLessThanOrEqualTo(NSNumber *expectedValue) { + return [NMBPredicate beLessThanOrEqualToMatcher:expectedValue]; } -NIMBLE_EXPORT id NMB_beTruthy() { - return [NMBObjCMatcher beTruthyMatcher]; +NIMBLE_EXPORT NMBPredicate *NMB_beTruthy() { + return [NMBPredicate beTruthyMatcher]; } -NIMBLE_EXPORT id NMB_beFalsy() { - return [NMBObjCMatcher beFalsyMatcher]; +NIMBLE_EXPORT NMBPredicate *NMB_beFalsy() { + return [NMBPredicate beFalsyMatcher]; } -NIMBLE_EXPORT id NMB_beTrue() { - return [NMBObjCMatcher beTrueMatcher]; +NIMBLE_EXPORT NMBPredicate *NMB_beTrue() { + return [NMBPredicate beTrueMatcher]; } -NIMBLE_EXPORT id NMB_beFalse() { - return [NMBObjCMatcher beFalseMatcher]; +NIMBLE_EXPORT NMBPredicate *NMB_beFalse() { + return [NMBPredicate beFalseMatcher]; } -NIMBLE_EXPORT id NMB_beNil() { - return [NMBObjCMatcher beNilMatcher]; +NIMBLE_EXPORT NMBPredicate *NMB_beNil() { + return [NMBPredicate beNilMatcher]; } -NIMBLE_EXPORT id NMB_beEmpty() { - return [NMBObjCMatcher beEmptyMatcher]; +NIMBLE_EXPORT NMBPredicate *NMB_beEmpty() { + return [NMBPredicate beEmptyMatcher]; } -NIMBLE_EXPORT id NMB_containWithNilTermination(id itemOrSubstring, ...) { +NIMBLE_EXPORT NMBPredicate *NMB_containWithNilTermination(id itemOrSubstring, ...) { NSMutableArray *itemOrSubstringArray = [NSMutableArray array]; if (itemOrSubstring) { @@ -107,43 +107,43 @@ NIMBLE_EXPORT id NMB_containWithNilTermination(id itemOrSubstring, . va_end(args); } - return [NMBObjCMatcher containMatcher:itemOrSubstringArray]; + return [NMBPredicate containMatcher:itemOrSubstringArray]; } -NIMBLE_EXPORT id NMB_containElementSatisfying(BOOL(^predicate)(id)) { - return [NMBObjCMatcher containElementSatisfyingMatcher:predicate]; +NIMBLE_EXPORT NMBPredicate *NMB_containElementSatisfying(BOOL(^predicate)(id)) { + return [NMBPredicate containElementSatisfyingMatcher:predicate]; } -NIMBLE_EXPORT id NMB_endWith(id itemElementOrSubstring) { - return [NMBObjCMatcher endWithMatcher:itemElementOrSubstring]; +NIMBLE_EXPORT NMBPredicate *NMB_endWith(id itemElementOrSubstring) { + return [NMBPredicate endWithMatcher:itemElementOrSubstring]; } -NIMBLE_EXPORT NIMBLE_OVERLOADABLE id NMB_equal(__nullable id expectedValue) { - return [NMBObjCMatcher equalMatcher:expectedValue]; +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBPredicate *NMB_equal(__nullable id expectedValue) { + return [NMBPredicate equalMatcher:expectedValue]; } -NIMBLE_EXPORT NIMBLE_OVERLOADABLE id NMB_haveCount(id expectedValue) { - return [NMBObjCMatcher haveCountMatcher:expectedValue]; +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBPredicate *NMB_haveCount(id expectedValue) { + return [NMBPredicate haveCountMatcher:expectedValue]; } -NIMBLE_EXPORT id NMB_match(id expectedValue) { - return [NMBObjCMatcher matchMatcher:expectedValue]; +NIMBLE_EXPORT NMBPredicate *NMB_match(id expectedValue) { + return [NMBPredicate matchMatcher:expectedValue]; } -NIMBLE_EXPORT id NMB_allPass(id expectedValue) { - return [NMBObjCMatcher allPassMatcher:expectedValue]; +NIMBLE_EXPORT NMBPredicate *NMB_allPass(id expectedValue) { + return [NMBPredicate allPassMatcher:expectedValue]; } -NIMBLE_EXPORT id NMB_satisfyAnyOfWithMatchers(id matchers) { - return [NMBObjCMatcher satisfyAnyOfMatcher:matchers]; +NIMBLE_EXPORT NMBPredicate *NMB_satisfyAnyOfWithMatchers(id matchers) { + return [NMBPredicate satisfyAnyOfMatcher:matchers]; } -NIMBLE_EXPORT id NMB_satisfyAllOfWithMatchers(id matchers) { - return [NMBObjCMatcher satisfyAllOfMatcher:matchers]; +NIMBLE_EXPORT NMBPredicate *NMB_satisfyAllOfWithMatchers(id matchers) { + return [NMBPredicate satisfyAllOfMatcher:matchers]; } -NIMBLE_EXPORT NMBObjCRaiseExceptionMatcher *NMB_raiseException() { - return [NMBObjCMatcher raiseExceptionMatcher]; +NIMBLE_EXPORT NMBObjCRaiseExceptionPredicate *NMB_raiseException() { + return [NMBPredicate raiseExceptionMatcher]; } NIMBLE_EXPORT NMBWaitUntilTimeoutBlock NMB_waitUntilTimeoutBuilder(NSString *file, NSUInteger line) { 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 fa5030a..3c1110b 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,5 +1,4 @@ #import -#import #if __has_include("Nimble-Swift.h") #import "Nimble-Swift.h" @@ -7,77 +6,12 @@ #import #endif -#pragma mark - Method Swizzling - -/// Swaps the implementations between two instance methods. -/// -/// @param class The class containing `originalSelector`. -/// @param originalSelector Original method to replace. -/// @param replacementSelector Replacement method. -void swizzleSelectors(Class class, SEL originalSelector, SEL replacementSelector) { - Method originalMethod = class_getInstanceMethod(class, originalSelector); - Method replacementMethod = class_getInstanceMethod(class, replacementSelector); - - BOOL didAddMethod = - class_addMethod(class, - originalSelector, - method_getImplementation(replacementMethod), - method_getTypeEncoding(replacementMethod)); - - if (didAddMethod) { - class_replaceMethod(class, - replacementSelector, - method_getImplementation(originalMethod), - method_getTypeEncoding(originalMethod)); - } else { - method_exchangeImplementations(originalMethod, replacementMethod); - } -} - #pragma mark - Private -@interface XCTestObservationCenter (Private) -- (void)_addLegacyTestObserver:(id)observer; -@end - @implementation XCTestObservationCenter (Register) -/// Uses objc method swizzling to register `CurrentTestCaseTracker` as a test observer. This is necessary -/// because Xcode 7.3 introduced timing issues where if a custom `XCTestObservation` is registered too early -/// it suppresses all console output (generated by `XCTestLog`), breaking any tools that depend on this output. -/// This approach waits to register our custom test observer until XCTest adds its first "legacy" observer, -/// falling back to registering after the first normal observer if this private method ever changes. + (void)load { - if (class_getInstanceMethod([self class], @selector(_addLegacyTestObserver:))) { - // Swizzle -_addLegacyTestObserver: - swizzleSelectors([self class], @selector(_addLegacyTestObserver:), @selector(NMB_original__addLegacyTestObserver:)); - } else { - // Swizzle -addTestObserver:, only if -_addLegacyTestObserver: is not implemented - swizzleSelectors([self class], @selector(addTestObserver:), @selector(NMB_original_addTestObserver:)); - } -} - -#pragma mark - Replacement Methods - -/// Registers `CurrentTestCaseTracker` as a test observer after `XCTestLog` has been added. -- (void)NMB_original__addLegacyTestObserver:(id)observer { - [self NMB_original__addLegacyTestObserver:observer]; - - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - [self addTestObserver:[CurrentTestCaseTracker sharedInstance]]; - }); -} - -/// Registers `CurrentTestCaseTracker` as a test observer after `XCTestLog` has been added. -/// This method is only used if `-_addLegacyTestObserver:` is not impelemented. (added in Xcode 7.3) -- (void)NMB_original_addTestObserver:(id)observer { - [self NMB_original_addTestObserver:observer]; - - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - [self NMB_original_addTestObserver:[CurrentTestCaseTracker sharedInstance]]; - }); + [[XCTestObservationCenter sharedTestObservationCenter] addTestObserver:[CurrentTestCaseTracker sharedInstance]]; } @end 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 bfa34c2..e517638 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 @@ -1,9 +1,10 @@ import Dispatch +import CoreFoundation import Foundation import XCTest import Nimble -final class AsyncTest: XCTestCase, XCTestCaseProvider { +final class AsyncTest: XCTestCase { class Error: Swift.Error {} let errorToThrow = Error() @@ -37,9 +38,9 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { } func testToEventuallyWithCustomDefaultTimeout() { - AsyncDefaults.Timeout = 2 + AsyncDefaults.timeout = .seconds(2) defer { - AsyncDefaults.Timeout = 1 + AsyncDefaults.timeout = .seconds(1) } var value = 0 @@ -61,12 +62,12 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { } func testWaitUntilWithCustomDefaultsTimeout() { - AsyncDefaults.Timeout = 5 + AsyncDefaults.timeout = .seconds(3) defer { - AsyncDefaults.Timeout = 1 + AsyncDefaults.timeout = .seconds(1) } waitUntil { done in - Thread.sleep(forTimeInterval: 4.8) + Thread.sleep(forTimeInterval: 2.8) done() } } @@ -84,14 +85,14 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { func testWaitUntilTimesOutIfNotCalled() { failsWithErrorMessage("Waited more than 1.0 second") { - waitUntil(timeout: 1) { _ in return } + waitUntil(timeout: .seconds(1)) { _ in return } } } func testWaitUntilTimesOutWhenExceedingItsTime() { var waiting = true failsWithErrorMessage("Waited more than 0.01 seconds") { - waitUntil(timeout: 0.01) { done in + waitUntil(timeout: .milliseconds(10)) { done in let asyncOperation: () -> Void = { Thread.sleep(forTimeInterval: 0.1) done() @@ -120,8 +121,8 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { func testWaitUntilDetectsStalledMainThreadActivity() { let msg = "-waitUntil() timed out but was unable to run the timeout handler because the main thread is unresponsive (0.5 seconds is allow after the wait times out). Conditions that may cause this include processing blocking IO on the main thread, calls to sleep(), deadlocks, and synchronous IPC. Nimble forcefully stopped run loop which may cause future failures in test run." failsWithErrorMessage(msg) { - waitUntil(timeout: 1) { done in - Thread.sleep(forTimeInterval: 5.0) + waitUntil(timeout: .seconds(1)) { done in + Thread.sleep(forTimeInterval: 3.0) done() } } @@ -141,7 +142,7 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { is currently managing the main run loop. """ failsWithErrorMessage(msg) { // reference line - waitUntil(timeout: 2.0) { done in + waitUntil(timeout: .seconds(2)) { done in var protected: Int = 0 DispatchQueue.main.async { protected = 1 @@ -165,6 +166,39 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { } } + func testWaitUntilDoesNotCompleteBeforeRunLoopIsWaiting() { + // This verifies the fix for a race condition in which `done()` is + // called asynchronously on a background thread after the main thread checks + // for completion, but prior to `RunLoop.current.run(mode:before:)` being called. + // This race condition resulted in the RunLoop locking up. + var failed = false + + let timeoutQueue = DispatchQueue(label: "Nimble.waitUntilTest.timeout", qos: .background) + let timer = DispatchSource.makeTimerSource(flags: .strict, queue: timeoutQueue) + timer.schedule( + deadline: DispatchTime.now() + 5, + repeating: .never, + leeway: .milliseconds(1) + ) + timer.setEventHandler { + failed = true + fail("Timed out: Main RunLoop stalled.") + CFRunLoopStop(CFRunLoopGetMain()) + } + timer.resume() + + for index in 0..<100 { + if failed { break } + waitUntil(line: UInt(index)) { done in + DispatchQueue(label: "Nimble.waitUntilTest.\(index)").async { + done() + } + } + } + + timer.cancel() + } + func testWaitUntilMustBeInMainThread() { #if !SWIFT_PACKAGE var executedAsyncBlock: Bool = false @@ -203,11 +237,11 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider { var subject: ClassUnderTest? = ClassUnderTest() if let sub = subject { - expect(sub.count).toEventually(equal(0), timeout: 0.1) - expect(sub.count).toEventuallyNot(equal(1), timeout: 0.1) + expect(sub.count).toEventually(equal(0), timeout: .milliseconds(100)) + expect(sub.count).toEventuallyNot(equal(1), timeout: .milliseconds(100)) } - waitUntil(timeout: 0.5) { done in + waitUntil(timeout: .milliseconds(500)) { done in subject?.deinitCalled = { done() } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/DSLTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/DSLTest.swift new file mode 100644 index 0000000..afa6fab --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/DSLTest.swift @@ -0,0 +1,39 @@ +import XCTest +import Nimble + +private func nonThrowingInt() -> Int { + return 1 +} + +private func throwingInt() throws -> Int { + return 1 +} + +final class DSLTest: XCTestCase { + func testExpectAutoclosureNonThrowing() throws { + let _: Expectation = expect(1) + let _: Expectation = expect(nonThrowingInt()) + } + + func testExpectAutoclosureThrowing() throws { + let _: Expectation = expect(try throwingInt()) + } + + func testExpectClosure() throws { + let _: Expectation = expect { 1 } + let _: Expectation = expect { nonThrowingInt() } + let _: Expectation = expect { try throwingInt() } + let _: Expectation = expect { () -> Int in 1 } + let _: Expectation = expect { () -> Int? in 1 } + let _: Expectation = expect { () -> Int? in nil } + + let _: Expectation = expect { } + let _: Expectation = expect { () -> Void in } + + let _: Expectation = expect { return } + let _: Expectation = expect { () -> Void in return } + + let _: Expectation = expect { return () } + let _: Expectation = expect { () -> Void in return () } + } +} 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 deleted file mode 100644 index 08567fd..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Helpers/XCTestCaseProvider.swift +++ /dev/null @@ -1,62 +0,0 @@ -import Foundation -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` -// has a default implementation provided by a protocol extension. - -// Implementation note: This is broken down into two separate protocols because we need a -// protocol with no Self references to which we can cast XCTestCase instances in a non-generic context. - -public protocol XCTestCaseProviderStatic { - // This should be explicitly implemented by XCTestCase subclasses - static var __allTests: [(String, (Self) -> () -> ())] { get } -} - -public protocol XCTestCaseNameProvider { - // This does not need to be explicitly implemented because of the protocol extension below - 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 name - }) - } -} -#else -public protocol XCTestCaseProvider {} -#endif - -#if os(macOS) - -extension XCTestCase { - override open func tearDown() { - if let provider = self as? XCTestCaseNameProvider { - provider.assertContainsTest(invocation!.selector.description) - } - - super.tearDown() - } -} - -extension XCTestCaseNameProvider { - fileprivate func assertContainsTest(_ name: String) { - let contains = self.allTestNames.contains(name) - XCTAssert( - contains, - """ - Test '\(name)' is missing from the __allTests array. - Please run `$ swift test --generate-linuxmain` to update the manifests. - """ - ) - } -} - -#endif 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 c90b72a..785d601 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 @@ -71,7 +71,7 @@ func deferToMainQueue(action: @escaping () -> Void) { } } -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE public class NimbleHelper: NSObject { @objc public class func expectFailureMessage(_ message: NSString, block: () -> Void, file: FileString, line: UInt) { failsWithErrorMessage(String(describing: message), file: file, line: line, preferOriginalSourceLocation: true, closure: block) diff --git a/Carthage/Checkouts/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 683121c..17a330f 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 @@ -42,7 +42,7 @@ extension Optional where Wrapped: Comparable { } } -final class AllPassTest: XCTestCase, XCTestCaseProvider { +final class AllPassTest: XCTestCase { 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 64a439b..5628ec3 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 @@ -7,7 +7,7 @@ private protocol TestProtocol {} private class TestClassConformingToProtocol: TestProtocol {} private struct TestStructConformingToProtocol: TestProtocol {} -final class BeAKindOfSwiftTest: XCTestCase, XCTestCaseProvider { +final class BeAKindOfSwiftTest: XCTestCase { enum TestEnum { case one, two } @@ -47,29 +47,31 @@ final class BeAKindOfSwiftTest: XCTestCase, XCTestCaseProvider { } } -final class BeAKindOfObjCTest: XCTestCase, XCTestCaseProvider { +final class BeAKindOfObjCTest: XCTestCase { 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 + expect(1 as NSNumber).toNot(beAKindOf(NSDate.self)) } 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)) } failsWithErrorMessageForNil("expected to be a kind of NSString, got ") { expect(nil as NSString?).to(beAKindOf(NSString.self)) } - failsWithErrorMessage("expected to be a kind of NSString, got <__NSCFNumber instance>") { - expect(NSNumber(value: 1)).to(beAKindOf(NSString.self)) + + #if canImport(Darwin) + let numberTypeName = "__NSCFNumber" + #else + let numberTypeName = "NSNumber" + #endif + failsWithErrorMessage("expected to be a kind of NSString, got <\(numberTypeName) instance>") { + expect(1 as NSNumber).to(beAKindOf(NSString.self)) } - failsWithErrorMessage("expected to not be a kind of NSNumber, got <__NSCFNumber instance>") { - expect(NSNumber(value: 1)).toNot(beAKindOf(NSNumber.self)) + failsWithErrorMessage("expected to not be a kind of NSNumber, got <\(numberTypeName) instance>") { + expect(1 as NSNumber).toNot(beAKindOf(NSNumber.self)) } -#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 df431e6..1648fa5 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 @@ -6,10 +6,10 @@ private protocol TestProtocol {} private class TestClassConformingToProtocol: TestProtocol {} private struct TestStructConformingToProtocol: TestProtocol {} -final class BeAnInstanceOfTest: XCTestCase, XCTestCaseProvider { +final class BeAnInstanceOfTest: XCTestCase { func testPositiveMatch() { expect(NSNull()).to(beAnInstanceOf(NSNull.self)) - expect(NSNumber(value: 1)).toNot(beAnInstanceOf(NSDate.self)) + expect(1 as NSNumber).toNot(beAnInstanceOf(NSDate.self)) } enum TestEnum { @@ -40,16 +40,17 @@ final class BeAnInstanceOfTest: XCTestCase, XCTestCaseProvider { failsWithErrorMessageForNil("expected to be an instance of NSString, got ") { expect(nil as NSString?).to(beAnInstanceOf(NSString.self)) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + + #if canImport(Darwin) let numberTypeName = "__NSCFNumber" -#else + #else let numberTypeName = "NSNumber" -#endif + #endif failsWithErrorMessage("expected to be an instance of NSString, got <\(numberTypeName) instance>") { - expect(NSNumber(value: 1)).to(beAnInstanceOf(NSString.self)) + expect(1 as NSNumber).to(beAnInstanceOf(NSString.self)) } failsWithErrorMessage("expected to not be an instance of \(numberTypeName), got <\(numberTypeName) instance>") { - expect(NSNumber(value: 1)).toNot(beAnInstanceOf(type(of: NSNumber(value: 1)))) + expect(1 as NSNumber).toNot(beAnInstanceOf(type(of: 1 as NSNumber))) } } 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 f724be6..cdb92ad 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 @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -final class BeCloseToTest: XCTestCase, XCTestCaseProvider { +final class BeCloseToTest: XCTestCase { func testBeCloseTo() { expect(1.2).to(beCloseTo(1.2001)) expect(1.2 as CDouble).to(beCloseTo(1.2001)) @@ -22,12 +22,12 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { } func testBeCloseToWithNSNumber() { - expect(NSNumber(value: 1.2)).to(beCloseTo(9.300, within: 10)) - expect(NSNumber(value: 1.2)).to(beCloseTo(NSNumber(value: 9.300), within: 10)) - expect(1.2).to(beCloseTo(NSNumber(value: 9.300), within: 10)) + expect(1.2 as NSNumber).to(beCloseTo(9.300, within: 10)) + expect(1.2 as NSNumber).to(beCloseTo(9.300 as NSNumber, within: 10)) + expect(1.2).to(beCloseTo(9.300 as NSNumber, within: 10)) 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)) + expect(1.2 as NSNumber).toNot(beCloseTo(1.2001, within: 1.1)) } } @@ -53,7 +53,8 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect(NSDate(dateTimeString: "2015-08-26 11:43:00")).to(beCloseTo(NSDate(dateTimeString: "2015-08-26 11:43:05"), within: 10)) failsWithErrorMessage("expected to not be close to <2015-08-26 11:43:00.0050> (within 0.006), got <2015-08-26 11:43:00.0000>") { - let expectedDate = NSDate(dateTimeString: "2015-08-26 11:43:00").addingTimeInterval(0.005) + // Cast to NSDate is needed for Linux (swift-corelibs-foundation) compatibility. + let expectedDate = NSDate(dateTimeString: "2015-08-26 11:43:00").addingTimeInterval(0.005) as NSDate expect(NSDate(dateTimeString: "2015-08-26 11:43:00")).toNot(beCloseTo(expectedDate, within: 0.006)) } } @@ -139,4 +140,10 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider { expect([0.1, 1.2]).to(beCloseTo([0.3, 1.3], within: 0.1)) } } + + // https://github.com/Quick/Nimble/issues/831 + func testCombinationWithAllPass() { + let values: [NSNumber] = [0] + expect(values).to(allPass(beCloseTo(0))) + } } 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 637bc7a..90aa03d 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 @@ -2,60 +2,102 @@ import Foundation import XCTest import Nimble -final class BeEmptyTest: XCTestCase, XCTestCaseProvider { +final class BeEmptyTest: XCTestCase { func testBeEmptyPositive() { + // Array expect([] as [Int]).to(beEmpty()) expect([1]).toNot(beEmpty()) expect([] as [CInt]).to(beEmpty()) expect([1] as [CInt]).toNot(beEmpty()) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - expect(NSDictionary() as? [Int: Int]).to(beEmpty()) - expect(NSDictionary(object: 1, forKey: 1 as NSNumber) as? [Int: Int]).toNot(beEmpty()) -#endif + // Set + expect([] as Set).to(beEmpty()) + expect([1] as Set).toNot(beEmpty()) + // Dictionary expect([Int: Int]()).to(beEmpty()) - expect(["hi": 1]).toNot(beEmpty()) + expect([1: 1]).toNot(beEmpty()) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - expect(NSArray() as? [Int]).to(beEmpty()) - expect(NSArray(array: [1]) as? [Int]).toNot(beEmpty()) -#endif + // NSArray + expect(NSArray()).to(beEmpty()) + expect([1] as NSArray).toNot(beEmpty()) + // NSSet expect(NSSet()).to(beEmpty()) - expect(NSSet(array: [NSNumber(value: 1)])).toNot(beEmpty()) + expect(NSSet(array: [1 as NSNumber])).toNot(beEmpty()) + // NSIndexSet expect(NSIndexSet()).to(beEmpty()) expect(NSIndexSet(index: 1)).toNot(beEmpty()) - expect(NSString()).to(beEmpty()) - expect(NSString(string: "hello")).toNot(beEmpty()) + // NSDictionary + expect(NSDictionary()).to(beEmpty()) + expect([1: 1] as NSDictionary).toNot(beEmpty()) + // String expect("").to(beEmpty()) expect("foo").toNot(beEmpty()) + // NSString + expect(NSString()).to(beEmpty()) + expect("hello" as NSString).toNot(beEmpty()) + + // OptionSet expect([] as TestOptionSet).to(beEmpty()) expect(TestOptionSet.one).toNot(beEmpty()) } func testBeEmptyNegative() { + // NSArray failsWithErrorMessage("expected to not be empty, got <()>") { expect(NSArray()).toNot(beEmpty()) } + failsWithErrorMessage("expected to be empty, got <(1)>") { + expect([1] as NSArray).to(beEmpty()) + } + + // Array + failsWithErrorMessage("expected to not be empty, got <[]>") { + expect([]).toNot(beEmpty()) + } failsWithErrorMessage("expected to be empty, got <[1]>") { expect([1]).to(beEmpty()) } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + // NSDictionary + failsWithErrorMessage("expected to not be empty, got <{}>") { + expect(NSDictionary()).toNot(beEmpty()) + } + failsWithErrorMessage("expected to be empty, got <{1 = 1;}>") { + expect([1: 1] as NSDictionary).to(beEmpty()) + } + + // Dictionary + failsWithErrorMessage("expected to not be empty, got <[:]>") { + expect([Int: Int]()).toNot(beEmpty()) + } + failsWithErrorMessage("expected to be empty, got <[1: 1]>") { + expect([1: 1]).to(beEmpty()) + } + + // Set + failsWithErrorMessage("expected to not be empty, got ") { + expect([] as Set).toNot(beEmpty()) + } + failsWithErrorMessage("expected to be empty, got ") { + expect([1] as Set).to(beEmpty()) + } + + // NSSet 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()) + expect(NSSet(object: 1 as NSNumber)).to(beEmpty()) } -#endif + // NSIndexSet failsWithErrorMessage("expected to not be empty, got <()>") { expect(NSIndexSet()).toNot(beEmpty()) } @@ -63,6 +105,7 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect(NSIndexSet(index: 1)).to(beEmpty()) } + // String failsWithErrorMessage("expected to not be empty, got <>") { expect("").toNot(beEmpty()) } @@ -70,6 +113,15 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect("foo").to(beEmpty()) } + // NSString + failsWithErrorMessage("expected to not be empty, got <>") { + expect("" as NSString).toNot(beEmpty()) + } + failsWithErrorMessage("expected to be empty, got ") { + expect("foo" as NSString).to(beEmpty()) + } + + // OptionSet failsWithErrorMessage("expected to not be empty, got ") { expect([] as TestOptionSet).toNot(beEmpty()) } @@ -79,6 +131,13 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { } func testNilMatches() { + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as String?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as String?).toNot(beEmpty()) + } + failsWithErrorMessageForNil("expected to be empty, got ") { expect(nil as NSString?).to(beEmpty()) } @@ -93,6 +152,41 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider { expect(nil as [CInt]?).toNot(beEmpty()) } + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as NSArray?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as NSArray?).toNot(beEmpty()) + } + + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as NSDictionary?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as NSDictionary?).toNot(beEmpty()) + } + + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as Set?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as Set?).toNot(beEmpty()) + } + + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as NSSet?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as NSSet?).toNot(beEmpty()) + } + + failsWithErrorMessageForNil("expected to be empty, got ") { + expect(nil as NSIndexSet?).to(beEmpty()) + } + failsWithErrorMessageForNil("expected to not be empty, got ") { + expect(nil as NSIndexSet?).toNot(beEmpty()) + } + failsWithErrorMessageForNil("expected to be empty, got ") { expect(nil as TestOptionSet?).to(beEmpty()) } 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 4c91fec..d2cabdd 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 @@ -2,16 +2,14 @@ import Foundation import XCTest import Nimble -final class BeGreaterThanOrEqualToTest: XCTestCase, XCTestCaseProvider { +final class BeGreaterThanOrEqualToTest: XCTestCase { func testGreaterThanOrEqualTo() { expect(10).to(beGreaterThanOrEqualTo(10)) expect(10).to(beGreaterThanOrEqualTo(2)) expect(1).toNot(beGreaterThanOrEqualTo(2)) - expect(NSNumber(value: 1)).toNot(beGreaterThanOrEqualTo(2)) - expect(NSNumber(value: 2)).to(beGreaterThanOrEqualTo(NSNumber(value: 2))) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - expect(1).to(beGreaterThanOrEqualTo(NSNumber(value: 0))) -#endif + expect(1 as NSNumber).toNot(beGreaterThanOrEqualTo(2)) + expect(2 as NSNumber).to(beGreaterThanOrEqualTo(2 as NSNumber)) + expect(1).to(beGreaterThanOrEqualTo(0 as NSNumber)) failsWithErrorMessage("expected to be greater than or equal to <2>, got <0>") { expect(0).to(beGreaterThanOrEqualTo(2)) @@ -32,8 +30,8 @@ final class BeGreaterThanOrEqualToTest: XCTestCase, XCTestCaseProvider { func testGreaterThanOrEqualToOperator() { expect(0) >= 0 expect(1) >= 0 - expect(NSNumber(value: 1)) >= 1 - expect(NSNumber(value: 1)) >= NSNumber(value: 1) + expect(1 as NSNumber) >= 1 + expect(1 as NSNumber) >= 1 as NSNumber expect(2.5) >= 2.5 expect(2.5) >= 2 expect(Float(2.5)) >= Float(2.5) 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 3d742f4..7278dc8 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 @@ -2,16 +2,12 @@ import Foundation import XCTest import Nimble -final class BeGreaterThanTest: XCTestCase, XCTestCaseProvider { +final class BeGreaterThanTest: XCTestCase { func testGreaterThan() { expect(10).to(beGreaterThan(2)) expect(1).toNot(beGreaterThan(2)) -#if SUPPORT_IMPLICIT_BRIDGING_CONVERSION - expect(NSNumber(value: 3)).to(beGreaterThan(2)) -#else - expect(NSNumber(value: 3)).to(beGreaterThan(2 as NSNumber)) -#endif - expect(NSNumber(value: 1)).toNot(beGreaterThan(NSNumber(value: 2))) + expect(3 as NSNumber).to(beGreaterThan(2 as NSNumber)) + expect(1 as NSNumber).toNot(beGreaterThan(2 as NSNumber)) failsWithErrorMessage("expected to be greater than <2>, got <0>") { expect(0).to(beGreaterThan(2)) @@ -29,12 +25,8 @@ final class BeGreaterThanTest: XCTestCase, XCTestCaseProvider { func testGreaterThanOperator() { expect(1) > 0 - expect(NSNumber(value: 1)) > NSNumber(value: 0) -#if SUPPORT_IMPLICIT_BRIDGING_CONVERSION - expect(NSNumber(value: 1)) > 0 -#else - expect(NSNumber(value: 1)) > 0 as NSNumber -#endif + expect(1 as NSNumber) > 0 as NSNumber + expect(1 as NSNumber) > 0 as NSNumber expect(2.5) > 1.5 expect(Float(2.5)) > Float(1.5) 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 b1155fb..1f705bf 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 @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -final class BeIdenticalToObjectTest: XCTestCase, XCTestCaseProvider { +final class BeIdenticalToObjectTest: XCTestCase { 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 8830647..54ae6f4 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 @@ -2,20 +2,20 @@ import Foundation import XCTest @testable import Nimble -final class BeIdenticalToTest: XCTestCase, XCTestCaseProvider { +final class BeIdenticalToTest: XCTestCase { func testBeIdenticalToPositive() { let value = NSDate() expect(value).to(beIdenticalTo(value)) } func testBeIdenticalToNegative() { - expect(NSNumber(value: 1)).toNot(beIdenticalTo(NSString(string: "yo"))) - expect(NSArray(array: [NSNumber(value: 1)])).toNot(beIdenticalTo(NSArray(array: [NSNumber(value: 1)]))) + expect(1 as NSNumber).toNot(beIdenticalTo("yo" as NSString)) + expect([1 as NSNumber] as NSArray).toNot(beIdenticalTo([1 as NSNumber] as NSArray)) } func testBeIdenticalToPositiveMessage() { - let num1 = NSNumber(value: 1) - let num2 = NSNumber(value: 2) + let num1 = 1 as NSNumber + let num2 = 2 as NSNumber let message = "expected to be identical to \(identityAsString(num2)), got \(identityAsString(num1))" failsWithErrorMessage(message) { expect(num1).to(beIdenticalTo(num2)) @@ -23,7 +23,7 @@ final class BeIdenticalToTest: XCTestCase, XCTestCaseProvider { } func testBeIdenticalToNegativeMessage() { - let value1 = NSArray(array: []) + let value1 = NSArray() let value2 = value1 let message = "expected to not be identical to \(identityAsString(value2)), got \(identityAsString(value1))" failsWithErrorMessage(message) { @@ -34,20 +34,17 @@ final class BeIdenticalToTest: XCTestCase, XCTestCaseProvider { func testOperators() { let value = NSDate() expect(value) === value - expect(NSNumber(value: 1)) !== NSNumber(value: 2) + expect(1 as NSNumber) !== 2 as NSNumber } func testBeAlias() { let value = NSDate() expect(value).to(be(value)) - expect(NSNumber(value: 1)).toNot(be(NSString(string: "turtles"))) - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - expect([1]).toNot(be([1])) - #else - expect(NSArray(array: [NSNumber(value: 1)])).toNot(beIdenticalTo(NSArray(array: [NSNumber(value: 1)]))) - #endif + expect(1 as NSNumber).toNot(be("turtles" as NSString)) + expect([1]).toNot(be([1])) + expect([1 as NSNumber] as NSArray).toNot(be([1 as NSNumber] as NSArray)) - let value1 = NSArray(array: []) + let value1 = NSArray() let value2 = value1 let message = "expected to not be identical to \(identityAsString(value1)), got \(identityAsString(value2))" failsWithErrorMessage(message) { 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 f389469..78b37f4 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 @@ -2,18 +2,16 @@ import Foundation import XCTest import Nimble -final class BeLessThanOrEqualToTest: XCTestCase, XCTestCaseProvider { +final class BeLessThanOrEqualToTest: XCTestCase { func testLessThanOrEqualTo() { expect(10).to(beLessThanOrEqualTo(10)) expect(2).to(beLessThanOrEqualTo(10)) expect(2).toNot(beLessThanOrEqualTo(1)) - expect(NSNumber(value: 2)).to(beLessThanOrEqualTo(10)) - expect(NSNumber(value: 2)).toNot(beLessThanOrEqualTo(1)) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - expect(2).to(beLessThanOrEqualTo(NSNumber(value: 10))) - expect(2).toNot(beLessThanOrEqualTo(NSNumber(value: 1))) -#endif + expect(2 as NSNumber).to(beLessThanOrEqualTo(10)) + expect(2 as NSNumber).toNot(beLessThanOrEqualTo(1)) + expect(2).to(beLessThanOrEqualTo(10 as NSNumber)) + expect(2).toNot(beLessThanOrEqualTo(1 as NSNumber)) failsWithErrorMessage("expected to be less than or equal to <0>, got <2>") { expect(2).to(beLessThanOrEqualTo(0)) 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 d560232..e30238c 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 @@ -2,23 +2,12 @@ import Foundation import XCTest import Nimble -final class BeLessThanTest: XCTestCase, XCTestCaseProvider { +final class BeLessThanTest: XCTestCase { func testLessThan() { expect(2).to(beLessThan(10)) expect(2).toNot(beLessThan(1)) -#if SUPPORT_IMPLICIT_BRIDGING_CONVERSION - expect(NSNumber(value: 2)).to(beLessThan(10)) - expect(NSNumber(value: 2)).toNot(beLessThan(1)) - - expect(2).to(beLessThan(NSNumber(value: 10))) - expect(2).toNot(beLessThan(NSNumber(value: 1))) -#else - expect(NSNumber(value: 2)).to(beLessThan(10 as NSNumber)) - expect(NSNumber(value: 2)).toNot(beLessThan(1 as NSNumber)) - - expect(2 as NSNumber).to(beLessThan(NSNumber(value: 10))) - expect(2 as NSNumber).toNot(beLessThan(NSNumber(value: 1))) -#endif + expect(2 as NSNumber).to(beLessThan(10 as NSNumber)) + expect(2 as NSNumber).toNot(beLessThan(1 as NSNumber)) failsWithErrorMessage("expected to be less than <0>, got <2>") { expect(2).to(beLessThan(0)) @@ -37,11 +26,7 @@ final class BeLessThanTest: XCTestCase, XCTestCaseProvider { func testLessThanOperator() { expect(0) < 1 -#if SUPPORT_IMPLICIT_BRIDGING_CONVERSION - expect(NSNumber(value: 0)) < 1 -#else - expect(NSNumber(value: 0)) < 1 as NSNumber -#endif + expect(0 as NSNumber) < 1 as NSNumber failsWithErrorMessage("expected to be less than <1>, got <2>") { expect(2) < 1 return 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 d9ef8ea..dfe3bcd 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 @@ -29,7 +29,7 @@ enum ConvertsToBool: ExpressibleByBooleanLiteral, CustomStringConvertible { } } -final class BeTruthyTest: XCTestCase, XCTestCaseProvider { +final class BeTruthyTest: XCTestCase { func testShouldMatchNonNilTypes() { expect(true as Bool?).to(beTruthy()) @@ -110,7 +110,7 @@ final class BeTruthyTest: XCTestCase, XCTestCaseProvider { } } -final class BeTrueTest: XCTestCase, XCTestCaseProvider { +final class BeTrueTest: XCTestCase { func testShouldMatchTrue() { expect(true).to(beTrue()) @@ -138,7 +138,7 @@ final class BeTrueTest: XCTestCase, XCTestCaseProvider { } } -final class BeFalsyTest: XCTestCase, XCTestCaseProvider { +final class BeFalsyTest: XCTestCase { func testShouldMatchNilTypes() { expect(false as Bool?).to(beFalsy()) @@ -203,7 +203,7 @@ final class BeFalsyTest: XCTestCase, XCTestCaseProvider { } } -final class BeFalseTest: XCTestCase, XCTestCaseProvider { +final class BeFalseTest: XCTestCase { 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 9e37116..df35eeb 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 @@ -1,7 +1,7 @@ import XCTest import Nimble -final class BeNilTest: XCTestCase, XCTestCaseProvider { +final class BeNilTest: XCTestCase { 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 bb5d324..bea7f4e 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 @@ -1,7 +1,7 @@ import XCTest import Nimble -final class BeVoidTest: XCTestCase, XCTestCaseProvider { +final class BeVoidTest: XCTestCase { func testBeVoid() { expect(()).to(beVoid()) expect(() as ()?).to(beVoid()) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeginWithPrefixTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeginWithPrefixTest.swift new file mode 100644 index 0000000..e649790 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/Matchers/BeginWithPrefixTest.swift @@ -0,0 +1,64 @@ +import Foundation +import Nimble +import XCTest + +final class BeginWithPrefixTest: XCTestCase { + + func testBeginWithSequencePrefix() { + failsWithErrorMessageForNil("expected to begin with , got ") { + expect(nil as [Int]?).to(beginWith(prefix: nil as [Int]?)) + } + + failsWithErrorMessageForNil("expected to begin with <[1, 2]>, got ") { + expect(nil as [Int]?).to(beginWith(prefix: [1, 2])) + } + + failsWithErrorMessageForNil("expected to begin with , got <[1, 2]>") { + expect([1, 2]).to(beginWith(prefix: nil as [Int]?)) + } + + let sequence = [1, 2, 3] + expect(sequence).toNot(beginWith(prefix: [1, 2, 3, 4])) + expect(sequence).toNot(beginWith(prefix: [2, 3])) + + expect(sequence).to(beginWith(prefix: [1, 2, 3])) + expect(sequence).to(beginWith(prefix: [1, 2])) + expect(sequence).to(beginWith(prefix: [])) + + expect([]).toNot(beginWith(prefix: [1])) + expect([]).to(beginWith(prefix: [] as [Int])) + } + + func testBeginWithSequencePrefixUsingPredicateClosure() { + failsWithErrorMessageForNil("expected to begin with , got ") { + expect(nil as [Int]?).to(beginWith(prefix: nil as [Int]?, by: { $0 == $1 })) + } + + failsWithErrorMessageForNil("expected to begin with <[1, 2]>, got ") { + expect(nil as [Int]?).to(beginWith(prefix: [1, 2], by: { $0 == $1 })) + } + + failsWithErrorMessageForNil("expected to begin with , got <[1, 2]>") { + expect([1, 2]).to(beginWith(prefix: nil as [Int]?, by: { $0 == $1 })) + } + + let sequence = [1, 2, 3] + expect(sequence).toNot(beginWith(prefix: [1, 2, 3, 4], by: { $0 == $1 })) + expect(sequence).toNot(beginWith(prefix: [2, 3], by: { $0 == $1 })) + + expect(sequence).to(beginWith(prefix: [1, 2, 3], by: { $0 == $1 })) + expect(sequence).to(beginWith(prefix: [1, 2], by: { $0 == $1 })) + expect(sequence).to(beginWith(prefix: [], by: { $0 == $1 })) + + expect([]).toNot(beginWith(prefix: [1], by: { $0 == $1 })) + expect([]).to(beginWith(prefix: [] as [Int], by: { $0 == $1 })) + } + + func testBeginWithSequencePrefixWithDifferentSequenceTypes() { + expect(1...3).to(beginWith(prefix: [1, 2, 3])) + expect(1...3).toNot(beginWith(prefix: [1, 2, 3, 4, 5])) + + expect(1...3).to(beginWith(prefix: [1, 2, 3], by: { $0 == $1 })) + expect(1...3).toNot(beginWith(prefix: [1, 2, 3, 4, 5], by: { $0 == $1 })) + } +} 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 3a5162e..4babb0b 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 @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -final class BeginWithTest: XCTestCase, XCTestCaseProvider { +final class BeginWithTest: XCTestCase { func testPositiveMatches() { expect([1, 2, 3]).to(beginWith(1)) expect([1, 2, 3]).toNot(beginWith(2)) @@ -12,21 +12,19 @@ final class BeginWithTest: XCTestCase, XCTestCaseProvider { expect("foobarfoo").to(beginWith("foo")) - expect(NSString(string: "foobar").description).to(beginWith("foo")) - expect(NSString(string: "foobar").description).toNot(beginWith("oo")) + expect(("foobar" as NSString).description).to(beginWith("foo")) + expect(("foobar" as NSString).description).toNot(beginWith("oo")) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - expect(NSArray(array: ["a", "b"])).to(beginWith("a")) - expect(NSArray(array: ["a", "b"])).toNot(beginWith("b")) -#endif + expect(["a", "b"] as NSArray).to(beginWith("a")) + expect(["a", "b"] as NSArray).toNot(beginWith("b")) } func testNegativeMatches() { failsWithErrorMessageForNil("expected to begin with , got ") { - expect(nil as NSArray?).to(beginWith(NSString(string: "b"))) + expect(nil as NSArray?).to(beginWith("b" as NSString)) } failsWithErrorMessageForNil("expected to not begin with , got ") { - expect(nil as NSArray?).toNot(beginWith(NSString(string: "b"))) + expect(nil as NSArray?).toNot(beginWith("b" as NSString)) } failsWithErrorMessage("expected to begin with <2>, got <[1, 2, 3]>") { 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 6944375..324b0c9 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 @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -final class ContainElementSatisfyingTest: XCTestCase, XCTestCaseProvider { +final class ContainElementSatisfyingTest: XCTestCase { 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 f69f351..5dea081 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 @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -final class ContainTest: XCTestCase, XCTestCaseProvider { +final class ContainTest: XCTestCase { func testContainSequence() { expect([1, 2, 3]).to(contain(1)) expect([1, 2, 3]).toNot(contain(4)) @@ -10,10 +10,10 @@ final class ContainTest: XCTestCase, XCTestCaseProvider { expect([1, 2, 3] as [CInt]).toNot(contain(4 as CInt)) expect(["foo", "bar", "baz"]).to(contain("baz")) expect(["foo", "bar", "baz"]).toNot(contain("ba")) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - expect(NSArray(array: ["a"])).to(contain(NSString(string: "a"))) - expect(NSArray(array: ["a"])).toNot(contain(NSString(string: "b"))) - expect(NSArray(object: 1) as NSArray?).to(contain(1)) +#if canImport(Darwin) + expect(["a"] as NSArray).to(contain("a" as NSString)) + expect(["a"] as NSArray).toNot(contain("b" as NSString)) + expect([1] as NSArray?).to(contain(1)) #endif failsWithErrorMessage("expected to contain , got <[a, b, c]>") { @@ -50,6 +50,27 @@ final class ContainTest: XCTestCase, XCTestCaseProvider { } } + func testContainSequenceAndSetAlgebra() { + let set = [1, 2, 3] as Set + + expect(set).to(contain(1)) + expect(set).toNot(contain(4)) + + failsWithErrorMessage("expected to contain <4>, got <\(set.debugDescription)>") { + expect(set).to(contain(4)) + } + failsWithErrorMessage("expected to not contain <2>, got <\(set.debugDescription)>") { + expect(set).toNot(contain(2)) + } + + failsWithErrorMessageForNil("expected to contain <1>, got ") { + expect(nil as Set?).to(contain(1)) + } + failsWithErrorMessageForNil("expected to not contain <1>, got ") { + expect(nil as Set?).toNot(contain(1)) + } + } + func testContainSubstring() { expect("foo").to(contain("o")) expect("foo").to(contain("oo")) @@ -64,12 +85,12 @@ final class ContainTest: XCTestCase, XCTestCaseProvider { } } - func testContainObjCSubstring() { - let str = NSString(string: "foo") - expect(str).to(contain(NSString(string: "o"))) - expect(str).to(contain(NSString(string: "oo"))) - expect(str).toNot(contain(NSString(string: "z"))) - expect(str).toNot(contain(NSString(string: "zz"))) + func testContainNSStringSubstring() { + let str = "foo" as NSString + expect(str).to(contain("o" as NSString)) + expect(str).to(contain("oo" as NSString)) + expect(str).toNot(contain("z" as NSString)) + expect(str).toNot(contain("zz" as NSString)) } func testVariadicArguments() { 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 index ec7a0dd..39dd1f4 100644 --- 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 @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -final class ElementsEqualTest: XCTestCase, XCTestCaseProvider { +final class ElementsEqualTest: XCTestCase { func testSequenceElementsEquality() { failsWithErrorMessageForNil("expected to elementsEqual , got ") { @@ -22,6 +22,35 @@ final class ElementsEqualTest: XCTestCase, XCTestCaseProvider { expect(sequence1).toNot(elementsEqual(sequence2)) expect(sequence1).toNot(elementsEqual([3, 2, 1])) expect(sequence1).to(elementsEqual([1, 2, 3])) + } + func testSequenceElementsEqualityUsingPredicateClosure() { + failsWithErrorMessageForNil("expected to elementsEqual , got ") { + expect(nil as [Int]?).to(elementsEqual(nil as [Int]?, by: { $0 == $1 })) + } + let sequence = [1, 2] + failsWithErrorMessageForNil("expected to elementsEqual <[1, 2]>, got ") { + expect(nil as [Int]?).to(elementsEqual(sequence, by: { $0 == $1 })) + } + + failsWithErrorMessageForNil("expected to elementsEqual , got <[1, 2]>") { + expect(sequence).to(elementsEqual(nil as [Int]?, by: { $0 == $1 })) + } + + let sequence1 = [1, 2, 3] + let sequence2 = [1, 2, 3, 4, 5] + expect(sequence1).toNot(elementsEqual(sequence2, by: { $0 == $1 })) + expect(sequence1).toNot(elementsEqual([3, 2, 1], by: { $0 == $1 })) + expect(sequence1).to(elementsEqual([1, 2, 3], by: { $0 == $1 })) + } + + func testElementsEqualDifferentSequenceTypes() { + expect(1...3).to(elementsEqual([1, 2, 3])) + expect(1...3).toNot(elementsEqual([1, 2, 3, 4, 5])) + expect(1...3).toNot(elementsEqual([3, 2, 1])) + + expect(1...3).to(elementsEqual([1, 2, 3], by: { $0 == $1 })) + expect(1...3).toNot(elementsEqual([1, 2, 3, 4, 5], by: { $0 == $1 })) + expect(1...3).toNot(elementsEqual([3, 2, 1], by: { $0 == $1 })) } } 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 88005e8..ea38757 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 @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -final class EndWithTest: XCTestCase, XCTestCaseProvider { +final class EndWithTest: XCTestCase { func testEndWithPositives() { expect([1, 2, 3]).to(endWith(3)) expect([1, 2, 3]).toNot(endWith(2)) @@ -13,15 +13,13 @@ final class EndWithTest: XCTestCase, XCTestCaseProvider { expect("foobar").toNot(endWith("oo")) expect("foobarfoo").to(endWith("foo")) - expect(NSString(string: "foobar").description).to(endWith("bar")) - expect(NSString(string: "foobar").description).toNot(endWith("oo")) + expect(("foobar" as NSString).description).to(endWith("bar")) + expect(("foobar" as NSString).description).toNot(endWith("oo")) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - expect(NSArray(array: ["a", "b"])).to(endWith("b")) - expect(NSArray(array: ["a", "b"])).toNot(endWith("a")) - expect(NSArray(array: [])).toNot(endWith("a")) - expect(NSArray(array: ["a", "b", "a"])).to(endWith("a")) -#endif + expect(["a", "b"] as NSArray).to(endWith("b")) + expect(["a", "b"] as NSArray).toNot(endWith("a")) + expect([] as NSArray).toNot(endWith("a")) + expect(["a", "b", "a"] as NSArray).to(endWith("a")) } func testEndWithNegatives() { 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 18b0647..5dad499 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 @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -final class EqualTest: XCTestCase, XCTestCaseProvider { +final class EqualTest: XCTestCase { func testEquality() { expect(1 as CInt).to(equal(1 as CInt)) expect(1 as CInt).to(equal(1)) @@ -33,9 +33,7 @@ final class EqualTest: XCTestCase, XCTestCaseProvider { expect(array1).to(equal([1, 2, 3])) expect(array1).toNot(equal([1, 2] as [Int])) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - expect(NSArray(array: [1, 2, 3])).to(equal(NSArray(array: [1, 2, 3]))) -#endif + expect([1, 2, 3] as NSArray).to(equal([1, 2, 3] as NSArray)) failsWithErrorMessage("expected to equal <[1, 2]>, got <[1, 2, 3]>") { expect([1, 2, 3]).to(equal([1, 2])) @@ -119,10 +117,8 @@ final class EqualTest: XCTestCase, XCTestCaseProvider { expect(actual).to(equal(expected)) expect(actual).toNot(equal(unexpected)) -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - expect(NSDictionary(object: "bar", forKey: "foo" as NSString)).to(equal(["foo": "bar"])) - expect(NSDictionary(object: "bar", forKey: "foo" as NSString) as? [String: String]).to(equal(expected)) -#endif + expect(["foo": "bar"] as NSDictionary).to(equal(["foo": "bar"])) + expect((["foo": "bar"] as NSDictionary) as? [String: String]).to(equal(expected)) } func testDataEquality() { @@ -133,14 +129,8 @@ final class EqualTest: XCTestCase, XCTestCaseProvider { expect(actual).to(equal(expected)) expect(actual).toNot(equal(unexpected)) - #if os(Linux) - // swiftlint:disable:next todo - // FIXME: Swift on Linux triggers a segfault when calling NSData's hash() (last checked on 03-11) - let expectedErrorMessage = "expected to equal >, got >" - #else - let expectedErrorMessage = "expected to equal >," + let expectedErrorMessage = "expected to equal >," + " got >" - #endif failsWithErrorMessage(expectedErrorMessage) { expect(actual).to(equal(unexpected)) @@ -148,10 +138,10 @@ final class EqualTest: XCTestCase, XCTestCaseProvider { } func testNSObjectEquality() { - expect(NSNumber(value: 1)).to(equal(NSNumber(value: 1))) - expect(NSNumber(value: 1)) == NSNumber(value: 1) - expect(NSNumber(value: 1)) != NSNumber(value: 2) - expect { NSNumber(value: 1) }.to(equal(1)) + expect(1 as NSNumber).to(equal(1 as NSNumber)) + expect(1 as NSNumber) == 1 as NSNumber + expect(1 as NSNumber) != 2 as NSNumber + expect { 1 as NSNumber }.to(equal(1)) } func testOperatorEquality() { 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 4ef610e..5b5f194 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 @@ -1,7 +1,7 @@ import XCTest import Nimble -final class HaveCountTest: XCTestCase, XCTestCaseProvider { +final class HaveCountTest: XCTestCase { func testHaveCountForArray() { expect([1, 2, 3]).to(haveCount(3)) expect([1, 2, 3]).notTo(haveCount(1)) 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 41e5159..a2517c1 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 @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -final class MatchErrorTest: XCTestCase, XCTestCaseProvider { +final class MatchErrorTest: XCTestCase { func testMatchErrorPositive() { expect(NimbleError.laugh).to(matchError(NimbleError.laugh)) expect(NimbleError.laugh).to(matchError(NimbleError.self)) @@ -19,12 +19,10 @@ 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,13 +43,11 @@ 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 1285ecc..73b0c16 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 @@ -1,7 +1,7 @@ import XCTest import Nimble -final class MatchTest: XCTestCase, XCTestCaseProvider { +final class MatchTest: XCTestCase { 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 32f5100..613435e 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 @@ -2,33 +2,31 @@ import XCTest import Nimble import Foundation -final class PostNotificationTest: XCTestCase, XCTestCaseProvider { +final class PostNotificationTest: XCTestCase { let notificationCenter = NotificationCenter() func testPassesWhenNoNotificationsArePosted() { expect { // no notifications here! - return nil - }.to(postNotifications(beEmpty(), fromNotificationCenter: notificationCenter)) + }.to(postNotifications(beEmpty())) } func testPassesWhenExpectedNotificationIsPosted() { let testNotification = Notification(name: Notification.Name("Foo"), object: nil) expect { self.notificationCenter.post(testNotification) - }.to(postNotifications(equal([testNotification]), fromNotificationCenter: notificationCenter)) + }.to(postNotifications(equal([testNotification]), from: notificationCenter)) } func testPassesWhenAllExpectedNotificationsArePosted() { - let foo = NSNumber(value: 1) - let bar = NSNumber(value: 2) + let foo = 1 as NSNumber + let bar = 2 as NSNumber let n1 = Notification(name: Notification.Name("Foo"), object: foo) let n2 = Notification(name: Notification.Name("Bar"), object: bar) expect { self.notificationCenter.post(n1) self.notificationCenter.post(n2) - return nil - }.to(postNotifications(equal([n1, n2]), fromNotificationCenter: notificationCenter)) + }.to(postNotifications(equal([n1, n2]), from: notificationCenter)) } func testFailsWhenNoNotificationsArePosted() { @@ -36,8 +34,7 @@ final class PostNotificationTest: XCTestCase, XCTestCaseProvider { failsWithErrorMessage("expected to equal <[\(testNotification)]>, got no notifications") { expect { // no notifications here! - return nil - }.to(postNotifications(equal([testNotification]), fromNotificationCenter: self.notificationCenter)) + }.to(postNotifications(equal([testNotification]), from: self.notificationCenter)) } } @@ -47,8 +44,7 @@ final class PostNotificationTest: XCTestCase, XCTestCaseProvider { failsWithErrorMessage("expected to equal <[\(n1)]>, got <[\(n2)]>") { expect { self.notificationCenter.post(n2) - return nil - }.to(postNotifications(equal([n1]), fromNotificationCenter: self.notificationCenter)) + }.to(postNotifications(equal([n1]), from: self.notificationCenter)) } } @@ -58,22 +54,28 @@ final class PostNotificationTest: XCTestCase, XCTestCaseProvider { failsWithErrorMessage("expected to equal <[\(n1)]>, got <[\(n2)]>") { expect { self.notificationCenter.post(n2) - return nil - }.to(postNotifications(equal([n1]), fromNotificationCenter: self.notificationCenter)) + }.to(postNotifications(equal([n1]), from: self.notificationCenter)) } } func testPassesWhenExpectedNotificationEventuallyIsPosted() { - #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) - let testNotification = Notification(name: Notification.Name("Foo"), object: nil) - expect { - deferToMainQueue { - self.notificationCenter.post(testNotification) - } - return nil - }.toEventually(postNotifications(equal([testNotification]), fromNotificationCenter: notificationCenter)) - #else - print("\(#function) is missing because toEventually is not implement on this platform") - #endif + let testNotification = Notification(name: Notification.Name("Foo"), object: nil) + expect { + deferToMainQueue { + self.notificationCenter.post(testNotification) + } + }.toEventually(postNotifications(equal([testNotification]), from: notificationCenter)) } + + #if os(macOS) + func testPassesWhenAllExpectedNotificationsarePostedInDistributedNotificationCenter() { + let center = DistributedNotificationCenter() + let n1 = Notification(name: Notification.Name("Foo"), object: "1") + let n2 = Notification(name: Notification.Name("Bar"), object: "2") + expect { + center.post(n1) + center.post(n2) + }.toEventually(postDistributedNotifications(equal([n1, n2]), from: center, names: [n1.name, n2.name])) + } + #endif } 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 beca75b..50a858c 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 @@ -1,115 +1,115 @@ import XCTest import Nimble -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE +#if canImport(Darwin) && !SWIFT_PACKAGE + +let anException = NSException(name: NSExceptionName("laugh"), reason: "Lulz", userInfo: ["key": "value"]) final class RaisesExceptionTest: XCTestCase { - var anException = NSException(name: NSExceptionName("laugh"), reason: "Lulz", userInfo: ["key": "value"]) - func testPositiveMatches() { - expect { self.anException.raise() }.to(raiseException()) - expect { self.anException.raise() }.to(raiseException(named: "laugh")) - expect { self.anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz")) - expect { self.anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"])) + expect { anException.raise() }.to(raiseException()) + expect { anException.raise() }.to(raiseException(named: "laugh")) + expect { anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz")) + expect { anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"])) } func testPositiveMatchesWithClosures() { - expect { self.anException.raise() }.to(raiseException { (exception: NSException) in + expect { anException.raise() }.to(raiseException { (exception: NSException) in expect(exception.name).to(equal(NSExceptionName("laugh"))) }) - expect { self.anException.raise() }.to(raiseException(named: "laugh") { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "laugh") { (exception: NSException) in expect(exception.name.rawValue).to(beginWith("lau")) }) - expect { self.anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz") { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz") { (exception: NSException) in expect(exception.name.rawValue).to(beginWith("lau")) }) - expect { self.anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"]) { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"]) { (exception: NSException) in expect(exception.name.rawValue).to(beginWith("lau")) }) - expect { self.anException.raise() }.to(raiseException(named: "laugh") { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "laugh") { (exception: NSException) in expect(exception.name.rawValue).toNot(beginWith("as")) }) - expect { self.anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz") { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz") { (exception: NSException) in expect(exception.name.rawValue).toNot(beginWith("df")) }) - expect { self.anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"]) { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"]) { (exception: NSException) in expect(exception.name.rawValue).toNot(beginWith("as")) }) } func testNegativeMatches() { failsWithErrorMessage("expected to raise exception with name , got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }") { - expect { self.anException.raise() }.to(raiseException(named: "foo")) + expect { anException.raise() }.to(raiseException(named: "foo")) } failsWithErrorMessage("expected to raise exception with name with reason , got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }") { - expect { self.anException.raise() }.to(raiseException(named: "laugh", reason: "bar")) + expect { anException.raise() }.to(raiseException(named: "laugh", reason: "bar")) } failsWithErrorMessage( "expected to raise exception with name with reason with userInfo <{k = v;}>, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }") { - expect { self.anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz", userInfo: ["k": "v"])) + expect { anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz", userInfo: ["k": "v"])) } failsWithErrorMessage("expected to raise any exception, got no exception") { - expect { self.anException }.to(raiseException()) + expect {}.to(raiseException()) } failsWithErrorMessage("expected to not raise any exception, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }") { - expect { self.anException.raise() }.toNot(raiseException()) + expect { anException.raise() }.toNot(raiseException()) } failsWithErrorMessage("expected to raise exception with name with reason , got no exception") { - expect { self.anException }.to(raiseException(named: "laugh", reason: "Lulz")) + expect {}.to(raiseException(named: "laugh", reason: "Lulz")) } failsWithErrorMessage("expected to raise exception with name with reason , got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }") { - expect { self.anException.raise() }.to(raiseException(named: "bar", reason: "Lulz")) + expect { anException.raise() }.to(raiseException(named: "bar", reason: "Lulz")) } failsWithErrorMessage("expected to not raise exception with name , got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }") { - expect { self.anException.raise() }.toNot(raiseException(named: "laugh")) + expect { anException.raise() }.toNot(raiseException(named: "laugh")) } failsWithErrorMessage("expected to not raise exception with name with reason , got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }") { - expect { self.anException.raise() }.toNot(raiseException(named: "laugh", reason: "Lulz")) + expect { anException.raise() }.toNot(raiseException(named: "laugh", reason: "Lulz")) } failsWithErrorMessage("expected to not raise exception with name with reason with userInfo <{key = value;}>, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }") { - expect { self.anException.raise() }.toNot(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"])) + expect { anException.raise() }.toNot(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"])) } } func testNegativeMatchesDoNotCallClosureWithoutException() { failsWithErrorMessage("expected to raise exception that satisfies block, got no exception") { - expect { self.anException }.to(raiseException { (exception: NSException) in + expect {}.to(raiseException { (exception: NSException) in expect(exception.name).to(equal(NSExceptionName(rawValue: "foo"))) }) } failsWithErrorMessage("expected to raise exception with name that satisfies block, got no exception") { - expect { self.anException }.to(raiseException(named: "foo") { (exception: NSException) in + expect {}.to(raiseException(named: "foo") { (exception: NSException) in expect(exception.name.rawValue).to(equal("foo")) }) } failsWithErrorMessage("expected to raise exception with name with reason that satisfies block, got no exception") { - expect { self.anException }.to(raiseException(named: "foo", reason: "ha") { (exception: NSException) in + expect {}.to(raiseException(named: "foo", reason: "ha") { (exception: NSException) in expect(exception.name.rawValue).to(equal("foo")) }) } failsWithErrorMessage("expected to raise exception with name with reason with userInfo <{}> that satisfies block, got no exception") { - expect { self.anException }.to(raiseException(named: "foo", reason: "Lulz", userInfo: [:]) { (exception: NSException) in + expect {}.to(raiseException(named: "foo", reason: "Lulz", userInfo: [:]) { (exception: NSException) in expect(exception.name.rawValue).to(equal("foo")) }) } failsWithErrorMessage("expected to not raise any exception, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }") { - expect { self.anException.raise() }.toNot(raiseException()) + expect { anException.raise() }.toNot(raiseException()) } } func testNegativeMatchesWithClosure() { failsWithErrorMessage("expected to raise exception that satisfies block, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }") { - expect { self.anException.raise() }.to(raiseException { (exception: NSException) in + expect { anException.raise() }.to(raiseException { (exception: NSException) in expect(exception.name.rawValue).to(equal("foo")) }) } @@ -117,40 +117,57 @@ final class RaisesExceptionTest: XCTestCase { let innerFailureMessage = "expected to begin with , got " failsWithErrorMessage([innerFailureMessage, "expected to raise exception with name that satisfies block, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }"]) { - expect { self.anException.raise() }.to(raiseException(named: "laugh") { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "laugh") { (exception: NSException) in expect(exception.name.rawValue).to(beginWith("fo")) }) } failsWithErrorMessage([innerFailureMessage, "expected to raise exception with name that satisfies block, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }"]) { - expect { self.anException.raise() }.to(raiseException(named: "lol") { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "lol") { (exception: NSException) in expect(exception.name.rawValue).to(beginWith("fo")) }) } failsWithErrorMessage([innerFailureMessage, "expected to raise exception with name with reason that satisfies block, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }"]) { - expect { self.anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz") { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz") { (exception: NSException) in expect(exception.name.rawValue).to(beginWith("fo")) }) } failsWithErrorMessage([innerFailureMessage, "expected to raise exception with name with reason that satisfies block, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }"]) { - expect { self.anException.raise() }.to(raiseException(named: "lol", reason: "wrong") { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "lol", reason: "wrong") { (exception: NSException) in expect(exception.name.rawValue).to(beginWith("fo")) }) } failsWithErrorMessage([innerFailureMessage, "expected to raise exception with name with reason with userInfo <{key = value;}> that satisfies block, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }"]) { - expect { self.anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"]) { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"]) { (exception: NSException) in expect(exception.name.rawValue).to(beginWith("fo")) }) } failsWithErrorMessage([innerFailureMessage, "expected to raise exception with name with reason with userInfo <{}> that satisfies block, got NSException { name=NSExceptionName(_rawValue: laugh), reason='Lulz', userInfo=[AnyHashable(\"key\"): \"value\"] }"]) { - expect { self.anException.raise() }.to(raiseException(named: "lol", reason: "Lulz", userInfo: [:]) { (exception: NSException) in + expect { anException.raise() }.to(raiseException(named: "lol", reason: "Lulz", userInfo: [:]) { (exception: NSException) in expect(exception.name.rawValue).to(beginWith("fo")) }) } } + + func testNSExceptionName() { + let exception = NSException(name: .genericException, reason: nil, userInfo: nil) + expect { exception.raise() }.to(raiseException(named: .genericException)) + } + + func testNonVoidClosure() { + expect { return 1 }.toNot(raiseException()) + expect { return 2 }.toNot(raiseException(named: "laugh")) + expect { return 3 }.toNot(raiseException(named: "laugh", reason: "Lulz")) + expect { return 4 }.toNot(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"])) + expect { return 5 }.toNot(raiseException(named: "laugh", reason: "Lulz", userInfo: ["key": "value"]) { _ in }) + } + + func testChainOnRaiseException() { + expect { () -> Int in return 5 }.toNot(raiseException()).to(equal(5)) + } } #endif 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 be60a41..f85b5fc 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 @@ -2,14 +2,10 @@ import XCTest import Nimble import Foundation -final class SatisfyAllOfTest: XCTestCase, XCTestCaseProvider { +final class SatisfyAllOfTest: XCTestCase { func testSatisfyAllOf() { expect(2).to(satisfyAllOf(equal(2), beLessThan(3))) -#if SUPPORT_IMPLICIT_BRIDGING_CONVERSION - expect(2).toNot(satisfyAllOf(equal(3), equal("turtles"))) -#else expect(2 as NSNumber).toNot(satisfyAllOf(equal(3 as NSNumber), equal("turtles" as NSString))) -#endif expect([1, 2, 3]).to(satisfyAllOf(equal([1, 2, 3]), allPass({$0 < 4}), haveCount(3))) expect("turtle").to(satisfyAllOf(contain("e"), beginWith("tur"))) expect(82.0).to(satisfyAllOf(beGreaterThan(10.5), beLessThan(100.75), beCloseTo(82.00001))) @@ -36,11 +32,8 @@ final class SatisfyAllOfTest: XCTestCase, XCTestCaseProvider { func testOperatorAnd() { expect(2).to(equal(2) && beLessThan(3)) -#if SUPPORT_IMPLICIT_BRIDGING_CONVERSION expect(2).to(beLessThan(3) && beGreaterThan(1)) -#else expect(2 as NSNumber).to(beLessThan(3 as NSNumber) && beGreaterThan(1 as NSNumber)) -#endif expect("turtle").to(contain("t") && endWith("tle")) expect(82.0).to(beGreaterThan(10.5) && beLessThan(100.75)) expect(false).to(beFalsy() && beFalse()) 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 0cba8d5..102616d 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 @@ -2,14 +2,10 @@ import XCTest import Nimble import Foundation -final class SatisfyAnyOfTest: XCTestCase, XCTestCaseProvider { +final class SatisfyAnyOfTest: XCTestCase { func testSatisfyAnyOf() { expect(2).to(satisfyAnyOf(equal(2), equal(3))) -#if SUPPORT_IMPLICIT_BRIDGING_CONVERSION - expect(2).toNot(satisfyAnyOf(equal(3), equal("turtles"))) -#else expect(2 as NSNumber).toNot(satisfyAnyOf(equal(3 as NSNumber), equal("turtles" as NSString))) -#endif expect([1, 2, 3]).to(satisfyAnyOf(equal([1, 2, 3]), allPass({$0 < 4}), haveCount(3))) expect("turtle").toNot(satisfyAnyOf(contain("a"), endWith("magic"))) expect(82.0).toNot(satisfyAnyOf(beLessThan(10.5), beGreaterThan(100.75), beCloseTo(50.1))) @@ -36,11 +32,7 @@ final class SatisfyAnyOfTest: XCTestCase, XCTestCaseProvider { func testOperatorOr() { expect(2).to(equal(2) || equal(3)) -#if SUPPORT_IMPLICIT_BRIDGING_CONVERSION - expect(2).toNot(equal(3) || equal("turtles")) -#else expect(2 as NSNumber).toNot(equal(3 as NSNumber) || equal("turtles" as NSString)) -#endif expect("turtle").toNot(contain("a") || endWith("magic")) expect(82.0).toNot(beLessThan(10.5) || beGreaterThan(100.75)) expect(false).to(beTrue() || beFalse()) 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 edd9e0e..f3b9969 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 @@ -2,20 +2,23 @@ import Foundation import XCTest import Nimble -#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE - private let error: Error = NSError(domain: "test", code: 0, userInfo: nil) final class ThrowAssertionTest: XCTestCase { func testPositiveMatch() { + #if canImport(Darwin) expect { () -> Void in fatalError() }.to(throwAssertion()) + #endif } func testErrorThrown() { + #if canImport(Darwin) expect { throw error }.toNot(throwAssertion()) + #endif } func testPostAssertionCodeNotRun() { + #if canImport(Darwin) var reachedPoint1 = false var reachedPoint2 = false @@ -27,17 +30,21 @@ final class ThrowAssertionTest: XCTestCase { expect(reachedPoint1) == true expect(reachedPoint2) == false + #endif } func testNegativeMatch() { + #if canImport(Darwin) var reachedPoint1 = false expect { reachedPoint1 = true }.toNot(throwAssertion()) expect(reachedPoint1) == true + #endif } func testPositiveMessage() { + #if canImport(Darwin) failsWithErrorMessage("expected to throw an assertion") { expect { () -> Void? in return }.to(throwAssertion()) } @@ -45,13 +52,26 @@ final class ThrowAssertionTest: XCTestCase { failsWithErrorMessage("expected to throw an assertion; threw error instead <\(error)>") { expect { throw error }.to(throwAssertion()) } + #endif } func testNegativeMessage() { + #if canImport(Darwin) failsWithErrorMessage("expected to not throw an assertion") { expect { () -> Void in fatalError() }.toNot(throwAssertion()) } + #endif + } + + func testNonVoidClosure() { + #if canImport(Darwin) + expect { () -> Int in fatalError() }.to(throwAssertion()) + #endif + } + + func testChainOnThrowAssertion() { + #if canImport(Darwin) + expect { () -> Int in return 5 }.toNot(throwAssertion()).to(equal(5)) + #endif } } - -#endif 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 7a7253f..5c15567 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 @@ -6,7 +6,7 @@ enum NimbleError: Error { case cry } -enum EquatableError: Error { +enum EquatableError: Error, Equatable { case parameterized(x: Int) } @@ -19,16 +19,6 @@ extension EquatableError: CustomDebugStringConvertible { } } -extension EquatableError: Equatable { -} - -func == (lhs: EquatableError, rhs: EquatableError) -> Bool { - switch (lhs, rhs) { - case (.parameterized(let l), .parameterized(let r)): - return l == r - } -} - enum CustomDebugStringConvertibleError: Error { // swiftlint:disable identifier_name case a @@ -42,7 +32,7 @@ extension CustomDebugStringConvertibleError: CustomDebugStringConvertible { } } -final class ThrowErrorTest: XCTestCase, XCTestCaseProvider { +final class ThrowErrorTest: XCTestCase { func testPositiveMatches() { expect { throw NimbleError.laugh }.to(throwError()) expect { throw NimbleError.laugh }.to(throwError(NimbleError.laugh)) @@ -135,7 +125,7 @@ final class ThrowErrorTest: XCTestCase, XCTestCaseProvider { func testNegativeMatchesWithClosure() { let moduleName = "NimbleTests" let innerFailureMessage = "expected to equal , got <\(moduleName).NimbleError>" - let closure = { (error: Error) in + let closure = { (error: Error) -> Void in expect(error._domain).to(equal("foo")) } @@ -151,4 +141,31 @@ final class ThrowErrorTest: XCTestCase, XCTestCaseProvider { expect { throw NimbleError.laugh }.to(throwError(NimbleError.laugh, closure: closure)) } } + + func testNonVoidClosure() { + expect { return 1 }.toNot(throwError()) + expect { return 2 }.toNot(throwError(NimbleError.laugh)) + expect { return 3 }.toNot(throwError(errorType: NimbleError.self)) + expect { return 4 }.toNot(throwError(EquatableError.parameterized(x: 1))) + expect { return 5 }.toNot(throwError(EquatableError.parameterized(x: 2))) + + // swiftlint:disable unused_closure_parameter + + // Generic typed closure + expect { return "1" }.toNot(throwError { error in }) + // Explicit typed closure + expect { return "2" }.toNot(throwError { (error: EquatableError) in }) + // Typed closure over errorType argument + expect { return "3" }.toNot(throwError(errorType: EquatableError.self) { error in }) + // Typed closure over error argument + expect { return "4" }.toNot(throwError(NimbleError.laugh) { (error: Error) in }) + // Typed closure over error argument + expect { return "5" }.toNot(throwError(NimbleError.laugh) { (error: Error) in }) + + // swiftlint:enable unused_closure_parameter + } + + func testChainOnThrowError() { + expect { () throws -> Int in return 5 }.toNot(throwError()).to(equal(5)) + } } 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 0079f23..df6b0aa 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 @@ -1,7 +1,7 @@ import XCTest import Nimble -final class ToSucceedTest: XCTestCase, XCTestCaseProvider { +final class ToSucceedTest: XCTestCase { func testToSucceed() { expect({ return .succeeded diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/PredicateTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/PredicateTest.swift new file mode 100644 index 0000000..3fd5615 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/PredicateTest.swift @@ -0,0 +1,28 @@ +import XCTest +import Nimble + +final class PredicateTest: XCTestCase { + func testDefineDefaultMessage() { + failsWithErrorMessage("expected to match, got <1>") { + expect(1).to(Predicate.define { _, msg in PredicateResult(status: .fail, message: msg) }) + } + } + + func testDefineNilableDefaultMessage() { + failsWithErrorMessage("expected to match, got <1>") { + expect(1).to(Predicate.defineNilable { _, msg in PredicateResult(status: .fail, message: msg) }) + } + } + + func testSimpleDefaultMessage() { + failsWithErrorMessage("expected to match, got <1>") { + expect(1).to(Predicate.simple { _ in .fail }) + } + } + + func testSimpleNilableDefaultMessage() { + failsWithErrorMessage("expected to match, got <1>") { + expect(1).to(Predicate.simpleNilable { _ in .fail }) + } + } +} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/SynchronousDeprecatedTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/SynchronousDeprecatedTest.swift new file mode 100644 index 0000000..ed305f0 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/SynchronousDeprecatedTest.swift @@ -0,0 +1,98 @@ +import Foundation +import XCTest +import Nimble + +@available(*, deprecated) +final class SynchronousDeprecatedTest: XCTestCase { + 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) + } + + func testToProvidesActualValueExpression() { + var value: Int? + expect(1).to(MatcherFunc { expr, _ in value = try expr.evaluate(); return true }) + expect(value).to(equal(1)) + } + + func testToProvidesAMemoizedActualValueExpression() { + var callCount = 0 + expect { callCount += 1 }.to(MatcherFunc { expr, _ in + _ = try expr.evaluate() + _ = try expr.evaluate() + return true + }) + expect(callCount).to(equal(1)) + } + + func testToProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl() { + var callCount = 0 + expect { callCount += 1 }.to(MatcherFunc { expr, _ in + expect(callCount).to(equal(0)) + _ = try expr.evaluate() + return true + }) + expect(callCount).to(equal(1)) + } + + // repeated tests from to() for toNot() + 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) + } + + func testToNotProvidesActualValueExpression() { + var value: Int? + expect(1).toNot(MatcherFunc { expr, _ in value = try expr.evaluate(); return false }) + expect(value).to(equal(1)) + } + + func testToNotProvidesAMemoizedActualValueExpression() { + var callCount = 0 + expect { callCount += 1 }.toNot(MatcherFunc { expr, _ in + _ = try expr.evaluate() + _ = try expr.evaluate() + return false + }) + expect(callCount).to(equal(1)) + } + + func testToNotProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl() { + var callCount = 0 + expect { callCount += 1 }.toNot(MatcherFunc { expr, _ in + expect(callCount).to(equal(0)) + _ = try expr.evaluate() + return false + }) + 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) + } + } + + 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) + } + } + + func testNotToMatchesLikeToNot() { + expect(1).notTo(MatcherFunc { _, _ in false }) + expect(1).notTo(MatcherFunc { _, _ in false }.predicate) + } +} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/SynchronousTest.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/SynchronousTest.swift index 1f412dd..cab4e52 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/SynchronousTest.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/SynchronousTest.swift @@ -2,7 +2,7 @@ import Foundation import XCTest import Nimble -final class SynchronousTest: XCTestCase, XCTestCaseProvider { +final class SynchronousTest: XCTestCase { class Error: Swift.Error {} let errorToThrow = Error() @@ -29,38 +29,32 @@ 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 }) + expect(1).to(Predicate.simple { _ in .matches }) + expect {1}.to(Predicate.simple { _ in .matches }) } func testToProvidesActualValueExpression() { var value: Int? - expect(1).to(MatcherFunc { expr, _ in value = try expr.evaluate(); return true }) + expect(1).to(Predicate.simple { expr in value = try expr.evaluate(); return .matches }) expect(value).to(equal(1)) } func testToProvidesAMemoizedActualValueExpression() { var callCount = 0 - expect { callCount += 1 }.to(MatcherFunc { expr, _ in + expect { callCount += 1 }.to(Predicate.simple { expr in _ = try expr.evaluate() _ = try expr.evaluate() - return true + return .matches }) expect(callCount).to(equal(1)) } func testToProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl() { var callCount = 0 - expect { callCount += 1 }.to(MatcherFunc { expr, _ in + expect { callCount += 1 }.to(Predicate.simple { expr in expect(callCount).to(equal(0)) _ = try expr.evaluate() - return true + return .matches }) expect(callCount).to(equal(1)) } @@ -74,69 +68,61 @@ final class SynchronousTest: XCTestCase, XCTestCaseProvider { // repeated tests from to() for toNot() 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 }) + expect(1).toNot(Predicate.simple { _ in .doesNotMatch }) + expect {1}.toNot(Predicate.simple { _ in .doesNotMatch }) } func testToNotProvidesActualValueExpression() { var value: Int? - expect(1).toNot(MatcherFunc { expr, _ in value = try expr.evaluate(); return false }) + expect(1).toNot(Predicate.simple { expr in value = try expr.evaluate(); return .doesNotMatch }) expect(value).to(equal(1)) } func testToNotProvidesAMemoizedActualValueExpression() { var callCount = 0 - expect { callCount += 1 }.toNot(MatcherFunc { expr, _ in + expect { callCount += 1 }.toNot(Predicate.simple { expr in _ = try expr.evaluate() _ = try expr.evaluate() - return false + return .doesNotMatch }) expect(callCount).to(equal(1)) } func testToNotProvidesAMemoizedActualValueExpressionIsEvaluatedAtMatcherControl() { var callCount = 0 - expect { callCount += 1 }.toNot(MatcherFunc { expr, _ in + expect { callCount += 1 }.toNot(Predicate.simple { expr in expect(callCount).to(equal(0)) _ = try expr.evaluate() - return false + return .doesNotMatch }) 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 }) + expect(1).to(Predicate.simple { _ 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 }) + expect(1).toNot(Predicate.simple { _ 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 }) + expect(1).notTo(Predicate.simple { _ in .doesNotMatch }) + } + + // MARK: Assertion chaining + + func testChain() { + expect(2).toNot(equal(1)).to(equal(2)).notTo(equal(3)) + } + + func testChainFail() { + failsWithErrorMessage(["expected to not equal <2>, got <2>", "expected to equal <3>, got <2>"]) { + expect(2).toNot(equal(1)).toNot(equal(2)).to(equal(3)) + } } } 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 0c451c8..71feb9b 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 @@ -1,7 +1,7 @@ import XCTest import Nimble -final class UserDescriptionTest: XCTestCase, XCTestCaseProvider { +final class UserDescriptionTest: XCTestCase { func testToMatcher_CustomFailureMessage() { failsWithErrorMessage( """ @@ -9,7 +9,7 @@ final class UserDescriptionTest: XCTestCase, XCTestCaseProvider { expected to match, got <1> """ ) { - expect(1).to(MatcherFunc { _, _ in false }, description: "These aren't equal!") + expect(1).to(Predicate.simple { _ in .doesNotMatch }, description: "These aren't equal!") } } @@ -20,7 +20,7 @@ final class UserDescriptionTest: XCTestCase, XCTestCaseProvider { expected to not match, got <1> """ ) { - expect(1).notTo(MatcherFunc { _, _ in true }, description: "These aren't equal!") + expect(1).notTo(Predicate.simple { _ in .matches }, description: "These aren't equal!") } } @@ -31,7 +31,7 @@ final class UserDescriptionTest: XCTestCase, XCTestCaseProvider { expected to not match, got <1> """ ) { - expect(1).toNot(MatcherFunc { _, _ in true }, description: "These aren't equal!") + expect(1).toNot(Predicate.simple { _ in .matches }, description: "These aren't 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 deleted file mode 100644 index e0fcd0a..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/XCTestManifests.swift +++ /dev/null @@ -1,386 +0,0 @@ -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/ObjCSyncTest.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCSyncTest.m index 2aae816..64b6a05 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCSyncTest.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/Tests/NimbleTests/objc/ObjCSyncTest.m @@ -18,4 +18,16 @@ }); } +#pragma mark - Assertion chaining + +- (void)testChain { + expect(@2).toNot(equal(@1)).to(equal(@2)).notTo(equal(@3)); +} + +- (void)testChainFail { + expectFailureMessages((@[@"expected to not equal <2>, got <2>", @"expected to equal <3>, got <2>"]), ^{ + expect(@2).toNot(equal(@1)).toNot(equal(@2)).to(equal(@3)); + }); +} + @end diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/script/release b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/script/release index f61c0dc..20d15e9 100755 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/script/release +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/script/release @@ -3,7 +3,7 @@ REMOTE_BRANCH=master POD_NAME=Nimble PODSPEC=Nimble.podspec -POD=${COCOAPODS:-pod} +POD=${COCOAPODS:-"bundle exec pod"} function help { echo "Usage: release VERSION RELEASE_NOTES [-f]" @@ -173,7 +173,7 @@ echo echo "Pushing to pod trunk..." # NOTE: remove allow-warnings after v9.0.0 of Nimble -$POD trunk push "$PODSPEC" --allow-warnings +$POD trunk push "$PODSPEC" --allow-warnings --skip-import-validation echo echo "================ Finalizing the Release ================" diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/test b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/test index c213afe..7e5eec3 100755 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/test +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Externals/Nimble/test @@ -7,12 +7,14 @@ if which xcodebuild > /dev/null; then echo -e "Gathering ${GREEN}xcodebuild sdk versions${CLEAR}..." BUILD_DIR=`pwd`/build LATEST_IOS_SDK_VERSION=`xcodebuild -showsdks | grep iphonesimulator | cut -d ' ' -f 4 | ruby -e 'puts STDIN.read.chomp.split("\n").last'` + LATEST_IOS_VERSION=`xcrun simctl list | grep ^iOS | ruby -e 'puts /\(([0-9.]+).*\)/.match(STDIN.read.chomp.split("\n").last).to_a[1]'` LATEST_TVOS_SDK_VERSION=`xcodebuild -showsdks | grep appletvsimulator | cut -d ' ' -f 4 | ruby -e 'puts STDIN.read.chomp.split("\n").last'` - LATEST_MACOS_SDK_VERSION=`xcodebuild -showsdks | grep 'macosx' | cut -d ' ' -f 3 | ruby -e 'puts STDIN.read.chomp.split("\n").last'` + LATEST_TVOS_VERSION=`xcrun simctl list | grep ^tvOS | ruby -e 'puts /\(([0-9.]+).*\)/.match(STDIN.read.chomp.split("\n").last).to_a[1]'` + LATEST_MACOS_SDK_VERSION=`xcodebuild -showsdks | grep 'macosx' | cut -d ' ' -f 2 | ruby -e 'puts STDIN.read.chomp.split("\n").last'` BUILD_IOS_SDK_VERSION=${NIMBLE_BUILD_IOS_SDK_VERSION:-$LATEST_IOS_SDK_VERSION} - RUNTIME_IOS_SDK_VERSION=${NIMBLE_RUNTIME_IOS_SDK_VERSION:-$LATEST_IOS_SDK_VERSION} + RUNTIME_IOS_VERSION=${NIMBLE_RUNTIME_IOS_VERSION:-$LATEST_IOS_VERSION} BUILD_TVOS_SDK_VERSION=${NIMBLE_BUILD_TVOS_SDK_VERSION:-$LATEST_TVOS_SDK_VERSION} - RUNTIME_TVOS_SDK_VERSION=${NIMBLE_RUNTIME_TVOS_SDK_VERSION:-$LATEST_TVOS_SDK_VERSION} + RUNTIME_TVOS_VERSION=${NIMBLE_RUNTIME_TVOS_VERSION:-$LATEST_TVOS_VERSION} BUILD_MACOS_SDK_VERSION=${NIMBLE_BUILD_MACOS_SDK_VERSION:-$LATEST_MACOS_SDK_VERSION} fi @@ -33,12 +35,12 @@ function print_env { echo " iOS:" echo " Latest iOS SDK: $LATEST_IOS_SDK_VERSION" echo " Building with iOS SDK: `color_if_overridden $BUILD_IOS_SDK_VERSION $NIMBLE_BUILD_IOS_SDK_VERSION`" - echo " Running with iOS SDK: `color_if_overridden $RUNTIME_IOS_SDK_VERSION $NIMBLE_RUNTIME_IOS_SDK_VERSION`" + echo " Running with iOS: `color_if_overridden $RUNTIME_IOS_VERSION $NIMBLE_RUNTIME_IOS_VERSION`" echo echo " tvOS:" echo " Latest tvOS SDK: $LATEST_TVOS_SDK_VERSION" echo " Building with tvOS SDK: `color_if_overridden $BUILD_TVOS_SDK_VERSION $NIMBLE_BUILD_TVOS_SDK_VERSION`" - echo " Running with tvOS SDK: `color_if_overridden $RUNTIME_TVOS_SDK_VERSION $NIMBLE_RUNTIME_TVOS_SDK_VERSION`" + echo " Running with tvOS: `color_if_overridden $RUNTIME_TVOS_VERSION $NIMBLE_RUNTIME_TVOS_VERSION`" echo echo " macOS:" echo " Latest macOS SDK: $LATEST_MACOS_SDK_VERSION" @@ -54,39 +56,59 @@ function run { } function test_ios { - run osascript -e 'tell app "Simulator" to quit' - run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -sdk "iphonesimulator$BUILD_IOS_SDK_VERSION" -destination "name=iPad Air,OS=$RUNTIME_IOS_SDK_VERSION" build-for-testing test-without-building + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -destination "generic/platform=iOS" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build | xcpretty run osascript -e 'tell app "Simulator" to quit' - run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -sdk "iphonesimulator$BUILD_IOS_SDK_VERSION" -destination "name=iPhone 5s,OS=$RUNTIME_IOS_SDK_VERSION" build-for-testing test-without-building + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -sdk "iphonesimulator$BUILD_IOS_SDK_VERSION" -destination "name=iPad Pro (9.7-inch),OS=$RUNTIME_IOS_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty + + run osascript -e 'tell app "Simulator" to quit' + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -sdk "iphonesimulator$BUILD_IOS_SDK_VERSION" -destination "name=iPhone 8,OS=$RUNTIME_IOS_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty } function test_tvos { + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-tvOS" -configuration "Debug" -destination "generic/platform=tvOS" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build | xcpretty + run osascript -e 'tell app "Simulator" to quit' - run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-tvOS" -configuration "Debug" -sdk "appletvsimulator$BUILD_TVOS_SDK_VERSION" -destination "name=Apple TV,OS=$RUNTIME_TVOS_SDK_VERSION" build-for-testing test-without-building + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-tvOS" -configuration "Debug" -sdk "appletvsimulator$BUILD_TVOS_SDK_VERSION" -destination "name=Apple TV,OS=$RUNTIME_TVOS_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty } function test_macos { - run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-macOS" -configuration "Debug" -sdk "macosx$BUILD_MACOS_SDK_VERSION" build-for-testing test-without-building + run set -o pipefail && xcodebuild -project Nimble.xcodeproj -scheme "Nimble-macOS" -configuration "Debug" -sdk "macosx$BUILD_MACOS_SDK_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty +} + +function test_xcode_spm_macos { + mv Nimble.xcodeproj Nimble.xcodeproj.bak + trap 'mv Nimble.xcodeproj.bak Nimble.xcodeproj' EXIT + run set -o pipefail && xcodebuild -scheme "Nimble" -configuration "Debug" -sdk "macosx$BUILD_MACOS_SDK_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty +} + +function test_xcode_spm_ios { + run osascript -e 'tell app "Simulator" to quit' + mv Nimble.xcodeproj Nimble.xcodeproj.bak + trap 'mv Nimble.xcodeproj.bak Nimble.xcodeproj' EXIT + run set -o pipefail && xcodebuild -scheme "Nimble" -configuration "Debug" -sdk "iphonesimulator$BUILD_IOS_SDK_VERSION" -destination "name=iPhone 8,OS=$RUNTIME_IOS_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty +} + +function test_xcode_spm_tvos { + run osascript -e 'tell app "Simulator" to quit' + mv Nimble.xcodeproj Nimble.xcodeproj.bak + trap 'mv Nimble.xcodeproj.bak Nimble.xcodeproj' EXIT + run set -o pipefail && xcodebuild -scheme "Nimble" -configuration "Debug" -sdk "appletvsimulator$BUILD_TVOS_SDK_VERSION" -destination "name=Apple TV,OS=$RUNTIME_TVOS_VERSION" OTHER_SWIFT_FLAGS='$(inherited) -suppress-warnings' build-for-testing test-without-building | xcpretty } 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 --skip-import-validation - run mv .swift-version.backup .swift-version + run bundle exec pod lib lint Nimble.podspec --allow-warnings --skip-import-validation --verbose } function test_swiftpm { if [ -d .build ]; then run swift package clean fi - run swift build && swift test + run swift build -Xswiftc -suppress-warnings && swift test -Xswiftc -suppress-warnings --enable-test-discovery } function test_swiftpm_docker { @@ -95,9 +117,17 @@ function test_swiftpm_docker { } function test() { + test_macos test_ios test_tvos - test_macos + + if xcodebuild --help 2>&1 | grep xcframework > /dev/null; then + test_xcode_spm_macos + test_xcode_spm_ios + test_xcode_spm_tvos + else + echo "Not testing with Swift Package Manager version of Xcode because it requires at least Xcode 11" + fi if which swift-test; then test_swiftpm @@ -123,12 +153,15 @@ function help { echo " all - Runs the all tests of macos, ios and tvos" echo " clean - Cleans the derived data directory of Xcode. Assumes default location" echo " help - Displays this help" - echo " ios - Runs the tests as an iOS device" echo " macos - Runs the tests on macOS 10.10 (Yosemite and newer only)" + echo " macos_xcodespm - Runs the tests on macOS using the Swift Package Manager version of Xcode" + echo " ios - Runs the tests as an iOS device" + echo " ios_xcodespm - Runs the tests as an iOS device using the Swift Package Manager version of Xcode" + echo " tvos - Runs the tests as an tvOS device" + echo " tvos_xcodespm - Runs the tests as an tvOS device using the Swift Package Manager version of Xcode" echo " podspec - Runs pod lib lint against the podspec to detect breaking changes" echo " swiftpm - Runs the tests built by the Swift Package Manager" echo " swiftpm_docker - Runs the tests built by the Swift Package Manager in a docker linux container" - echo " tvos - Runs the tests as an tvOS device" echo exit 1 } @@ -140,8 +173,11 @@ function main { case "$arg" in clean) clean ;; ios) test_ios ;; + ios_xcodespm) test_xcode_spm_ios ;; tvos) test_tvos ;; + tvos_xcodespm) test_xcode_spm_tvos ;; macos) test_macos ;; + macos_xcodespm) test_xcode_spm_macos ;; podspec) test_podspec ;; test) test ;; all) test ;; diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Gemfile b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Gemfile index 45cf683..a29354c 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Gemfile +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Gemfile @@ -1,5 +1,4 @@ source "https://rubygems.org" -gem 'cocoapods', '~> 1.7.0.beta' +gem 'cocoapods', '~> 1.9' 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 ce57b59..1eefeb8 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Gemfile.lock +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Gemfile.lock @@ -1,104 +1,125 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.0) - activesupport (4.2.11) + CFPropertyList (3.0.2) + activesupport (4.2.11.3) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - addressable (2.5.0) - public_suffix (~> 2.0, >= 2.0.2) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + algoliasearch (1.27.2) + httpclient (~> 2.8, >= 2.8.3) + json (>= 1.5.1) atomos (0.1.3) - claide (1.0.2) + claide (1.0.3) claide-plugins (0.9.2) cork nap open4 (~> 1.3) - cocoapods (1.7.0.beta.1) + cocoapods (1.9.2) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.7.0.beta.1) + cocoapods-core (= 1.9.2) 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.1, < 2.0) + cocoapods-trunk (>= 1.4.0, < 2.0) cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) - fourflusher (>= 2.2.0, < 3.0) + fourflusher (>= 2.3.0, < 3.0) gh_inspector (~> 1.0) molinillo (~> 0.6.6) nap (~> 1.0) ruby-macho (~> 1.4) - xcodeproj (>= 1.8.1, < 2.0) - cocoapods-core (1.7.0.beta.1) + xcodeproj (>= 1.14.0, < 2.0) + cocoapods-core (1.9.2) activesupport (>= 4.0.2, < 6) + algoliasearch (~> 1.0) + concurrent-ruby (~> 1.1) fuzzy_match (~> 2.0.4) nap (~> 1.0) - cocoapods-deintegrate (1.0.3) - cocoapods-downloader (1.2.2) + netrc (~> 0.11) + typhoeus (~> 1.0) + cocoapods-deintegrate (1.0.4) + cocoapods-downloader (1.3.0) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) cocoapods-stats (1.1.0) - cocoapods-trunk (1.3.1) + cocoapods-trunk (1.5.0) nap (>= 0.8, < 2.0) netrc (~> 0.11) - cocoapods-try (1.1.0) - colored (1.2) + cocoapods-try (1.2.0) colored2 (3.1.2) - concurrent-ruby (1.1.4) - cork (0.2.0) - colored (~> 1.2) - danger (4.0.4) + concurrent-ruby (1.1.6) + cork (0.3.0) + colored2 (~> 3.1) + danger (8.0.0) claide (~> 1.0) claide-plugins (>= 0.9.2) - colored (~> 1.2) + colored2 (~> 3.1) cork (~> 0.1) - faraday (~> 0.9) - faraday-http-cache (~> 1.0) - git (~> 1) - kramdown (~> 1.5) - octokit (~> 4.2) + faraday (>= 0.9.0, < 2.0) + faraday-http-cache (~> 2.0) + git (~> 1.7) + kramdown (~> 2.0) + kramdown-parser-gfm (~> 1.0) + no_proxy_fix + octokit (~> 4.7) terminal-table (~> 1) - danger-swiftlint (0.2.1) - danger escape (0.0.4) - faraday (0.10.1) + ethon (0.12.0) + ffi (>= 1.3.0) + faraday (1.0.1) multipart-post (>= 1.2, < 3) - faraday-http-cache (1.3.1) - faraday (~> 0.8) - fourflusher (2.2.0) + faraday-http-cache (2.2.0) + faraday (>= 0.8) + ffi (1.12.2) + fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) - git (1.3.0) + git (1.7.0) + rchardet (~> 1.8) + httpclient (2.8.3) i18n (0.9.5) concurrent-ruby (~> 1.0) - kramdown (1.13.2) - minitest (5.11.3) + json (2.3.0) + kramdown (2.2.1) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + minitest (5.14.1) molinillo (0.6.6) - multipart-post (2.0.0) + multipart-post (2.1.1) nanaimo (0.2.6) nap (1.1.0) netrc (0.11.0) - octokit (4.6.2) + no_proxy_fix (0.1.2) + octokit (4.18.0) + faraday (>= 0.9) sawyer (~> 0.8.0, >= 0.5.3) open4 (1.3.4) - public_suffix (2.0.5) + public_suffix (4.0.5) + rchardet (1.8.0) + rexml (3.2.4) ruby-macho (1.4.0) - sawyer (0.8.1) - addressable (>= 2.3.5, < 2.6) - faraday (~> 0.8, < 1.0) - terminal-table (1.7.3) - unicode-display_width (~> 1.1.1) + sawyer (0.8.2) + addressable (>= 2.3.5) + faraday (> 0.8, < 2.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) thread_safe (0.3.6) - tzinfo (1.2.5) + typhoeus (1.4.0) + ethon (>= 0.9.0) + tzinfo (1.2.7) thread_safe (~> 0.1) - unicode-display_width (1.1.2) - xcodeproj (1.8.1) + unicode-display_width (1.7.0) + xcodeproj (1.16.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) @@ -109,9 +130,8 @@ PLATFORMS ruby DEPENDENCIES - cocoapods (~> 1.7.0.beta) + cocoapods (~> 1.9) danger - danger-swiftlint BUNDLED WITH - 1.17.2 + 2.1.4 diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package.resolved b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package.resolved index 9d724da..1cdfbcb 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package.resolved +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package.resolved @@ -1,13 +1,31 @@ { "object": { "pins": [ + { + "package": "CwlCatchException", + "repositoryURL": "https://github.com/mattgallagher/CwlCatchException.git", + "state": { + "branch": null, + "revision": "f809deb30dc5c9d9b78c872e553261a61177721a", + "version": "2.0.0" + } + }, + { + "package": "CwlPreconditionTesting", + "repositoryURL": "https://github.com/mattgallagher/CwlPreconditionTesting.git", + "state": { + "branch": null, + "revision": "02b7a39a99c4da27abe03cab2053a9034379639f", + "version": "2.0.0" + } + }, { "package": "Nimble", "repositoryURL": "https://github.com/Quick/Nimble.git", "state": { "branch": null, - "revision": "a27c5186ce2d65f60d1237660b2509df3eb29023", - "version": "8.0.0" + "revision": "e491a6731307bb23783bf664d003be9b2fa59ab5", + "version": "9.0.0" } } ] diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package.swift index 419d663..94381cb 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package.swift @@ -1,14 +1,17 @@ -// swift-tools-version:4.2 +// swift-tools-version:5.2 import PackageDescription let package = Package( name: "Quick", + platforms: [ + .macOS(.v10_10), .iOS(.v8), .tvOS(.v9) + ], products: [ .library(name: "Quick", targets: ["Quick"]), ], dependencies: [ - .package(url: "https://github.com/Quick/Nimble.git", from: "8.0.0"), + .package(url: "https://github.com/Quick/Nimble.git", from: "9.0.0"), ], targets: { var targets: [Target] = [ @@ -19,15 +22,21 @@ let package = Package( "QuickAfterSuiteTests/AfterSuiteTests+ObjC.m", "QuickFocusedTests/FocusedTests+ObjC.m", "QuickTests/FunctionalTests/ObjC", - "QuickTests/Helpers", + "QuickTests/Helpers/QCKSpecRunner.h", + "QuickTests/Helpers/QCKSpecRunner.m", + "QuickTests/Helpers/QuickTestsBridgingHeader.h", "QuickTests/QuickConfigurationTests.m", ] ), + .testTarget( + name: "QuickIssue853RegressionTests", + dependencies: [ "Quick" ] + ), ] #if os(macOS) targets.append(contentsOf: [ - .target(name: "QuickSpecBase", dependencies: []), - .target(name: "Quick", dependencies: [ "QuickSpecBase" ]), + .target(name: "QuickObjCRuntime", dependencies: []), + .target(name: "Quick", dependencies: [ "QuickObjCRuntime" ]), ]) #else targets.append(contentsOf: [ @@ -36,5 +45,5 @@ let package = Package( #endif return targets }(), - swiftLanguageVersions: [.v4_2] + swiftLanguageVersions: [.v5] ) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package@swift-5.3.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package@swift-5.3.swift new file mode 100644 index 0000000..f9ac85e --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Package@swift-5.3.swift @@ -0,0 +1,50 @@ +// swift-tools-version:5.3 + +import PackageDescription + +let package = Package( + name: "Quick", + platforms: [ + .macOS(.v10_10), .iOS(.v9), .tvOS(.v9) + ], + products: [ + .library(name: "Quick", targets: ["Quick"]), + ], + dependencies: [ + .package(url: "https://github.com/Quick/Nimble.git", from: "9.0.0"), + ], + targets: { + var targets: [Target] = [ + .testTarget( + name: "QuickTests", + dependencies: [ "Quick", "Nimble" ], + exclude: [ + "QuickAfterSuiteTests/AfterSuiteTests+ObjC.m", + "QuickFocusedTests/FocusedTests+ObjC.m", + "QuickTests/FunctionalTests/ObjC", + "QuickTests/Helpers/QCKSpecRunner.h", + "QuickTests/Helpers/QCKSpecRunner.m", + "QuickTests/Helpers/QuickTestsBridgingHeader.h", + "QuickTests/QuickConfigurationTests.m", + ] + ), + .testTarget( + name: "QuickIssue853RegressionTests", + dependencies: [ "Quick" ] + ), + ] +#if os(macOS) + targets.append(contentsOf: [ + .target(name: "QuickObjCRuntime", dependencies: []), + .target(name: "Quick", dependencies: [ "QuickObjCRuntime" ]), + ]) +#else + targets.append(contentsOf: [ + .target(name: "Quick", dependencies: []), + ]) +#endif + return targets + }(), + swiftLanguageVersions: [.v5] +) + 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 31443f2..97798be 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 @@ -6,8 +6,8 @@ // ___COPYRIGHT___ // -#import -#import +@import Quick; +@import Nimble; QuickSpecBegin(___FILEBASENAMEASIDENTIFIER___) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick.podspec b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick.podspec index 4565831..bbae23b 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 = "2.0.0" + s.version = "3.1.0" s.summary = "The Swift (and Objective-C) testing framework." s.description = <<-DESC @@ -26,7 +26,6 @@ Pod::Spec.new do |s| ] s.exclude_files = [ - 'Sources/Quick/Configuration/QuickConfiguration.swift', 'Sources/Quick/QuickSpec.swift', 'Sources/Quick/QuickMain.swift', ] @@ -36,10 +35,15 @@ Pod::Spec.new do |s| s.user_target_xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '$(PLATFORM_DIR)/Developer/Library/Frameworks' } s.pod_target_xcconfig = { 'APPLICATION_EXTENSION_API_ONLY' => 'YES', + 'DEFINES_MODULE' => 'YES', 'ENABLE_BITCODE' => 'NO', 'OTHER_LDFLAGS' => '$(inherited) -Xlinker -no_application_extension', } s.cocoapods_version = '>= 1.4.0' - s.swift_version = '4.2' + if s.respond_to?(:swift_versions) then + s.swift_versions = ['5.0'] + else + s.swift_version = '5.0' + end 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 931b615..134dfaa 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick.xcodeproj/project.pbxproj +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick.xcodeproj/project.pbxproj @@ -119,6 +119,9 @@ 64076D231D6D7E6B00E2B499 /* AfterSuiteTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64076D1D1D6D7D0B00E2B499 /* AfterSuiteTests.swift */; }; 64076D261D6D80B500E2B499 /* AfterSuiteTests+ObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = 64076D241D6D80B500E2B499 /* AfterSuiteTests+ObjC.m */; }; 64076D271D6D80B500E2B499 /* AfterSuiteTests+ObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = 64076D241D6D80B500E2B499 /* AfterSuiteTests+ObjC.m */; }; + 79FE27DF22DC955400BA013D /* QuickSpec_SelectedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79FE27DE22DC955400BA013D /* QuickSpec_SelectedTests.swift */; }; + 79FE27E022DC955400BA013D /* QuickSpec_SelectedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79FE27DE22DC955400BA013D /* QuickSpec_SelectedTests.swift */; }; + 79FE27E122DC955400BA013D /* QuickSpec_SelectedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79FE27DE22DC955400BA013D /* QuickSpec_SelectedTests.swift */; }; 7B44ADBE1C5444940007AF2E /* HooksPhase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B44ADBD1C5444940007AF2E /* HooksPhase.swift */; }; 7B44ADBF1C5444940007AF2E /* HooksPhase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B44ADBD1C5444940007AF2E /* HooksPhase.swift */; }; 7B44ADC01C5444940007AF2E /* HooksPhase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B44ADBD1C5444940007AF2E /* HooksPhase.swift */; }; @@ -128,19 +131,34 @@ 8D010A571C11726F00633E2B /* DescribeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D010A561C11726F00633E2B /* DescribeTests.swift */; }; 8D010A581C11726F00633E2B /* DescribeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D010A561C11726F00633E2B /* DescribeTests.swift */; }; 8D010A591C11726F00633E2B /* DescribeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D010A561C11726F00633E2B /* DescribeTests.swift */; }; - AE4E58131C73097A00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */ = {isa = PBXBuildFile; fileRef = AEB080BB1C72F028004917D3 /* XCTestObservationCenter+QCKSuspendObservation.m */; }; - AE4E58141C73097A00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */ = {isa = PBXBuildFile; fileRef = AEB080BB1C72F028004917D3 /* XCTestObservationCenter+QCKSuspendObservation.m */; }; - AE4E58151C73097C00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */ = {isa = PBXBuildFile; fileRef = AEB080BB1C72F028004917D3 /* XCTestObservationCenter+QCKSuspendObservation.m */; }; - AE4E58161C73097C00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */ = {isa = PBXBuildFile; fileRef = AEB080BB1C72F028004917D3 /* XCTestObservationCenter+QCKSuspendObservation.m */; }; - AE4E58171C73097E00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */ = {isa = PBXBuildFile; fileRef = AEB080BB1C72F028004917D3 /* XCTestObservationCenter+QCKSuspendObservation.m */; }; - AE4E58181C73097E00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */ = {isa = PBXBuildFile; fileRef = AEB080BB1C72F028004917D3 /* XCTestObservationCenter+QCKSuspendObservation.m */; }; AED9C8631CC8A7BD00432F62 /* CrossReferencingSpecs.swift in Sources */ = {isa = PBXBuildFile; fileRef = AED9C8621CC8A7BD00432F62 /* CrossReferencingSpecs.swift */; }; AED9C8641CC8A7BD00432F62 /* CrossReferencingSpecs.swift in Sources */ = {isa = PBXBuildFile; fileRef = AED9C8621CC8A7BD00432F62 /* CrossReferencingSpecs.swift */; }; AED9C8651CC8A7BD00432F62 /* CrossReferencingSpecs.swift in Sources */ = {isa = PBXBuildFile; fileRef = AED9C8621CC8A7BD00432F62 /* CrossReferencingSpecs.swift */; }; + CD1F6503226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD1F6502226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift */; }; + CD1F6504226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD1F6502226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift */; }; + CD1F6505226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD1F6502226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift */; }; + CD1F6506226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD1F6502226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift */; }; + CD1F6507226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD1F6502226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift */; }; + CD1F6508226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD1F6502226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift */; }; + CD21A026247C1385002C4762 /* QuickTestObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD21A025247C1385002C4762 /* QuickTestObservation.swift */; }; + CD21A027247C1385002C4762 /* QuickTestObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD21A025247C1385002C4762 /* QuickTestObservation.swift */; }; + CD21A028247C1385002C4762 /* QuickTestObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD21A025247C1385002C4762 /* QuickTestObservation.swift */; }; CD264DBD1DDA147A0038B0EB /* AfterSuiteTests+ObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = 64076D241D6D80B500E2B499 /* AfterSuiteTests+ObjC.m */; }; - CD564DA020B5B09C00C15E6B /* QuickSpec+QuickSpec_MethodList.m in Sources */ = {isa = PBXBuildFile; fileRef = 96327C621C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m */; }; - CD564DA120B5B09D00C15E6B /* QuickSpec+QuickSpec_MethodList.m in Sources */ = {isa = PBXBuildFile; fileRef = 96327C621C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m */; }; - CD564DA220B5B09E00C15E6B /* QuickSpec+QuickSpec_MethodList.m in Sources */ = {isa = PBXBuildFile; fileRef = 96327C621C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m */; }; + CD582D6F2264B371008F7CE6 /* QuickSpec+MethodList.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD582D6E2264B371008F7CE6 /* QuickSpec+MethodList.swift */; }; + CD582D702264B371008F7CE6 /* QuickSpec+MethodList.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD582D6E2264B371008F7CE6 /* QuickSpec+MethodList.swift */; }; + CD582D712264B371008F7CE6 /* QuickSpec+MethodList.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD582D6E2264B371008F7CE6 /* QuickSpec+MethodList.swift */; }; + CD582D732264C137008F7CE6 /* QuickSpecRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD582D722264C137008F7CE6 /* QuickSpecRunner.swift */; }; + CD582D742264C137008F7CE6 /* QuickSpecRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD582D722264C137008F7CE6 /* QuickSpecRunner.swift */; }; + CD582D752264C137008F7CE6 /* QuickSpecRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD582D722264C137008F7CE6 /* QuickSpecRunner.swift */; }; + CD582D762264C137008F7CE6 /* QuickSpecRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD582D722264C137008F7CE6 /* QuickSpecRunner.swift */; }; + CD582D772264C137008F7CE6 /* QuickSpecRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD582D722264C137008F7CE6 /* QuickSpecRunner.swift */; }; + CD582D782264C137008F7CE6 /* QuickSpecRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD582D722264C137008F7CE6 /* QuickSpecRunner.swift */; }; + CD89D175247A673100C1F086 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8100E901A1E4447007595ED /* Nimble.framework */; }; + CD89D176247A673100C1F086 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAEB6B8E1943873100289F44 /* Quick.framework */; }; + CD89D17F247A68A100C1F086 /* SubclassOfSubclassWithStructPropertyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD89D17E247A68A000C1F086 /* SubclassOfSubclassWithStructPropertyTests.swift */; }; + CDE5BDFD2268CE95006E2F66 /* QuickConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD261AC81DEC8B0000A8863C /* QuickConfiguration.swift */; }; + CDE5BDFE2268CE96006E2F66 /* QuickConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD261AC81DEC8B0000A8863C /* QuickConfiguration.swift */; }; + CDE5BDFF2268CE97006E2F66 /* QuickConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD261AC81DEC8B0000A8863C /* QuickConfiguration.swift */; }; CE175D4E1E8D6B4900EB5E84 /* Behavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE175D4D1E8D6B4900EB5E84 /* Behavior.swift */; }; CE175D4F1E8D6B4900EB5E84 /* Behavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE175D4D1E8D6B4900EB5E84 /* Behavior.swift */; }; CE175D501E8D6B4900EB5E84 /* Behavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE175D4D1E8D6B4900EB5E84 /* Behavior.swift */; }; @@ -237,148 +255,15 @@ DAEB6B9A1943873100289F44 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAEB6B8E1943873100289F44 /* Quick.framework */; }; DAF28BC31A4DB8EC00A5D9BF /* FocusedTests+ObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = DAF28BC21A4DB8EC00A5D9BF /* FocusedTests+ObjC.m */; }; DAF28BC41A4DB8EC00A5D9BF /* FocusedTests+ObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = DAF28BC21A4DB8EC00A5D9BF /* FocusedTests+ObjC.m */; }; - DED3036B1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED3036A1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift */; }; - DED3036C1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED3036A1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift */; }; - DED3036D1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED3036A1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift */; }; + DED3036B1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED3036A1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift */; }; + DED3036C1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED3036A1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift */; }; + DED3036D1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED3036A1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift */; }; DED3037D1DF6CF140041394E /* BundleModuleNameTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED3037C1DF6CF140041394E /* BundleModuleNameTests.swift */; }; DED3037E1DF6CF140041394E /* BundleModuleNameTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED3037C1DF6CF140041394E /* BundleModuleNameTests.swift */; }; DED3037F1DF6CF140041394E /* BundleModuleNameTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED3037C1DF6CF140041394E /* BundleModuleNameTests.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 047655511949F4CB00B288BB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DAEB6B8D1943873100289F44; - remoteInfo = Quick; - }; - 047655531949F4CB00B288BB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DAEB6B8D1943873100289F44; - remoteInfo = Quick; - }; - 04765555194A327000B288BB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DAEB6B8D1943873100289F44; - remoteInfo = Quick; - }; - 04DC97E4194B4A6000CE00B6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DAEB6B8D1943873100289F44; - remoteInfo = Quick; - }; - 04DC97E6194B4A6000CE00B6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DAEB6B8D1943873100289F44; - remoteInfo = Quick; - }; - 04DC97E8194B4B7E00CE00B6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5A5D117B19473F2100F6D13D; - remoteInfo = "Quick-iOS"; - }; - 04DC97EA194B4B9B00CE00B6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5A5D117B19473F2100F6D13D; - remoteInfo = "Quick-iOS"; - }; - 04DC97F0194B82DB00CE00B6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DAEB6B8D1943873100289F44; - remoteInfo = Quick; - }; - 04DC97F2194B82DE00CE00B6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5A5D117B19473F2100F6D13D; - remoteInfo = "Quick-iOS"; - }; - 04DC97F6194B831200CE00B6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5A5D117B19473F2100F6D13D; - remoteInfo = "Quick-iOS"; - }; - 04DC97F8194B834000CE00B6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DAEB6B8D1943873100289F44; - remoteInfo = Quick; - }; - 04DC97FA194B834100CE00B6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5A5D117B19473F2100F6D13D; - remoteInfo = "Quick-iOS"; - }; - 04DC97FC194B834B00CE00B6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DAEB6B8D1943873100289F44; - remoteInfo = Quick; - }; - 04DC97FE194B835E00CE00B6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5A5D117B19473F2100F6D13D; - remoteInfo = "Quick-iOS"; - }; - 04DC9800194B836100CE00B6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DAEB6B8D1943873100289F44; - remoteInfo = Quick; - }; - 04DC9802194B836300CE00B6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5A5D117B19473F2100F6D13D; - remoteInfo = "Quick-iOS"; - }; - 04DC9804194B838400CE00B6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DAEB6B8D1943873100289F44; - remoteInfo = Quick; - }; - 04DC9806194B838700CE00B6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5A5D117B19473F2100F6D13D; - remoteInfo = "Quick-iOS"; - }; - 04DC9808194B838B00CE00B6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DAEB6B8D1943873100289F44; - remoteInfo = Quick; - }; 1F118CE01BDCA4AB005013A2 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = DAEB6B851943873100289F44 /* Project object */; @@ -393,27 +278,6 @@ remoteGlobalIDString = 1F118CD41BDCA4AB005013A2; remoteInfo = "Quick-tvOS"; }; - 5A5D118819473F2100F6D13D /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5A5D117B19473F2100F6D13D; - remoteInfo = "Quick-iOS"; - }; - 5A5D11EF194741B500F6D13D /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5A5D117B19473F2100F6D13D; - remoteInfo = "Quick-iOS"; - }; - 5A5D11F1194741B500F6D13D /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5A5D117B19473F2100F6D13D; - remoteInfo = "Quick-iOS"; - }; 64076CE71D6D7C2000E2B499 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = DAEB6B851943873100289F44 /* Project object */; @@ -435,12 +299,26 @@ remoteGlobalIDString = 1F118CD41BDCA4AB005013A2; remoteInfo = "Quick-tvOS"; }; - 93625F381951DDC8006B1FE1 /* PBXContainerItemProxy */ = { + CD89D14824791ED000C1F086 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = DAEB6B851943873100289F44 /* Project object */; proxyType = 1; remoteGlobalIDString = DAEB6B8D1943873100289F44; - remoteInfo = Quick; + remoteInfo = "Quick-macOS"; + }; + CD89D14A24791EDA00C1F086 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = DAEB6B851943873100289F44 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 5A5D117B19473F2100F6D13D; + remoteInfo = "Quick-iOS"; + }; + CD89D14E247A673100C1F086 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = DAEB6B851943873100289F44 /* Project object */; + proxyType = 1; + remoteGlobalIDString = DAEB6B8D1943873100289F44; + remoteInfo = "Quick-macOS"; }; DA5663EF1A4C8D8500193C88 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; @@ -456,13 +334,6 @@ remoteGlobalIDString = 5A5D117B19473F2100F6D13D; remoteInfo = "Quick-iOS"; }; - DAEB6B9B1943873100289F44 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DAEB6B851943873100289F44 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DAEB6B8D1943873100289F44; - remoteInfo = Quick; - }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ @@ -493,16 +364,21 @@ 64076D1A1D6D7CEA00E2B499 /* QuickAfterSuite - tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "QuickAfterSuite - tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 64076D1D1D6D7D0B00E2B499 /* AfterSuiteTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AfterSuiteTests.swift; sourceTree = ""; }; 64076D241D6D80B500E2B499 /* AfterSuiteTests+ObjC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "AfterSuiteTests+ObjC.m"; sourceTree = ""; }; + 79FE27DE22DC955400BA013D /* QuickSpec_SelectedTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickSpec_SelectedTests.swift; sourceTree = ""; }; 7B44ADBD1C5444940007AF2E /* HooksPhase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HooksPhase.swift; sourceTree = ""; }; 7B5358CA1C3D4E2A00A23FAA /* ContextTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContextTests.swift; sourceTree = ""; }; 8D010A561C11726F00633E2B /* DescribeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DescribeTests.swift; sourceTree = ""; }; - 96327C611C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "QuickSpec+QuickSpec_MethodList.h"; sourceTree = ""; }; - 96327C621C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "QuickSpec+QuickSpec_MethodList.m"; sourceTree = ""; }; - AEB080BB1C72F028004917D3 /* XCTestObservationCenter+QCKSuspendObservation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "XCTestObservationCenter+QCKSuspendObservation.m"; sourceTree = ""; }; AED9C8621CC8A7BD00432F62 /* CrossReferencingSpecs.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CrossReferencingSpecs.swift; sourceTree = ""; }; + CD1F6502226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "XCTestObservationCenter+QCKSuspendObservation.swift"; sourceTree = ""; }; + CD21A025247C1385002C4762 /* QuickTestObservation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickTestObservation.swift; sourceTree = ""; }; CD261AC81DEC8B0000A8863C /* QuickConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QuickConfiguration.swift; sourceTree = ""; }; CD3451461E4703D4000C8633 /* QuickMain.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QuickMain.swift; sourceTree = ""; }; CD3451471E4703D4000C8633 /* QuickSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QuickSpec.swift; sourceTree = ""; }; + CD582D6E2264B371008F7CE6 /* QuickSpec+MethodList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "QuickSpec+MethodList.swift"; sourceTree = ""; }; + CD582D722264C137008F7CE6 /* QuickSpecRunner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickSpecRunner.swift; sourceTree = ""; }; + CD665CE0225A5BB9008F0AE6 /* LinuxMain.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LinuxMain.swift; path = Tests/LinuxMain.swift; sourceTree = SOURCE_ROOT; }; + CD89D17B247A673100C1F086 /* QuickIssue853RegressionTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = QuickIssue853RegressionTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + CD89D17E247A68A000C1F086 /* SubclassOfSubclassWithStructPropertyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubclassOfSubclassWithStructPropertyTests.swift; sourceTree = ""; }; CE175D4D1E8D6B4900EB5E84 /* Behavior.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Behavior.swift; sourceTree = ""; }; CE4A57891EA5DC270063C0D4 /* BehaviorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BehaviorTests.swift; sourceTree = ""; }; CE4A578D1EA7251C0063C0D4 /* FunctionalTests_BehaviorTests_Behaviors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FunctionalTests_BehaviorTests_Behaviors.swift; sourceTree = ""; }; @@ -531,7 +407,6 @@ DA8F919519F31680006F6675 /* QCKSpecRunner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QCKSpecRunner.h; sourceTree = ""; }; DA8F919619F31680006F6675 /* QCKSpecRunner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QCKSpecRunner.m; sourceTree = ""; }; DA8F919719F31680006F6675 /* QuickTestsBridgingHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuickTestsBridgingHeader.h; sourceTree = ""; }; - DA8F919819F31680006F6675 /* XCTestObservationCenter+QCKSuspendObservation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "XCTestObservationCenter+QCKSuspendObservation.h"; sourceTree = ""; }; DA8F919C19F31921006F6675 /* FailureTests+ObjC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "FailureTests+ObjC.m"; sourceTree = ""; }; DA8F91A419F3208B006F6675 /* BeforeSuiteTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BeforeSuiteTests.swift; sourceTree = ""; }; DA8F91AA19F3299E006F6675 /* SharedExamplesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SharedExamplesTests.swift; sourceTree = ""; }; @@ -553,7 +428,7 @@ DAEB6B991943873100289F44 /* Quick - macOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Quick - macOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; DAEB6B9F1943873100289F44 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; DAF28BC21A4DB8EC00A5D9BF /* FocusedTests+ObjC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "FocusedTests+ObjC.m"; sourceTree = ""; }; - DED3036A1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSString+C99ExtendedIdentifier.swift"; sourceTree = ""; }; + DED3036A1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+C99ExtendedIdentifier.swift"; sourceTree = ""; }; DED3037C1DF6CF140041394E /* BundleModuleNameTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BundleModuleNameTests.swift; sourceTree = ""; }; F8100E901A1E4447007595ED /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -627,6 +502,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + CD89D174247A673100C1F086 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + CD89D175247A673100C1F086 /* Nimble.framework in Frameworks */, + CD89D176247A673100C1F086 /* Quick.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; DA5663E51A4C8D8500193C88 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -715,6 +599,15 @@ path = DSL; sourceTree = ""; }; + CD89D17D247A67BA00C1F086 /* QuickIssue853RegressionTests */ = { + isa = PBXGroup; + children = ( + CD89D17E247A68A000C1F086 /* SubclassOfSubclassWithStructPropertyTests.swift */, + ); + name = QuickIssue853RegressionTests; + path = Tests/QuickIssue853RegressionTests; + sourceTree = ""; + }; CDB2AA5E1D6C84CF005600C3 /* ObjC */ = { isa = PBXGroup; children = ( @@ -766,11 +659,10 @@ DA8F919719F31680006F6675 /* QuickTestsBridgingHeader.h */, DA8F919519F31680006F6675 /* QCKSpecRunner.h */, DA8F919619F31680006F6675 /* QCKSpecRunner.m */, + CD582D722264C137008F7CE6 /* QuickSpecRunner.swift */, + CD582D6E2264B371008F7CE6 /* QuickSpec+MethodList.swift */, 34ACFB7B1C34859300942064 /* XCTestCaseProvider.swift */, - DA8F919819F31680006F6675 /* XCTestObservationCenter+QCKSuspendObservation.h */, - 96327C611C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.h */, - 96327C621C56E90C00405AB3 /* QuickSpec+QuickSpec_MethodList.m */, - AEB080BB1C72F028004917D3 /* XCTestObservationCenter+QCKSuspendObservation.m */, + CD1F6502226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift */, ); path = Helpers; sourceTree = ""; @@ -793,6 +685,7 @@ DED3037C1DF6CF140041394E /* BundleModuleNameTests.swift */, CE4A57891EA5DC270063C0D4 /* BehaviorTests.swift */, DA5CBB471EAFA55800297C9E /* CurrentSpecTests.swift */, + 79FE27DE22DC955400BA013D /* QuickSpec_SelectedTests.swift */, ); path = FunctionalTests; sourceTree = ""; @@ -849,6 +742,7 @@ DAEB6B901943873100289F44 /* Quick */, 6C3983EE1D1E930D00637469 /* QuickObjectiveC */, DAEB6B9D1943873100289F44 /* QuickTests */, + CD89D17D247A67BA00C1F086 /* QuickIssue853RegressionTests */, DA9876BE1A4C87200004AA17 /* QuickFocusedTests */, 64076D1C1D6D7D0B00E2B499 /* QuickAfterSuiteTests */, DAEB6B8F1943873100289F44 /* Products */, @@ -873,6 +767,7 @@ 64076CF51D6D7C2000E2B499 /* QuickAfterSuite - macOSTests.xctest */, 64076D081D6D7CD600E2B499 /* QuickAfterSuite - iOSTests.xctest */, 64076D1A1D6D7CEA00E2B499 /* QuickAfterSuite - tvOSTests.xctest */, + CD89D17B247A673100C1F086 /* QuickIssue853RegressionTests.xctest */, ); name = Products; sourceTree = ""; @@ -885,6 +780,7 @@ DA408BDE19FF5599005DF92A /* Hooks */, CD3451461E4703D4000C8633 /* QuickMain.swift */, CD3451471E4703D4000C8633 /* QuickSpec.swift */, + CD21A025247C1385002C4762 /* QuickTestObservation.swift */, 34F375A619515CA700CE1B99 /* World.swift */, 34F3759E19515CA700CE1B99 /* Example.swift */, DA02C91819A8073100093156 /* ExampleMetadata.swift */, @@ -894,7 +790,7 @@ CE57CEDA1C430BD200D63004 /* QuickTestSuite.swift */, CE57CED91C430BD200D63004 /* QuickSelectedTestSuiteBuilder.swift */, CE57CED81C430BD200D63004 /* NSBundle+CurrentTestBundle.swift */, - DED3036A1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift */, + DED3036A1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift */, CE57CEDB1C430BD200D63004 /* URL+FileName.swift */, 34C586071C4AC5E500D4F057 /* ErrorUtility.swift */, DAEB6B911943873100289F44 /* Supporting Files */, @@ -915,6 +811,7 @@ DAEB6B9D1943873100289F44 /* QuickTests */ = { isa = PBXGroup; children = ( + CD665CE0225A5BB9008F0AE6 /* LinuxMain.swift */, DA8C00201A01E4B900CE58A6 /* QuickConfigurationTests.m */, DA8F919419F31680006F6675 /* Helpers */, DAEB6BCD194387D700289F44 /* Fixtures */, @@ -1073,17 +970,7 @@ buildRules = ( ); dependencies = ( - 5A5D118919473F2100F6D13D /* PBXTargetDependency */, - 5A5D11F0194741B500F6D13D /* PBXTargetDependency */, - 5A5D11F2194741B500F6D13D /* PBXTargetDependency */, - 04DC97E9194B4B7E00CE00B6 /* PBXTargetDependency */, - 04DC97EB194B4B9B00CE00B6 /* PBXTargetDependency */, - 04DC97F3194B82DE00CE00B6 /* PBXTargetDependency */, - 04DC97F7194B831200CE00B6 /* PBXTargetDependency */, - 04DC97FB194B834100CE00B6 /* PBXTargetDependency */, - 04DC97FF194B835E00CE00B6 /* PBXTargetDependency */, - 04DC9803194B836300CE00B6 /* PBXTargetDependency */, - 04DC9807194B838700CE00B6 /* PBXTargetDependency */, + CD89D14B24791EDA00C1F086 /* PBXTargetDependency */, ); name = "Quick - iOSTests"; productName = "Quick-iOSTests"; @@ -1144,6 +1031,24 @@ productReference = 64076D1A1D6D7CEA00E2B499 /* QuickAfterSuite - tvOSTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; + CD89D14C247A673100C1F086 /* QuickIssue853RegressionTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = CD89D178247A673100C1F086 /* Build configuration list for PBXNativeTarget "QuickIssue853RegressionTests" */; + buildPhases = ( + CD89D14F247A673100C1F086 /* Sources */, + CD89D174247A673100C1F086 /* Frameworks */, + CD89D177247A673100C1F086 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + CD89D14D247A673100C1F086 /* PBXTargetDependency */, + ); + name = QuickIssue853RegressionTests; + productName = QuickTests; + productReference = CD89D17B247A673100C1F086 /* QuickIssue853RegressionTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; DA5663E71A4C8D8500193C88 /* QuickFocused - macOSTests */ = { isa = PBXNativeTarget; buildConfigurationList = DA5663F31A4C8D8500193C88 /* Build configuration list for PBXNativeTarget "QuickFocused - macOSTests" */; @@ -1209,19 +1114,7 @@ buildRules = ( ); dependencies = ( - DAEB6B9C1943873100289F44 /* PBXTargetDependency */, - 047655521949F4CB00B288BB /* PBXTargetDependency */, - 047655541949F4CB00B288BB /* PBXTargetDependency */, - 04765556194A327000B288BB /* PBXTargetDependency */, - 04DC97E5194B4A6000CE00B6 /* PBXTargetDependency */, - 04DC97E7194B4A6000CE00B6 /* PBXTargetDependency */, - 04DC97F1194B82DB00CE00B6 /* PBXTargetDependency */, - 04DC97F9194B834000CE00B6 /* PBXTargetDependency */, - 04DC97FD194B834B00CE00B6 /* PBXTargetDependency */, - 04DC9801194B836100CE00B6 /* PBXTargetDependency */, - 04DC9805194B838400CE00B6 /* PBXTargetDependency */, - 04DC9809194B838B00CE00B6 /* PBXTargetDependency */, - 93625F391951DDC8006B1FE1 /* PBXTargetDependency */, + CD89D14924791ED000C1F086 /* PBXTargetDependency */, ); name = "Quick - macOSTests"; productName = QuickTests; @@ -1235,7 +1128,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0810; - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "Brian Ivan Gesiak"; TargetAttributes = { 1F118CD41BDCA4AB005013A2 = { @@ -1284,10 +1177,11 @@ }; buildConfigurationList = DAEB6B881943873100289F44 /* Build configuration list for PBXProject "Quick" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = DAEB6B841943873100289F44; productRefGroup = DAEB6B8F1943873100289F44 /* Products */; @@ -1296,6 +1190,7 @@ targets = ( DAEB6B8D1943873100289F44 /* Quick-macOS */, DAEB6B981943873100289F44 /* Quick - macOSTests */, + CD89D14C247A673100C1F086 /* QuickIssue853RegressionTests */, DA5663E71A4C8D8500193C88 /* QuickFocused - macOSTests */, 64076CE51D6D7C2000E2B499 /* QuickAfterSuite - macOSTests */, 5A5D117B19473F2100F6D13D /* Quick-iOS */, @@ -1368,6 +1263,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + CD89D177247A673100C1F086 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; DA5663E61A4C8D8500193C88 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -1427,7 +1329,7 @@ 34C5860A1C4AC5E500D4F057 /* ErrorUtility.swift in Sources */, 1F118D041BDCA536005013A2 /* Example.swift in Sources */, 1F118CFF1BDCA536005013A2 /* QCKDSL.m in Sources */, - DED3036D1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift in Sources */, + DED3036D1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift in Sources */, CE590E211C431FE400253D19 /* NSBundle+CurrentTestBundle.swift in Sources */, 1F118D071BDCA536005013A2 /* Callsite.swift in Sources */, CE590E231C431FE400253D19 /* XCTestSuite+QuickTestSuiteBuilder.m in Sources */, @@ -1442,6 +1344,8 @@ CE175D501E8D6B4900EB5E84 /* Behavior.swift in Sources */, CE590E1F1C431FE400253D19 /* QuickTestSuite.swift in Sources */, 1F118D091BDCA536005013A2 /* QuickSpec.m in Sources */, + CD21A028247C1385002C4762 /* QuickTestObservation.swift in Sources */, + CDE5BDFF2268CE97006E2F66 /* QuickConfiguration.swift in Sources */, 1F118D011BDCA536005013A2 /* ExampleHooks.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1452,6 +1356,7 @@ files = ( 1F118D381BDCA6E1005013A2 /* Configuration+BeforeEachTests.swift in Sources */, 1F118D121BDCA556005013A2 /* ItTests.swift in Sources */, + 79FE27E122DC955400BA013D /* QuickSpec_SelectedTests.swift in Sources */, 1F118D1C1BDCA556005013A2 /* BeforeSuiteTests.swift in Sources */, 1F118D1D1BDCA556005013A2 /* BeforeSuiteTests+ObjC.m in Sources */, 1F118D0E1BDCA547005013A2 /* QCKSpecRunner.m in Sources */, @@ -1460,6 +1365,7 @@ CE4A57911EA7252E0063C0D4 /* FunctionalTests_BehaviorTests_Behaviors.swift in Sources */, DED3037F1DF6CF140041394E /* BundleModuleNameTests.swift in Sources */, 1F118D0F1BDCA54B005013A2 /* FunctionalTests_SharedExamplesTests_SharedExamples.swift in Sources */, + CD1F6507226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */, 1F118D101BDCA556005013A2 /* Configuration+AfterEach.swift in Sources */, 1F118D1A1BDCA556005013A2 /* PendingTests.swift in Sources */, 1F118D171BDCA556005013A2 /* BeforeEachTests+ObjC.m in Sources */, @@ -1468,14 +1374,14 @@ 1F118D131BDCA556005013A2 /* ItTests+ObjC.m in Sources */, 1F118D191BDCA556005013A2 /* AfterEachTests+ObjC.m in Sources */, 1F118D221BDCA556005013A2 /* SharedExamples+BeforeEachTests.swift in Sources */, - AE4E58171C73097E00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */, AED9C8651CC8A7BD00432F62 /* CrossReferencingSpecs.swift in Sources */, 1F118D211BDCA556005013A2 /* SharedExamplesTests+ObjC.m in Sources */, 1F118D201BDCA556005013A2 /* SharedExamplesTests.swift in Sources */, 1F118D0C1BDCA543005013A2 /* QuickConfigurationTests.m in Sources */, + CD582D712264B371008F7CE6 /* QuickSpec+MethodList.swift in Sources */, 1F118D391BDCA6E6005013A2 /* Configuration+BeforeEach.swift in Sources */, - CD564DA220B5B09E00C15E6B /* QuickSpec+QuickSpec_MethodList.m in Sources */, 1F118D181BDCA556005013A2 /* AfterEachTests.swift in Sources */, + CD582D772264C137008F7CE6 /* QuickSpecRunner.swift in Sources */, 1F118D1B1BDCA556005013A2 /* PendingTests+ObjC.m in Sources */, 34C586051C4ABD4100D4F057 /* XCTestCaseProvider.swift in Sources */, 8D010A591C11726F00633E2B /* DescribeTests.swift in Sources */, @@ -1490,11 +1396,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + CD582D782264C137008F7CE6 /* QuickSpecRunner.swift in Sources */, + CD1F6508226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */, 1F118D0D1BDCA547005013A2 /* QCKSpecRunner.m in Sources */, 34C586061C4ABD4100D4F057 /* XCTestCaseProvider.swift in Sources */, 1F118D241BDCA561005013A2 /* FocusedTests.swift in Sources */, 1F118D251BDCA561005013A2 /* FocusedTests+ObjC.m in Sources */, - AE4E58181C73097E00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1509,7 +1416,7 @@ 34C586091C4AC5E500D4F057 /* ErrorUtility.swift in Sources */, DA408BE719FF5599005DF92A /* SuiteHooks.swift in Sources */, 34F375BA19515CA700CE1B99 /* QuickSpec.m in Sources */, - DED3036C1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift in Sources */, + DED3036C1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift in Sources */, CE590E1C1C431FE300253D19 /* NSBundle+CurrentTestBundle.swift in Sources */, DAE7150119FF6A62005905B8 /* QuickConfiguration.m in Sources */, CE590E1E1C431FE300253D19 /* XCTestSuite+QuickTestSuiteBuilder.m in Sources */, @@ -1525,6 +1432,8 @@ CE175D4F1E8D6B4900EB5E84 /* Behavior.swift in Sources */, CE590E1A1C431FE300253D19 /* QuickTestSuite.swift in Sources */, DA3124E719FCAEE8002858A7 /* DSL.swift in Sources */, + CD21A027247C1385002C4762 /* QuickTestObservation.swift in Sources */, + CDE5BDFE2268CE96006E2F66 /* QuickConfiguration.swift in Sources */, DA6B30191A4DB0D500FFB148 /* Filter.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1535,6 +1444,7 @@ files = ( DAE714F819FF6812005905B8 /* Configuration+AfterEach.swift in Sources */, DAA7C0D719F777EB0093D1D9 /* BeforeEachTests.swift in Sources */, + 79FE27E022DC955400BA013D /* QuickSpec_SelectedTests.swift in Sources */, DA8F919A19F31680006F6675 /* QCKSpecRunner.m in Sources */, DA8940F11B35B1FA00161061 /* FailureUsingXCTAssertTests+ObjC.m in Sources */, 4728253C1A5EECCE008DC74F /* SharedExamplesTests+ObjC.m in Sources */, @@ -1543,6 +1453,7 @@ DA05D61119F73A3800771050 /* AfterEachTests.swift in Sources */, DAB0137019FC4315006AFBEE /* SharedExamples+BeforeEachTests.swift in Sources */, DA8F91A619F3208B006F6675 /* BeforeSuiteTests.swift in Sources */, + CD1F6505226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */, DA8C00221A01E4B900CE58A6 /* QuickConfigurationTests.m in Sources */, CE4A578A1EA5DC270063C0D4 /* BehaviorTests.swift in Sources */, DAA63EA419F7637300CD0A3B /* PendingTests.swift in Sources */, @@ -1552,13 +1463,13 @@ CE4A578E1EA7251C0063C0D4 /* FunctionalTests_BehaviorTests_Behaviors.swift in Sources */, DA8F91AF19F32CE2006F6675 /* FunctionalTests_SharedExamplesTests_SharedExamples.swift in Sources */, DAE714FB19FF682A005905B8 /* Configuration+AfterEachTests.swift in Sources */, - AE4E58151C73097C00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */, AED9C8641CC8A7BD00432F62 /* CrossReferencingSpecs.swift in Sources */, 471590411A488F3F00FBA644 /* PendingTests+ObjC.m in Sources */, DA8F919E19F31921006F6675 /* FailureTests+ObjC.m in Sources */, + CD582D702264B371008F7CE6 /* QuickSpec+MethodList.swift in Sources */, DAE714F419FF65E7005905B8 /* Configuration+BeforeEach.swift in Sources */, - CD564DA120B5B09D00C15E6B /* QuickSpec+QuickSpec_MethodList.m in Sources */, 479C31E41A36172700DA8718 /* ItTests+ObjC.m in Sources */, + CD582D752264C137008F7CE6 /* QuickSpecRunner.swift in Sources */, 34C586031C4ABD4000D4F057 /* XCTestCaseProvider.swift in Sources */, 8D010A581C11726F00633E2B /* DescribeTests.swift in Sources */, 47FAEA371A3F49EB005A1D2F /* BeforeEachTests+ObjC.m in Sources */, @@ -1596,15 +1507,24 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + CD89D14F247A673100C1F086 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CD89D17F247A68A100C1F086 /* SubclassOfSubclassWithStructPropertyTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; DA5663E41A4C8D8500193C88 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + CD582D742264C137008F7CE6 /* QuickSpecRunner.swift in Sources */, + CD1F6504226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */, DA07722E1A4E5B7B0098839D /* QCKSpecRunner.m in Sources */, 34C586021C4ABD3F00D4F057 /* XCTestCaseProvider.swift in Sources */, DA5663F41A4C8D9A00193C88 /* FocusedTests.swift in Sources */, DAF28BC31A4DB8EC00A5D9BF /* FocusedTests+ObjC.m in Sources */, - AE4E58141C73097A00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1612,11 +1532,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + CD582D762264C137008F7CE6 /* QuickSpecRunner.swift in Sources */, + CD1F6506226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */, DA07722F1A4E5B7C0098839D /* QCKSpecRunner.m in Sources */, 34C586041C4ABD4000D4F057 /* XCTestCaseProvider.swift in Sources */, DA9876C11A4C87200004AA17 /* FocusedTests.swift in Sources */, DAF28BC41A4DB8EC00A5D9BF /* FocusedTests+ObjC.m in Sources */, - AE4E58161C73097C00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1631,7 +1552,7 @@ DA02C91919A8073100093156 /* ExampleMetadata.swift in Sources */, CE57CEDF1C430BD200D63004 /* QuickTestSuite.swift in Sources */, 34C586081C4AC5E500D4F057 /* ErrorUtility.swift in Sources */, - DED3036B1DF6C66B0041394E /* NSString+C99ExtendedIdentifier.swift in Sources */, + DED3036B1DF6C66B0041394E /* String+C99ExtendedIdentifier.swift in Sources */, DA408BE619FF5599005DF92A /* SuiteHooks.swift in Sources */, 34F375B919515CA700CE1B99 /* QuickSpec.m in Sources */, CE57CEE11C430BD200D63004 /* XCTestSuite+QuickTestSuiteBuilder.m in Sources */, @@ -1647,6 +1568,8 @@ CE175D4E1E8D6B4900EB5E84 /* Behavior.swift in Sources */, 34F375AB19515CA700CE1B99 /* Example.swift in Sources */, DA3124E619FCAEE8002858A7 /* DSL.swift in Sources */, + CD21A026247C1385002C4762 /* QuickTestObservation.swift in Sources */, + CDE5BDFD2268CE95006E2F66 /* QuickConfiguration.swift in Sources */, DA6B30181A4DB0D500FFB148 /* Filter.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1657,6 +1580,7 @@ files = ( DAE714F719FF6812005905B8 /* Configuration+AfterEach.swift in Sources */, DAB067E919F7801C00F970AC /* BeforeEachTests.swift in Sources */, + 79FE27DF22DC955400BA013D /* QuickSpec_SelectedTests.swift in Sources */, DA8F919919F31680006F6675 /* QCKSpecRunner.m in Sources */, DA8940F01B35B1FA00161061 /* FailureUsingXCTAssertTests+ObjC.m in Sources */, 4728253B1A5EECCE008DC74F /* SharedExamplesTests+ObjC.m in Sources */, @@ -1665,6 +1589,7 @@ CE4A57921EA725300063C0D4 /* FunctionalTests_BehaviorTests_Behaviors.swift in Sources */, DED3037D1DF6CF140041394E /* BundleModuleNameTests.swift in Sources */, DA05D61019F73A3800771050 /* AfterEachTests.swift in Sources */, + CD1F6503226398F600EBE9D8 /* XCTestObservationCenter+QCKSuspendObservation.swift in Sources */, DAB0136F19FC4315006AFBEE /* SharedExamples+BeforeEachTests.swift in Sources */, DA8F91A519F3208B006F6675 /* BeforeSuiteTests.swift in Sources */, DA8C00211A01E4B900CE58A6 /* QuickConfigurationTests.m in Sources */, @@ -1674,13 +1599,13 @@ 4748E8941A6AEBB3009EC992 /* SharedExamples+BeforeEachTests+ObjC.m in Sources */, DA8F91AE19F32CE2006F6675 /* FunctionalTests_SharedExamplesTests_SharedExamples.swift in Sources */, DAE714FA19FF682A005905B8 /* Configuration+AfterEachTests.swift in Sources */, - AE4E58131C73097A00420A2E /* XCTestObservationCenter+QCKSuspendObservation.m in Sources */, AED9C8631CC8A7BD00432F62 /* CrossReferencingSpecs.swift in Sources */, 471590401A488F3F00FBA644 /* PendingTests+ObjC.m in Sources */, DA8F919D19F31921006F6675 /* FailureTests+ObjC.m in Sources */, + CD582D6F2264B371008F7CE6 /* QuickSpec+MethodList.swift in Sources */, DAE714F319FF65E7005905B8 /* Configuration+BeforeEach.swift in Sources */, - CD564DA020B5B09C00C15E6B /* QuickSpec+QuickSpec_MethodList.m in Sources */, 479C31E31A36171B00DA8718 /* ItTests+ObjC.m in Sources */, + CD582D732264C137008F7CE6 /* QuickSpecRunner.swift in Sources */, 34C586011C4ABD3F00D4F057 /* XCTestCaseProvider.swift in Sources */, 8D010A571C11726F00633E2B /* DescribeTests.swift in Sources */, 47FAEA361A3F49E6005A1D2F /* BeforeEachTests+ObjC.m in Sources */, @@ -1694,101 +1619,6 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 047655521949F4CB00B288BB /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DAEB6B8D1943873100289F44 /* Quick-macOS */; - targetProxy = 047655511949F4CB00B288BB /* PBXContainerItemProxy */; - }; - 047655541949F4CB00B288BB /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DAEB6B8D1943873100289F44 /* Quick-macOS */; - targetProxy = 047655531949F4CB00B288BB /* PBXContainerItemProxy */; - }; - 04765556194A327000B288BB /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DAEB6B8D1943873100289F44 /* Quick-macOS */; - targetProxy = 04765555194A327000B288BB /* PBXContainerItemProxy */; - }; - 04DC97E5194B4A6000CE00B6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DAEB6B8D1943873100289F44 /* Quick-macOS */; - targetProxy = 04DC97E4194B4A6000CE00B6 /* PBXContainerItemProxy */; - }; - 04DC97E7194B4A6000CE00B6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DAEB6B8D1943873100289F44 /* Quick-macOS */; - targetProxy = 04DC97E6194B4A6000CE00B6 /* PBXContainerItemProxy */; - }; - 04DC97E9194B4B7E00CE00B6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 5A5D117B19473F2100F6D13D /* Quick-iOS */; - targetProxy = 04DC97E8194B4B7E00CE00B6 /* PBXContainerItemProxy */; - }; - 04DC97EB194B4B9B00CE00B6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 5A5D117B19473F2100F6D13D /* Quick-iOS */; - targetProxy = 04DC97EA194B4B9B00CE00B6 /* PBXContainerItemProxy */; - }; - 04DC97F1194B82DB00CE00B6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DAEB6B8D1943873100289F44 /* Quick-macOS */; - targetProxy = 04DC97F0194B82DB00CE00B6 /* PBXContainerItemProxy */; - }; - 04DC97F3194B82DE00CE00B6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 5A5D117B19473F2100F6D13D /* Quick-iOS */; - targetProxy = 04DC97F2194B82DE00CE00B6 /* PBXContainerItemProxy */; - }; - 04DC97F7194B831200CE00B6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 5A5D117B19473F2100F6D13D /* Quick-iOS */; - targetProxy = 04DC97F6194B831200CE00B6 /* PBXContainerItemProxy */; - }; - 04DC97F9194B834000CE00B6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DAEB6B8D1943873100289F44 /* Quick-macOS */; - targetProxy = 04DC97F8194B834000CE00B6 /* PBXContainerItemProxy */; - }; - 04DC97FB194B834100CE00B6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 5A5D117B19473F2100F6D13D /* Quick-iOS */; - targetProxy = 04DC97FA194B834100CE00B6 /* PBXContainerItemProxy */; - }; - 04DC97FD194B834B00CE00B6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DAEB6B8D1943873100289F44 /* Quick-macOS */; - targetProxy = 04DC97FC194B834B00CE00B6 /* PBXContainerItemProxy */; - }; - 04DC97FF194B835E00CE00B6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 5A5D117B19473F2100F6D13D /* Quick-iOS */; - targetProxy = 04DC97FE194B835E00CE00B6 /* PBXContainerItemProxy */; - }; - 04DC9801194B836100CE00B6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DAEB6B8D1943873100289F44 /* Quick-macOS */; - targetProxy = 04DC9800194B836100CE00B6 /* PBXContainerItemProxy */; - }; - 04DC9803194B836300CE00B6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 5A5D117B19473F2100F6D13D /* Quick-iOS */; - targetProxy = 04DC9802194B836300CE00B6 /* PBXContainerItemProxy */; - }; - 04DC9805194B838400CE00B6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DAEB6B8D1943873100289F44 /* Quick-macOS */; - targetProxy = 04DC9804194B838400CE00B6 /* PBXContainerItemProxy */; - }; - 04DC9807194B838700CE00B6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 5A5D117B19473F2100F6D13D /* Quick-iOS */; - targetProxy = 04DC9806194B838700CE00B6 /* PBXContainerItemProxy */; - }; - 04DC9809194B838B00CE00B6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DAEB6B8D1943873100289F44 /* Quick-macOS */; - targetProxy = 04DC9808194B838B00CE00B6 /* PBXContainerItemProxy */; - }; 1F118CE11BDCA4AB005013A2 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 1F118CD41BDCA4AB005013A2 /* Quick-tvOS */; @@ -1799,21 +1629,6 @@ target = 1F118CD41BDCA4AB005013A2 /* Quick-tvOS */; targetProxy = 1F118CF61BDCA4BB005013A2 /* PBXContainerItemProxy */; }; - 5A5D118919473F2100F6D13D /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 5A5D117B19473F2100F6D13D /* Quick-iOS */; - targetProxy = 5A5D118819473F2100F6D13D /* PBXContainerItemProxy */; - }; - 5A5D11F0194741B500F6D13D /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 5A5D117B19473F2100F6D13D /* Quick-iOS */; - targetProxy = 5A5D11EF194741B500F6D13D /* PBXContainerItemProxy */; - }; - 5A5D11F2194741B500F6D13D /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 5A5D117B19473F2100F6D13D /* Quick-iOS */; - targetProxy = 5A5D11F1194741B500F6D13D /* PBXContainerItemProxy */; - }; 64076CE61D6D7C2000E2B499 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = DAEB6B8D1943873100289F44 /* Quick-macOS */; @@ -1829,10 +1644,20 @@ target = 1F118CD41BDCA4AB005013A2 /* Quick-tvOS */; targetProxy = 64076D0C1D6D7CEA00E2B499 /* PBXContainerItemProxy */; }; - 93625F391951DDC8006B1FE1 /* PBXTargetDependency */ = { + CD89D14924791ED000C1F086 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = DAEB6B8D1943873100289F44 /* Quick-macOS */; - targetProxy = 93625F381951DDC8006B1FE1 /* PBXContainerItemProxy */; + targetProxy = CD89D14824791ED000C1F086 /* PBXContainerItemProxy */; + }; + CD89D14B24791EDA00C1F086 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 5A5D117B19473F2100F6D13D /* Quick-iOS */; + targetProxy = CD89D14A24791EDA00C1F086 /* PBXContainerItemProxy */; + }; + CD89D14D247A673100C1F086 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = DAEB6B8D1943873100289F44 /* Quick-macOS */; + targetProxy = CD89D14E247A673100C1F086 /* PBXContainerItemProxy */; }; DA5663F01A4C8D8500193C88 /* PBXTargetDependency */ = { isa = PBXTargetDependency; @@ -1844,11 +1669,6 @@ target = 5A5D117B19473F2100F6D13D /* Quick-iOS */; targetProxy = DA9876B91A4C70EB0004AA17 /* PBXContainerItemProxy */; }; - DAEB6B9C1943873100289F44 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DAEB6B8D1943873100289F44 /* Quick-macOS */; - targetProxy = DAEB6B9B1943873100289F44 /* PBXContainerItemProxy */; - }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ @@ -1856,6 +1676,7 @@ isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -1889,6 +1710,7 @@ isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; COPY_PHASE_STRIP = NO; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -1936,6 +1758,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickTests-Swift.h"; TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; @@ -1956,6 +1779,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; @@ -1978,6 +1802,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickFocusedTests-Swift.h"; TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; @@ -1998,6 +1823,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickFocusedTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; @@ -2008,6 +1834,7 @@ isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -2026,7 +1853,6 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( "$(inherited)", "-Xlinker", @@ -2037,9 +1863,7 @@ PRODUCT_NAME = Quick; SDKROOT = iphoneos; SKIP_INSTALL = YES; - SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; TARGETED_DEVICE_FAMILY = "1,2"; - TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; }; @@ -2047,6 +1871,7 @@ isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -2071,10 +1896,8 @@ PRODUCT_NAME = Quick; SDKROOT = iphoneos; SKIP_INSTALL = YES; - SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; - TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -2095,11 +1918,11 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = "io.quick.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -2116,11 +1939,11 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = NO; - ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = "io.quick.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; VALIDATE_PRODUCT = YES; }; @@ -2146,6 +1969,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "io.quick.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickAfterSuiteTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -2166,6 +1990,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "io.quick.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickAfterSuiteTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; @@ -2186,11 +2011,11 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = "io.quick.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickAfterSuiteTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -2207,11 +2032,11 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; - ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = "io.quick.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickAfterSuiteTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; VALIDATE_PRODUCT = YES; }; @@ -2233,6 +2058,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickAfterSuiteTests-Swift.h"; TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; @@ -2253,6 +2079,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickAfterSuiteTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; @@ -2273,6 +2100,52 @@ }; name = Release; }; + CD89D179247A673100C1F086 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(DEVELOPER_FRAMEWORKS_DIR)", + "$(inherited)", + ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = Tests/QuickTests/QuickTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; + METAL_ENABLE_DEBUG_INFO = YES; + PRODUCT_BUNDLE_IDENTIFIER = "io.quick.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickTests-Swift.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + CD89D17A247A673100C1F086 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(DEVELOPER_FRAMEWORKS_DIR)", + "$(inherited)", + ); + INFOPLIST_FILE = Tests/QuickTests/QuickTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; + METAL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = "io.quick.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickTests-Swift.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + }; + name = Release; + }; DA5663F11A4C8D8500193C88 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -2293,6 +2166,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "io.quick.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickFocusedTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -2313,6 +2187,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "io.quick.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickFocusedTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; @@ -2333,11 +2208,11 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = "io.quick.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickFocusedTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -2354,11 +2229,11 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; - ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = "io.quick.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickFocusedTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; VALIDATE_PRODUCT = YES; }; @@ -2368,6 +2243,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -2419,7 +2295,7 @@ SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -2429,6 +2305,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -2473,7 +2350,7 @@ SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -2483,6 +2360,7 @@ isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -2507,7 +2385,6 @@ PRODUCT_NAME = Quick; SKIP_INSTALL = YES; SWIFT_OBJC_BRIDGING_HEADER = ""; - VALID_ARCHS = x86_64; }; name = Debug; }; @@ -2515,6 +2392,7 @@ isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -2540,7 +2418,6 @@ SKIP_INSTALL = YES; SWIFT_OBJC_BRIDGING_HEADER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - VALID_ARCHS = x86_64; }; name = Release; }; @@ -2564,6 +2441,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "io.quick.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -2584,6 +2462,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "io.quick.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "QuickTests-Swift.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; @@ -2672,6 +2551,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + CD89D178247A673100C1F086 /* Build configuration list for PBXNativeTarget "QuickIssue853RegressionTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CD89D179247A673100C1F086 /* Debug */, + CD89D17A247A673100C1F086 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; DA5663F31A4C8D8500193C88 /* Build configuration list for PBXNativeTarget "QuickFocused - macOSTests" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick.xcodeproj/xcshareddata/xcschemes/Quick-iOS.xcscheme b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick.xcodeproj/xcshareddata/xcschemes/Quick-iOS.xcscheme index 584e319..278b377 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick.xcodeproj/xcshareddata/xcschemes/Quick-iOS.xcscheme +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Quick.xcodeproj/xcshareddata/xcschemes/Quick-iOS.xcscheme @@ -1,6 +1,6 @@ + + + + @@ -72,18 +81,17 @@ ReferencedContainer = "container:Quick.xcodeproj"> + + + + - - - - - - - - { - public static var name: String { return String(describing: self) } /** - override this method in your behavior to define a set of reusable examples. + Override this variable if you want to provide custom name for this example group. + */ + open class var name: String { return String(describing: self) } + + /** + Override this method in your behavior to define a set of reusable examples. This behaves just like an example group defines using `describe` or `context`--it may contain any number of `beforeEach` and `afterEach` closures, as well as any number of examples (defined using `it`). diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Callsite.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Callsite.swift index 951cf93..33e732c 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Callsite.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Callsite.swift @@ -1,10 +1,23 @@ import Foundation -#if canImport(Darwin) && !SWIFT_PACKAGE +#if canImport(Darwin) +// swiftlint:disable type_name @objcMembers public class _CallsiteBase: NSObject {} #else public class _CallsiteBase: NSObject {} +// swiftlint:enable type_name +#endif + +// Ideally we would always use `StaticString` as the type for tracking the file name +// in which an example is defined, for consistency with `assert` etc. from the +// stdlib, and because recent versions of the XCTest overlay require `StaticString` +// when calling `XCTFail`. Under the Objective-C runtime (i.e. building on macOS), we +// have to use `String` instead because StaticString can't be generated from Objective-C +#if SWIFT_PACKAGE +public typealias FileString = StaticString +#else +public typealias FileString = String #endif /** @@ -15,14 +28,14 @@ final public class Callsite: _CallsiteBase { /** The absolute path of the file in which an example is defined. */ - public let file: String + public let file: FileString /** The line number on which an example is defined. */ public let line: UInt - internal init(file: String, line: UInt) { + internal init(file: FileString, line: UInt) { self.file = file self.line = line } @@ -34,6 +47,6 @@ extension Callsite { If two callsites are in the same file and on the same line, they must be equal. */ @nonobjc public static func == (lhs: Callsite, rhs: Callsite) -> Bool { - return lhs.file == rhs.file && lhs.line == rhs.line + return String(describing: lhs.file) == String(describing: rhs.file) && lhs.line == rhs.line } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Configuration/Configuration.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Configuration/Configuration.swift index fe33997..71b263b 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 @@ -19,20 +19,24 @@ public typealias ExampleFilter = (_ example: Example) -> Bool final public class Configuration: NSObject { internal let exampleHooks = ExampleHooks() internal let suiteHooks = SuiteHooks() - internal var exclusionFilters: [ExampleFilter] = [ { example in - if let pending = example.filterFlags[Filter.pending] { - return pending - } else { - return false - } - }] - internal var inclusionFilters: [ExampleFilter] = [ { example in - if let focused = example.filterFlags[Filter.focused] { - return focused - } else { - return false - } - }] + internal var exclusionFilters: [ExampleFilter] = [ + { example in // swiftlint:disable:this opening_brace + if let pending = example.filterFlags[Filter.pending] { + return pending + } else { + return false + } + }, + ] + internal var inclusionFilters: [ExampleFilter] = [ + { example in // swiftlint:disable:this opening_brace + if let focused = example.filterFlags[Filter.focused] { + return focused + } else { + return false + } + }, + ] /** Run all examples if none match the configured filters. True by default. @@ -88,13 +92,13 @@ final public class Configuration: NSObject { given closure before each example that is run. The closure passed to this method is executed before each example Quick runs, globally across the test suite. You may call this method multiple - times across mulitple +[QuickConfigure configure:] methods in order + times across multiple +[QuickConfigure configure:] methods in order to define several closures to run before each example. Note that, since Quick makes no guarantee as to the order in which +[QuickConfiguration configure:] methods are evaluated, there is no guarantee as to the order in which beforeEach closures are evaluated - either. Mulitple beforeEach defined on a single configuration, however, + either. Multiple beforeEach defined on a single configuration, however, will be executed in the order they're defined. - parameter closure: The closure to be executed before each example @@ -125,13 +129,13 @@ final public class Configuration: NSObject { given closure after each example that is run. The closure passed to this method is executed after each example Quick runs, globally across the test suite. You may call this method multiple - times across mulitple +[QuickConfigure configure:] methods in order + times across multiple +[QuickConfigure configure:] methods in order to define several closures to run after each example. Note that, since Quick makes no guarantee as to the order in which +[QuickConfiguration configure:] methods are evaluated, there is no guarantee as to the order in which afterEach closures are evaluated - either. Mulitple afterEach defined on a single configuration, however, + either. Multiple afterEach defined on a single configuration, however, will be executed in the order they're defined. - parameter closure: The closure to be executed before each example 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 0874f64..d807bfe 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 @@ -1,39 +1,78 @@ import Foundation import XCTest -// NOTE: This file is not intended to be included in the Xcode project or CocoaPods. -// It is picked up by the Swift Package Manager during its build process. - #if SWIFT_PACKAGE open class QuickConfiguration: NSObject { open class func configure(_ configuration: Configuration) {} } -#if canImport(Darwin) +#endif -internal func qck_enumerateSubclasses(_ klass: T.Type, block: (T.Type) -> Void) { - var classesCount = objc_getClassList(nil, 0) +extension QuickConfiguration { + #if !canImport(Darwin) + private static var configurationSubclasses: [QuickConfiguration.Type] = [] + #endif - guard classesCount > 0 else { - return + /// Finds all direct subclasses of QuickConfiguration and passes them to the block provided. + /// The classes are iterated over in the order that objc_getClassList returns them. + /// + /// - parameter block: A block that takes a QuickConfiguration.Type. + /// This block will be executed once for each subclass of QuickConfiguration. + private static func enumerateSubclasses(_ block: (QuickConfiguration.Type) -> Void) { + #if canImport(Darwin) + let classesCount = objc_getClassList(nil, 0) + + guard classesCount > 0 else { + return + } + + let classes = UnsafeMutablePointer.allocate(capacity: Int(classesCount)) + defer { free(classes) } + + objc_getClassList(AutoreleasingUnsafeMutablePointer(classes), classesCount) + + var configurationSubclasses: [QuickConfiguration.Type] = [] + for index in 0...allocate(capacity: Int(classesCount)) - classesCount = objc_getClassList(AutoreleasingUnsafeMutablePointer(classes), classesCount) - - var subclass: AnyClass! - for i in 0.. Void) { +public func it(_ description: String, flags: FilterFlags = [:], file: FileString = #file, line: UInt = #line, closure: @escaping () throws -> Void) { World.sharedWorld.it(description, flags: flags, file: file, line: line, closure: closure) } @@ -143,7 +145,7 @@ public func it(_ description: String, flags: FilterFlags = [:], file: String = # - parameter file: The absolute path to the file containing the current example group. A sensible default is provided. - parameter line: The line containing the current example group. A sensible default is provided. */ -public func itBehavesLike(_ name: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line) { +public func itBehavesLike(_ name: String, flags: FilterFlags = [:], file: FileString = #file, line: UInt = #line) { itBehavesLike(name, flags: flags, file: file, line: line, sharedExampleContext: { return [:] }) } @@ -163,7 +165,7 @@ public func itBehavesLike(_ name: String, flags: FilterFlags = [:], file: String - parameter file: The absolute path to the file containing the current example group. A sensible default is provided. - parameter line: The line containing the current example group. A sensible default is provided. */ -public func itBehavesLike(_ name: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, sharedExampleContext: @escaping SharedExampleContext) { +public func itBehavesLike(_ name: String, flags: FilterFlags = [:], file: FileString = #file, line: UInt = #line, sharedExampleContext: @escaping SharedExampleContext) { World.sharedWorld.itBehavesLike(name, sharedExampleContext: sharedExampleContext, flags: flags, file: file, line: line) } @@ -179,7 +181,7 @@ public func itBehavesLike(_ name: String, flags: FilterFlags = [:], file: String - parameter file: The absolute path to the file containing the current example group. A sensible default is provided. - parameter line: The line containing the current example group. A sensible default is provided. */ -public func itBehavesLike(_ behavior: Behavior.Type, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, context: @escaping () -> C) { +public func itBehavesLike(_ behavior: Behavior.Type, flags: FilterFlags = [:], file: FileString = #file, line: UInt = #line, context: @escaping () -> C) { World.sharedWorld.itBehavesLike(behavior, context: context, flags: flags, file: file, line: line) } @@ -198,7 +200,7 @@ public func pending(_ description: String, closure: () -> Void) { Use this to quickly mark a `describe` closure as pending. This disables all examples within the closure. */ -public func xdescribe(_ description: String, flags: FilterFlags, closure: () -> Void) { +public func xdescribe(_ description: String, flags: FilterFlags = [:], closure: () -> Void) { World.sharedWorld.xdescribe(description, flags: flags, closure: closure) } @@ -206,7 +208,7 @@ public func xdescribe(_ description: String, flags: FilterFlags, closure: () -> Use this to quickly mark a `context` closure as pending. This disables all examples within the closure. */ -public func xcontext(_ description: String, flags: FilterFlags, closure: () -> Void) { +public func xcontext(_ description: String, flags: FilterFlags = [:], closure: () -> Void) { xdescribe(description, flags: flags, closure: closure) } @@ -214,7 +216,7 @@ public func xcontext(_ description: String, flags: FilterFlags, closure: () -> V Use this to quickly mark an `it` closure as pending. This disables the example and ensures the code within the closure is never run. */ -public func xit(_ description: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, closure: @escaping () -> Void) { +public func xit(_ description: String, flags: FilterFlags = [:], file: FileString = #file, line: UInt = #line, closure: @escaping () throws -> Void) { World.sharedWorld.xit(description, flags: flags, file: file, line: line, closure: closure) } @@ -222,7 +224,7 @@ public func xit(_ description: String, flags: FilterFlags = [:], file: String = Use this to quicklu mark an `itBehavesLike` closure as pending. This disables the example group defined by this behavior and ensures the code within is never run. */ -public func xitBehavesLike(_ behavior: Behavior.Type, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, context: @escaping () -> C) { +public func xitBehavesLike(_ behavior: Behavior.Type, flags: FilterFlags = [:], file: FileString = #file, line: UInt = #line, context: @escaping () -> C) { World.sharedWorld.xitBehavesLike(behavior, context: context, flags: flags, file: file, line: line) } /** @@ -245,27 +247,29 @@ public func fcontext(_ description: String, flags: FilterFlags = [:], closure: ( Use this to quickly focus an `it` closure, focusing the example. If any examples in the test suite are focused, only those examples are executed. */ -public func fit(_ description: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, closure: @escaping () -> Void) { +public func fit(_ description: String, flags: FilterFlags = [:], file: FileString = #file, line: UInt = #line, closure: @escaping () throws -> Void) { World.sharedWorld.fit(description, flags: flags, file: file, line: line, closure: closure) } /** Use this to quickly focus an `itBehavesLike` closure. */ -public func fitBehavesLike(_ name: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line) { +public func fitBehavesLike(_ name: String, flags: FilterFlags = [:], file: FileString = #file, line: UInt = #line) { fitBehavesLike(name, flags: flags, file: file, line: line, sharedExampleContext: { return [:] }) } /** Use this to quickly focus an `itBehavesLike` closure. */ -public func fitBehavesLike(_ name: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, sharedExampleContext: @escaping SharedExampleContext) { +public func fitBehavesLike(_ name: String, flags: FilterFlags = [:], file: FileString = #file, line: UInt = #line, sharedExampleContext: @escaping SharedExampleContext) { World.sharedWorld.fitBehavesLike(name, sharedExampleContext: sharedExampleContext, flags: flags, file: file, line: line) } /** Use this to quickly focus on `itBehavesLike` closure. */ -public func fitBehavesLike(_ behavior: Behavior.Type, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, context: @escaping () -> C) { +public func fitBehavesLike(_ behavior: Behavior.Type, flags: FilterFlags = [:], file: FileString = #file, line: UInt = #line, context: @escaping () -> C) { World.sharedWorld.fitBehavesLike(behavior, context: context, flags: flags, file: file, line: line) } + +// swiftlint:enable line_length 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 14a46d6..7b4edf3 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 @@ -20,9 +20,10 @@ extension World { internal func describe(_ description: String, flags: FilterFlags, closure: () -> Void) { guard currentExampleMetadata == nil else { - raiseError("'describe' cannot be used inside '\(currentPhase)', 'describe' may only be used inside 'context' or 'describe'. ") + raiseError("'describe' cannot be used inside '\(currentPhase)', 'describe' may only be used inside 'context' or 'describe'.") } guard currentExampleGroup != nil else { + // swiftlint:disable:next line_length raiseError("Error: example group was not created by its parent QuickSpec spec. Check that describe() or context() was used in QuickSpec.spec() and not a more general context (i.e. an XCTestCase test)") } let group = ExampleGroup(description: description, flags: flags) @@ -32,7 +33,7 @@ extension World { internal func context(_ description: String, flags: FilterFlags, closure: () -> Void) { guard currentExampleMetadata == nil else { - raiseError("'context' cannot be used inside '\(currentPhase)', 'context' may only be used inside 'context' or 'describe'. ") + raiseError("'context' cannot be used inside '\(currentPhase)', 'context' may only be used inside 'context' or 'describe'.") } self.describe(description, flags: flags, closure: closure) } @@ -51,12 +52,12 @@ extension World { internal func beforeEach(_ closure: @escaping BeforeExampleClosure) { guard currentExampleMetadata == nil else { - raiseError("'beforeEach' cannot be used inside '\(currentPhase)', 'beforeEach' may only be used inside 'context' or 'describe'. ") + raiseError("'beforeEach' cannot be used inside '\(currentPhase)', 'beforeEach' may only be used inside 'context' or 'describe'.") } currentExampleGroup.hooks.appendBefore(closure) } -#if canImport(Darwin) && !SWIFT_PACKAGE +#if canImport(Darwin) @objc(beforeEachWithMetadata:) internal func beforeEach(closure: @escaping BeforeExampleWithMetadataClosure) { currentExampleGroup.hooks.appendBefore(closure) @@ -69,12 +70,12 @@ extension World { internal func afterEach(_ closure: @escaping AfterExampleClosure) { guard currentExampleMetadata == nil else { - raiseError("'afterEach' cannot be used inside '\(currentPhase)', 'afterEach' may only be used inside 'context' or 'describe'. ") + raiseError("'afterEach' cannot be used inside '\(currentPhase)', 'afterEach' may only be used inside 'context' or 'describe'.") } currentExampleGroup.hooks.appendAfter(closure) } -#if canImport(Darwin) && !SWIFT_PACKAGE +#if canImport(Darwin) @objc(afterEachWithMetadata:) internal func afterEach(closure: @escaping AfterExampleWithMetadataClosure) { currentExampleGroup.hooks.appendAfter(closure) @@ -86,15 +87,15 @@ extension World { #endif @nonobjc - internal func it(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { + internal func it(_ description: String, flags: FilterFlags, file: FileString, line: UInt, closure: @escaping () throws -> Void) { if beforesCurrentlyExecuting { - raiseError("'it' cannot be used inside 'beforeEach', 'it' may only be used inside 'context' or 'describe'. ") + raiseError("'it' cannot be used inside 'beforeEach', 'it' may only be used inside 'context' or 'describe'.") } if aftersCurrentlyExecuting { - raiseError("'it' cannot be used inside 'afterEach', 'it' may only be used inside 'context' or 'describe'. ") + raiseError("'it' cannot be used inside 'afterEach', 'it' may only be used inside 'context' or 'describe'.") } guard currentExampleMetadata == nil else { - raiseError("'it' cannot be used inside 'it', 'it' may only be used inside 'context' or 'describe'. ") + raiseError("'it' cannot be used inside 'it', 'it' may only be used inside 'context' or 'describe'.") } let callsite = Callsite(file: file, line: line) let example = Example(description: description, callsite: callsite, flags: flags, closure: closure) @@ -102,23 +103,23 @@ extension World { } @nonobjc - internal func fit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { + internal func fit(_ description: String, flags: FilterFlags, file: FileString, line: UInt, closure: @escaping () throws -> Void) { var focusedFlags = flags focusedFlags[Filter.focused] = true self.it(description, flags: focusedFlags, file: file, line: line, closure: closure) } @nonobjc - internal func xit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { + internal func xit(_ description: String, flags: FilterFlags, file: FileString, line: UInt, closure: @escaping () throws -> Void) { var pendingFlags = flags pendingFlags[Filter.pending] = true self.it(description, flags: pendingFlags, file: file, line: line, closure: closure) } @nonobjc - internal func itBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, flags: FilterFlags, file: String, line: UInt) { + internal func itBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, flags: FilterFlags, file: FileString, line: UInt) { guard currentExampleMetadata == nil else { - raiseError("'itBehavesLike' cannot be used inside '\(currentPhase)', 'itBehavesLike' may only be used inside 'context' or 'describe'. ") + raiseError("'itBehavesLike' cannot be used inside '\(currentPhase)', 'itBehavesLike' may only be used inside 'context' or 'describe'.") } let callsite = Callsite(file: file, line: line) let closure = World.sharedWorld.sharedExample(name) @@ -136,15 +137,15 @@ extension World { } @nonobjc - internal func fitBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, flags: FilterFlags, file: String, line: UInt) { + internal func fitBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, flags: FilterFlags, file: FileString, line: UInt) { var focusedFlags = flags focusedFlags[Filter.focused] = true self.itBehavesLike(name, sharedExampleContext: sharedExampleContext, flags: focusedFlags, file: file, line: line) } - internal func itBehavesLike(_ behavior: Behavior.Type, context: @escaping () -> C, flags: FilterFlags, file: String, line: UInt) { + internal func itBehavesLike(_ behavior: Behavior.Type, context: @escaping () -> C, flags: FilterFlags, file: FileString, line: UInt) { guard currentExampleMetadata == nil else { - raiseError("'itBehavesLike' cannot be used inside '\(currentPhase)', 'itBehavesLike' may only be used inside 'context' or 'describe'. ") + raiseError("'itBehavesLike' cannot be used inside '\(currentPhase)', 'itBehavesLike' may only be used inside 'context' or 'describe'.") } let callsite = Callsite(file: file, line: line) let closure = behavior.spec @@ -160,13 +161,13 @@ extension World { } } - internal func fitBehavesLike(_ behavior: Behavior.Type, context: @escaping () -> C, flags: FilterFlags, file: String, line: UInt) { + internal func fitBehavesLike(_ behavior: Behavior.Type, context: @escaping () -> C, flags: FilterFlags, file: FileString, line: UInt) { var focusedFlags = flags focusedFlags[Filter.focused] = true self.itBehavesLike(behavior, context: context, flags: focusedFlags, file: file, line: line) } - internal func xitBehavesLike(_ behavior: Behavior.Type, context: @escaping () -> C, flags: FilterFlags, file: String, line: UInt) { + internal func xitBehavesLike(_ behavior: Behavior.Type, context: @escaping () -> C, flags: FilterFlags, file: FileString, line: UInt) { var pendingFlags = flags pendingFlags[Filter.pending] = true self.itBehavesLike(behavior, context: context, flags: pendingFlags, file: file, line: line) @@ -174,22 +175,22 @@ extension World { #if canImport(Darwin) && !SWIFT_PACKAGE @objc(itWithDescription:flags:file:line:closure:) - internal func objc_it(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { + internal func objc_it(_ description: String, flags: FilterFlags, file: FileString, line: UInt, closure: @escaping () -> Void) { it(description, flags: flags, file: file, line: line, closure: closure) } @objc(fitWithDescription:flags:file:line:closure:) - internal func objc_fit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { + internal func objc_fit(_ description: String, flags: FilterFlags, file: FileString, line: UInt, closure: @escaping () -> Void) { fit(description, flags: flags, file: file, line: line, closure: closure) } @objc(xitWithDescription:flags:file:line:closure:) - internal func objc_xit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) { + internal func objc_xit(_ description: String, flags: FilterFlags, file: FileString, line: UInt, closure: @escaping () -> Void) { xit(description, flags: flags, file: file, line: line, closure: closure) } @objc(itBehavesLikeSharedExampleNamed:sharedExampleContext:flags:file:line:) - internal func objc_itBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, flags: FilterFlags, file: String, line: UInt) { + internal func objc_itBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, flags: FilterFlags, file: FileString, line: UInt) { itBehavesLike(name, sharedExampleContext: sharedExampleContext, flags: flags, file: file, line: line) } #endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Example.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Example.swift index 594efa0..7cef7c5 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Example.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Example.swift @@ -1,13 +1,12 @@ import Foundation -private var numberOfExamplesRun = 0 -private var numberOfIncludedExamples = 0 - -#if canImport(Darwin) && !SWIFT_PACKAGE +#if canImport(Darwin) +// swiftlint:disable type_name @objcMembers public class _ExampleBase: NSObject {} #else public class _ExampleBase: NSObject {} +// swiftlint:enable type_name #endif /** @@ -31,10 +30,10 @@ final public class Example: _ExampleBase { weak internal var group: ExampleGroup? private let internalDescription: String - private let closure: () -> Void + private let closure: () throws -> Void private let flags: FilterFlags - internal init(description: String, callsite: Callsite, flags: FilterFlags, closure: @escaping () -> Void) { + internal init(description: String, callsite: Callsite, flags: FilterFlags, closure: @escaping () throws -> Void) { self.internalDescription = description self.closure = closure self.callsite = callsite @@ -65,15 +64,11 @@ final public class Example: _ExampleBase { public func run() { let world = World.sharedWorld - if numberOfIncludedExamples == 0 { - numberOfIncludedExamples = world.includedExampleCount - } - - if numberOfExamplesRun == 0 { + if world.numberOfExamplesRun == 0 { world.suiteHooks.executeBefores() } - let exampleMetadata = ExampleMetadata(example: self, exampleIndex: numberOfExamplesRun) + let exampleMetadata = ExampleMetadata(example: self, exampleIndex: world.numberOfExamplesRun) world.currentExampleMetadata = exampleMetadata defer { world.currentExampleMetadata = nil @@ -86,7 +81,22 @@ final public class Example: _ExampleBase { } group!.phase = .beforesFinished - closure() + do { + try closure() + } catch { + let description = "Test \(name) threw unexpected error: \(error.localizedDescription)" + #if SWIFT_PACKAGE + let file = callsite.file.description + #else + let file = callsite.file + #endif + QuickSpec.current.recordFailure( + withDescription: description, + inFile: file, + atLine: Int(callsite.line), + expected: false + ) + } group!.phase = .aftersExecuting for after in group!.afters { @@ -95,9 +105,9 @@ final public class Example: _ExampleBase { group!.phase = .aftersFinished world.exampleHooks.executeAfters(exampleMetadata) - numberOfExamplesRun += 1 + world.numberOfExamplesRun += 1 - if !world.isRunningAdditionalSuites && numberOfExamplesRun >= numberOfIncludedExamples { + if !world.isRunningAdditionalSuites && world.numberOfExamplesRun >= world.cachedIncludedExampleCount { world.suiteHooks.executeAfters() } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/ExampleGroup.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/ExampleGroup.swift index 129bed0..5fbfadb 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/ExampleGroup.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/ExampleGroup.swift @@ -31,9 +31,16 @@ final public class ExampleGroup: NSObject { Returns a list of examples that belong to this example group, or to any of its descendant example groups. */ + #if canImport(Darwin) + @objc public var examples: [Example] { return childExamples + childGroups.flatMap { $0.examples } } + #else + public var examples: [Example] { + return childExamples + childGroups.flatMap { $0.examples } + } + #endif internal var name: String? { guard let parent = parent else { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/ExampleMetadata.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/ExampleMetadata.swift index b07b3bd..a8f0d77 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/ExampleMetadata.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/ExampleMetadata.swift @@ -1,10 +1,12 @@ import Foundation -#if canImport(Darwin) && !SWIFT_PACKAGE +#if canImport(Darwin) +// swiftlint:disable type_name @objcMembers public class _ExampleMetadataBase: NSObject {} #else public class _ExampleMetadataBase: NSObject {} +// swiftlint:enable type_name #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 304f6ec..d7fbe8d 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Filter.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/Filter.swift @@ -1,10 +1,12 @@ import Foundation -#if canImport(Darwin) && !SWIFT_PACKAGE +#if canImport(Darwin) +// swiftlint:disable type_name @objcMembers public class _FilterBase: NSObject {} #else public class _FilterBase: NSObject {} +// swiftlint:enable type_name #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 ed0cf8e..f5596cc 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 @@ -17,7 +17,7 @@ extension Bundle { Module name has to be a valid "C99 extended identifier". */ internal var moduleName: String { - let fileName = bundleURL.fileName as NSString + let fileName = bundleURL.fileName return fileName.c99ExtendedIdentifier } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickMain.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickMain.swift index 63e099f..accd5bf 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickMain.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickMain.swift @@ -22,15 +22,8 @@ import XCTest public func QCKMain(_ specs: [QuickSpec.Type], configurations: [QuickConfiguration.Type] = [], testCases: [XCTestCaseEntry] = []) -> Never { - let world = World.sharedWorld - // Perform all configurations (ensures that shared examples have been discovered) - world.configure { configuration in - for configurationClass in configurations { - configurationClass.configure(configuration) - } - } - world.finalizeConfiguration() + QuickConfiguration.configureSubclassesIfNeeded(configurations, world: World.sharedWorld) XCTMain(specs.compactMap { testCase($0.allTests) } + testCases) } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickSpec.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickSpec.swift index 62e50d4..7f63787 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickSpec.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickSpec.swift @@ -5,8 +5,8 @@ import XCTest #if SWIFT_PACKAGE -#if canImport(Darwin) -import QuickSpecBase +#if canImport(QuickObjCRuntime) +import QuickObjCRuntime public typealias QuickSpecBase = _QuickSpecBase #else @@ -14,6 +14,16 @@ public typealias QuickSpecBase = XCTestCase #endif open class QuickSpec: QuickSpecBase { + /// Returns the currently executing spec. Use in specs that require XCTestCase + /// methods, e.g. expectation(description:). + public private(set) static var current: QuickSpec! + + private var example: Example? { + didSet { + QuickSpec.current = self + } + } + open func spec() {} #if !canImport(Darwin) @@ -38,52 +48,39 @@ open class QuickSpec: QuickSpecBase { /// discovered powered by Objective-C runtime), so we needed the alternative /// way. override open class var defaultTestSuite: XCTestSuite { - configureDefaultTestSuite() + QuickConfiguration.configureSubclassesIfNeeded(world: World.sharedWorld) + + // Let's gather examples for each spec classes. This has the same effect + // as listing spec classes in `LinuxMain.swift` on Linux. + gatherExamplesIfNeeded() return super.defaultTestSuite } - private static func configureDefaultTestSuite() { - let world = World.sharedWorld - - if !world.isConfigurationFinalized { - // Perform all configurations (ensures that shared examples have been discovered) - world.configure { configuration in - qck_enumerateSubclasses(QuickConfiguration.self) { configurationClass in - configurationClass.configure(configuration) - } - } - world.finalizeConfiguration() - } - - // Let's gather examples for each spec classes. This has the same effect - // as listing spec classes in `LinuxMain.swift` on Linux. - _ = allTests - } - - override open class func _qck_testMethodSelectors() -> [_QuickSelectorWrapper] { - let examples = World.sharedWorld.examples(self) + override open class func _qck_testMethodSelectors() -> [String] { + let examples = World.sharedWorld.examples(forSpecClass: self) var selectorNames = Set() return examples.map { example in let selector = addInstanceMethod(for: example, classSelectorNames: &selectorNames) - return _QuickSelectorWrapper(selector: selector) + return NSStringFromSelector(selector) } } private static func addInstanceMethod(for example: Example, classSelectorNames selectorNames : inout Set) -> Selector { - let block: @convention(block) (QuickSpec) -> Void = { _ in + let block: @convention(block) (QuickSpec) -> Void = { spec in + spec.example = example example.run() } let implementation = imp_implementationWithBlock(block as Any) - let originalName = example.name + let originalName = example.name.c99ExtendedIdentifier var selectorName = originalName - var i: UInt = 2 + var index: UInt = 2 while selectorNames.contains(selectorName) { - selectorName = String(format: "%@_%tu", originalName, i) - i += 1 + selectorName = String(format: "%@_%tu", originalName, index) + index += 1 } selectorNames.insert(selectorName) @@ -95,31 +92,59 @@ open class QuickSpec: QuickSpecBase { } #endif - static var allTestsCache = [String: [(String, (XCTestCase) -> () throws -> Void)]]() - - public class var allTests: [(String, (XCTestCase) -> () throws -> Void)] { - if let cached = allTestsCache[String(describing: self)] { - return cached - } - +#if !canImport(Darwin) + public class var allTests: [(String, (QuickSpec) -> () throws -> Void)] { gatherExamplesIfNeeded() - let examples = World.sharedWorld.examples(self) - let result = examples.map { example -> (String, (XCTestCase) -> () throws -> Void) in - return (example.name, { _ in { example.run() } }) + let examples = World.sharedWorld.examples(forSpecClass: self) + let result = examples.map { example -> (String, (QuickSpec) -> () throws -> Void) in + return (example.name, { spec in + return { + spec.example = example + example.run() + } + }) } - allTestsCache[String(describing: self)] = result return result } +#endif internal static func gatherExamplesIfNeeded() { let world = World.sharedWorld - let rootExampleGroup = world.rootExampleGroupForSpecClass(self) - if rootExampleGroup.examples.isEmpty { - world.currentExampleGroup = rootExampleGroup - self.init().spec() - world.currentExampleGroup = nil + let rootExampleGroup = world.rootExampleGroup(forSpecClass: self) + guard rootExampleGroup.examples.isEmpty else { + return } + + world.performWithCurrentExampleGroup(rootExampleGroup) { + self.init().spec() + } + } + + // MARK: Delegation to `QuickSpec.current`. + + override public func recordFailure( + withDescription description: String, + inFile filePath: String, + atLine lineNumber: Int, + expected: Bool + ) { + guard self === Self.current else { + Self.current.recordFailure( + withDescription: description, + inFile: filePath, + atLine: lineNumber, + expected: expected + ) + return + } + + super.recordFailure( + withDescription: description, + inFile: filePath, + atLine: lineNumber, + expected: expected + ) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickTestObservation.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickTestObservation.swift new file mode 100644 index 0000000..e508566 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/Quick/QuickTestObservation.swift @@ -0,0 +1,69 @@ +#if !SWIFT_PACKAGE + +import Foundation +import XCTest + +/// A dummy protocol for calling the internal `+[QuickSpec buildExamplesIfNeeded]` method +/// which is defined in Objective-C from Swift. +@objc internal protocol _QuickSpecInternal { + static func buildExamplesIfNeeded() +} + +@objc internal final class QuickTestObservation: NSObject, XCTestObservation { + @objc(sharedInstance) + static let shared = QuickTestObservation() + + // Quick hooks into this event to compile example groups for each QuickSpec subclasses. + // + // If an exception occurs when compiling examples, report it to the user. Chances are they + // included an expectation outside of a "it", "describe", or "context" block. + func testBundleWillStart(_ testBundle: Bundle) { + QuickSpec.enumerateSubclasses { specClass in + // This relies on `_QuickSpecInternal`. + (specClass as AnyClass).buildExamplesIfNeeded() + } + } +} + +// swiftlint:disable:next todo +// TODO: Unify this with QuickConfiguration's equivalent +extension QuickSpec { + internal static func enumerateSubclasses( + subclasses: [QuickSpec.Type]? = nil, + _ block: (QuickSpec.Type) -> Void + ) { + let subjects: [QuickSpec.Type] + if let subclasses = subclasses { + subjects = subclasses + } else { + let classesCount = objc_getClassList(nil, 0) + + guard classesCount > 0 else { + return + } + + let classes = UnsafeMutablePointer.allocate(capacity: Int(classesCount)) + defer { free(classes) } + + objc_getClassList(AutoreleasingUnsafeMutablePointer(classes), classesCount) + + var specSubclasses: [QuickSpec.Type] = [] + for index in 0.. [String: Any] */ public typealias SharedExampleClosure = (@escaping SharedExampleContext) -> Void -#if canImport(Darwin) && !SWIFT_PACKAGE +#if canImport(Darwin) +// swiftlint:disable type_name @objcMembers internal class _WorldBase: NSObject {} #else internal class _WorldBase: NSObject {} +// swiftlint:enable type_name #endif /** @@ -46,6 +48,8 @@ final internal class World: _WorldBase { internal var currentExampleMetadata: ExampleMetadata? + internal var numberOfExamplesRun = 0 + /** A flag that indicates whether additional test suites are being run within this test suite. This is only true within the context of Quick @@ -72,7 +76,16 @@ final internal class World: _WorldBase { private override init() {} - static let sharedWorld = World() + static private(set) var sharedWorld = World() + + static func anotherWorld(block: (World) -> T) -> T { + let previous = sharedWorld + defer { sharedWorld = previous } + + let newWorld = World() + sharedWorld = newWorld + return block(newWorld) + } // MARK: Public Interface @@ -85,8 +98,11 @@ final internal class World: _WorldBase { be mutated to change Quick's behavior. */ internal func configure(_ closure: QuickConfigurer) { - assert(!isConfigurationFinalized, - "Quick cannot be configured outside of a +[QuickConfiguration configure:] method. You should not call -[World configure:] directly. Instead, subclass QuickConfiguration and override the +[QuickConfiguration configure:] method.") + assert( + !isConfigurationFinalized, + // swiftlint:disable:next line_length + "Quick cannot be configured outside of a +[QuickConfiguration configure:] method. You should not call -[World configure:] directly. Instead, subclass QuickConfiguration and override the +[QuickConfiguration configure:] method." + ) closure(configuration) } @@ -98,6 +114,17 @@ final internal class World: _WorldBase { isConfigurationFinalized = true } + /** + Returns `true` if the root example group for the given spec class has been already initialized. + + - parameter specClass: The QuickSpec class for which is checked for the existing root example group. + - returns: Whether the root example group for the given spec class has been already initialized or not. + */ + internal func isRootExampleGroupInitialized(forSpecClass specClass: QuickSpec.Type) -> Bool { + let name = String(describing: specClass) + return specs.keys.contains(name) + } + /** Returns an internally constructed root example group for the given QuickSpec class. @@ -113,11 +140,11 @@ final internal class World: _WorldBase { it("is at the top level") {} } - - parameter cls: The QuickSpec class for which to retrieve the root example group. + - parameter specClass: The QuickSpec class for which to retrieve the root example group. - returns: The root example group for the class. */ - internal func rootExampleGroupForSpecClass(_ cls: AnyClass) -> ExampleGroup { - let name = String(describing: cls) + internal func rootExampleGroup(forSpecClass specClass: QuickSpec.Type) -> ExampleGroup { + let name = String(describing: specClass) if let group = specs[name] { return group @@ -141,24 +168,17 @@ final internal class World: _WorldBase { - parameter specClass: The QuickSpec subclass for which examples are to be returned. - returns: A list of examples to be run as test invocations. */ - internal func examples(_ specClass: AnyClass) -> [Example] { + internal func examples(forSpecClass specClass: QuickSpec.Type) -> [Example] { // 1. Grab all included examples. let included = includedExamples // 2. Grab the intersection of (a) examples for this spec, and (b) included examples. - let spec = rootExampleGroupForSpecClass(specClass).examples.filter { included.contains($0) } + let spec = rootExampleGroup(forSpecClass: specClass).examples.filter { included.contains($0) } // 3. Remove all excluded examples. return spec.filter { example in - !self.configuration.exclusionFilters.reduce(false) { $0 || $1(example) } + !self.configuration.exclusionFilters.contains { $0(example) } } } -#if canImport(Darwin) - @objc(examplesForSpecClass:) - internal func objc_examples(_ specClass: AnyClass) -> [Example] { - return examples(specClass) - } -#endif - // MARK: Internal internal func registerSharedExample(_ name: String, closure: @escaping SharedExampleClosure) { @@ -175,6 +195,8 @@ final internal class World: _WorldBase { return includedExamples.count } + internal lazy var cachedIncludedExampleCount: Int = self.includedExampleCount + internal var beforesCurrentlyExecuting: Bool { let suiteBeforesExecuting = suiteHooks.phase == .beforesExecuting let exampleBeforesExecuting = exampleHooks.phase == .beforesExecuting @@ -217,7 +239,7 @@ final internal class World: _WorldBase { private var includedExamples: [Example] { let all = allExamples let included = all.filter { example in - return self.configuration.inclusionFilters.reduce(false) { $0 || $1(example) } + return self.configuration.inclusionFilters.contains { $0(example) } } if included.isEmpty && configuration.runAllWhenEverythingFiltered { diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickSpecBase/QuickSpecBase.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjCRuntime/QuickSpecBase.m similarity index 60% rename from Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickSpecBase/QuickSpecBase.m rename to Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjCRuntime/QuickSpecBase.m index 10b6f7e..e452e65 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickSpecBase/QuickSpecBase.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjCRuntime/QuickSpecBase.m @@ -1,22 +1,5 @@ #import "QuickSpecBase.h" -#pragma mark - _QuickSelectorWrapper - -@interface _QuickSelectorWrapper () -@property(nonatomic, assign) SEL selector; -@end - -@implementation _QuickSelectorWrapper - -- (instancetype)initWithSelector:(SEL)selector { - self = [super init]; - _selector = selector; - return self; -} - -@end - - #pragma mark - _QuickSpecBase @implementation _QuickSpecBase @@ -33,11 +16,11 @@ @return An array of invocations that execute the newly defined example methods. */ + (NSArray *)testInvocations { - NSArray<_QuickSelectorWrapper *> *wrappers = [self _qck_testMethodSelectors]; - NSMutableArray *invocations = [NSMutableArray arrayWithCapacity:wrappers.count]; + NSArray *selectors = [self _qck_testMethodSelectors]; + NSMutableArray *invocations = [NSMutableArray arrayWithCapacity:selectors.count]; - for (_QuickSelectorWrapper *wrapper in wrappers) { - SEL selector = wrapper.selector; + for (NSString *selectorString in selectors) { + SEL selector = NSSelectorFromString(selectorString); NSMethodSignature *signature = [self instanceMethodSignatureForSelector:selector]; NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; invocation.selector = selector; @@ -48,7 +31,7 @@ return invocations; } -+ (NSArray<_QuickSelectorWrapper *> *)_qck_testMethodSelectors { ++ (NSArray *)_qck_testMethodSelectors { return @[]; } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjCRuntime/include/QuickSpecBase.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjCRuntime/include/QuickSpecBase.h new file mode 100644 index 0000000..2ee00e7 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjCRuntime/include/QuickSpecBase.h @@ -0,0 +1,7 @@ +#import +#import + +@interface _QuickSpecBase : XCTestCase ++ (NSArray *)_qck_testMethodSelectors; +- (instancetype)init NS_DESIGNATED_INITIALIZER; +@end 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 17beaa7..a51a8bd 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 @@ -7,36 +7,6 @@ #import #endif -typedef void (^QCKClassEnumerationBlock)(Class klass); - -/** - Finds all direct subclasses of the given class and passes them to the block provided. - The classes are iterated over in the order that objc_getClassList returns them. - - @param klass The base class to find subclasses of. - @param block A block that takes a Class. This block will be executed once for each subclass of klass. - */ -void qck_enumerateSubclasses(Class klass, QCKClassEnumerationBlock block) { - Class *classes = NULL; - int classesCount = objc_getClassList(NULL, 0); - - if (classesCount > 0) { - classes = (Class *)calloc(sizeof(Class), classesCount); - classesCount = objc_getClassList(classes, classesCount); - - Class subclass, superclass; - for(int i = 0; i < classesCount; i++) { - subclass = classes[i]; - superclass = class_getSuperclass(subclass); - if (superclass == klass && block) { - block(subclass); - } - } - - free(classes); - } -} - @implementation QuickConfiguration #pragma mark - Object Lifecycle @@ -65,19 +35,8 @@ void qck_enumerateSubclasses(Class klass, QCKClassEnumerationBlock block) { + (void)initialize { // Only enumerate over the subclasses of QuickConfiguration, not any of its subclasses. if ([self class] == [QuickConfiguration class]) { - - // Only enumerate over subclasses once, even if +[QuickConfiguration initialize] - // were to be called several times. This is necessary because +[QuickSpec initialize] - // manually calls +[QuickConfiguration initialize]. - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - qck_enumerateSubclasses([QuickConfiguration class], ^(__unsafe_unretained Class klass) { - [[World sharedWorld] configure:^(Configuration *configuration) { - [klass configure:configuration]; - }]; - }); - [[World sharedWorld] finalizeConfiguration]; - }); + World *world = [World sharedWorld]; + [self configureSubclassesIfNeededWithWorld:world]; } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/QuickSpec.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/QuickSpec.h index 21bc772..ccf006e 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/QuickSpec.h +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/QuickSpec.h @@ -49,7 +49,7 @@ /** Returns the currently executing spec. Use in specs that require XCTestCase - methds, e.g. expectationWithDescription. + methods, e.g. expectationWithDescription. */ @property (class, nonatomic, readonly) QuickSpec *current; diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/QuickSpec.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/QuickSpec.m index ed70d35..90ac7c6 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/QuickSpec.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickObjectiveC/QuickSpec.m @@ -17,39 +17,6 @@ static QuickSpec *currentSpec = nil; #pragma mark - XCTestCase Overrides -/** - The runtime sends initialize to each class in a program just before the class, or any class - that inherits from it, is sent its first message from within the program. QuickSpec hooks into - this event to compile the example groups for this spec subclass. - - If an exception occurs when compiling the examples, report it to the user. Chances are they - included an expectation outside of a "it", "describe", or "context" block. - */ -+ (void)initialize { - [QuickConfiguration initialize]; - - World *world = [World sharedWorld]; - [world performWithCurrentExampleGroup:[world rootExampleGroupForSpecClass:self] closure:^{ - QuickSpec *spec = [self new]; - - @try { - [spec spec]; - } - @catch (NSException *exception) { - [NSException raise:NSInternalInconsistencyException - format:@"An exception occurred when building Quick's example groups.\n" - @"Some possible reasons this might happen include:\n\n" - @"- An 'expect(...).to' expectation was evaluated outside of " - @"an 'it', 'context', or 'describe' block\n" - @"- 'sharedExamples' was called twice with the same name\n" - @"- 'itBehavesLike' was called with a name that is not registered as a shared example\n\n" - @"Here's the original exception: '%@', reason: '%@', userInfo: '%@'", - exception.name, exception.reason, exception.userInfo]; - } - [self testInvocations]; - }]; -} - /** Invocations for each test method in the test case. QuickSpec overrides this method to define a new method for each example defined in +[QuickSpec spec]. @@ -85,6 +52,42 @@ static QuickSpec *currentSpec = nil; #pragma mark - Internal Methods +/** + Runs the `spec` method and builds the examples for this class. + + It's safe to call this method multiple times. If the examples for the class have been built, invocation + of this method has no effect. + */ ++ (void)buildExamplesIfNeeded { + [QuickConfiguration class]; + World *world = [World sharedWorld]; + + if ([world isRootExampleGroupInitializedForSpecClass:[self class]]) { + // The examples fot this subclass have been already built. Skipping. + return; + } + + ExampleGroup *rootExampleGroup = [world rootExampleGroupForSpecClass:[self class]]; + [world performWithCurrentExampleGroup:rootExampleGroup closure:^{ + QuickSpec *spec = [self new]; + + @try { + [spec spec]; + } + @catch (NSException *exception) { + [NSException raise:NSInternalInconsistencyException + format:@"An exception occurred when building Quick's example groups.\n" + @"Some possible reasons this might happen include:\n\n" + @"- An 'expect(...).to' expectation was evaluated outside of " + @"an 'it', 'context', or 'describe' block\n" + @"- 'sharedExamples' was called twice with the same name\n" + @"- 'itBehavesLike' was called with a name that is not registered as a shared example\n\n" + @"Here's the original exception: '%@', reason: '%@', userInfo: '%@'", + exception.name, exception.reason, exception.userInfo]; + } + }]; +} + /** QuickSpec uses this method to dynamically define a new instance method for the given example. The instance method runs the example, catching any exceptions. @@ -136,14 +139,29 @@ static QuickSpec *currentSpec = nil; inFile:(NSString *)filePath atLine:(NSUInteger)lineNumber expected:(BOOL)expected { + if (self != [QuickSpec current]) { + [[QuickSpec current] recordFailureWithDescription:description + inFile:filePath + atLine:lineNumber + expected:expected]; + return; + } + if (self.example.isSharedExample) { filePath = self.example.callsite.file; lineNumber = self.example.callsite.line; } - [currentSpec.testRun recordFailureWithDescription:description - inFile:filePath - atLine:lineNumber - expected:expected]; + [super recordFailureWithDescription:description + inFile:filePath + atLine:lineNumber + expected:expected]; } @end + +#pragma mark - Test Observation + +__attribute__((constructor)) +static void registerQuickTestObservation(void) { + [[XCTestObservationCenter sharedTestObservationCenter] addTestObserver:[QuickTestObservation sharedInstance]]; +} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickSpecBase/include/QuickSpecBase.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickSpecBase/include/QuickSpecBase.h deleted file mode 100644 index 8881ca0..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Sources/QuickSpecBase/include/QuickSpecBase.h +++ /dev/null @@ -1,11 +0,0 @@ -#import -#import - -@interface _QuickSelectorWrapper : NSObject -- (instancetype)initWithSelector:(SEL)selector; -@end - -@interface _QuickSpecBase : XCTestCase -+ (NSArray<_QuickSelectorWrapper *> *)_qck_testMethodSelectors; -- (instancetype)init NS_DESIGNATED_INITIALIZER; -@end diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/.swiftlint.yml b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/.swiftlint.yml new file mode 100644 index 0000000..e747774 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/.swiftlint.yml @@ -0,0 +1,5 @@ +disabled_rules: + - function_body_length + - identifier_name + - line_length + - type_name diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/LinuxMain.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/LinuxMain.swift index 2a67c4a..43706fc 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/LinuxMain.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/LinuxMain.swift @@ -4,42 +4,44 @@ import Quick @testable import QuickTests Quick.QCKMain([ - FunctionalTests_AfterEachSpec.self, AfterSuiteTests.self, + Configuration_AfterEachSpec.self, + Configuration_BeforeEachSpec.self, + CurrentSpecTests.self, + FunctionalTests_AfterEachSpec.self, FunctionalTests_BeforeEachSpec.self, FunctionalTests_BeforeSuite_BeforeSuiteSpec.self, FunctionalTests_BeforeSuite_Spec.self, FunctionalTests_ItSpec.self, FunctionalTests_PendingSpec.self, - FunctionalTests_SharedExamples_BeforeEachSpec.self, - FunctionalTests_SharedExamples_Spec.self, - FunctionalTests_SharedExamples_ContextSpec.self, - Configuration_AfterEachSpec.self, - Configuration_BeforeEachSpec.self, FunctionalTests_CrossReferencingSpecA.self, FunctionalTests_CrossReferencingSpecB.self, + FunctionalTests_SharedExamples_BeforeEachSpec.self, + FunctionalTests_SharedExamples_ContextSpec.self, + FunctionalTests_SharedExamples_Spec.self, _FunctionalTests_FocusedSpec_Focused.self, - _FunctionalTests_FocusedSpec_Unfocused.self + _FunctionalTests_FocusedSpec_Unfocused.self, ], configurations: [ - FunctionalTests_SharedExamples_BeforeEachTests_SharedExamples.self, - FunctionalTests_SharedExamplesTests_SharedExamples.self, FunctionalTests_Configuration_AfterEach.self, FunctionalTests_Configuration_BeforeEach.self, - FunctionalTests_FocusedSpec_SharedExamplesConfiguration.self + FunctionalTests_FocusedSpec_SharedExamplesConfiguration.self, + FunctionalTests_SharedExamples_BeforeEachTests_SharedExamples.self, + FunctionalTests_SharedExamplesTests_SharedExamples.self, ], testCases: [ testCase(AfterEachTests.allTests), testCase(BeforeEachTests.allTests), testCase(BeforeSuiteTests.allTests), + testCase(BehaviorTests.allTests), + testCase(Configuration_AfterEachTests.allTests), + testCase(Configuration_BeforeEachTests.allTests), // testCase(DescribeTests.allTests), + testCase(FocusedTests.allTests), + testCase(FunctionalTests_CrossReferencingSpecA.allTests), + testCase(FunctionalTests_CrossReferencingSpecB.allTests), testCase(ItTests.allTests), testCase(PendingTests.allTests), testCase(SharedExamples_BeforeEachTests.allTests), testCase(SharedExamplesTests.allTests), - testCase(Configuration_AfterEachTests.allTests), - testCase(Configuration_BeforeEachTests.allTests), - testCase(FocusedTests.allTests), - testCase(FunctionalTests_CrossReferencingSpecA.allTests), - testCase(FunctionalTests_CrossReferencingSpecB.allTests) ]) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickIssue853RegressionTests/SubclassOfSubclassWithStructPropertyTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickIssue853RegressionTests/SubclassOfSubclassWithStructPropertyTests.swift new file mode 100644 index 0000000..5eff595 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickIssue853RegressionTests/SubclassOfSubclassWithStructPropertyTests.swift @@ -0,0 +1,20 @@ +import XCTest +import Quick + +// The regression test for https://github.com/Quick/Quick/issues/853 +// +// Don't change the classes definition order to mimic the situation in https://github.com/gzafra/QuickCrashTest. + +class SubclassOfSubclassWithStructPropertySpec: SubclassSpec { + let date = Date() + + override func spec() { + it("should not crash") {} + } +} + +class SubclassSpec: QuickSpec { + override func spec() { + it("should not crash") {} + } +} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickFocusedTests/FocusedTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickFocusedTests/FocusedTests.swift index 132b748..126167b 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickFocusedTests/FocusedTests.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickFocusedTests/FocusedTests.swift @@ -48,21 +48,32 @@ class _FunctionalTests_FocusedSpec_Unfocused: QuickSpec { beforeEach { assert(false) } it("has an example that fails, but is never run") { fail() } } + + sharedExamples("empty shared example") { _ in + // https://github.com/Quick/Quick/pull/901#issuecomment-530816224 + } } } final class FocusedTests: XCTestCase, XCTestCaseProvider { static var allTests: [(String, (FocusedTests) -> () throws -> Void)] { return [ - ("testOnlyFocusedExamplesAreExecuted", testOnlyFocusedExamplesAreExecuted) + ("testOnlyFocusedExamplesAreExecuted", testOnlyFocusedExamplesAreExecuted), ] } func testOnlyFocusedExamplesAreExecuted() { + #if SWIFT_PACKAGE let result = qck_runSpecs([ _FunctionalTests_FocusedSpec_Focused.self, - _FunctionalTests_FocusedSpec_Unfocused.self + _FunctionalTests_FocusedSpec_Unfocused.self, ]) + #else + let result = qck_runSpecs([ + _FunctionalTests_FocusedSpec_Unfocused.self, + _FunctionalTests_FocusedSpec_Focused.self, + ]) + #endif XCTAssertEqual(result?.executionCount, 8) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/SpecRunner.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/SpecRunner.swift deleted file mode 100644 index 66dec1b..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/SpecRunner.swift +++ /dev/null @@ -1,30 +0,0 @@ -@testable import Quick -import Nimble - -@discardableResult -public func qck_runSpec(_ specClass: QuickSpec.Type) -> TestRun? { - return qck_runSpecs([specClass]) -} - -@discardableResult -public func qck_runSpecs(_ specClasses: [QuickSpec.Type]) -> TestRun? { - Quick.World.sharedWorld.isRunningAdditionalSuites = true - - var executionCount: UInt = 0 - var hadUnexpectedFailure = false - - let fails = gatherFailingExpectations(silently: true) { - for specClass in specClasses { - for (_, test) in specClass.allTests { - do { - try test(specClass.init())() - } catch { - hadUnexpectedFailure = true - } - executionCount += 1 - } - } - } - - return TestRun(executionCount: executionCount, hasSucceeded: fails.isEmpty && !hadUnexpectedFailure) -} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/TestRun.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/TestRun.swift deleted file mode 100644 index 3ef0d6c..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/TestRun.swift +++ /dev/null @@ -1,9 +0,0 @@ -public struct TestRun { - public var executionCount: UInt - public var hasSucceeded: Bool - - public init(executionCount: UInt, hasSucceeded: Bool) { - self.executionCount = executionCount - self.hasSucceeded = hasSucceeded - } -} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/XCTestCaseProvider.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTestHelpers/XCTestCaseProvider.swift index 05b0196..782f457 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 @@ -10,19 +10,19 @@ import XCTest // Implementation note: This is broken down into two separate protocols because we need a // protocol with no Self references to which we can cast XCTestCase instances in a non-generic context. -public protocol XCTestCaseProviderStatic { +protocol XCTestCaseProviderStatic { // This should be explicitly implemented by XCTestCase subclasses static var allTests: [(String, (Self) -> () throws -> Void)] { get } } -public protocol XCTestCaseNameProvider { +protocol XCTestCaseNameProvider { // This does not need to be explicitly implemented because of the protocol extension below var allTestNames: [String] { get } } -public protocol XCTestCaseProvider: XCTestCaseProviderStatic, XCTestCaseNameProvider {} +protocol XCTestCaseProvider: XCTestCaseProviderStatic, XCTestCaseNameProvider {} -public extension XCTestCaseProvider where Self: XCTestCaseProviderStatic { +extension XCTestCaseProvider where Self: XCTestCaseProviderStatic { var allTestNames: [String] { return type(of: self).allTests.map { name, _ in return name diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/AfterEachTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/AfterEachTests.swift index f6b6777..6e4e703 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 @@ -41,8 +41,8 @@ class FunctionalTests_AfterEachSpec: QuickSpec { // The list should contain the afterEach for those example, executed from top to bottom. expect(afterEachOrder).to(equal([ .outerOne, .outerTwo, .outerThree, - .outerOne, .outerTwo, .outerThree - ])) + .outerOne, .outerTwo, .outerThree, + ])) } } @@ -57,7 +57,7 @@ class FunctionalTests_AfterEachSpec: QuickSpec { afterEach { } }.to(raiseException { (exception: NSException) in expect(exception.name).to(equal(NSExceptionName.internalInconsistencyException)) - expect(exception.reason).to(equal("'afterEach' cannot be used inside 'it', 'afterEach' may only be used inside 'context' or 'describe'. ")) + expect(exception.reason).to(equal("'afterEach' cannot be used inside 'it', 'afterEach' may only be used inside 'context' or 'describe'.")) }) } } @@ -68,7 +68,7 @@ class FunctionalTests_AfterEachSpec: QuickSpec { final class AfterEachTests: XCTestCase, XCTestCaseProvider { static var allTests: [(String, (AfterEachTests) -> () throws -> Void)] { return [ - ("testAfterEachIsExecutedInTheCorrectOrder", testAfterEachIsExecutedInTheCorrectOrder) + ("testAfterEachIsExecutedInTheCorrectOrder", testAfterEachIsExecutedInTheCorrectOrder), ] } @@ -83,7 +83,7 @@ final class AfterEachTests: XCTestCase, XCTestCaseProvider { .outerOne, .outerTwo, .outerThree, // [3] The inner afterEach closures are executed from top to bottom, // then the outer afterEach closures are executed from top to bottom. - .innerOne, .innerTwo, .outerOne, .outerTwo, .outerThree + .innerOne, .innerTwo, .outerOne, .outerTwo, .outerThree, ] XCTAssertEqual(afterEachOrder, expectedOrder) 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 17b222e..9b5d44e 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 @@ -42,7 +42,7 @@ class FunctionalTests_BeforeEachSpec: QuickSpec { beforeEach { } }.to(raiseException { (exception: NSException) in expect(exception.name).to(equal(NSExceptionName.internalInconsistencyException)) - expect(exception.reason).to(equal("'beforeEach' cannot be used inside 'it', 'beforeEach' may only be used inside 'context' or 'describe'. ")) + expect(exception.reason).to(equal("'beforeEach' cannot be used inside 'it', 'beforeEach' may only be used inside 'context' or 'describe'.")) }) } } @@ -53,7 +53,7 @@ class FunctionalTests_BeforeEachSpec: QuickSpec { final class BeforeEachTests: XCTestCase, XCTestCaseProvider { static var allTests: [(String, (BeforeEachTests) -> () throws -> Void)] { return [ - ("testBeforeEachIsExecutedInTheCorrectOrder", testBeforeEachIsExecutedInTheCorrectOrder) + ("testBeforeEachIsExecutedInTheCorrectOrder", testBeforeEachIsExecutedInTheCorrectOrder), ] } @@ -68,7 +68,7 @@ final class BeforeEachTests: XCTestCase, XCTestCaseProvider { .outerOne, .outerTwo, // [3] The outer beforeEach closures are executed from top to bottom, // then the inner beforeEach closures are executed from top to bottom. - .outerOne, .outerTwo, .innerOne, .innerTwo, .innerThree + .outerOne, .outerTwo, .innerOne, .innerTwo, .innerThree, ] XCTAssertEqual(beforeEachOrder, expectedOrder) } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/BeforeSuiteTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/BeforeSuiteTests.swift index df39126..4213486 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/BeforeSuiteTests.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/BeforeSuiteTests.swift @@ -23,7 +23,7 @@ class FunctionalTests_BeforeSuite_Spec: QuickSpec { final class BeforeSuiteTests: XCTestCase, XCTestCaseProvider { static var allTests: [(String, (BeforeSuiteTests) -> () throws -> Void)] { return [ - ("testBeforeSuiteIsExecutedBeforeAnyExamples", testBeforeSuiteIsExecutedBeforeAnyExamples) + ("testBeforeSuiteIsExecutedBeforeAnyExamples", testBeforeSuiteIsExecutedBeforeAnyExamples), ] } @@ -31,8 +31,8 @@ final class BeforeSuiteTests: XCTestCase, XCTestCaseProvider { // Execute the spec with an assertion before the one with a beforeSuite let result = qck_runSpecs([ FunctionalTests_BeforeSuite_Spec.self, - FunctionalTests_BeforeSuite_BeforeSuiteSpec.self - ]) + FunctionalTests_BeforeSuite_BeforeSuiteSpec.self, + ]) XCTAssert(result!.hasSucceeded) } 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 54bcb42..db22bbf 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 @@ -27,7 +27,7 @@ class FunctionalTests_BehaviorTests_ErrorSpec: QuickSpec { } .to(raiseException {(exception: NSException) in expect(exception.name).to(equal(NSExceptionName.internalInconsistencyException)) - expect(exception.reason).to(equal("'itBehavesLike' cannot be used inside 'it', 'itBehavesLike' may only be used inside 'context' or 'describe'. ")) + expect(exception.reason).to(equal("'itBehavesLike' cannot be used inside 'it', 'itBehavesLike' may only be used inside 'context' or 'describe'.")) }) } } @@ -39,10 +39,8 @@ final class BehaviorTests: XCTestCase, XCTestCaseProvider { static var allTests: [(String, (BehaviorTests) -> () throws -> Void)] { return [ - ("testBehaviorPassContextToExamples", - testBehaviorPassContextToExamples), - ("testBehaviorExecutesThreeExamples", - testBehaviorExecutesThreeExamples) + ("testBehaviorPassContextToExamples", testBehaviorPassContextToExamples), + ("testBehaviorExecutesThreeExamples", testBehaviorExecutesThreeExamples), ] } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/Configuration/AfterEach/Configuration+AfterEachTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/Configuration/AfterEach/Configuration+AfterEachTests.swift index d7c2105..2cb0113 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/Configuration/AfterEach/Configuration+AfterEachTests.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/Configuration/AfterEach/Configuration+AfterEachTests.swift @@ -16,7 +16,7 @@ class Configuration_AfterEachSpec: QuickSpec { final class Configuration_AfterEachTests: XCTestCase, XCTestCaseProvider { static var allTests: [(String, (Configuration_AfterEachTests) -> () throws -> Void)] { return [ - ("testExampleIsRunAfterTheConfigurationBeforeEachIsExecuted", testExampleIsRunAfterTheConfigurationBeforeEachIsExecuted) + ("testExampleIsRunAfterTheConfigurationBeforeEachIsExecuted", testExampleIsRunAfterTheConfigurationBeforeEachIsExecuted), ] } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/Configuration/BeforeEach/Configuration+BeforeEachTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/Configuration/BeforeEach/Configuration+BeforeEachTests.swift index ddf1509..a7a8c3c 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/Configuration/BeforeEach/Configuration+BeforeEachTests.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/Configuration/BeforeEach/Configuration+BeforeEachTests.swift @@ -13,7 +13,7 @@ class Configuration_BeforeEachSpec: QuickSpec { final class Configuration_BeforeEachTests: XCTestCase, XCTestCaseProvider { static var allTests: [(String, (Configuration_BeforeEachTests) -> () throws -> Void)] { return [ - ("testExampleIsRunAfterTheConfigurationBeforeEachIsExecuted", testExampleIsRunAfterTheConfigurationBeforeEachIsExecuted) + ("testExampleIsRunAfterTheConfigurationBeforeEachIsExecuted", testExampleIsRunAfterTheConfigurationBeforeEachIsExecuted), ] } 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 eb6c03a..20d0846 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 @@ -11,7 +11,7 @@ class QuickContextTests: QuickSpec { context("A nested context that should throw") { } }.to(raiseException { (exception: NSException) in expect(exception.name).to(equal(NSExceptionName.internalInconsistencyException)) - expect(exception.reason).to(equal("'context' cannot be used inside 'it', 'context' may only be used inside 'context' or 'describe'. ")) + expect(exception.reason).to(equal("'context' cannot be used inside 'it', 'context' may only be used inside 'context' or 'describe'.")) }) } } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/CurrentSpecTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/CurrentSpecTests.swift index 05b37f7..db610c1 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/CurrentSpecTests.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/CurrentSpecTests.swift @@ -1,12 +1,19 @@ import Quick import Nimble - -#if !SWIFT_PACKAGE +import Dispatch class CurrentSpecTests: QuickSpec { override func spec() { it("returns the currently executing spec") { - expect(QuickSpec.current?.name).to(match("currently_executing_spec")) + let name: String = { + let result = QuickSpec.current.name + #if canImport(Darwin) + return result.replacingOccurrences(of: "_", with: " ") + #else + return result + #endif + }() + expect(name).to(match("returns the currently executing spec")) } let currentSpecDuringSpecSetup = QuickSpec.current @@ -16,10 +23,15 @@ class CurrentSpecTests: QuickSpec { it("supports XCTest expectations") { let expectation = QuickSpec.current.expectation(description: "great expectation") - DispatchQueue.main.async(execute: expectation.fulfill) + let fulfill: () -> Void + #if canImport(Darwin) + fulfill = expectation.fulfill + #else + // https://github.com/apple/swift-corelibs-xctest/blob/51afda0bc782b2d6a2f00fbdca58943faf6ccecd/Sources/XCTest/Public/Asynchronous/XCTestExpectation.swift#L233-L253 + fulfill = { expectation.fulfill() } + #endif + DispatchQueue.main.async(execute: fulfill) QuickSpec.current.waitForExpectations(timeout: 1) } } } - -#endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/DescribeTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/DescribeTests.swift index a923f4d..7bdeee6 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 @@ -7,7 +7,7 @@ import Quick final class DescribeTests: XCTestCase, XCTestCaseProvider { static var allTests: [(String, (DescribeTests) -> () throws -> Void)] { return [ - ("testDescribeThrowsIfUsedOutsideOfQuickSpec", testDescribeThrowsIfUsedOutsideOfQuickSpec) + ("testDescribeThrowsIfUsedOutsideOfQuickSpec", testDescribeThrowsIfUsedOutsideOfQuickSpec), ] } @@ -24,7 +24,7 @@ class QuickDescribeTests: QuickSpec { describe("A nested describe that should throw") { } }.to(raiseException { (exception: NSException) in expect(exception.name).to(equal(NSExceptionName.internalInconsistencyException)) - expect(exception.reason).to(equal("'describe' cannot be used inside 'it', 'describe' may only be used inside 'context' or 'describe'. ")) + expect(exception.reason).to(equal("'describe' cannot be used inside 'it', 'describe' may only be used inside 'context' or 'describe'.")) }) } } 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 3016401..d04db0d 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,8 +16,7 @@ class FunctionalTests_ItSpec: QuickSpec { expect(exampleMetadata!.example.name).to(equal(name)) } -#if canImport(Darwin) && !SWIFT_PACKAGE - +#if canImport(Darwin) describe("when an example has a unique name") { it("has a unique name") {} @@ -29,7 +28,7 @@ class FunctionalTests_ItSpec: QuickSpec { expect(allSelectors) == [ "when_an_example_has_a_unique_name__doesn_t_add_multiple_selectors_for_it", - "when_an_example_has_a_unique_name__has_a_unique_name" + "when_an_example_has_a_unique_name__has_a_unique_name", ] } } @@ -47,19 +46,20 @@ class FunctionalTests_ItSpec: QuickSpec { expect(allSelectors) == [ "when_two_examples_have_the_exact_name__has_exactly_the_same_name", "when_two_examples_have_the_exact_name__has_exactly_the_same_name_2", - "when_two_examples_have_the_exact_name__makes_a_unique_name_for_each_of_the_above" + "when_two_examples_have_the_exact_name__makes_a_unique_name_for_each_of_the_above", ] } } +#if !SWIFT_PACKAGE describe("error handling when misusing ordering") { it("an it") { expect { it("will throw an error when it is nested in another it") { } }.to(raiseException { (exception: NSException) in expect(exception.name).to(equal(NSExceptionName.internalInconsistencyException)) - expect(exception.reason).to(equal("'it' cannot be used inside 'it', 'it' may only be used inside 'context' or 'describe'. ")) + expect(exception.reason).to(equal("'it' cannot be used inside 'it', 'it' may only be used inside 'context' or 'describe'.")) }) } @@ -79,7 +79,7 @@ class FunctionalTests_ItSpec: QuickSpec { it("should have thrown an exception with the correct error message") { expect(exception).toNot(beNil()) - expect(exception!.reason).to(equal("'it' cannot be used inside 'beforeEach', 'it' may only be used inside 'context' or 'describe'. ")) + expect(exception!.reason).to(equal("'it' cannot be used inside 'beforeEach', 'it' may only be used inside 'context' or 'describe'.")) } } @@ -90,7 +90,7 @@ class FunctionalTests_ItSpec: QuickSpec { let capture = NMBExceptionCapture(handler: ({ e in exception = e expect(exception).toNot(beNil()) - expect(exception!.reason).to(equal("'it' cannot be used inside 'afterEach', 'it' may only be used inside 'context' or 'describe'. ")) + expect(exception!.reason).to(equal("'it' cannot be used inside 'afterEach', 'it' may only be used inside 'context' or 'describe'.")) }), finally: nil) capture.tryBlock { @@ -103,25 +103,75 @@ class FunctionalTests_ItSpec: QuickSpec { } } #endif +#endif + } +} + +private var isRunningFunctionalTests = false + +class FunctionalTests_ImplicitErrorItSpec: QuickSpec { + override func spec() { + describe("implicit error handling") { + enum ExampleError: Error { + case error + } + + func nonThrowingFunc() throws {} + + func throwingFunc(shouldThrow: Bool) throws { + if shouldThrow { + throw ExampleError.error + } + } + + it("supports calling functions marked as throws") { + try nonThrowingFunc() + } + + it("supports calling functions that actually throws") { + try throwingFunc(shouldThrow: isRunningFunctionalTests) + } + } } } final class ItTests: XCTestCase, XCTestCaseProvider { static var allTests: [(String, (ItTests) -> () throws -> Void)] { return [ - ("testAllExamplesAreExecuted", testAllExamplesAreExecuted) + ("testAllExamplesAreExecuted", testAllExamplesAreExecuted), + ("testImplicitErrorHandling", testImplicitErrorHandling), ] } -#if canImport(Darwin) && !SWIFT_PACKAGE + override func setUp() { + super.setUp() + isRunningFunctionalTests = true + } + + override func tearDown() { + isRunningFunctionalTests = false + super.tearDown() + } + func testAllExamplesAreExecuted() { let result = qck_runSpec(FunctionalTests_ItSpec.self) + #if canImport(Darwin) + #if SWIFT_PACKAGE + XCTAssertEqual(result?.executionCount, 7) + #else XCTAssertEqual(result?.executionCount, 10) - } -#else - func testAllExamplesAreExecuted() { - let result = qck_runSpec(FunctionalTests_ItSpec.self) + #endif + #else XCTAssertEqual(result?.executionCount, 2) + #endif + } + + func testImplicitErrorHandling() { + let result = qck_runSpec(FunctionalTests_ImplicitErrorItSpec.self)! + XCTAssertFalse(result.hasSucceeded) + XCTAssertEqual(result.executionCount, 2) + XCTAssertEqual(result.failureCount, 0) + XCTAssertEqual(result.unexpectedExceptionCount, 1) + XCTAssertEqual(result.totalFailureCount, 1) } -#endif } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ObjC/ItTests+ObjC.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ObjC/ItTests+ObjC.m index 39e0b7d..6b8fdb3 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ObjC/ItTests+ObjC.m +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/ObjC/ItTests+ObjC.m @@ -2,8 +2,8 @@ @import Quick; @import Nimble; +#import "QuickTests-Swift.h" #import "QCKSpecRunner.h" -#import "QuickSpec+QuickSpec_MethodList.h" QuickSpecBegin(FunctionalTests_ItSpec_ObjC) diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/PendingTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/PendingTests.swift index 5334200..556a981 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/PendingTests.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/PendingTests.swift @@ -28,6 +28,18 @@ class FunctionalTests_PendingSpec: QuickSpec { beforeEach { onlyPendingExamplesBeforeEachExecutedCount += 1 } pending("an example that will not run") {} } + describe("a describe block with a disabled context that will not run") { + xcontext("these examples will not run") { + it("does not run") { + fail() + } + } + } + xdescribe("a describe block that will not run") { + it("does not run") { + fail() + } + } } } @@ -36,7 +48,7 @@ final class PendingTests: XCTestCase, XCTestCaseProvider { return [ ("testAnOtherwiseFailingExampleWhenMarkedPendingDoesNotCauseTheSuiteToFail", testAnOtherwiseFailingExampleWhenMarkedPendingDoesNotCauseTheSuiteToFail), ("testBeforeEachOnlyRunForEnabledExamples", testBeforeEachOnlyRunForEnabledExamples), - ("testBeforeEachDoesNotRunForContextsWithOnlyPendingExamples", testBeforeEachDoesNotRunForContextsWithOnlyPendingExamples) + ("testBeforeEachDoesNotRunForContextsWithOnlyPendingExamples", testBeforeEachDoesNotRunForContextsWithOnlyPendingExamples), ] } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/QuickSpec_SelectedTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/QuickSpec_SelectedTests.swift new file mode 100644 index 0000000..f0e206c --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/QuickSpec_SelectedTests.swift @@ -0,0 +1,52 @@ +#if canImport(Darwin) && !SWIFT_PACKAGE + +import Nimble +import Quick +import XCTest + +// The regression tests for https://github.com/Quick/Quick/issues/891 + +class SimulateSelectedTests_TestCase: QuickSpec { + override class var defaultTestSuite: QuickTestSuite { + // XCTest doesn't call `defaultTestSuite` when running only selected tests. + // We simulate this behavior by not calling super. + return .init(name: "Selected tests") + } + + override func spec() { + it("example1") { } + it("example2") { } + it("example3") { } + } +} + +class SimulareAllTests_TestCase: QuickSpec { + override func spec() { + it("example1") { } + it("example2") { } + it("example3") { } + } +} + +class QuickSpec_SelectedTests: XCTestCase { + + func testQuickSpecTestInvocationsForAllTests() { + // Simulate running 'All tests' + let invocations = SimulareAllTests_TestCase.testInvocations + expect(invocations).to(haveCount(3)) + + let selectorNames = invocations.map { $0.selector.description } + expect(selectorNames).to(contain(["example1", "example2", "example3"])) + } + + func testQuickSpecTestInvocationsForSelectedTests() { + // Simulate running 'Selected tests' + let invocations = SimulateSelectedTests_TestCase.testInvocations + expect(invocations).to(haveCount(3)) + + let selectorNames = invocations.map { $0.selector.description } + expect(selectorNames).to(contain(["example1", "example2", "example3"])) + } +} + +#endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/SharedExamples+BeforeEachTests.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/SharedExamples+BeforeEachTests.swift index 2b0fd77..c458075 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/SharedExamples+BeforeEachTests.swift +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/FunctionalTests/SharedExamples+BeforeEachTests.swift @@ -28,7 +28,7 @@ final class SharedExamples_BeforeEachTests: XCTestCase, XCTestCaseProvider { static var allTests: [(String, (SharedExamples_BeforeEachTests) -> () throws -> Void)] { return [ ("testBeforeEachOutsideOfSharedExamplesExecutedOnceBeforeEachExample", testBeforeEachOutsideOfSharedExamplesExecutedOnceBeforeEachExample), - ("testBeforeEachInSharedExamplesExecutedOnceBeforeEachSharedExample", testBeforeEachInSharedExamplesExecutedOnceBeforeEachSharedExample) + ("testBeforeEachInSharedExamplesExecutedOnceBeforeEachSharedExample", testBeforeEachInSharedExamplesExecutedOnceBeforeEachSharedExample), ] } 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 f75f524..63395b3 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 @@ -24,7 +24,7 @@ class FunctionalTests_SharedExamples_ErrorSpec: QuickSpec { itBehavesLike("a group of three shared examples") }.to(raiseException { (exception: NSException) in expect(exception.name).to(equal(NSExceptionName.internalInconsistencyException)) - expect(exception.reason).to(equal("'itBehavesLike' cannot be used inside 'it', 'itBehavesLike' may only be used inside 'context' or 'describe'. ")) + expect(exception.reason).to(equal("'itBehavesLike' cannot be used inside 'it', 'itBehavesLike' may only be used inside 'context' or 'describe'.")) }) } } @@ -37,7 +37,7 @@ final class SharedExamplesTests: XCTestCase, XCTestCaseProvider { static var allTests: [(String, (SharedExamplesTests) -> () throws -> Void)] { return [ ("testAGroupOfThreeSharedExamplesExecutesThreeExamples", testAGroupOfThreeSharedExamplesExecutesThreeExamples), - ("testSharedExamplesWithContextPassContextToExamples", testSharedExamplesWithContextPassContextToExamples) + ("testSharedExamplesWithContextPassContextToExamples", testSharedExamplesWithContextPassContextToExamples), ] } 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 a3437a1..127e521 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 @@ -1,32 +1,17 @@ @import Quick; +#if __has_include("QuickTests-Swift.h") +#import "QuickTests-Swift.h" +#elif __has_include("QuickFocusedTests-Swift.h") +#import "QuickFocusedTests-Swift.h" +#endif + #import "QCKSpecRunner.h" -#import "XCTestObservationCenter+QCKSuspendObservation.h" - -@interface XCTest (Redeclaration) -- (XCTestRun *)run; -@end - -XCTestRun * _Nullable qck_runSuite(XCTestSuite * _Nonnull suite) { - [World sharedWorld].isRunningAdditionalSuites = YES; - - __block XCTestRun *result = nil; - [[XCTestObservationCenter sharedTestObservationCenter] qck_suspendObservationForBlock:^{ - [suite runTest]; - result = suite.testRun; - }]; - return result; -} XCTestRun *qck_runSpec(Class specClass) { - return qck_runSuite([XCTestSuite testSuiteForTestCaseClass:specClass]); + return [QCKSpecRunner runSpec:specClass]; } XCTestRun * _Nullable qck_runSpecs(NSArray * _Nonnull specClasses) { - XCTestSuite *suite = [XCTestSuite testSuiteWithName:@"MySpecs"]; - for (Class specClass in specClasses) { - [suite addTest:[XCTestSuite testSuiteForTestCaseClass:specClass]]; - } - - return qck_runSuite(suite); + return [QCKSpecRunner runSpecs:specClasses]; } diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+MethodList.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+MethodList.swift new file mode 100644 index 0000000..1acb529 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+MethodList.swift @@ -0,0 +1,24 @@ +#if canImport(Darwin) +import Foundation +import Quick + +extension QuickSpec { + @objc static func allSelectors() -> Set { + var allSelectors = Set() + + var methodCount: UInt32 = 0 + guard let methodList = class_copyMethodList(self, &methodCount) else { + return [] + } + defer { free(methodList) } + + for i in 0.. - -NS_ASSUME_NONNULL_BEGIN - -@interface QuickSpec (QuickSpec_MethodList) - -/** - * This method will instantiate an instance of the class on which it is called, - * returning a list of selector names for it. - * - * @return a set of NSStrings representing the list of selectors it contains - */ -+ (NSSet *)allSelectors; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Carthage/Checkouts/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 deleted file mode 100644 index 5a403f2..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpec+QuickSpec_MethodList.m +++ /dev/null @@ -1,23 +0,0 @@ -#import "QuickSpec+QuickSpec_MethodList.h" -#import - - -@implementation QuickSpec (QuickSpec_MethodList) - -+ (NSSet *)allSelectors { - QuickSpec *specInstance = [[[self class] alloc] init]; - NSMutableSet *allSelectors = [NSMutableSet set]; - - unsigned int methodCount = 0; - Method *methodList = class_copyMethodList(object_getClass(specInstance), &methodCount); - - for (unsigned int i = 0; i < methodCount; i++) { - SEL selector = method_getName(methodList[i]); - [allSelectors addObject:NSStringFromSelector(selector)]; - } - - free(methodList); - return [allSelectors copy]; -} - -@end diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpecRunner.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpecRunner.swift new file mode 100644 index 0000000..bc57921 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickSpecRunner.swift @@ -0,0 +1,101 @@ +import Foundation +import XCTest +@testable import Quick + +#if !canImport(Darwin) +// Based on https://github.com/apple/swift-corelibs-xctest/blob/51afda0bc782b2d6a2f00fbdca58943faf6ccecd/Sources/XCTest/Private/XCTestCaseSuite.swift#L14-L42 +private final class TestCaseSuite: XCTestSuite { + let specClass: QuickSpec.Type + + init(specClass: QuickSpec.Type) { + self.specClass = specClass + super.init(name: String(describing: specClass)) + + for (testName, testClosure) in specClass.allTests { + let testCase = specClass.init(name: testName, testClosure: { testCase in + // swiftlint:disable:next force_cast + try testClosure(testCase as! QuickSpec)() + }) + addTest(testCase) + } + } + + override func setUp() { + specClass.setUp() + } + + override func tearDown() { + specClass.tearDown() + } +} +#endif + +/** + Runs an XCTestSuite instance containing only the given QuickSpec subclass. + Use this to run QuickSpec subclasses from within a set of unit tests. + + Due to implicit dependencies in _XCTFailureHandler, this function raises an + exception when used in Swift to run a failing test case. + + @param specClass The class of the spec to be run. + @return An XCTestRun instance that contains information such as the number of failures, etc. + */ +@discardableResult +func qck_runSpec(_ specClass: QuickSpec.Type) -> XCTestRun? { + return qck_runSpecs([specClass]) +} + +/** + Runs an XCTestSuite instance containing the given QuickSpec subclasses, in the order provided. + See the documentation for `qck_runSpec` for more details. + + @param specClasses An array of QuickSpec classes, in the order they should be run. + @return An XCTestRun instance that contains information such as the number of failures, etc. + */ +@discardableResult +func qck_runSpecs(_ specClasses: [QuickSpec.Type]) -> XCTestRun? { + return World.anotherWorld { world -> XCTestRun? in + QuickConfiguration.configureSubclassesIfNeeded(world: world) + + world.isRunningAdditionalSuites = true + defer { world.isRunningAdditionalSuites = false } + + #if !SWIFT_PACKAGE + // Gather examples first + QuickSpec.enumerateSubclasses(subclasses: specClasses) { specClass in + // This relies on `_QuickSpecInternal`. + (specClass as AnyClass).buildExamplesIfNeeded() + } + #endif + + let suite = XCTestSuite(name: "MySpecs") + for specClass in specClasses { + #if canImport(Darwin) + let test = specClass.defaultTestSuite + #else + let test = TestCaseSuite(specClass: specClass) + #endif + suite.addTest(test) + } + + let result: XCTestRun? = XCTestObservationCenter.shared.qck_suspendObservation { + suite.run() + return suite.testRun + } + return result + } +} + +#if canImport(Darwin) && !SWIFT_PACKAGE +@objc(QCKSpecRunner) +@objcMembers +class QuickSpecRunner: NSObject { + static func runSpec(_ specClass: QuickSpec.Type) -> XCTestRun? { + return qck_runSpec(specClass) + } + + static func runSpecs(_ specClasses: [QuickSpec.Type]) -> XCTestRun? { + return qck_runSpecs(specClasses) + } +} +#endif diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h index 301c5d5..8b13789 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h @@ -1,2 +1 @@ -#import "QCKSpecRunner.h" -#import "QuickSpec+QuickSpec_MethodList.h" + diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.h b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.h deleted file mode 100644 index d69f808..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.h +++ /dev/null @@ -1,20 +0,0 @@ -#import - -/** - Add the ability to temporarily disable internal XCTest execution observation in - order to run isolated XCTestSuite instances while the QuickTests test suite is running. - */ -@interface XCTestObservationCenter (QCKSuspendObservation) - -/** - Suspends test suite observation for XCTest-provided observers for the duration that - the block is executing. Any test suites that are executed within the block do not - generate any log output. Failures are still reported. - - Use this method to run XCTestSuite objects while another XCTestSuite is running. - Without this method, tests fail with the message: "Timed out waiting for IDE - barrier message to complete" or "Unexpected TestSuiteDidStart". - */ -- (void)qck_suspendObservationForBlock:(void (^)(void))block; - -@end diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.m b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.m deleted file mode 100644 index 1a32e10..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.m +++ /dev/null @@ -1,54 +0,0 @@ -@import XCTest; -#import - -@interface XCTestObservationCenter (Redeclaration) -- (id)observers; -- (void)removeTestObserver:(id)testObserver; -@end - -@implementation XCTestObservationCenter (QCKSuspendObservation) - -/// This allows us to only suspend observation for observers by provided by Apple -/// as a part of the XCTest framework. In particular it is important that we not -/// suspend the observer added by Nimble, otherwise it is unable to properly -/// report assertion failures. -static BOOL (^isFromApple)(id) = ^BOOL(id observer){ - return [[NSBundle bundleForClass:[observer class]].bundleIdentifier containsString:@"com.apple.dt.XCTest"]; -}; - -- (void)qck_suspendObservationForBlock:(void (^)(void))block { - id originalObservers = [[self observers] copy]; - NSMutableArray *suspendedObservers = [NSMutableArray new]; - - for (id observer in originalObservers) { - if (isFromApple(observer)) { - [suspendedObservers addObject:observer]; - - if ([self respondsToSelector:@selector(removeTestObserver:)]) { - [self removeTestObserver:observer]; - } - else if ([[self observers] respondsToSelector:@selector(removeObject:)]) { - [[self observers] removeObject:observer]; - } - else { - NSAssert(NO, @"unexpected type: unable to remove observers: %@", originalObservers); - } - } - } - - @try { - block(); - } - @finally { - for (id observer in suspendedObservers) { - if ([[self observers] respondsToSelector:@selector(addObject:)]) { - [[self observers] addObject:observer]; - } - else if ([self respondsToSelector:@selector(addTestObserver:)]) { - [self addTestObserver:observer]; - } - } - } -} - -@end diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.swift b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.swift new file mode 100644 index 0000000..48bcbeb --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.swift @@ -0,0 +1,64 @@ +import Foundation +import XCTest + +/// This allows us to only suspend observation for observers by provided by Apple +/// as a part of the XCTest framework. In particular it is important that we not +/// suspend the observer added by Nimble, otherwise it is unable to properly +/// report assertion failures. +private func isFromApple(observer: XCTestObservation) -> Bool { + #if canImport(Darwin) + guard let bundleIdentifier = Bundle(for: type(of: observer)).bundleIdentifier else { + return false + } + return bundleIdentifier.contains("com.apple.dt.XCTest") + #else + // https://github.com/apple/swift-corelibs-xctest/blob/swift-5.0.1-RELEASE/Sources/XCTest/Public/XCTestMain.swift#L91-L93 + return String(describing: observer) == "XCTest.PrintObserver" + || String(describing: type(of: observer)) == "PrintObserver" + #endif +} + +/** + Add the ability to temporarily disable internal XCTest execution observation in + order to run isolated XCTestSuite instances while the QuickTests test suite is running. + */ +extension XCTestObservationCenter { + /** + Suspends test suite observation for XCTest-provided observers for the duration that + the block is executing. Any test suites that are executed within the block do not + generate any log output. Failures are still reported. + + Use this method to run XCTestSuite objects while another XCTestSuite is running. + Without this method, tests fail with the message: "Timed out waiting for IDE + barrier message to complete" or "Unexpected TestSuiteDidStart". + */ + func qck_suspendObservation(forBlock block: () -> T) -> T { + #if canImport(Darwin) + let originalObservers = value(forKey: "observers") as? [XCTestObservation] ?? [] + #else + let originalObservers: [XCTestObservation] = { + // https://github.com/apple/swift-corelibs-xctest/blob/swift-5.0.1-RELEASE/Sources/XCTest/Public/XCTestObservationCenter.swift#L20-L22 + let mirror = Mirror(reflecting: self) + let observers = mirror.descendant("observers") as? Set ?? [] + return observers.compactMap { hashable in + // https://github.com/apple/swift-corelibs-xctest/blob/swift-5.0.1-RELEASE/Sources/XCTest/Private/ObjectWrapper.swift#L16-L17 + let wrapperMirror = Mirror(reflecting: hashable.base) + return wrapperMirror.descendant("object") as? XCTestObservation + } + }() + #endif + var suspendedObservers = [XCTestObservation]() + + for observer in originalObservers where isFromApple(observer: observer) { + suspendedObservers.append(observer) + removeTestObserver(observer) + } + defer { + for observer in suspendedObservers { + addTestObserver(observer) + } + } + + return block() + } +} diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/script/travis-install-linux b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/script/travis-install-linux deleted file mode 100755 index 279cd88..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/script/travis-install-linux +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -set -e - -# See: https://github.com/kylef/swiftenv/wiki/Travis-CI -curl -sL https://gist.github.com/kylef/5c0475ff02b7c7671d2a/raw/621ef9b29bbb852fdfd2e10ed147b321d792c1e4/swiftenv-install.sh | bash diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/script/travis-script-linux b/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/script/travis-script-linux deleted file mode 100755 index 7a6558d..0000000 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/Quick/script/travis-script-linux +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh - -. ~/.swiftenv/init -rake test:swiftpm diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Common.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Common.xcconfig index 99b7fc8..ad3576f 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Common.xcconfig +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Common.xcconfig @@ -10,6 +10,12 @@ ALWAYS_SEARCH_USER_PATHS = NO // Architectures to build ARCHS = $(ARCHS_STANDARD) +// Check for Grand Central Dispatch idioms that may lead to poor performance. +CLANG_ANALYZER_GCD_PERFORMANCE = YES + +// Warn when a number object, such as an instance of `NSNumber`, `CFNumberRef`, `OSNumber`, or `OSBoolean` is compared or converted to a primitive value instead of another object. +CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE + // Whether to warn when a floating-point value is used as a loop counter CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES @@ -25,10 +31,25 @@ CLANG_ENABLE_MODULES = YES // Enable ARC CLANG_ENABLE_OBJC_ARC = YES +// Warn when a source file does not end with a newline. +GCC_WARN_ABOUT_MISSING_NEWLINE = YES + +// Warn about assigning integer constants to enum values that are out of the range of the enumerated type. +CLANG_WARN_ASSIGN_ENUM = YES + +// Warns when an atomic is used with an implicitly sequentially-consistent memory order, instead of explicitly specifying memory order. +CLANG_WARN_ATOMIC_IMPLICIT_SEQ_CST = YES + +// Warn about block captures of implicitly autoreleasing parameters. +CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES + // Warn about implicit conversions to boolean values that are suspicious. // For example, writing 'if (foo)' with 'foo' being the name a function will trigger a warning. CLANG_WARN_BOOL_CONVERSION = YES +// Warn about suspicious uses of the comma operator. +CLANG_WARN_COMMA = YES + // Warn about implicit conversions of constant values that cause the constant value to change, // either through a loss of precision, or entirely in its meaning. CLANG_WARN_CONSTANT_CONVERSION = YES @@ -39,6 +60,9 @@ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES // Warn about direct accesses to the Objective-C 'isa' pointer instead of using a runtime API. CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR +// Warns about issues in documentation comments (`doxygen`-style) such as missing or incorrect documentation tags. +CLANG_WARN_DOCUMENTATION_COMMENTS = YES + // Warn about declaring the same method more than once within the same @interface. CLANG_WARN__DUPLICATE_METHOD_MATCH = YES @@ -56,15 +80,48 @@ CLANG_WARN_IMPLICIT_SIGN_CONVERSION = NO // For example, this can catch issues when one incorrectly intermixes using NSNumbers and raw integers. CLANG_WARN_INT_CONVERSION = YES +// Warn about non-literal expressions that evaluate to zero being treated as a null pointer. +CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES + +// Warn about implicit capture of self (e.g. direct ivar access) +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES + +// Warn about implicit conversions from Objective-C literals to values of incompatible type. +CLANG_WARN_OBJC_LITERAL_CONVERSION = YES + // Don't warn about repeatedly using a weak reference without assigning the weak reference to a strong reference. Too many false positives. CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = NO // Warn about classes that unintentionally do not subclass a root class (such as NSObject). CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR +// Warn about implicit ownership types on Objective-C object references as out parameters. For example, declaring a parameter with type `NSObject**` will produce a warning because the compiler will assume that the out parameter's ownership type is `__autoreleasing` +CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES + +// Warns when a quoted include is used instead of a framework style include in a framework header. +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES + +// Warn about ranged-based for loops. +CLANG_WARN_RANGE_LOOP_ANALYSIS = YES + // Whether to warn on suspicious implicit conversions CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES +// Warn about non-prototype declarations. +CLANG_WARN_STRICT_PROTOTYPES = YES + +// Warn if an API that is newer than the deployment target is used without "if (@available(...))" guards. +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE + +// Warn about incorrect uses of nullable values +CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION = YES + +// Warn for missing nullability attributes +CLANG_ANALYZER_NONNULL = YES + +// Warn when a non-localized string is passed to a user-interface method expecting a localized string +CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES + // Warn about potentially unreachable code CLANG_WARN_UNREACHABLE_CODE = YES @@ -77,8 +134,8 @@ ENABLE_NS_ASSERTIONS = YES // Whether to require objc_msgSend to be cast before invocation ENABLE_STRICT_OBJC_MSGSEND = YES -// Which C variant to use -GCC_C_LANGUAGE_STANDARD = gnu99 +// Which C variant to use. gnu11 is the default value when creating a Xcode project with version 10.1 (10B61) +GCC_C_LANGUAGE_STANDARD = gnu11 // Whether to enable exceptions for Objective-C GCC_ENABLE_OBJC_EXCEPTIONS = YES @@ -106,6 +163,7 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0 // Whether warnings are treated as errors GCC_TREAT_WARNINGS_AS_ERRORS = YES +SWIFT_TREAT_WARNINGS_AS_ERRORS = YES // Whether to warn about 64-bit values being implicitly shortened to 32 bits GCC_WARN_64_TO_32_BIT_CONVERSION = YES @@ -155,8 +213,8 @@ GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES // Warn if a "@selector(...)" expression referring to an undeclared selector is found GCC_WARN_UNDECLARED_SELECTOR = YES -// Warn if a variable might be clobbered by a setjmp call or if an automatic variable is used without prior initialization. -GCC_WARN_UNINITIALIZED_AUTOS = YES +// Warn if a variable might be clobbered by a `setjmp` call or if an automatic variable is used without prior initialization. +GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE // Whether to warn about static functions that are unused GCC_WARN_UNUSED_FUNCTION = YES @@ -171,9 +229,17 @@ GCC_WARN_UNUSED_VARIABLE = YES RUN_CLANG_STATIC_ANALYZER = YES // Don't treat unknown warnings as errors, and disable GCC compatibility warnings and unused static const variable warnings -WARNING_CFLAGS = -Wno-error=unknown-warning-option -Wno-gcc-compat -Wno-unused-const-variable -Wno-nullability-completeness +WARNING_CFLAGS = -Wno-error=unknown-warning-option -Wno-gcc-compat -Wno-unused-const-variable // This setting is on for new projects as of Xcode ~6.3, though it is still not // the default. It warns if the same variable is declared in two binaries that // are linked together. GCC_NO_COMMON_BLOCKS = YES + +// This warnings detects when a function will recursively call itself on every +// code path though that function. More information can be found here: +// http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20131216/096004.html +CLANG_WARN_INFINITE_RECURSION = YES + +// This warning detects suspicious uses of std::move. +CLANG_WARN_SUSPICIOUS_MOVE = YES diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Configurations/Debug.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Configurations/Debug.xcconfig index 6ef0040..c9eba67 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Configurations/Debug.xcconfig +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Configurations/Debug.xcconfig @@ -15,6 +15,9 @@ GCC_OPTIMIZATION_LEVEL = 0 // Preproccessor definitions to apply to each file compiled GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1 +// Allow @testable imports +ENABLE_TESTABILITY = YES + // Whether to enable link-time optimizations (such as inlining across translation // units) LLVM_LTO = NO @@ -32,12 +35,17 @@ OTHER_CFLAGS = -ftrapv // This enables conditional compilation with #if DEBUG OTHER_SWIFT_FLAGS = -D DEBUG +// Xcode 8 introduced a new flag for conditional compilation +// +// This enables conditional compilation with #if DEBUG +SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG + // Whether to strip debugging symbols when copying the built product to its // final installation location STRIP_INSTALLED_PRODUCT = NO -// The optimization level (-Onone, -O, -Ofast) for the produced Swift binary +// The optimization level (-Onone, -O, -Osize) for the produced Swift binary SWIFT_OPTIMIZATION_LEVEL = -Onone -// Disable Developer ID timestamping -OTHER_CODE_SIGN_FLAGS = --timestamp=none +// Use a faster hashing algorithm for signing and disable Developer ID timestamping +OTHER_CODE_SIGN_FLAGS = --digest-algorithm=sha1 --timestamp=none diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Configurations/Release.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Configurations/Release.xcconfig index c83729b..be7cc91 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Configurations/Release.xcconfig +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Configurations/Release.xcconfig @@ -9,6 +9,11 @@ // binaries) COPY_PHASE_STRIP = YES +// Whether to compile assertions in. This value is set to YES in Common.xcconfig, +// but the release configuration is an exception: default value in Xcode 10.1 (10B61) +// is YES for debug configuration and NO for release configuration +ENABLE_NS_ASSERTIONS = NO + // The optimization level (0, 1, 2, 3, s) for the produced binary GCC_OPTIMIZATION_LEVEL = s @@ -26,8 +31,11 @@ ONLY_ACTIVE_ARCH = NO // final installation location STRIP_INSTALLED_PRODUCT = YES -// The optimization level (-Onone, -O, -Owholemodule) for the produced Swift binary -SWIFT_OPTIMIZATION_LEVEL = -Owholemodule +// The optimization level (-Onone, -O, -Osize) for the produced Swift binary +SWIFT_OPTIMIZATION_LEVEL = -O + +// Compilation mode (independent of optimization level) +SWIFT_COMPILATION_MODE = wholemodule // Whether to perform App Store validation checks VALIDATE_PRODUCT = YES diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Configurations/Test.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Configurations/Test.xcconfig index 2da35e8..bf17949 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Configurations/Test.xcconfig +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Configurations/Test.xcconfig @@ -8,3 +8,6 @@ // Sandboxed apps can't be unit tested since they can't load some random // external bundle. So we disable sandboxing for testing. CODE_SIGN_ENTITLEMENTS = + +// Allow @testable imports +ENABLE_TESTABILITY = YES diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Targets/Extension.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Targets/Extension.xcconfig new file mode 100644 index 0000000..beb7990 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Targets/Extension.xcconfig @@ -0,0 +1,8 @@ +// +// This file defines additional configuration options that are appropriate only +// for an extension embedded within an application. Typically, you want to use a +// platform-specific variant instead. +// + +// Whether to strip out code that isn't called from anywhere +DEAD_CODE_STRIPPING = NO diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Targets/Framework.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Targets/Framework.xcconfig index 24ae2e5..af3bf77 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Targets/Framework.xcconfig +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Base/Targets/Framework.xcconfig @@ -4,6 +4,12 @@ // instead. // +// Disable code signing for successful device builds with Xcode 8. Frameworks do +// need to be signed, but they don't need to be signed at compile time because +// they'll be re-signed when you include them in your app. +CODE_SIGNING_REQUIRED = NO +CODE_SIGN_IDENTITY = + // Whether to strip out code that isn't called from anywhere DEAD_CODE_STRIPPING = NO @@ -25,8 +31,14 @@ INSTALL_PATH = @rpath LD_DYLIB_INSTALL_NAME = @rpath/$(PRODUCT_NAME).$(WRAPPER_EXTENSION)/$(PRODUCT_NAME) SKIP_INSTALL = YES +// Make SwiftUI previews work in frameworks that depend on other non-system +// frameworks. The Xcode agent that renders SwiftUI previews seems to copy all +// required frameworks from the built product into a single temp directory. +// This allows the rendering agent to find the frameworks there. +// Source: https://github.com/NSHipster/articles/issues/673 +LD_RUNPATH_SEARCH_PATHS = $(inherited) @loader_path/.. + // Disallows use of APIs that are not available // to app extensions and linking to frameworks // that have not been built with this setting enabled. APPLICATION_EXTENSION_API_ONLY = YES - diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-Application.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-Application.xcconfig index 2e552c7..b8376ea 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-Application.xcconfig +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-Application.xcconfig @@ -1,15 +1,8 @@ // -// This file defines additional configuration options that are appropriate only -// for an application on Mac OS X. This should be set at the target level for -// each project configuration. +// DEPRECATED: This configuration file is deprecated. Please use 'macOS/macOS-Application.xcconfig' instead. // -// Import base application settings -#include "../Base/Targets/Application.xcconfig" +#include "../macOS/macOS-Application.xcconfig" -// Apply common settings specific to Mac OS X -#include "Mac-Base.xcconfig" - -// Whether function calls should be position-dependent (should always be -// disabled for library code) -GCC_DYNAMIC_NO_PIC = YES +// The below #include is intended to fail, so that Xcode will include the deprecation notice in the error message shown to the user. +#include "This configuration file ('Mac OS X/Mac-Application.xcconfig') is deprecated. Please use 'macOS/macOS-Application.xcconfig' instead." diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-Base.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-Base.xcconfig index 8fdeccc..9317620 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-Base.xcconfig +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-Base.xcconfig @@ -1,19 +1,8 @@ // -// This file defines additional configuration options that are appropriate only -// for Mac OS X. This file is not standalone -- it is meant to be included into -// a configuration file for a specific type of target. +// DEPRECATED: This configuration file is deprecated. Please use 'macOS/macOS-Base.xcconfig' instead. // -// Whether to combine multiple image resolutions into a multirepresentational -// TIFF -COMBINE_HIDPI_IMAGES = YES +#include "../macOS/macOS-Base.xcconfig" -// Where to find embedded frameworks -LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/../Frameworks @loader_path/../Frameworks - -// The base SDK to use (if no version is specified, the latest version is -// assumed) -SDKROOT = macosx - -// Supported build architectures -VALID_ARCHS = x86_64 +// The below #include is intended to fail, so that Xcode will include the deprecation notice in the error message shown to the user. +#include "This configuration file ('Mac OS X/Mac-Base.xcconfig') is deprecated. Please use 'macOS/macOS-Base.xcconfig' instead." diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-DynamicLibrary.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-DynamicLibrary.xcconfig index 1e2a37c..f824753 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-DynamicLibrary.xcconfig +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-DynamicLibrary.xcconfig @@ -1,18 +1,8 @@ // -// This file defines additional configuration options that are appropriate only -// for a dynamic library on Mac OS X. This should be set at the target level -// for each project configuration. +// DEPRECATED: This configuration file is deprecated. Please use 'macOS/macOS-DynamicLibrary.xcconfig' instead. // -// Import common settings specific to Mac OS X -#include "Mac-Base.xcconfig" +#include "../macOS/macOS-DynamicLibrary.xcconfig" -// Whether to strip out code that isn't called from anywhere -DEAD_CODE_STRIPPING = NO - -// Whether function calls should be position-dependent (should always be -// disabled for library code) -GCC_DYNAMIC_NO_PIC = NO - -// Don't include in an xcarchive -SKIP_INSTALL = YES +// The below #include is intended to fail, so that Xcode will include the deprecation notice in the error message shown to the user. +#include "This configuration file ('Mac OS X/Mac-DynamicLibrary.xcconfig') is deprecated. Please use 'macOS/macOS-DynamicLibrary.xcconfig' instead." diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-Framework.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-Framework.xcconfig index dd98764..3155c01 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-Framework.xcconfig +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-Framework.xcconfig @@ -1,11 +1,8 @@ // -// This file defines additional configuration options that are appropriate only -// for a framework on OS X. This should be set at the target level for each -// project configuration. +// DEPRECATED: This configuration file is deprecated. Please use 'macOS/macOS-Framework.xcconfig' instead. // -// Import base framework settings -#include "../Base/Targets/Framework.xcconfig" +#include "../macOS/macOS-Framework.xcconfig" -// Import common settings specific to Mac OS X -#include "Mac-Base.xcconfig" +// The below #include is intended to fail, so that Xcode will include the deprecation notice in the error message shown to the user. +#include "This configuration file ('Mac OS X/Mac-Framework.xcconfig') is deprecated. Please use 'macOS/macOS-Framework.xcconfig' instead." diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-StaticLibrary.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-StaticLibrary.xcconfig index 97d0318..d7a1cac 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-StaticLibrary.xcconfig +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-StaticLibrary.xcconfig @@ -1,11 +1,8 @@ // -// This file defines additional configuration options that are appropriate only -// for a static library on Mac OS X. This should be set at the target level for -// each project configuration. +// DEPRECATED: This configuration file is deprecated. Please use 'macOS/macOS-StaticLibrary.xcconfig' instead. // -// Import base static library settings -#include "../Base/Targets/StaticLibrary.xcconfig" +#include "../macOS/macOS-StaticLibrary.xcconfig" -// Apply common settings specific to Mac OS X -#include "Mac-Base.xcconfig" +// The below #include is intended to fail, so that Xcode will include the deprecation notice in the error message shown to the user. +#include "This configuration file ('Mac OS X/Mac-StaticLibrary.xcconfig') is deprecated. Please use 'macOS/macOS-StaticLibrary.xcconfig' instead." diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-XCTest.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-XCTest.xcconfig new file mode 100644 index 0000000..9e4bffc --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/Mac OS X/Mac-XCTest.xcconfig @@ -0,0 +1,8 @@ +// +// DEPRECATED: This configuration file is deprecated. Please use 'macOS/macOS-XCTest.xcconfig' instead. +// + +#include "../macOS/macOS-XCTest.xcconfig" + +// The below #include is intended to fail, so that Xcode will include the deprecation notice in the error message shown to the user. +#include "This configuration file ('Mac OS X/Mac-XCTest.xcconfig') is deprecated. Please use 'macOS/macOS-XCTest.xcconfig' instead." diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/iOS/iOS-Extension.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/iOS/iOS-Extension.xcconfig new file mode 100644 index 0000000..c503845 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/iOS/iOS-Extension.xcconfig @@ -0,0 +1,23 @@ +// +// This file defines additional configuration options that are appropriate only +// for an extension embedded within an application on iOS. This should be set at +// the target level for each project configuration. +// + +// Import base extension settings +#include "../Base/Targets/Extension.xcconfig" + +// Apply common settings specific to iOS +#include "iOS-Base.xcconfig" + +// Sets the @rpath for the application such that it can include frameworks in +// the application bundle two levels up, inside the "Frameworks" folder. +// +// Does not search the frameworks folder at the same level as the extension +// executable since extensions with their own embedded frameworks are rejected +// with the following error: +// +// > Invalid Bundle. The bundle at 'App.app/PlugIns/Extension.appex' contains +// > disallowed file 'Frameworks' +// +LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/../../Frameworks diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/macOS/macOS-Application.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/macOS/macOS-Application.xcconfig new file mode 100644 index 0000000..167c041 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/macOS/macOS-Application.xcconfig @@ -0,0 +1,21 @@ +// +// This file defines additional configuration options that are appropriate only +// for an application on macOS. This should be set at the target level for each +// project configuration. +// + +// Import base application settings +#include "../Base/Targets/Application.xcconfig" + +// Apply common settings specific to macOS +#include "macOS-Base.xcconfig" + +// Whether function calls should be position-dependent (should always be +// disabled for library code) +GCC_DYNAMIC_NO_PIC = YES + +// Where to find embedded frameworks +// Search `Frameworks` in the .app. +// If app is cli at `/usr/local/bin/foo`, `@executable_path/../Frameworks` +// means `/usr/local/Frameworks`. +LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/../Frameworks diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/macOS/macOS-Base.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/macOS/macOS-Base.xcconfig new file mode 100644 index 0000000..fe31ff9 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/macOS/macOS-Base.xcconfig @@ -0,0 +1,16 @@ +// +// This file defines additional configuration options that are appropriate only +// for macOS. This file is not standalone -- it is meant to be included into a +// configuration file for a specific type of target. +// + +// Whether to combine multiple image resolutions into a multirepresentational +// TIFF +COMBINE_HIDPI_IMAGES = YES + +// The base SDK to use (if no version is specified, the latest version is +// assumed) +SDKROOT = macosx + +// Supported build architectures +VALID_ARCHS = arm64 arm64e i386 x86_64 diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/macOS/macOS-DynamicLibrary.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/macOS/macOS-DynamicLibrary.xcconfig new file mode 100644 index 0000000..2968491 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/macOS/macOS-DynamicLibrary.xcconfig @@ -0,0 +1,18 @@ +// +// This file defines additional configuration options that are appropriate only +// for a dynamic library on macOS. This should be set at the target level for +// each project configuration. +// + +// Import common settings specific to macOS +#include "macOS-Base.xcconfig" + +// Whether to strip out code that isn't called from anywhere +DEAD_CODE_STRIPPING = NO + +// Whether function calls should be position-dependent (should always be +// disabled for library code) +GCC_DYNAMIC_NO_PIC = NO + +// Don't include in an xcarchive +SKIP_INSTALL = YES diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/macOS/macOS-Framework.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/macOS/macOS-Framework.xcconfig new file mode 100644 index 0000000..4ca73e0 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/macOS/macOS-Framework.xcconfig @@ -0,0 +1,17 @@ +// +// This file defines additional configuration options that are appropriate only +// for a framework on macOS. This should be set at the target level for each +// project configuration. +// + +// Import base framework settings +#include "../Base/Targets/Framework.xcconfig" + +// Import common settings specific to macOS +#include "macOS-Base.xcconfig" + +// Where to find embedded frameworks. +// First search `Frameworks` in the .framework, then one in the .app. +// If app is cli at `/usr/local/bin/foo`, `@executable_path/../Frameworks` +// means `/usr/local/Frameworks`. +LD_RUNPATH_SEARCH_PATHS = $(inherited) @loader_path/Frameworks @executable_path/../Frameworks diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/macOS/macOS-StaticLibrary.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/macOS/macOS-StaticLibrary.xcconfig new file mode 100644 index 0000000..3cc99dc --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/macOS/macOS-StaticLibrary.xcconfig @@ -0,0 +1,11 @@ +// +// This file defines additional configuration options that are appropriate only +// for a static library on macOS. This should be set at the target level for +// each project configuration. +// + +// Import base static library settings +#include "../Base/Targets/StaticLibrary.xcconfig" + +// Apply common settings specific to macOS +#include "macOS-Base.xcconfig" diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/macOS/macOS-XCTest.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/macOS/macOS-XCTest.xcconfig new file mode 100644 index 0000000..182e1d0 --- /dev/null +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/macOS/macOS-XCTest.xcconfig @@ -0,0 +1,16 @@ +// +// This file defines additional configuration options that are appropriate only +// for an application on macOS. This should be set at the target level for each +// project configuration. +// + +// Import base application settings +#include "../Base/Targets/Application.xcconfig" + +// Apply common settings specific to macOS +#include "macOS-Base.xcconfig" + +// Whether function calls should be position-dependent (should always be +// disabled for library code) +GCC_DYNAMIC_NO_PIC = YES + diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/tvOS/tvOS-Application.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/tvOS/tvOS-Application.xcconfig index 2998e2b..74f892c 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/tvOS/tvOS-Application.xcconfig +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/tvOS/tvOS-Application.xcconfig @@ -1,11 +1,11 @@ // // This file defines additional configuration options that are appropriate only -// for an application on watchOS. This should be set at the target level for +// for an application on tvOS. This should be set at the target level for // each project configuration. // // Import base application settings #include "../Base/Targets/Application.xcconfig" -// Apply common settings specific to watchOS +// Apply common settings specific to tvOS #include "tvOS-Base.xcconfig" diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/tvOS/tvOS-Base.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/tvOS/tvOS-Base.xcconfig index 05f72cd..e5cb616 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/tvOS/tvOS-Base.xcconfig +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/tvOS/tvOS-Base.xcconfig @@ -1,6 +1,6 @@ // // This file defines additional configuration options that are appropriate only -// for watchOS. This file is not standalone -- it is meant to be included into +// for tvOS. This file is not standalone -- it is meant to be included into // a configuration file for a specific type of target. // diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/tvOS/tvOS-Framework.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/tvOS/tvOS-Framework.xcconfig index 69a23e8..cb08820 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/tvOS/tvOS-Framework.xcconfig +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/tvOS/tvOS-Framework.xcconfig @@ -1,6 +1,6 @@ // // This file defines additional configuration options that are appropriate only -// for a framework on watchOS. This should be set at the target level for each +// for a framework on tvOS. This should be set at the target level for each // project configuration. // diff --git a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/tvOS/tvOS-StaticLibrary.xcconfig b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/tvOS/tvOS-StaticLibrary.xcconfig index 0efb4c4..34d0200 100644 --- a/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/tvOS/tvOS-StaticLibrary.xcconfig +++ b/Carthage/Checkouts/Commandant/Carthage/Checkouts/xcconfigs/tvOS/tvOS-StaticLibrary.xcconfig @@ -1,11 +1,11 @@ // // This file defines additional configuration options that are appropriate only -// for a static library on watchOS. This should be set at the target level for +// for a static library on tvOS. This should be set at the target level for // each project configuration. // // Import base static library settings #include "../Base/Targets/StaticLibrary.xcconfig" -// Apply common settings specific to watchOS +// Apply common settings specific to tvOS #include "tvOS-Base.xcconfig" diff --git a/Carthage/Checkouts/Commandant/Commandant.podspec b/Carthage/Checkouts/Commandant/Commandant.podspec index 01428b6..d6d8a5d 100644 --- a/Carthage/Checkouts/Commandant/Commandant.podspec +++ b/Carthage/Checkouts/Commandant/Commandant.podspec @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.name = "Commandant" - s.version = "0.17.0" + s.version = "0.18.0" s.summary = "Type-safe command line argument handling" s.description = <<-DESC Commandant is a Swift framework for parsing command-line arguments, inspired by Argo @@ -26,5 +26,5 @@ Commandant is a Swift framework for parsing command-line arguments, inspired by s.source_files = "Sources/**/*.swift" s.cocoapods_version = ">= 1.4.0" - s.swift_version = "5.0" + s.swift_version = "5.2" end diff --git a/Carthage/Checkouts/Commandant/Commandant.xcodeproj/project.pbxproj b/Carthage/Checkouts/Commandant/Commandant.xcodeproj/project.pbxproj index 98b82b0..3c9659e 100644 --- a/Carthage/Checkouts/Commandant/Commandant.xcodeproj/project.pbxproj +++ b/Carthage/Checkouts/Commandant/Commandant.xcodeproj/project.pbxproj @@ -25,6 +25,12 @@ D00CCE2F1A2075F700109F8C /* Option.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00CCE2E1A2075F700109F8C /* Option.swift */; }; D0BF14FB1A4C8957003147BC /* HelpCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BF14FA1A4C8957003147BC /* HelpCommand.swift */; }; D8169D871ACB942D00923FB0 /* Switch.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8169D861ACB942D00923FB0 /* Switch.swift */; }; + F88F259424F34E9700EC60D5 /* macOS-Application.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = F88F258E24F34E9700EC60D5 /* macOS-Application.xcconfig */; }; + F88F259524F34E9700EC60D5 /* macOS-Framework.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = F88F258F24F34E9700EC60D5 /* macOS-Framework.xcconfig */; }; + F88F259624F34E9700EC60D5 /* macOS-StaticLibrary.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = F88F259024F34E9700EC60D5 /* macOS-StaticLibrary.xcconfig */; }; + F88F259724F34E9700EC60D5 /* macOS-Base.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = F88F259124F34E9700EC60D5 /* macOS-Base.xcconfig */; }; + F88F259824F34E9700EC60D5 /* macOS-XCTest.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = F88F259224F34E9700EC60D5 /* macOS-XCTest.xcconfig */; }; + F88F259924F34E9700EC60D5 /* macOS-DynamicLibrary.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = F88F259324F34E9700EC60D5 /* macOS-DynamicLibrary.xcconfig */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -63,11 +69,6 @@ D00CCE041A20719500109F8C /* iOS-Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "iOS-Base.xcconfig"; sourceTree = ""; }; D00CCE051A20719500109F8C /* iOS-Framework.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "iOS-Framework.xcconfig"; sourceTree = ""; }; D00CCE061A20719500109F8C /* iOS-StaticLibrary.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "iOS-StaticLibrary.xcconfig"; sourceTree = ""; }; - D00CCE081A20719500109F8C /* Mac-Application.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Mac-Application.xcconfig"; sourceTree = ""; }; - D00CCE091A20719500109F8C /* Mac-Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Mac-Base.xcconfig"; sourceTree = ""; }; - D00CCE0A1A20719500109F8C /* Mac-DynamicLibrary.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Mac-DynamicLibrary.xcconfig"; sourceTree = ""; }; - D00CCE0B1A20719500109F8C /* Mac-Framework.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Mac-Framework.xcconfig"; sourceTree = ""; }; - D00CCE0C1A20719500109F8C /* Mac-StaticLibrary.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Mac-StaticLibrary.xcconfig"; sourceTree = ""; }; D00CCE0D1A20719500109F8C /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; D00CCE221A2073DA00109F8C /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D00CCE231A2073DA00109F8C /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Quick.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -78,6 +79,12 @@ D00CCE2E1A2075F700109F8C /* Option.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Option.swift; sourceTree = ""; }; D0BF14FA1A4C8957003147BC /* HelpCommand.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HelpCommand.swift; sourceTree = ""; }; D8169D861ACB942D00923FB0 /* Switch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Switch.swift; sourceTree = ""; }; + F88F258E24F34E9700EC60D5 /* macOS-Application.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "macOS-Application.xcconfig"; sourceTree = ""; }; + F88F258F24F34E9700EC60D5 /* macOS-Framework.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "macOS-Framework.xcconfig"; sourceTree = ""; }; + F88F259024F34E9700EC60D5 /* macOS-StaticLibrary.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "macOS-StaticLibrary.xcconfig"; sourceTree = ""; }; + F88F259124F34E9700EC60D5 /* macOS-Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "macOS-Base.xcconfig"; sourceTree = ""; }; + F88F259224F34E9700EC60D5 /* macOS-XCTest.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "macOS-XCTest.xcconfig"; sourceTree = ""; }; + F88F259324F34E9700EC60D5 /* macOS-DynamicLibrary.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "macOS-DynamicLibrary.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -170,7 +177,7 @@ children = ( D00CCDF71A20719500109F8C /* Base */, D00CCE021A20719500109F8C /* iOS */, - D00CCE071A20719500109F8C /* Mac OS X */, + F88F258D24F34E9700EC60D5 /* macOS */, D00CCE0D1A20719500109F8C /* README.md */, ); name = Configuration; @@ -219,18 +226,6 @@ path = iOS; sourceTree = ""; }; - D00CCE071A20719500109F8C /* Mac OS X */ = { - isa = PBXGroup; - children = ( - D00CCE081A20719500109F8C /* Mac-Application.xcconfig */, - D00CCE091A20719500109F8C /* Mac-Base.xcconfig */, - D00CCE0A1A20719500109F8C /* Mac-DynamicLibrary.xcconfig */, - D00CCE0B1A20719500109F8C /* Mac-Framework.xcconfig */, - D00CCE0C1A20719500109F8C /* Mac-StaticLibrary.xcconfig */, - ); - path = "Mac OS X"; - sourceTree = ""; - }; D0BF14F81A4C892E003147BC /* Core */ = { isa = PBXGroup; children = ( @@ -255,6 +250,19 @@ name = "Built-in Commands"; sourceTree = ""; }; + F88F258D24F34E9700EC60D5 /* macOS */ = { + isa = PBXGroup; + children = ( + F88F258E24F34E9700EC60D5 /* macOS-Application.xcconfig */, + F88F258F24F34E9700EC60D5 /* macOS-Framework.xcconfig */, + F88F259024F34E9700EC60D5 /* macOS-StaticLibrary.xcconfig */, + F88F259124F34E9700EC60D5 /* macOS-Base.xcconfig */, + F88F259224F34E9700EC60D5 /* macOS-XCTest.xcconfig */, + F88F259324F34E9700EC60D5 /* macOS-DynamicLibrary.xcconfig */, + ); + path = macOS; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -313,7 +321,7 @@ attributes = { LastSwiftMigration = 0700; LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1160; ORGANIZATIONNAME = Carthage; TargetAttributes = { D00CCDD81A20717400109F8C = { @@ -350,6 +358,12 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + F88F259424F34E9700EC60D5 /* macOS-Application.xcconfig in Resources */, + F88F259724F34E9700EC60D5 /* macOS-Base.xcconfig in Resources */, + F88F259924F34E9700EC60D5 /* macOS-DynamicLibrary.xcconfig in Resources */, + F88F259524F34E9700EC60D5 /* macOS-Framework.xcconfig in Resources */, + F88F259824F34E9700EC60D5 /* macOS-XCTest.xcconfig in Resources */, + F88F259624F34E9700EC60D5 /* macOS-StaticLibrary.xcconfig in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -418,7 +432,7 @@ ENABLE_TESTABILITY = YES; MACOSX_DEPLOYMENT_TARGET = 10.9; ONLY_ACTIVE_ARCH = YES; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 5.2; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -439,7 +453,7 @@ CURRENT_PROJECT_VERSION = 1; MACOSX_DEPLOYMENT_TARGET = 10.9; SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 5.2; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -447,7 +461,7 @@ }; D00CCDF01A20717400109F8C /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D00CCE0B1A20719500109F8C /* Mac-Framework.xcconfig */; + baseConfigurationReference = F88F258F24F34E9700EC60D5 /* macOS-Framework.xcconfig */; buildSettings = { CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; @@ -464,7 +478,7 @@ }; D00CCDF11A20717400109F8C /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D00CCE0B1A20719500109F8C /* Mac-Framework.xcconfig */; + baseConfigurationReference = F88F258F24F34E9700EC60D5 /* macOS-Framework.xcconfig */; buildSettings = { CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; @@ -480,7 +494,7 @@ }; D00CCDF31A20717400109F8C /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D00CCE081A20719500109F8C /* Mac-Application.xcconfig */; + baseConfigurationReference = F88F258E24F34E9700EC60D5 /* macOS-Application.xcconfig */; buildSettings = { FRAMEWORK_SEARCH_PATHS = ( "$(DEVELOPER_FRAMEWORKS_DIR)", @@ -495,7 +509,7 @@ }; D00CCDF41A20717400109F8C /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D00CCE081A20719500109F8C /* Mac-Application.xcconfig */; + baseConfigurationReference = F88F258E24F34E9700EC60D5 /* macOS-Application.xcconfig */; buildSettings = { FRAMEWORK_SEARCH_PATHS = ( "$(DEVELOPER_FRAMEWORKS_DIR)", @@ -522,7 +536,7 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CURRENT_PROJECT_VERSION = 1; MACOSX_DEPLOYMENT_TARGET = 10.9; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 5.2; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -530,7 +544,7 @@ }; D00CCE121A2072AB00109F8C /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D00CCE0B1A20719500109F8C /* Mac-Framework.xcconfig */; + baseConfigurationReference = F88F258F24F34E9700EC60D5 /* macOS-Framework.xcconfig */; buildSettings = { CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; @@ -546,7 +560,7 @@ }; D00CCE131A2072AB00109F8C /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D00CCE081A20719500109F8C /* Mac-Application.xcconfig */; + baseConfigurationReference = F88F258E24F34E9700EC60D5 /* macOS-Application.xcconfig */; buildSettings = { FRAMEWORK_SEARCH_PATHS = ( "$(DEVELOPER_FRAMEWORKS_DIR)", @@ -573,7 +587,7 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CURRENT_PROJECT_VERSION = 1; MACOSX_DEPLOYMENT_TARGET = 10.9; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 5.2; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -581,7 +595,7 @@ }; D00CCE151A2072BD00109F8C /* Test */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D00CCE0B1A20719500109F8C /* Mac-Framework.xcconfig */; + baseConfigurationReference = F88F258F24F34E9700EC60D5 /* macOS-Framework.xcconfig */; buildSettings = { CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; @@ -598,7 +612,7 @@ }; D00CCE161A2072BD00109F8C /* Test */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D00CCE081A20719500109F8C /* Mac-Application.xcconfig */; + baseConfigurationReference = F88F258E24F34E9700EC60D5 /* macOS-Application.xcconfig */; buildSettings = { FRAMEWORK_SEARCH_PATHS = ( "$(DEVELOPER_FRAMEWORKS_DIR)", diff --git a/Carthage/Checkouts/Commandant/Commandant.xcodeproj/xcshareddata/xcschemes/Commandant.xcscheme b/Carthage/Checkouts/Commandant/Commandant.xcodeproj/xcshareddata/xcschemes/Commandant.xcscheme index c4485c9..ebefe1d 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 @@ + + + + @@ -53,17 +62,6 @@ - - - - - - - - CFBundlePackageType FMWK CFBundleShortVersionString - 0.17.0 + 0.18.0 CFBundleSignature ???? CFBundleVersion diff --git a/Carthage/Checkouts/Commandant/Tests/CommandantTests/Info.plist b/Carthage/Checkouts/Commandant/Tests/CommandantTests/Info.plist index 0189359..8f567f1 100644 --- a/Carthage/Checkouts/Commandant/Tests/CommandantTests/Info.plist +++ b/Carthage/Checkouts/Commandant/Tests/CommandantTests/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 0.17.0 + 0.18.0 CFBundleSignature ???? CFBundleVersion