mirror of
https://github.com/mas-cli/mas
synced 2024-11-22 03:23:08 +00:00
Merge branch 'master' into release-1.6.4
# Conflicts: # CHANGELOG.md
This commit is contained in:
commit
70f0a6fd47
748 changed files with 9539 additions and 13183 deletions
|
@ -12,5 +12,5 @@ insert_final_newline = true
|
||||||
[*.md]
|
[*.md]
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
[*.rb]
|
[{script/*,*.rb,*.yml}]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
2.3.1
|
2.4.3
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
4.2
|
|
13
.travis.yml
13
.travis.yml
|
@ -2,13 +2,17 @@
|
||||||
# .travis.yml
|
# .travis.yml
|
||||||
# mas-cli
|
# mas-cli
|
||||||
#
|
#
|
||||||
# https://travis-ci.org/mas-cli/mas
|
# https://travis-ci.com/mas-cli/mas
|
||||||
# https://docs.travis-ci.com/user/reference/osx/
|
# https://docs.travis-ci.com/user/reference/osx/
|
||||||
# https://docs.travis-ci.com/user/languages/objective-c/
|
# https://docs.travis-ci.com/user/languages/objective-c/
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# https://docs.travis-ci.com/user/build-config-validation
|
||||||
|
version: ~> 1.0
|
||||||
|
|
||||||
|
# https://docs.travis-ci.com/user/reference/osx/#macos-version
|
||||||
os: osx
|
os: osx
|
||||||
osx_image: xcode10.1 # macOS 10.13
|
osx_image: xcode11.3 # macOS 10.14
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
|
@ -16,6 +20,11 @@ env:
|
||||||
- LC_ALL=en_US.UTF-8
|
- LC_ALL=en_US.UTF-8
|
||||||
- LANGUAGE=en_US.UTF-8
|
- LANGUAGE=en_US.UTF-8
|
||||||
|
|
||||||
|
# Bundler 2
|
||||||
|
# https://docs.travis-ci.com/user/languages/ruby/#bundler-20
|
||||||
|
before_install:
|
||||||
|
- gem install bundler
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- script/bootstrap
|
- script/bootstrap
|
||||||
|
|
||||||
|
|
4
Brewfile
4
Brewfile
|
@ -1,4 +1,2 @@
|
||||||
brew "carthage"
|
brew "mint"
|
||||||
brew "shellcheck"
|
brew "shellcheck"
|
||||||
brew "swiftlint"
|
|
||||||
brew "swiftformat"
|
|
||||||
|
|
56
Brewfile.lock.json
Normal file
56
Brewfile.lock.json
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
{
|
||||||
|
"entries": {
|
||||||
|
"brew": {
|
||||||
|
"mint": {
|
||||||
|
"version": "0.14.2",
|
||||||
|
"bottle": {
|
||||||
|
"cellar": ":any_skip_relocation",
|
||||||
|
"prefix": "/usr/local",
|
||||||
|
"files": {
|
||||||
|
"catalina": {
|
||||||
|
"url": "https://homebrew.bintray.com/bottles/mint-0.14.2.catalina.bottle.tar.gz",
|
||||||
|
"sha256": "cc7a17ee517fe97f12852c71252896c9ca30dfe8236f816f2990b2d0553ff5b3"
|
||||||
|
},
|
||||||
|
"mojave": {
|
||||||
|
"url": "https://homebrew.bintray.com/bottles/mint-0.14.2.mojave.bottle.tar.gz",
|
||||||
|
"sha256": "f70e96558839243a845c67f15defbd8718ad5a9e094ae1c1b998ac9faf4399b0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"shellcheck": {
|
||||||
|
"version": "0.7.1",
|
||||||
|
"bottle": {
|
||||||
|
"cellar": ":any_skip_relocation",
|
||||||
|
"prefix": "/usr/local",
|
||||||
|
"files": {
|
||||||
|
"catalina": {
|
||||||
|
"url": "https://homebrew.bintray.com/bottles/shellcheck-0.7.1.catalina.bottle.tar.gz",
|
||||||
|
"sha256": "77e5385a84164971cd75df484031c79e41eab8454deede5b40b278859a039115"
|
||||||
|
},
|
||||||
|
"mojave": {
|
||||||
|
"url": "https://homebrew.bintray.com/bottles/shellcheck-0.7.1.mojave.bottle.tar.gz",
|
||||||
|
"sha256": "983f1eb4590e9be83584d68f5b7db13b3c3f2dbc50ad61b1896e8070e2e0d375"
|
||||||
|
},
|
||||||
|
"high_sierra": {
|
||||||
|
"url": "https://homebrew.bintray.com/bottles/shellcheck-0.7.1.high_sierra.bottle.tar.gz",
|
||||||
|
"sha256": "6f371407500c5bfffb2c44e69482c524d8cb96d682ce93d06d148eccd6e4d052"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"system": {
|
||||||
|
"macos": {
|
||||||
|
"catalina": {
|
||||||
|
"HOMEBREW_VERSION": "2.2.13",
|
||||||
|
"HOMEBREW_PREFIX": "/usr/local",
|
||||||
|
"Homebrew/homebrew-core": "474ad1d25ce77de5836bfbe9824716667f853797",
|
||||||
|
"CLT": "11.4.1.0.1.1586360307",
|
||||||
|
"Xcode": "11.4.1",
|
||||||
|
"macOS": "10.15.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
35
CHANGELOG.md
35
CHANGELOG.md
|
@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
- 🕊 Swift 5 #255
|
||||||
|
- ⚒️ Xcode 10.2 and macOS 10.14 required to build
|
||||||
|
- ⬆️ Commandant (0.17.0) #255
|
||||||
|
- ⬆️ Nimble (8.0.4) #255
|
||||||
|
- ⬆️ Quick (2.2.0) #255
|
||||||
|
- ➖ Result #255
|
||||||
|
- Seriously more interactive fish completions #242
|
||||||
|
thanks, [@lwolfsonkin](https://github.com/lwolfsonkin)!
|
||||||
|
- 💡 Update readme with simpler tap usage #241
|
||||||
|
|
||||||
## [v1.6.4] 🔎 Search Fix - 2020-05-11
|
## [v1.6.4] 🔎 Search Fix - 2020-05-11
|
||||||
|
|
||||||
- 🐛 Fix search parameters #269
|
- 🐛 Fix search parameters #269
|
||||||
|
@ -90,83 +100,102 @@ Use the `mas.pkg` package to install manually.
|
||||||
## [v1.4.0] 🧟♂️ It's Alive! - 2018-02-16
|
## [v1.4.0] 🧟♂️ It's Alive! - 2018-02-16
|
||||||
|
|
||||||
### ✨ Enhancements
|
### ✨ Enhancements
|
||||||
|
|
||||||
- ℹ️ Info command #26, #55
|
- ℹ️ Info command #26, #55
|
||||||
- 🍀 Lucky command #88
|
- 🍀 Lucky command #88
|
||||||
- 🕵🏽♀️ Include version number in search output #131
|
- 🕵🏽♀️ Include version number in search output #131
|
||||||
- ☝🏻 Support app name(s) arugments for upgrade command #100
|
- ☝🏻 Support app name(s) arugments for upgrade command #100
|
||||||
|
|
||||||
### 🔨 Xcode Project
|
### 🔨 Xcode Project
|
||||||
|
|
||||||
- ⬆️ Swift 4 #114
|
- ⬆️ Swift 4 #114
|
||||||
- ✅ Added test target #127
|
- ✅ Added test target #127
|
||||||
- 📛 Add build badge to readme #121
|
- 📛 Add build badge to readme #121
|
||||||
- 💎 Configure bundler #118
|
- 💎 Configure bundler #118
|
||||||
|
|
||||||
### 🐙 GitHub
|
### 🐙 GitHub
|
||||||
|
|
||||||
- ⚠️ Added Danger for PR feedback #124
|
- ⚠️ Added Danger for PR feedback #124
|
||||||
- 📝🤝🎨 Added Contributing Guidelines, Code of Conduct and style guide #117, #126
|
- 📝🤝🎨 Added Contributing Guidelines, Code of Conduct and style guide #117, #126
|
||||||
- 📝 Added CHANGELOG #119
|
- 📝 Added CHANGELOG #119
|
||||||
- 📝 Added note about installing through app store first #93
|
- 📝 Added note about installing through app store first #93
|
||||||
|
|
||||||
### 🏛 Dependencies #122
|
### 🏛 Dependencies #122
|
||||||
|
|
||||||
- ⬆️ Commandant (0.13.0)
|
- ⬆️ Commandant (0.13.0)
|
||||||
- ⬆️ Result (3.2.4)
|
- ⬆️ Result (3.2.4)
|
||||||
- ⬆️ cocoaseeds (0.8.3)
|
- ⬆️ cocoaseeds (0.8.3)
|
||||||
- ⬆️ xcpretty (0.2.8)
|
- ⬆️ xcpretty (0.2.8)
|
||||||
|
|
||||||
### 👷🏻♀️ CI Build
|
### 👷🏻♀️ CI Build
|
||||||
|
|
||||||
- 🍎 Now using [`xcode9.2`](https://docs.travis-ci.com/user/reference/osx#Xcode-9.2) image for `macosx10.13` SDK #120
|
- 🍎 Now using [`xcode9.2`](https://docs.travis-ci.com/user/reference/osx#Xcode-9.2) image for `macosx10.13` SDK #120
|
||||||
|
|
||||||
## [v1.3.1] Better Errors - 2016-09-25
|
## [v1.3.1] Better Errors - 2016-09-25
|
||||||
|
|
||||||
- Descriptive error messages instead of exit codes
|
- Descriptive error messages instead of exit codes
|
||||||
- Fixed nullability issue with `list` command
|
- Fixed nullability issue with `list` command
|
||||||
- Simpler upgrade checking
|
- Simpler upgrade checking
|
||||||
|
|
||||||
## [v1.3.0] Multiple app install - 2016-09-14
|
## [v1.3.0] Multiple app install - 2016-09-14
|
||||||
|
|
||||||
- Fix install of Free apps (#19)
|
- Fix install of Free apps (#19)
|
||||||
- Install / Upgrade multiple apps at once
|
- Install / Upgrade multiple apps at once
|
||||||
- Skip Install if the app is already installed
|
- Skip Install if the app is already installed
|
||||||
|
|
||||||
## [v1.2.2] Secure Password entry - 2016-09-14
|
## [v1.2.2] Secure Password entry - 2016-09-14
|
||||||
|
|
||||||
- Support reading password from STDIN
|
- Support reading password from STDIN
|
||||||
- Fix building with Swift 2.3/Xcode 8
|
- Fix building with Swift 2.3/Xcode 8
|
||||||
|
|
||||||
## [v1.2.1] - 2016-09-13
|
## [v1.2.1] - 2016-09-13
|
||||||
|
|
||||||
- Support reading password from STDIN
|
- Support reading password from STDIN
|
||||||
- Fix building with Swift 2.3/Xcode 8
|
- Fix building with Swift 2.3/Xcode 8
|
||||||
|
|
||||||
## [v1.2.0] Search - 2016-04-16
|
## [v1.2.0] Search - 2016-04-16
|
||||||
|
|
||||||
- `search` command
|
- `search` command
|
||||||
- Fix `mas list` illegal instruction (#16)
|
- Fix `mas list` illegal instruction (#16)
|
||||||
|
|
||||||
## [v1.1.3] - 2016-02-21
|
## [v1.1.3] - 2016-02-21
|
||||||
|
|
||||||
- Fix Illegal Instruction: 4 error (#10)
|
- Fix Illegal Instruction: 4 error (#10)
|
||||||
|
|
||||||
## [v1.1.2] Upload dSYM correctly - 2016-02-21
|
## [v1.1.2] Upload dSYM correctly - 2016-02-21
|
||||||
|
|
||||||
- Move the dSYM to the xcarchive
|
- Move the dSYM to the xcarchive
|
||||||
|
|
||||||
## [v1.1.1] Upload dSYM - 2016-02-21
|
## [v1.1.1] Upload dSYM - 2016-02-21
|
||||||
|
|
||||||
- Upload dSYM from Travis release
|
- Upload dSYM from Travis release
|
||||||
|
|
||||||
## [v1.1.0] Sign In - 2016-02-13
|
## [v1.1.0] Sign In - 2016-02-13
|
||||||
|
|
||||||
- Added `signin` command (#3)
|
- Added `signin` command (#3)
|
||||||
- Added `signout` command
|
- Added `signout` command
|
||||||
|
|
||||||
## [v1.0.2] Upgrade all - 2015-12-30
|
## [v1.0.2] Upgrade all - 2015-12-30
|
||||||
### Features
|
|
||||||
- Added `upgrade` command (#1)
|
- Added `upgrade` command (#1)
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
|
||||||
- Updated to latest version of Commandant
|
- Updated to latest version of Commandant
|
||||||
- Broken `install` command after updating Commandant
|
- Broken `install` command after updating Commandant
|
||||||
|
|
||||||
## [v1.0.1] - 2015-12-30
|
## [v1.0.1] - 2015-12-30
|
||||||
|
|
||||||
- Bump version to 1.0.1
|
- Bump version to 1.0.1
|
||||||
|
|
||||||
## [v1.0.0] - 2015-09-20
|
## [v1.0.0] - 2015-09-20
|
||||||
|
|
||||||
- Initial Release
|
- Initial Release
|
||||||
|
|
||||||
[Unreleased]: https://github.com/mas-cli/mas/compare/v1.6.1...HEAD
|
[Unreleased]: https://github.com/mas-cli/mas/compare/v1.6.3...HEAD
|
||||||
[v1.6.0]: https://github.com/mas-cli/mas/compare/v1.6.0...v1.6.1
|
[v1.6.3]: https://github.com/mas-cli/mas/compare/v1.6.2...v1.6.3
|
||||||
|
[v1.6.2]: https://github.com/mas-cli/mas/compare/v1.6.1...v1.6.2
|
||||||
|
[v1.6.1]: https://github.com/mas-cli/mas/compare/v1.6.0...v1.6.1
|
||||||
[v1.6.0]: https://github.com/mas-cli/mas/compare/v1.5.0...v1.6.0
|
[v1.6.0]: https://github.com/mas-cli/mas/compare/v1.5.0...v1.6.0
|
||||||
[v1.5.0]: https://github.com/mas-cli/mas/compare/v1.4.4...v1.5.0
|
[v1.5.0]: https://github.com/mas-cli/mas/compare/v1.4.4...v1.5.0
|
||||||
[v1.4.4]: https://github.com/mas-cli/mas/compare/v1.4.3...v1.4.4
|
[v1.4.4]: https://github.com/mas-cli/mas/compare/v1.4.3...v1.4.4
|
||||||
|
|
1
Cartfile
1
Cartfile
|
@ -1,2 +1 @@
|
||||||
github "Carthage/Commandant"
|
github "Carthage/Commandant"
|
||||||
github "antitypical/Result"
|
|
|
@ -1,4 +1,3 @@
|
||||||
github "Carthage/Commandant" "0.15.0"
|
github "Carthage/Commandant" "0.17.0"
|
||||||
github "Quick/Nimble" "v7.3.2"
|
github "Quick/Nimble" "v8.0.4"
|
||||||
github "Quick/Quick" "v1.3.2"
|
github "Quick/Quick" "v2.2.0"
|
||||||
github "antitypical/Result" "4.1.0"
|
|
||||||
|
|
3
Carthage/Checkouts/Commandant/.gitmodules
vendored
3
Carthage/Checkouts/Commandant/.gitmodules
vendored
|
@ -7,6 +7,3 @@
|
||||||
[submodule "Carthage/Checkouts/xcconfigs"]
|
[submodule "Carthage/Checkouts/xcconfigs"]
|
||||||
path = Carthage/Checkouts/xcconfigs
|
path = Carthage/Checkouts/xcconfigs
|
||||||
url = https://github.com/jspahrsummers/xcconfigs.git
|
url = https://github.com/jspahrsummers/xcconfigs.git
|
||||||
[submodule "Carthage/Checkouts/Result"]
|
|
||||||
path = Carthage/Checkouts/Result
|
|
||||||
url = https://github.com/antitypical/Result.git
|
|
||||||
|
|
2
Carthage/Checkouts/Commandant/.hound.yml
vendored
Normal file
2
Carthage/Checkouts/Commandant/.hound.yml
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
swiftlint:
|
||||||
|
config_file: .swiftlint.yml
|
2
Carthage/Checkouts/Commandant/.swift-version
vendored
2
Carthage/Checkouts/Commandant/.swift-version
vendored
|
@ -1 +1 @@
|
||||||
4.1.2
|
5.0
|
||||||
|
|
13
Carthage/Checkouts/Commandant/.swiftlint.yml
vendored
Normal file
13
Carthage/Checkouts/Commandant/.swiftlint.yml
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
included:
|
||||||
|
- Sources
|
||||||
|
- Tests
|
||||||
|
|
||||||
|
disabled_rules:
|
||||||
|
- function_body_length
|
||||||
|
- identifier_name
|
||||||
|
- line_length
|
||||||
|
- opening_brace
|
||||||
|
- operator_whitespace
|
||||||
|
|
||||||
|
trailing_comma:
|
||||||
|
mandatory_comma: true
|
31
Carthage/Checkouts/Commandant/.travis.yml
vendored
31
Carthage/Checkouts/Commandant/.travis.yml
vendored
|
@ -8,6 +8,7 @@ aliases:
|
||||||
- &cocoapods
|
- &cocoapods
|
||||||
script:
|
script:
|
||||||
- rm .swift-version
|
- rm .swift-version
|
||||||
|
- gem update cocoapods
|
||||||
- pod repo update master
|
- pod repo update master
|
||||||
- pod lib lint --verbose
|
- pod lib lint --verbose
|
||||||
os: osx
|
os: osx
|
||||||
|
@ -31,7 +32,7 @@ aliases:
|
||||||
dist: trusty
|
dist: trusty
|
||||||
language: generic
|
language: generic
|
||||||
install:
|
install:
|
||||||
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/02090c7ede5a637b76e6df1710e83cd0bbe7dcdf/swiftenv-install.sh)"
|
- eval "$(curl -sL https://swiftenv.fuller.li/install.sh)"
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
|
@ -40,28 +41,20 @@ branches:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- <<: *xcode
|
- <<: *xcode
|
||||||
osx_image: xcode9.2
|
name: Xcode 10.2 / Swift 5.0
|
||||||
env: JOB=Xcode9.2
|
osx_image: xcode10.2
|
||||||
- <<: *xcode
|
env: JOB=Xcode10.2
|
||||||
osx_image: xcode9.4
|
|
||||||
env: JOB=Xcode9.4
|
|
||||||
- <<: *cocoapods
|
- <<: *cocoapods
|
||||||
osx_image: xcode9.4
|
name: CocoaPods Lint
|
||||||
|
osx_image: xcode10.2
|
||||||
- <<: *swiftpm_darwin
|
- <<: *swiftpm_darwin
|
||||||
osx_image: xcode9.2
|
name: SwiftPM / Swift 5.0
|
||||||
- <<: *swiftpm_darwin
|
osx_image: xcode10.2
|
||||||
osx_image: xcode9.4
|
|
||||||
- <<: *swiftpm_linux
|
- <<: *swiftpm_linux
|
||||||
|
name: Linux / Swift 5.0
|
||||||
env:
|
env:
|
||||||
- JOB=Linux
|
- JOB=Linux
|
||||||
- SWIFT_VERSION=4.0.3
|
- SWIFT_VERSION=5.0
|
||||||
- <<: *swiftpm_linux
|
|
||||||
env:
|
|
||||||
- JOB=Linux
|
|
||||||
- <<: *swiftpm_linux
|
|
||||||
env:
|
|
||||||
- JOB=Linux
|
|
||||||
- SWIFT_VERSION=4.2-DEVELOPMENT-SNAPSHOT-2018-07-05-a
|
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
|
@ -83,4 +76,4 @@ deploy:
|
||||||
on:
|
on:
|
||||||
repo: Carthage/Commandant
|
repo: Carthage/Commandant
|
||||||
tags: true
|
tags: true
|
||||||
condition: $JOB = Xcode9.4
|
condition: $JOB = Xcode10.1
|
||||||
|
|
1
Carthage/Checkouts/Commandant/Cartfile
vendored
1
Carthage/Checkouts/Commandant/Cartfile
vendored
|
@ -1 +0,0 @@
|
||||||
github "antitypical/Result" ~> 4.0
|
|
|
@ -1,3 +1,3 @@
|
||||||
github "jspahrsummers/xcconfigs" ~> 0.9
|
github "jspahrsummers/xcconfigs" ~> 0.9
|
||||||
github "Quick/Quick" ~> 1.3
|
github "Quick/Quick" ~> 2.0
|
||||||
github "Quick/Nimble" ~> 7.1.2
|
github "Quick/Nimble" ~> 8.0
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
github "Quick/Nimble" "v7.1.2"
|
github "Quick/Nimble" "v8.0.0"
|
||||||
github "Quick/Quick" "v1.3.0"
|
github "Quick/Quick" "v2.0.0"
|
||||||
github "antitypical/Result" "4.0.0"
|
|
||||||
github "jspahrsummers/xcconfigs" "0.9"
|
github "jspahrsummers/xcconfigs" "0.9"
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
3.0
|
4.2
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
disabled_rules:
|
disabled_rules:
|
||||||
- todo
|
-
|
||||||
- variable_name
|
|
||||||
- force_try
|
|
||||||
- force_cast
|
|
||||||
|
|
||||||
included:
|
included:
|
||||||
- Sources
|
- Sources
|
||||||
|
@ -10,6 +7,8 @@ included:
|
||||||
|
|
||||||
excluded:
|
excluded:
|
||||||
- Carthage/Checkouts
|
- Carthage/Checkouts
|
||||||
|
- Tests/NimbleTests/XCTestManifests.swift
|
||||||
|
- Tests/NimbleTests/Helpers/XCTestCaseProvider.swift
|
||||||
|
|
||||||
trailing_comma:
|
trailing_comma:
|
||||||
mandatory_comma: true
|
mandatory_comma: true
|
||||||
|
@ -17,3 +16,16 @@ trailing_comma:
|
||||||
line_length:
|
line_length:
|
||||||
ignores_comments: true
|
ignores_comments: true
|
||||||
ignores_function_declarations: true
|
ignores_function_declarations: true
|
||||||
|
|
||||||
|
identifier_name:
|
||||||
|
max_length: 50
|
||||||
|
excluded:
|
||||||
|
- x
|
||||||
|
- l
|
||||||
|
- r
|
||||||
|
- e
|
||||||
|
- n1
|
||||||
|
- n2
|
||||||
|
- to
|
||||||
|
allowed_symbols:
|
||||||
|
- _
|
||||||
|
|
|
@ -1,39 +1,52 @@
|
||||||
osx_image: xcode8.3
|
osx_image: xcode10.1
|
||||||
language: generic
|
language: generic
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: osx
|
- os: osx
|
||||||
sudo: required
|
sudo: required
|
||||||
env: TYPE=podspec
|
env: TYPE=podspec
|
||||||
|
install: bundle install
|
||||||
|
name: CocoaPods Lint
|
||||||
- os: osx
|
- os: osx
|
||||||
env: TYPE=ios NIMBLE_RUNTIME_IOS_SDK_VERSION=10.0
|
env: TYPE=ios
|
||||||
|
name: iOS / Swift 4.2.1
|
||||||
- os: osx
|
- os: osx
|
||||||
env: TYPE=tvos NIMBLE_RUNTIME_TVOS_SDK_VERSION=10.0
|
env: TYPE=tvos
|
||||||
|
name: tvOS / Swift 4.2.1
|
||||||
- os: osx
|
- os: osx
|
||||||
env: TYPE=macos
|
env: TYPE=macos
|
||||||
|
name: macOS / Swift 4.2.1
|
||||||
- os: osx
|
- os: osx
|
||||||
env: TYPE=macos
|
env: TYPE=macos
|
||||||
osx_image: xcode9
|
osx_image: xcode10.2
|
||||||
|
name: macOS / Swift 5.0
|
||||||
- os: osx
|
- os: osx
|
||||||
env: TYPE=swiftpm
|
env:
|
||||||
|
- TYPE=swiftpm
|
||||||
- os: osx
|
- os: osx
|
||||||
env: TYPE=swiftpm
|
env:
|
||||||
osx_image: xcode9
|
- TYPE=swiftpm
|
||||||
- os: linux
|
osx_image: xcode10.2
|
||||||
dist: trusty
|
- &linux
|
||||||
sudo: required
|
name: Linux / Swift 4.2.1
|
||||||
env: TYPE=swiftpm
|
os: linux
|
||||||
install:
|
|
||||||
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
|
|
||||||
- os: linux
|
|
||||||
dist: trusty
|
dist: trusty
|
||||||
sudo: required
|
sudo: required
|
||||||
env:
|
env:
|
||||||
- TYPE=swiftpm
|
- TYPE=swiftpm
|
||||||
- SWIFT_VERSION=4.0.2
|
- SWIFT_VERSION=4.2.1
|
||||||
install:
|
install:
|
||||||
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
|
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
|
||||||
install:
|
- <<: *linux
|
||||||
- if [[ "$TYPE" == "podspec" ]]; then sudo gem install bundler; bundle install; fi
|
name: Linux / Swift 5.0 Development
|
||||||
|
env:
|
||||||
|
- TYPE=swiftpm
|
||||||
|
- SWIFT_VERSION=5.0-DEVELOPMENT-SNAPSHOT-2019-02-28-a
|
||||||
|
install:
|
||||||
|
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
|
||||||
|
install: true
|
||||||
script:
|
script:
|
||||||
- ./test $TYPE
|
- ./test $TYPE
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
email: false
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
github "mattgallagher/CwlPreconditionTesting" "cb7ab89273cfd0725a7a2f865cc6fc560a9b9083"
|
github "mattgallagher/CwlPreconditionTesting" "1e62a726d54c743f4585233f08fcaac7307319b5"
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
github "mattgallagher/CwlCatchException" "b14c111e9b33cd142bd4bc75c482cfd5c3490923"
|
github "mattgallagher/CwlCatchException" "b14c111e9b33cd142bd4bc75c482cfd5c3490923"
|
||||||
github "mattgallagher/CwlPreconditionTesting" "cb7ab89273cfd0725a7a2f865cc6fc560a9b9083"
|
github "mattgallagher/CwlPreconditionTesting" "1e62a726d54c743f4585233f08fcaac7307319b5"
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
extern bool _swift_reportFatalErrorsToDebugger;
|
||||||
|
|
||||||
//! Project version number for CwlUtils.
|
//! Project version number for CwlUtils.
|
||||||
FOUNDATION_EXPORT double CwlPreconditionTestingVersionNumber;
|
FOUNDATION_EXPORT double CwlPreconditionTestingVersionNumber;
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
extern bool _swift_reportFatalErrorsToDebugger;
|
||||||
|
|
||||||
//! Project version number for CwlUtils.
|
//! Project version number for CwlUtils.
|
||||||
FOUNDATION_EXPORT double CwlPreconditionTesting_POSIXVersionNumber;
|
FOUNDATION_EXPORT double CwlPreconditionTesting_POSIXVersionNumber;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# A sample Gemfile
|
# A sample Gemfile
|
||||||
source "https://rubygems.org"
|
source "https://rubygems.org"
|
||||||
|
|
||||||
gem 'cocoapods', '1.5.0'
|
gem 'cocoapods', '~> 1.6.0.rc.2'
|
||||||
|
|
|
@ -2,75 +2,75 @@ GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
CFPropertyList (3.0.0)
|
CFPropertyList (3.0.0)
|
||||||
activesupport (4.2.10)
|
activesupport (4.2.11)
|
||||||
i18n (~> 0.7)
|
i18n (~> 0.7)
|
||||||
minitest (~> 5.1)
|
minitest (~> 5.1)
|
||||||
thread_safe (~> 0.3, >= 0.3.4)
|
thread_safe (~> 0.3, >= 0.3.4)
|
||||||
tzinfo (~> 1.1)
|
tzinfo (~> 1.1)
|
||||||
atomos (0.1.2)
|
atomos (0.1.3)
|
||||||
claide (1.0.2)
|
claide (1.0.2)
|
||||||
cocoapods (1.5.0)
|
cocoapods (1.6.0.rc.2)
|
||||||
activesupport (>= 4.0.2, < 5)
|
activesupport (>= 4.0.2, < 5)
|
||||||
claide (>= 1.0.2, < 2.0)
|
claide (>= 1.0.2, < 2.0)
|
||||||
cocoapods-core (= 1.5.0)
|
cocoapods-core (= 1.6.0.rc.2)
|
||||||
cocoapods-deintegrate (>= 1.0.2, < 2.0)
|
cocoapods-deintegrate (>= 1.0.2, < 2.0)
|
||||||
cocoapods-downloader (>= 1.2.0, < 2.0)
|
cocoapods-downloader (>= 1.2.2, < 2.0)
|
||||||
cocoapods-plugins (>= 1.0.0, < 2.0)
|
cocoapods-plugins (>= 1.0.0, < 2.0)
|
||||||
cocoapods-search (>= 1.0.0, < 2.0)
|
cocoapods-search (>= 1.0.0, < 2.0)
|
||||||
cocoapods-stats (>= 1.0.0, < 2.0)
|
cocoapods-stats (>= 1.0.0, < 2.0)
|
||||||
cocoapods-trunk (>= 1.3.0, < 2.0)
|
cocoapods-trunk (>= 1.3.1, < 2.0)
|
||||||
cocoapods-try (>= 1.1.0, < 2.0)
|
cocoapods-try (>= 1.1.0, < 2.0)
|
||||||
colored2 (~> 3.1)
|
colored2 (~> 3.1)
|
||||||
escape (~> 0.0.4)
|
escape (~> 0.0.4)
|
||||||
fourflusher (~> 2.0.1)
|
fourflusher (>= 2.2.0, < 3.0)
|
||||||
gh_inspector (~> 1.0)
|
gh_inspector (~> 1.0)
|
||||||
molinillo (~> 0.6.5)
|
molinillo (~> 0.6.6)
|
||||||
nap (~> 1.0)
|
nap (~> 1.0)
|
||||||
ruby-macho (~> 1.1)
|
ruby-macho (~> 1.3, >= 1.3.1)
|
||||||
xcodeproj (>= 1.5.7, < 2.0)
|
xcodeproj (>= 1.8.0, < 2.0)
|
||||||
cocoapods-core (1.5.0)
|
cocoapods-core (1.6.0.rc.2)
|
||||||
activesupport (>= 4.0.2, < 6)
|
activesupport (>= 4.0.2, < 6)
|
||||||
fuzzy_match (~> 2.0.4)
|
fuzzy_match (~> 2.0.4)
|
||||||
nap (~> 1.0)
|
nap (~> 1.0)
|
||||||
cocoapods-deintegrate (1.0.2)
|
cocoapods-deintegrate (1.0.2)
|
||||||
cocoapods-downloader (1.2.0)
|
cocoapods-downloader (1.2.2)
|
||||||
cocoapods-plugins (1.0.0)
|
cocoapods-plugins (1.0.0)
|
||||||
nap
|
nap
|
||||||
cocoapods-search (1.0.0)
|
cocoapods-search (1.0.0)
|
||||||
cocoapods-stats (1.0.0)
|
cocoapods-stats (1.1.0)
|
||||||
cocoapods-trunk (1.3.0)
|
cocoapods-trunk (1.3.1)
|
||||||
nap (>= 0.8, < 2.0)
|
nap (>= 0.8, < 2.0)
|
||||||
netrc (~> 0.11)
|
netrc (~> 0.11)
|
||||||
cocoapods-try (1.1.0)
|
cocoapods-try (1.1.0)
|
||||||
colored2 (3.1.2)
|
colored2 (3.1.2)
|
||||||
concurrent-ruby (1.0.5)
|
concurrent-ruby (1.1.4)
|
||||||
escape (0.0.4)
|
escape (0.0.4)
|
||||||
fourflusher (2.0.1)
|
fourflusher (2.2.0)
|
||||||
fuzzy_match (2.0.4)
|
fuzzy_match (2.0.4)
|
||||||
gh_inspector (1.1.3)
|
gh_inspector (1.1.3)
|
||||||
i18n (0.9.5)
|
i18n (0.9.5)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
minitest (5.11.3)
|
minitest (5.11.3)
|
||||||
molinillo (0.6.5)
|
molinillo (0.6.6)
|
||||||
nanaimo (0.2.5)
|
nanaimo (0.2.6)
|
||||||
nap (1.1.0)
|
nap (1.1.0)
|
||||||
netrc (0.11.0)
|
netrc (0.11.0)
|
||||||
ruby-macho (1.1.0)
|
ruby-macho (1.3.1)
|
||||||
thread_safe (0.3.6)
|
thread_safe (0.3.6)
|
||||||
tzinfo (1.2.5)
|
tzinfo (1.2.5)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
xcodeproj (1.5.7)
|
xcodeproj (1.8.0)
|
||||||
CFPropertyList (>= 2.3.3, < 4.0)
|
CFPropertyList (>= 2.3.3, < 4.0)
|
||||||
atomos (~> 0.1.2)
|
atomos (~> 0.1.3)
|
||||||
claide (>= 1.0.2, < 2.0)
|
claide (>= 1.0.2, < 2.0)
|
||||||
colored2 (~> 3.1)
|
colored2 (~> 3.1)
|
||||||
nanaimo (~> 0.2.4)
|
nanaimo (~> 0.2.6)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
cocoapods (= 1.5.0)
|
cocoapods (~> 1.6.0.rc.2)
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.16.1
|
1.17.2
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = "Nimble"
|
s.name = "Nimble"
|
||||||
s.version = "7.1.2"
|
s.version = "8.0.0"
|
||||||
s.summary = "A Matcher Framework for Swift and Objective-C"
|
s.summary = "A Matcher Framework for Swift and Objective-C"
|
||||||
s.description = <<-DESC
|
s.description = <<-DESC
|
||||||
Use Nimble to express the expected outcomes of Swift or Objective-C expressions. Inspired by Cedar.
|
Use Nimble to express the expected outcomes of Swift or Objective-C expressions. Inspired by Cedar.
|
||||||
|
@ -45,8 +45,11 @@ Pod::Spec.new do |s|
|
||||||
s.pod_target_xcconfig = {
|
s.pod_target_xcconfig = {
|
||||||
'APPLICATION_EXTENSION_API_ONLY' => 'YES',
|
'APPLICATION_EXTENSION_API_ONLY' => 'YES',
|
||||||
'ENABLE_BITCODE' => 'NO',
|
'ENABLE_BITCODE' => 'NO',
|
||||||
'OTHER_LDFLAGS' => '-weak-lswiftXCTest',
|
'OTHER_LDFLAGS' => '$(inherited) -weak-lswiftXCTest -Xlinker -no_application_extension',
|
||||||
'OTHER_SWIFT_FLAGS' => '$(inherited) -suppress-warnings',
|
'OTHER_SWIFT_FLAGS' => '$(inherited) -suppress-warnings',
|
||||||
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks"',
|
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks"',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s.cocoapods_version = '>= 1.4.0'
|
||||||
|
s.swift_version = '4.2'
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
1F0648CC19639F5A001F9C46 /* ObjectWithLazyProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */; };
|
1F0648CC19639F5A001F9C46 /* ObjectWithLazyProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */; };
|
||||||
1F0648CD19639F5A001F9C46 /* ObjectWithLazyProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */; };
|
1F0648CD19639F5A001F9C46 /* ObjectWithLazyProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */; };
|
||||||
1F0648D41963AAB2001F9C46 /* SynchronousTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTests.swift */; };
|
1F0648D41963AAB2001F9C46 /* SynchronousTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */; };
|
||||||
1F0648D51963AAB2001F9C46 /* SynchronousTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTests.swift */; };
|
1F0648D51963AAB2001F9C46 /* SynchronousTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */; };
|
||||||
1F14FB64194180C5009F2A08 /* utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F14FB63194180C5009F2A08 /* utils.swift */; };
|
1F14FB64194180C5009F2A08 /* utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F14FB63194180C5009F2A08 /* utils.swift */; };
|
||||||
1F1871C51CA89EDB00A34BF2 /* DSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1871BC1CA89EDB00A34BF2 /* DSL.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
1F1871C51CA89EDB00A34BF2 /* DSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1871BC1CA89EDB00A34BF2 /* DSL.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
1F1871C61CA89EDB00A34BF2 /* DSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871BD1CA89EDB00A34BF2 /* DSL.m */; };
|
1F1871C61CA89EDB00A34BF2 /* DSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871BD1CA89EDB00A34BF2 /* DSL.m */; };
|
||||||
|
@ -50,10 +50,10 @@
|
||||||
1F1871E01CA89EF600A34BF2 /* DSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1871BC1CA89EDB00A34BF2 /* DSL.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
1F1871E01CA89EF600A34BF2 /* DSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1871BC1CA89EDB00A34BF2 /* DSL.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
1F1871E11CA89EF600A34BF2 /* NMBExceptionCapture.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1871BE1CA89EDB00A34BF2 /* NMBExceptionCapture.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
1F1871E11CA89EF600A34BF2 /* NMBExceptionCapture.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1871BE1CA89EDB00A34BF2 /* NMBExceptionCapture.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
1F1871E21CA89EF600A34BF2 /* NMBStringify.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1871C01CA89EDB00A34BF2 /* NMBStringify.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
1F1871E21CA89EF600A34BF2 /* NMBStringify.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1871C01CA89EDB00A34BF2 /* NMBStringify.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
1F1871E41CA89FB600A34BF2 /* AsyncMatcherWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* AsyncMatcherWrapper.swift */; };
|
1F1871E41CA89FB600A34BF2 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* Async.swift */; };
|
||||||
1F1871E61CA89FCD00A34BF2 /* MatcherFunc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */; };
|
1F1871E61CA89FCD00A34BF2 /* MatcherFunc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */; };
|
||||||
1F1871E71CA8A18400A34BF2 /* AsyncMatcherWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* AsyncMatcherWrapper.swift */; };
|
1F1871E71CA8A18400A34BF2 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* Async.swift */; };
|
||||||
1F1871E81CA8A18400A34BF2 /* AsyncMatcherWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* AsyncMatcherWrapper.swift */; };
|
1F1871E81CA8A18400A34BF2 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E31CA89FB600A34BF2 /* Async.swift */; };
|
||||||
1F1871E91CA8A18700A34BF2 /* MatcherFunc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */; };
|
1F1871E91CA8A18700A34BF2 /* MatcherFunc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */; };
|
||||||
1F1871EB1CA8A18800A34BF2 /* MatcherFunc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */; };
|
1F1871EB1CA8A18800A34BF2 /* MatcherFunc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */; };
|
||||||
1F1A742F1940169200FFFC47 /* Nimble.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1A742E1940169200FFFC47 /* Nimble.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
1F1A742F1940169200FFFC47 /* Nimble.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F1A742E1940169200FFFC47 /* Nimble.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
|
@ -143,11 +143,11 @@
|
||||||
1F5DF1891BDCA0F500C3A531 /* RaisesException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1E1968AB07008ED995 /* RaisesException.swift */; };
|
1F5DF1891BDCA0F500C3A531 /* RaisesException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1E1968AB07008ED995 /* RaisesException.swift */; };
|
||||||
1F5DF18A1BDCA0F500C3A531 /* ThrowError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29EA59651B551EE6002D767E /* ThrowError.swift */; };
|
1F5DF18A1BDCA0F500C3A531 /* ThrowError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29EA59651B551EE6002D767E /* ThrowError.swift */; };
|
||||||
1F5DF18B1BDCA0F500C3A531 /* Functional.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD251968AB07008ED995 /* Functional.swift */; };
|
1F5DF18B1BDCA0F500C3A531 /* Functional.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD251968AB07008ED995 /* Functional.swift */; };
|
||||||
1F5DF18C1BDCA0F500C3A531 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Async.swift */; };
|
1F5DF18C1BDCA0F500C3A531 /* Await.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Await.swift */; };
|
||||||
1F5DF18D1BDCA0F500C3A531 /* SourceLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD271968AB07008ED995 /* SourceLocation.swift */; };
|
1F5DF18D1BDCA0F500C3A531 /* SourceLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD271968AB07008ED995 /* SourceLocation.swift */; };
|
||||||
1F5DF18E1BDCA0F500C3A531 /* Stringers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD281968AB07008ED995 /* Stringers.swift */; };
|
1F5DF18E1BDCA0F500C3A531 /* Stringers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD281968AB07008ED995 /* Stringers.swift */; };
|
||||||
1F5DF1921BDCA10200C3A531 /* AsynchronousTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F925EE5195C121200ED456B /* AsynchronousTest.swift */; };
|
1F5DF1921BDCA10200C3A531 /* AsynchronousTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F925EE5195C121200ED456B /* AsynchronousTest.swift */; };
|
||||||
1F5DF1931BDCA10200C3A531 /* SynchronousTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTests.swift */; };
|
1F5DF1931BDCA10200C3A531 /* SynchronousTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */; };
|
||||||
1F5DF1941BDCA10200C3A531 /* UserDescriptionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965B0D0B1B62C06D0005AE66 /* UserDescriptionTest.swift */; };
|
1F5DF1941BDCA10200C3A531 /* UserDescriptionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965B0D0B1B62C06D0005AE66 /* UserDescriptionTest.swift */; };
|
||||||
1F5DF1951BDCA10200C3A531 /* utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F14FB63194180C5009F2A08 /* utils.swift */; };
|
1F5DF1951BDCA10200C3A531 /* utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F14FB63194180C5009F2A08 /* utils.swift */; };
|
||||||
1F5DF1961BDCA10200C3A531 /* ObjectWithLazyProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */; };
|
1F5DF1961BDCA10200C3A531 /* ObjectWithLazyProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */; };
|
||||||
|
@ -273,8 +273,8 @@
|
||||||
1FD8CD5B1968AB07008ED995 /* Equal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1C1968AB07008ED995 /* Equal.swift */; };
|
1FD8CD5B1968AB07008ED995 /* Equal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1C1968AB07008ED995 /* Equal.swift */; };
|
||||||
1FD8CD5E1968AB07008ED995 /* RaisesException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1E1968AB07008ED995 /* RaisesException.swift */; };
|
1FD8CD5E1968AB07008ED995 /* RaisesException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1E1968AB07008ED995 /* RaisesException.swift */; };
|
||||||
1FD8CD5F1968AB07008ED995 /* RaisesException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1E1968AB07008ED995 /* RaisesException.swift */; };
|
1FD8CD5F1968AB07008ED995 /* RaisesException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD1E1968AB07008ED995 /* RaisesException.swift */; };
|
||||||
1FD8CD6A1968AB07008ED995 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Async.swift */; };
|
1FD8CD6A1968AB07008ED995 /* Await.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Await.swift */; };
|
||||||
1FD8CD6B1968AB07008ED995 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Async.swift */; };
|
1FD8CD6B1968AB07008ED995 /* Await.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD8CD261968AB07008ED995 /* Await.swift */; };
|
||||||
1FDBD8671AF8A4FF0089F27B /* AssertionDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FDBD8661AF8A4FF0089F27B /* AssertionDispatcher.swift */; };
|
1FDBD8671AF8A4FF0089F27B /* AssertionDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FDBD8661AF8A4FF0089F27B /* AssertionDispatcher.swift */; };
|
||||||
1FDBD8681AF8A4FF0089F27B /* AssertionDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FDBD8661AF8A4FF0089F27B /* AssertionDispatcher.swift */; };
|
1FDBD8681AF8A4FF0089F27B /* AssertionDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FDBD8661AF8A4FF0089F27B /* AssertionDispatcher.swift */; };
|
||||||
1FE661571E6574E30035F243 /* ExpectationMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FE661561E6574E20035F243 /* ExpectationMessage.swift */; };
|
1FE661571E6574E30035F243 /* ExpectationMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FE661561E6574E20035F243 /* ExpectationMessage.swift */; };
|
||||||
|
@ -347,6 +347,13 @@
|
||||||
AE7ADE491C80C00D00B94CD3 /* MatchErrorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */; };
|
AE7ADE491C80C00D00B94CD3 /* MatchErrorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */; };
|
||||||
AE7ADE4A1C80C00D00B94CD3 /* MatchErrorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */; };
|
AE7ADE4A1C80C00D00B94CD3 /* MatchErrorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */; };
|
||||||
AE7ADE4B1C80C00D00B94CD3 /* MatchErrorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */; };
|
AE7ADE4B1C80C00D00B94CD3 /* MatchErrorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */; };
|
||||||
|
B20058C120E92C7500C1264D /* ElementsEqual.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C020E92C7500C1264D /* ElementsEqual.swift */; };
|
||||||
|
B20058C220E92CA900C1264D /* ElementsEqual.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C020E92C7500C1264D /* ElementsEqual.swift */; };
|
||||||
|
B20058C320E92CA900C1264D /* ElementsEqual.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C020E92C7500C1264D /* ElementsEqual.swift */; };
|
||||||
|
B20058C520E92CE400C1264D /* ElementsEqualTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C420E92CE400C1264D /* ElementsEqualTest.swift */; };
|
||||||
|
B20058C620E92CE400C1264D /* ElementsEqualTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C420E92CE400C1264D /* ElementsEqualTest.swift */; };
|
||||||
|
B20058C720E92CE400C1264D /* ElementsEqualTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B20058C420E92CE400C1264D /* ElementsEqualTest.swift */; };
|
||||||
|
CD037213207DCC580047AF28 /* XCTestManifests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD037212207DCC580047AF28 /* XCTestManifests.swift */; };
|
||||||
CD79C99E1D2CC832004B6F9A /* ObjCAsyncTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F4A56651A3B305F009E1637 /* ObjCAsyncTest.m */; };
|
CD79C99E1D2CC832004B6F9A /* ObjCAsyncTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F4A56651A3B305F009E1637 /* ObjCAsyncTest.m */; };
|
||||||
CD79C99F1D2CC835004B6F9A /* ObjCSyncTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F8A37AF1B7C5042001C8357 /* ObjCSyncTest.m */; };
|
CD79C99F1D2CC835004B6F9A /* ObjCSyncTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F8A37AF1B7C5042001C8357 /* ObjCSyncTest.m */; };
|
||||||
CD79C9A01D2CC839004B6F9A /* ObjCBeAnInstanceOfTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F4A56691A3B3108009E1637 /* ObjCBeAnInstanceOfTest.m */; };
|
CD79C9A01D2CC839004B6F9A /* ObjCBeAnInstanceOfTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F4A56691A3B3108009E1637 /* ObjCBeAnInstanceOfTest.m */; };
|
||||||
|
@ -487,7 +494,7 @@
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectWithLazyProperty.swift; sourceTree = "<group>"; };
|
1F0648CB19639F5A001F9C46 /* ObjectWithLazyProperty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectWithLazyProperty.swift; sourceTree = "<group>"; };
|
||||||
1F0648D31963AAB2001F9C46 /* SynchronousTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SynchronousTests.swift; sourceTree = "<group>"; };
|
1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SynchronousTest.swift; sourceTree = "<group>"; };
|
||||||
1F14FB63194180C5009F2A08 /* utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = utils.swift; sourceTree = "<group>"; };
|
1F14FB63194180C5009F2A08 /* utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = utils.swift; sourceTree = "<group>"; };
|
||||||
1F1871BC1CA89EDB00A34BF2 /* DSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DSL.h; sourceTree = "<group>"; };
|
1F1871BC1CA89EDB00A34BF2 /* DSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DSL.h; sourceTree = "<group>"; };
|
||||||
1F1871BD1CA89EDB00A34BF2 /* DSL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DSL.m; sourceTree = "<group>"; };
|
1F1871BD1CA89EDB00A34BF2 /* DSL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DSL.m; sourceTree = "<group>"; };
|
||||||
|
@ -498,7 +505,7 @@
|
||||||
1F1871C21CA89EDB00A34BF2 /* NMBExpectation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NMBExpectation.swift; sourceTree = "<group>"; };
|
1F1871C21CA89EDB00A34BF2 /* NMBExpectation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NMBExpectation.swift; sourceTree = "<group>"; };
|
||||||
1F1871C31CA89EDB00A34BF2 /* NMBObjCMatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NMBObjCMatcher.swift; sourceTree = "<group>"; };
|
1F1871C31CA89EDB00A34BF2 /* NMBObjCMatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NMBObjCMatcher.swift; sourceTree = "<group>"; };
|
||||||
1F1871CD1CA89EE000A34BF2 /* ExceptionCapture.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExceptionCapture.swift; sourceTree = "<group>"; };
|
1F1871CD1CA89EE000A34BF2 /* ExceptionCapture.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExceptionCapture.swift; sourceTree = "<group>"; };
|
||||||
1F1871E31CA89FB600A34BF2 /* AsyncMatcherWrapper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AsyncMatcherWrapper.swift; sourceTree = "<group>"; };
|
1F1871E31CA89FB600A34BF2 /* Async.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Async.swift; sourceTree = "<group>"; };
|
||||||
1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatcherFunc.swift; sourceTree = "<group>"; };
|
1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatcherFunc.swift; sourceTree = "<group>"; };
|
||||||
1F1A74291940169200FFFC47 /* Nimble.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
1F1A74291940169200FFFC47 /* Nimble.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
1F1A742D1940169200FFFC47 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
1F1A742D1940169200FFFC47 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
|
@ -582,7 +589,7 @@
|
||||||
1FD8CD1D1968AB07008ED995 /* MatcherProtocols.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatcherProtocols.swift; sourceTree = "<group>"; };
|
1FD8CD1D1968AB07008ED995 /* MatcherProtocols.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatcherProtocols.swift; sourceTree = "<group>"; };
|
||||||
1FD8CD1E1968AB07008ED995 /* RaisesException.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = RaisesException.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
1FD8CD1E1968AB07008ED995 /* RaisesException.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = RaisesException.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||||
1FD8CD251968AB07008ED995 /* Functional.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Functional.swift; sourceTree = "<group>"; };
|
1FD8CD251968AB07008ED995 /* Functional.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Functional.swift; sourceTree = "<group>"; };
|
||||||
1FD8CD261968AB07008ED995 /* Async.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Async.swift; sourceTree = "<group>"; };
|
1FD8CD261968AB07008ED995 /* Await.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Await.swift; sourceTree = "<group>"; };
|
||||||
1FD8CD271968AB07008ED995 /* SourceLocation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SourceLocation.swift; sourceTree = "<group>"; };
|
1FD8CD271968AB07008ED995 /* SourceLocation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SourceLocation.swift; sourceTree = "<group>"; };
|
||||||
1FD8CD281968AB07008ED995 /* Stringers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Stringers.swift; sourceTree = "<group>"; };
|
1FD8CD281968AB07008ED995 /* Stringers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Stringers.swift; sourceTree = "<group>"; };
|
||||||
1FDBD8661AF8A4FF0089F27B /* AssertionDispatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssertionDispatcher.swift; sourceTree = "<group>"; };
|
1FDBD8661AF8A4FF0089F27B /* AssertionDispatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssertionDispatcher.swift; sourceTree = "<group>"; };
|
||||||
|
@ -612,6 +619,9 @@
|
||||||
AE4BA9AC1C88DDB500B73906 /* Errors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Errors.swift; sourceTree = "<group>"; };
|
AE4BA9AC1C88DDB500B73906 /* Errors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Errors.swift; sourceTree = "<group>"; };
|
||||||
AE7ADE441C80BF8000B94CD3 /* MatchError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatchError.swift; sourceTree = "<group>"; };
|
AE7ADE441C80BF8000B94CD3 /* MatchError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatchError.swift; sourceTree = "<group>"; };
|
||||||
AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatchErrorTest.swift; sourceTree = "<group>"; };
|
AE7ADE481C80C00D00B94CD3 /* MatchErrorTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatchErrorTest.swift; sourceTree = "<group>"; };
|
||||||
|
B20058C020E92C7500C1264D /* ElementsEqual.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementsEqual.swift; sourceTree = "<group>"; };
|
||||||
|
B20058C420E92CE400C1264D /* ElementsEqualTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementsEqualTest.swift; sourceTree = "<group>"; };
|
||||||
|
CD037212207DCC580047AF28 /* XCTestManifests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTestManifests.swift; sourceTree = "<group>"; };
|
||||||
CDFB6A1E1F7E07C600AD8CC7 /* CwlCatchException.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlCatchException.swift; sourceTree = "<group>"; };
|
CDFB6A1E1F7E07C600AD8CC7 /* CwlCatchException.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CwlCatchException.swift; sourceTree = "<group>"; };
|
||||||
CDFB6A201F7E07C600AD8CC7 /* CwlCatchException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CwlCatchException.m; sourceTree = "<group>"; };
|
CDFB6A201F7E07C600AD8CC7 /* CwlCatchException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CwlCatchException.m; sourceTree = "<group>"; };
|
||||||
CDFB6A221F7E07C600AD8CC7 /* CwlCatchException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlCatchException.h; sourceTree = "<group>"; };
|
CDFB6A221F7E07C600AD8CC7 /* CwlCatchException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CwlCatchException.h; sourceTree = "<group>"; };
|
||||||
|
@ -768,9 +778,10 @@
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
1F925EE5195C121200ED456B /* AsynchronousTest.swift */,
|
1F925EE5195C121200ED456B /* AsynchronousTest.swift */,
|
||||||
1F0648D31963AAB2001F9C46 /* SynchronousTests.swift */,
|
1F0648D31963AAB2001F9C46 /* SynchronousTest.swift */,
|
||||||
965B0D0B1B62C06D0005AE66 /* UserDescriptionTest.swift */,
|
965B0D0B1B62C06D0005AE66 /* UserDescriptionTest.swift */,
|
||||||
6CAEDD091CAEA86F003F1584 /* LinuxSupport.swift */,
|
6CAEDD091CAEA86F003F1584 /* LinuxSupport.swift */,
|
||||||
|
CD037212207DCC580047AF28 /* XCTestManifests.swift */,
|
||||||
1FFD729A1963FC8200CD29A2 /* objc */,
|
1FFD729A1963FC8200CD29A2 /* objc */,
|
||||||
1F14FB61194180A7009F2A08 /* Helpers */,
|
1F14FB61194180A7009F2A08 /* Helpers */,
|
||||||
1F925EE3195C11B000ED456B /* Matchers */,
|
1F925EE3195C11B000ED456B /* Matchers */,
|
||||||
|
@ -810,6 +821,7 @@
|
||||||
1F925F01195C189500ED456B /* ContainTest.swift */,
|
1F925F01195C189500ED456B /* ContainTest.swift */,
|
||||||
1F925EFE195C187600ED456B /* EndWithTest.swift */,
|
1F925EFE195C187600ED456B /* EndWithTest.swift */,
|
||||||
1F925F04195C18B700ED456B /* EqualTest.swift */,
|
1F925F04195C18B700ED456B /* EqualTest.swift */,
|
||||||
|
B20058C420E92CE400C1264D /* ElementsEqualTest.swift */,
|
||||||
472FD1361B9E094B00C7B8DA /* HaveCountTest.swift */,
|
472FD1361B9E094B00C7B8DA /* HaveCountTest.swift */,
|
||||||
DDB4D5EF19FE442800E9D9FE /* MatchTest.swift */,
|
DDB4D5EF19FE442800E9D9FE /* MatchTest.swift */,
|
||||||
1F925EEB195C12C800ED456B /* RaisesExceptionTest.swift */,
|
1F925EEB195C12C800ED456B /* RaisesExceptionTest.swift */,
|
||||||
|
@ -843,7 +855,7 @@
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
DDB1BC781A92235600F743C3 /* AllPass.swift */,
|
DDB1BC781A92235600F743C3 /* AllPass.swift */,
|
||||||
1F1871E31CA89FB600A34BF2 /* AsyncMatcherWrapper.swift */,
|
1F1871E31CA89FB600A34BF2 /* Async.swift */,
|
||||||
1FD8CD0E1968AB07008ED995 /* BeAKindOf.swift */,
|
1FD8CD0E1968AB07008ED995 /* BeAKindOf.swift */,
|
||||||
1FD8CD0D1968AB07008ED995 /* BeAnInstanceOf.swift */,
|
1FD8CD0D1968AB07008ED995 /* BeAnInstanceOf.swift */,
|
||||||
1FD8CD0F1968AB07008ED995 /* BeCloseTo.swift */,
|
1FD8CD0F1968AB07008ED995 /* BeCloseTo.swift */,
|
||||||
|
@ -861,6 +873,7 @@
|
||||||
7B13BA051DD360AA00C9098C /* ContainElementSatisfying.swift */,
|
7B13BA051DD360AA00C9098C /* ContainElementSatisfying.swift */,
|
||||||
1FD8CD1B1968AB07008ED995 /* EndWith.swift */,
|
1FD8CD1B1968AB07008ED995 /* EndWith.swift */,
|
||||||
1FD8CD1C1968AB07008ED995 /* Equal.swift */,
|
1FD8CD1C1968AB07008ED995 /* Equal.swift */,
|
||||||
|
B20058C020E92C7500C1264D /* ElementsEqual.swift */,
|
||||||
472FD1341B9E085700C7B8DA /* HaveCount.swift */,
|
472FD1341B9E085700C7B8DA /* HaveCount.swift */,
|
||||||
DDB4D5EC19FE43C200E9D9FE /* Match.swift */,
|
DDB4D5EC19FE43C200E9D9FE /* Match.swift */,
|
||||||
1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */,
|
1F1871E51CA89FCD00A34BF2 /* MatcherFunc.swift */,
|
||||||
|
@ -882,7 +895,7 @@
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
1FD8CD251968AB07008ED995 /* Functional.swift */,
|
1FD8CD251968AB07008ED995 /* Functional.swift */,
|
||||||
1FD8CD261968AB07008ED995 /* Async.swift */,
|
1FD8CD261968AB07008ED995 /* Await.swift */,
|
||||||
1FD8CD271968AB07008ED995 /* SourceLocation.swift */,
|
1FD8CD271968AB07008ED995 /* SourceLocation.swift */,
|
||||||
1FD8CD281968AB07008ED995 /* Stringers.swift */,
|
1FD8CD281968AB07008ED995 /* Stringers.swift */,
|
||||||
AE4BA9AC1C88DDB500B73906 /* Errors.swift */,
|
AE4BA9AC1C88DDB500B73906 /* Errors.swift */,
|
||||||
|
@ -1081,9 +1094,9 @@
|
||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 1F1A743F1940169200FFFC47 /* Build configuration list for PBXNativeTarget "Nimble-iOS" */;
|
buildConfigurationList = 1F1A743F1940169200FFFC47 /* Build configuration list for PBXNativeTarget "Nimble-iOS" */;
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
|
1F1A74261940169200FFFC47 /* Headers */,
|
||||||
1F1A74241940169200FFFC47 /* Sources */,
|
1F1A74241940169200FFFC47 /* Sources */,
|
||||||
1F1A74251940169200FFFC47 /* Frameworks */,
|
1F1A74251940169200FFFC47 /* Frameworks */,
|
||||||
1F1A74261940169200FFFC47 /* Headers */,
|
|
||||||
1F1A74271940169200FFFC47 /* Resources */,
|
1F1A74271940169200FFFC47 /* Resources */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
|
@ -1120,9 +1133,9 @@
|
||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 1F5DF16A1BDCA0CE00C3A531 /* Build configuration list for PBXNativeTarget "Nimble-tvOS" */;
|
buildConfigurationList = 1F5DF16A1BDCA0CE00C3A531 /* Build configuration list for PBXNativeTarget "Nimble-tvOS" */;
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
|
1F5DF1521BDCA0CE00C3A531 /* Headers */,
|
||||||
1F5DF1501BDCA0CE00C3A531 /* Sources */,
|
1F5DF1501BDCA0CE00C3A531 /* Sources */,
|
||||||
1F5DF1511BDCA0CE00C3A531 /* Frameworks */,
|
1F5DF1511BDCA0CE00C3A531 /* Frameworks */,
|
||||||
1F5DF1521BDCA0CE00C3A531 /* Headers */,
|
|
||||||
1F5DF1531BDCA0CE00C3A531 /* Resources */,
|
1F5DF1531BDCA0CE00C3A531 /* Resources */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
|
@ -1156,9 +1169,9 @@
|
||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 1F925EC0195C0D6300ED456B /* Build configuration list for PBXNativeTarget "Nimble-macOS" */;
|
buildConfigurationList = 1F925EC0195C0D6300ED456B /* Build configuration list for PBXNativeTarget "Nimble-macOS" */;
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
|
1F925EAA195C0D6300ED456B /* Headers */,
|
||||||
1F925EA8195C0D6300ED456B /* Sources */,
|
1F925EA8195C0D6300ED456B /* Sources */,
|
||||||
1F925EA9195C0D6300ED456B /* Frameworks */,
|
1F925EA9195C0D6300ED456B /* Frameworks */,
|
||||||
1F925EAA195C0D6300ED456B /* Headers */,
|
|
||||||
1F925EAB195C0D6300ED456B /* Resources */,
|
1F925EAB195C0D6300ED456B /* Resources */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
|
@ -1343,6 +1356,7 @@
|
||||||
DDB4D5ED19FE43C200E9D9FE /* Match.swift in Sources */,
|
DDB4D5ED19FE43C200E9D9FE /* Match.swift in Sources */,
|
||||||
1F91DD311C74BF61002C309F /* BeVoid.swift in Sources */,
|
1F91DD311C74BF61002C309F /* BeVoid.swift in Sources */,
|
||||||
7B13BA0B1DD361D200C9098C /* ContainElementSatisfying.swift in Sources */,
|
7B13BA0B1DD361D200C9098C /* ContainElementSatisfying.swift in Sources */,
|
||||||
|
B20058C220E92CA900C1264D /* ElementsEqual.swift in Sources */,
|
||||||
1FCF91531C61C8A400B15DCB /* PostNotification.swift in Sources */,
|
1FCF91531C61C8A400B15DCB /* PostNotification.swift in Sources */,
|
||||||
1FD8CD2E1968AB07008ED995 /* AssertionRecorder.swift in Sources */,
|
1FD8CD2E1968AB07008ED995 /* AssertionRecorder.swift in Sources */,
|
||||||
29EA59661B551EE6002D767E /* ThrowError.swift in Sources */,
|
29EA59661B551EE6002D767E /* ThrowError.swift in Sources */,
|
||||||
|
@ -1366,11 +1380,11 @@
|
||||||
1FE661581E6574E30035F243 /* ExpectationMessage.swift in Sources */,
|
1FE661581E6574E30035F243 /* ExpectationMessage.swift in Sources */,
|
||||||
1F1871E61CA89FCD00A34BF2 /* MatcherFunc.swift in Sources */,
|
1F1871E61CA89FCD00A34BF2 /* MatcherFunc.swift in Sources */,
|
||||||
1FD8CD421968AB07008ED995 /* BeEmpty.swift in Sources */,
|
1FD8CD421968AB07008ED995 /* BeEmpty.swift in Sources */,
|
||||||
1F1871E41CA89FB600A34BF2 /* AsyncMatcherWrapper.swift in Sources */,
|
1F1871E41CA89FB600A34BF2 /* Async.swift in Sources */,
|
||||||
1F1871CA1CA89EDB00A34BF2 /* NMBStringify.m in Sources */,
|
1F1871CA1CA89EDB00A34BF2 /* NMBStringify.m in Sources */,
|
||||||
A8A3B6EB2071487E00E25A08 /* SatisfyAllOf.swift in Sources */,
|
A8A3B6EB2071487E00E25A08 /* SatisfyAllOf.swift in Sources */,
|
||||||
1FD8CD521968AB07008ED995 /* BeNil.swift in Sources */,
|
1FD8CD521968AB07008ED995 /* BeNil.swift in Sources */,
|
||||||
1FD8CD6A1968AB07008ED995 /* Async.swift in Sources */,
|
1FD8CD6A1968AB07008ED995 /* Await.swift in Sources */,
|
||||||
CDFB6A241F7E07C700AD8CC7 /* CwlCatchException.swift in Sources */,
|
CDFB6A241F7E07C700AD8CC7 /* CwlCatchException.swift in Sources */,
|
||||||
1FD8CD581968AB07008ED995 /* EndWith.swift in Sources */,
|
1FD8CD581968AB07008ED995 /* EndWith.swift in Sources */,
|
||||||
1FD8CD341968AB07008ED995 /* DSL.swift in Sources */,
|
1FD8CD341968AB07008ED995 /* DSL.swift in Sources */,
|
||||||
|
@ -1427,6 +1441,7 @@
|
||||||
1F4A56911A3B344A009E1637 /* ObjCBeNilTest.m in Sources */,
|
1F4A56911A3B344A009E1637 /* ObjCBeNilTest.m in Sources */,
|
||||||
1F8A37B01B7C5042001C8357 /* ObjCSyncTest.m in Sources */,
|
1F8A37B01B7C5042001C8357 /* ObjCSyncTest.m in Sources */,
|
||||||
1F4A56941A3B346F009E1637 /* ObjCContainTest.m in Sources */,
|
1F4A56941A3B346F009E1637 /* ObjCContainTest.m in Sources */,
|
||||||
|
B20058C620E92CE400C1264D /* ElementsEqualTest.swift in Sources */,
|
||||||
1F299EAB19627B2D002641AF /* BeEmptyTest.swift in Sources */,
|
1F299EAB19627B2D002641AF /* BeEmptyTest.swift in Sources */,
|
||||||
7B13BA111DD361EB00C9098C /* ObjCContainElementSatisfyingTest.m in Sources */,
|
7B13BA111DD361EB00C9098C /* ObjCContainElementSatisfyingTest.m in Sources */,
|
||||||
1F925EF6195C147800ED456B /* BeCloseToTest.swift in Sources */,
|
1F925EF6195C147800ED456B /* BeCloseToTest.swift in Sources */,
|
||||||
|
@ -1441,7 +1456,7 @@
|
||||||
1F4A56851A3B33A0009E1637 /* ObjCBeTruthyTest.m in Sources */,
|
1F4A56851A3B33A0009E1637 /* ObjCBeTruthyTest.m in Sources */,
|
||||||
DD9A9A8F19CF439B00706F49 /* BeIdenticalToObjectTest.swift in Sources */,
|
DD9A9A8F19CF439B00706F49 /* BeIdenticalToObjectTest.swift in Sources */,
|
||||||
1F4BB8B71DACA0E40048464B /* ThrowAssertionTest.swift in Sources */,
|
1F4BB8B71DACA0E40048464B /* ThrowAssertionTest.swift in Sources */,
|
||||||
1F0648D41963AAB2001F9C46 /* SynchronousTests.swift in Sources */,
|
1F0648D41963AAB2001F9C46 /* SynchronousTest.swift in Sources */,
|
||||||
347155CA1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */,
|
347155CA1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */,
|
||||||
4793854D1BA0BB2500296F85 /* ObjCHaveCountTest.m in Sources */,
|
4793854D1BA0BB2500296F85 /* ObjCHaveCountTest.m in Sources */,
|
||||||
1F925F08195C18CF00ED456B /* BeGreaterThanTest.swift in Sources */,
|
1F925F08195C18CF00ED456B /* BeGreaterThanTest.swift in Sources */,
|
||||||
|
@ -1470,7 +1485,7 @@
|
||||||
1F5DF1751BDCA0F500C3A531 /* FailureMessage.swift in Sources */,
|
1F5DF1751BDCA0F500C3A531 /* FailureMessage.swift in Sources */,
|
||||||
A8A3B6EC2071487F00E25A08 /* SatisfyAllOf.swift in Sources */,
|
A8A3B6EC2071487F00E25A08 /* SatisfyAllOf.swift in Sources */,
|
||||||
1F5DF1801BDCA0F500C3A531 /* BeLessThanOrEqual.swift in Sources */,
|
1F5DF1801BDCA0F500C3A531 /* BeLessThanOrEqual.swift in Sources */,
|
||||||
1F1871E81CA8A18400A34BF2 /* AsyncMatcherWrapper.swift in Sources */,
|
1F1871E81CA8A18400A34BF2 /* Async.swift in Sources */,
|
||||||
1F5DF18A1BDCA0F500C3A531 /* ThrowError.swift in Sources */,
|
1F5DF18A1BDCA0F500C3A531 /* ThrowError.swift in Sources */,
|
||||||
1F5DF1891BDCA0F500C3A531 /* RaisesException.swift in Sources */,
|
1F5DF1891BDCA0F500C3A531 /* RaisesException.swift in Sources */,
|
||||||
1F5DF1761BDCA0F500C3A531 /* AllPass.swift in Sources */,
|
1F5DF1761BDCA0F500C3A531 /* AllPass.swift in Sources */,
|
||||||
|
@ -1504,12 +1519,13 @@
|
||||||
1F1871E91CA8A18700A34BF2 /* MatcherFunc.swift in Sources */,
|
1F1871E91CA8A18700A34BF2 /* MatcherFunc.swift in Sources */,
|
||||||
1F5DF17A1BDCA0F500C3A531 /* BeEmpty.swift in Sources */,
|
1F5DF17A1BDCA0F500C3A531 /* BeEmpty.swift in Sources */,
|
||||||
CDFB6A511F7E087500AD8CC7 /* CwlCatchBadInstructionPosix.swift in Sources */,
|
CDFB6A511F7E087500AD8CC7 /* CwlCatchBadInstructionPosix.swift in Sources */,
|
||||||
1F5DF18C1BDCA0F500C3A531 /* Async.swift in Sources */,
|
1F5DF18C1BDCA0F500C3A531 /* Await.swift in Sources */,
|
||||||
1F1871D81CA89EEF00A34BF2 /* NMBStringify.m in Sources */,
|
1F1871D81CA89EEF00A34BF2 /* NMBStringify.m in Sources */,
|
||||||
1F5DF1821BDCA0F500C3A531 /* BeNil.swift in Sources */,
|
1F5DF1821BDCA0F500C3A531 /* BeNil.swift in Sources */,
|
||||||
1F5DF16F1BDCA0F500C3A531 /* AssertionDispatcher.swift in Sources */,
|
1F5DF16F1BDCA0F500C3A531 /* AssertionDispatcher.swift in Sources */,
|
||||||
964CFEFF1C4FF48900513336 /* ThrowAssertion.swift in Sources */,
|
964CFEFF1C4FF48900513336 /* ThrowAssertion.swift in Sources */,
|
||||||
1F5DF1841BDCA0F500C3A531 /* EndWith.swift in Sources */,
|
1F5DF1841BDCA0F500C3A531 /* EndWith.swift in Sources */,
|
||||||
|
B20058C320E92CA900C1264D /* ElementsEqual.swift in Sources */,
|
||||||
1F5DF18D1BDCA0F500C3A531 /* SourceLocation.swift in Sources */,
|
1F5DF18D1BDCA0F500C3A531 /* SourceLocation.swift in Sources */,
|
||||||
1F5DF1701BDCA0F500C3A531 /* DSL.swift in Sources */,
|
1F5DF1701BDCA0F500C3A531 /* DSL.swift in Sources */,
|
||||||
CDD80B851F20307B0002CD65 /* MatcherProtocols.swift in Sources */,
|
CDD80B851F20307B0002CD65 /* MatcherProtocols.swift in Sources */,
|
||||||
|
@ -1562,11 +1578,12 @@
|
||||||
1F5DF19C1BDCA10200C3A531 /* BeginWithTest.swift in Sources */,
|
1F5DF19C1BDCA10200C3A531 /* BeginWithTest.swift in Sources */,
|
||||||
1F5DF1A01BDCA10200C3A531 /* BeIdenticalToTest.swift in Sources */,
|
1F5DF1A01BDCA10200C3A531 /* BeIdenticalToTest.swift in Sources */,
|
||||||
1F5DF19A1BDCA10200C3A531 /* BeCloseToTest.swift in Sources */,
|
1F5DF19A1BDCA10200C3A531 /* BeCloseToTest.swift in Sources */,
|
||||||
|
B20058C720E92CE400C1264D /* ElementsEqualTest.swift in Sources */,
|
||||||
1F5DF1A61BDCA10200C3A531 /* EndWithTest.swift in Sources */,
|
1F5DF1A61BDCA10200C3A531 /* EndWithTest.swift in Sources */,
|
||||||
CD79C9A31D2CC841004B6F9A /* ObjCBeFalseTest.m in Sources */,
|
CD79C9A31D2CC841004B6F9A /* ObjCBeFalseTest.m in Sources */,
|
||||||
1F5DF1A71BDCA10200C3A531 /* EqualTest.swift in Sources */,
|
1F5DF1A71BDCA10200C3A531 /* EqualTest.swift in Sources */,
|
||||||
CD79C9AA1D2CC848004B6F9A /* ObjCBeLessThanOrEqualToTest.m in Sources */,
|
CD79C9AA1D2CC848004B6F9A /* ObjCBeLessThanOrEqualToTest.m in Sources */,
|
||||||
1F5DF1931BDCA10200C3A531 /* SynchronousTests.swift in Sources */,
|
1F5DF1931BDCA10200C3A531 /* SynchronousTest.swift in Sources */,
|
||||||
CD79C9A11D2CC83B004B6F9A /* ObjCBeCloseToTest.m in Sources */,
|
CD79C9A11D2CC83B004B6F9A /* ObjCBeCloseToTest.m in Sources */,
|
||||||
1F5DF19D1BDCA10200C3A531 /* BeGreaterThanOrEqualToTest.swift in Sources */,
|
1F5DF19D1BDCA10200C3A531 /* BeGreaterThanOrEqualToTest.swift in Sources */,
|
||||||
A8A3B6F7207329DE00E25A08 /* SatisfyAllOfTest.swift in Sources */,
|
A8A3B6F7207329DE00E25A08 /* SatisfyAllOfTest.swift in Sources */,
|
||||||
|
@ -1605,7 +1622,7 @@
|
||||||
1F43728E1A1B343F00EB80F8 /* Stringers.swift in Sources */,
|
1F43728E1A1B343F00EB80F8 /* Stringers.swift in Sources */,
|
||||||
1F43728C1A1B343C00EB80F8 /* SourceLocation.swift in Sources */,
|
1F43728C1A1B343C00EB80F8 /* SourceLocation.swift in Sources */,
|
||||||
1FD8CD4F1968AB07008ED995 /* BeLessThanOrEqual.swift in Sources */,
|
1FD8CD4F1968AB07008ED995 /* BeLessThanOrEqual.swift in Sources */,
|
||||||
1F1871E71CA8A18400A34BF2 /* AsyncMatcherWrapper.swift in Sources */,
|
1F1871E71CA8A18400A34BF2 /* Async.swift in Sources */,
|
||||||
1FDBD8681AF8A4FF0089F27B /* AssertionDispatcher.swift in Sources */,
|
1FDBD8681AF8A4FF0089F27B /* AssertionDispatcher.swift in Sources */,
|
||||||
1F43728B1A1B343900EB80F8 /* Functional.swift in Sources */,
|
1F43728B1A1B343900EB80F8 /* Functional.swift in Sources */,
|
||||||
AE4BA9AE1C88DDB500B73906 /* Errors.swift in Sources */,
|
AE4BA9AE1C88DDB500B73906 /* Errors.swift in Sources */,
|
||||||
|
@ -1618,6 +1635,7 @@
|
||||||
1FD8CD2F1968AB07008ED995 /* AssertionRecorder.swift in Sources */,
|
1FD8CD2F1968AB07008ED995 /* AssertionRecorder.swift in Sources */,
|
||||||
7B13BA061DD360AA00C9098C /* ContainElementSatisfying.swift in Sources */,
|
7B13BA061DD360AA00C9098C /* ContainElementSatisfying.swift in Sources */,
|
||||||
1F91DD321C74BF61002C309F /* BeVoid.swift in Sources */,
|
1F91DD321C74BF61002C309F /* BeVoid.swift in Sources */,
|
||||||
|
B20058C120E92C7500C1264D /* ElementsEqual.swift in Sources */,
|
||||||
1FCF91541C61C8A400B15DCB /* PostNotification.swift in Sources */,
|
1FCF91541C61C8A400B15DCB /* PostNotification.swift in Sources */,
|
||||||
DDB4D5EE19FE43C200E9D9FE /* Match.swift in Sources */,
|
DDB4D5EE19FE43C200E9D9FE /* Match.swift in Sources */,
|
||||||
29EA59671B551EE6002D767E /* ThrowError.swift in Sources */,
|
29EA59671B551EE6002D767E /* ThrowError.swift in Sources */,
|
||||||
|
@ -1645,7 +1663,7 @@
|
||||||
1F1871D41CA89EEE00A34BF2 /* NMBStringify.m in Sources */,
|
1F1871D41CA89EEE00A34BF2 /* NMBStringify.m in Sources */,
|
||||||
A8F6B5BD2070186D00FCB5ED /* SatisfyAllOf.swift in Sources */,
|
A8F6B5BD2070186D00FCB5ED /* SatisfyAllOf.swift in Sources */,
|
||||||
1FD8CD531968AB07008ED995 /* BeNil.swift in Sources */,
|
1FD8CD531968AB07008ED995 /* BeNil.swift in Sources */,
|
||||||
1FD8CD6B1968AB07008ED995 /* Async.swift in Sources */,
|
1FD8CD6B1968AB07008ED995 /* Await.swift in Sources */,
|
||||||
CDFB6A231F7E07C700AD8CC7 /* CwlCatchException.swift in Sources */,
|
CDFB6A231F7E07C700AD8CC7 /* CwlCatchException.swift in Sources */,
|
||||||
964CFEFE1C4FF48900513336 /* ThrowAssertion.swift in Sources */,
|
964CFEFE1C4FF48900513336 /* ThrowAssertion.swift in Sources */,
|
||||||
1FD8CD591968AB07008ED995 /* EndWith.swift in Sources */,
|
1FD8CD591968AB07008ED995 /* EndWith.swift in Sources */,
|
||||||
|
@ -1676,10 +1694,12 @@
|
||||||
DDB4D5F119FE442800E9D9FE /* MatchTest.swift in Sources */,
|
DDB4D5F119FE442800E9D9FE /* MatchTest.swift in Sources */,
|
||||||
1F4A56741A3B3210009E1637 /* ObjCBeginWithTest.m in Sources */,
|
1F4A56741A3B3210009E1637 /* ObjCBeginWithTest.m in Sources */,
|
||||||
1F4A56831A3B336F009E1637 /* ObjCBeLessThanOrEqualToTest.m in Sources */,
|
1F4A56831A3B336F009E1637 /* ObjCBeLessThanOrEqualToTest.m in Sources */,
|
||||||
|
CD037213207DCC580047AF28 /* XCTestManifests.swift in Sources */,
|
||||||
7B13BA0D1DD361DE00C9098C /* ContainElementSatisfyingTest.swift in Sources */,
|
7B13BA0D1DD361DE00C9098C /* ContainElementSatisfyingTest.swift in Sources */,
|
||||||
1F925F03195C189500ED456B /* ContainTest.swift in Sources */,
|
1F925F03195C189500ED456B /* ContainTest.swift in Sources */,
|
||||||
A8A3B6FD2073644700E25A08 /* ObjcStringersTest.m in Sources */,
|
A8A3B6FD2073644700E25A08 /* ObjcStringersTest.m in Sources */,
|
||||||
1F4A56891A3B33CB009E1637 /* ObjCBeFalsyTest.m in Sources */,
|
1F4A56891A3B33CB009E1637 /* ObjCBeFalsyTest.m in Sources */,
|
||||||
|
B20058C520E92CE400C1264D /* ElementsEqualTest.swift in Sources */,
|
||||||
1F4A568F1A3B342B009E1637 /* ObjCBeFalseTest.m in Sources */,
|
1F4A568F1A3B342B009E1637 /* ObjCBeFalseTest.m in Sources */,
|
||||||
1F925F12195C190B00ED456B /* BeGreaterThanOrEqualToTest.swift in Sources */,
|
1F925F12195C190B00ED456B /* BeGreaterThanOrEqualToTest.swift in Sources */,
|
||||||
1F925EF0195C136500ED456B /* BeLogicalTest.swift in Sources */,
|
1F925EF0195C136500ED456B /* BeLogicalTest.swift in Sources */,
|
||||||
|
@ -1716,7 +1736,7 @@
|
||||||
1F4A56861A3B33A0009E1637 /* ObjCBeTruthyTest.m in Sources */,
|
1F4A56861A3B33A0009E1637 /* ObjCBeTruthyTest.m in Sources */,
|
||||||
DD9A9A9019CF43AD00706F49 /* BeIdenticalToObjectTest.swift in Sources */,
|
DD9A9A9019CF43AD00706F49 /* BeIdenticalToObjectTest.swift in Sources */,
|
||||||
1F4BB8B61DACA0E30048464B /* ThrowAssertionTest.swift in Sources */,
|
1F4BB8B61DACA0E30048464B /* ThrowAssertionTest.swift in Sources */,
|
||||||
1F0648D51963AAB2001F9C46 /* SynchronousTests.swift in Sources */,
|
1F0648D51963AAB2001F9C46 /* SynchronousTest.swift in Sources */,
|
||||||
347155CB1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */,
|
347155CB1C337C8900549F03 /* XCTestCaseProvider.swift in Sources */,
|
||||||
4793854E1BA0BB2500296F85 /* ObjCHaveCountTest.m in Sources */,
|
4793854E1BA0BB2500296F85 /* ObjCHaveCountTest.m in Sources */,
|
||||||
1F925F09195C18CF00ED456B /* BeGreaterThanTest.swift in Sources */,
|
1F925F09195C18CF00ED456B /* BeGreaterThanTest.swift in Sources */,
|
||||||
|
@ -1836,13 +1856,13 @@
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||||
METAL_ENABLE_DEBUG_INFO = YES;
|
METAL_ENABLE_DEBUG_INFO = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
|
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
|
||||||
SWIFT_VERSION = 3.0;
|
SWIFT_VERSION = 4.2;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||||
VERSIONING_SYSTEM = "apple-generic";
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
|
@ -1895,12 +1915,12 @@
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||||
METAL_ENABLE_DEBUG_INFO = NO;
|
METAL_ENABLE_DEBUG_INFO = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||||
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
|
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
|
||||||
SWIFT_VERSION = 3.0;
|
SWIFT_VERSION = 4.2;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||||
VALIDATE_PRODUCT = YES;
|
VALIDATE_PRODUCT = YES;
|
||||||
|
@ -1933,9 +1953,12 @@
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||||
ONLY_ACTIVE_ARCH = NO;
|
ONLY_ACTIVE_ARCH = NO;
|
||||||
OTHER_LDFLAGS = (
|
OTHER_LDFLAGS = (
|
||||||
|
"$(inherited)",
|
||||||
"-weak_framework",
|
"-weak_framework",
|
||||||
XCTest,
|
XCTest,
|
||||||
"-weak-lswiftXCTest",
|
"-weak-lswiftXCTest",
|
||||||
|
"-Xlinker",
|
||||||
|
"-no_application_extension",
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}";
|
PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}";
|
||||||
PRODUCT_MODULE_NAME = Nimble;
|
PRODUCT_MODULE_NAME = Nimble;
|
||||||
|
@ -1967,9 +1990,12 @@
|
||||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
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";
|
||||||
OTHER_LDFLAGS = (
|
OTHER_LDFLAGS = (
|
||||||
|
"$(inherited)",
|
||||||
"-weak_framework",
|
"-weak_framework",
|
||||||
XCTest,
|
XCTest,
|
||||||
"-weak-lswiftXCTest",
|
"-weak-lswiftXCTest",
|
||||||
|
"-Xlinker",
|
||||||
|
"-no_application_extension",
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}";
|
PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}";
|
||||||
PRODUCT_MODULE_NAME = Nimble;
|
PRODUCT_MODULE_NAME = Nimble;
|
||||||
|
@ -2043,9 +2069,12 @@
|
||||||
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;
|
MTL_ENABLE_DEBUG_INFO = YES;
|
||||||
OTHER_LDFLAGS = (
|
OTHER_LDFLAGS = (
|
||||||
|
"$(inherited)",
|
||||||
"-weak_framework",
|
"-weak_framework",
|
||||||
XCTest,
|
XCTest,
|
||||||
"-weak-lswiftXCTest",
|
"-weak-lswiftXCTest",
|
||||||
|
"-Xlinker",
|
||||||
|
"-no_application_extension",
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}";
|
PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}";
|
||||||
PRODUCT_MODULE_NAME = Nimble;
|
PRODUCT_MODULE_NAME = Nimble;
|
||||||
|
@ -2080,9 +2109,12 @@
|
||||||
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;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
OTHER_LDFLAGS = (
|
OTHER_LDFLAGS = (
|
||||||
|
"$(inherited)",
|
||||||
"-weak_framework",
|
"-weak_framework",
|
||||||
XCTest,
|
XCTest,
|
||||||
"-weak-lswiftXCTest",
|
"-weak-lswiftXCTest",
|
||||||
|
"-Xlinker",
|
||||||
|
"-no_application_extension",
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}";
|
PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}";
|
||||||
PRODUCT_MODULE_NAME = Nimble;
|
PRODUCT_MODULE_NAME = Nimble;
|
||||||
|
@ -2160,9 +2192,12 @@
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||||
METAL_ENABLE_DEBUG_INFO = YES;
|
METAL_ENABLE_DEBUG_INFO = YES;
|
||||||
OTHER_LDFLAGS = (
|
OTHER_LDFLAGS = (
|
||||||
|
"$(inherited)",
|
||||||
"-weak_framework",
|
"-weak_framework",
|
||||||
XCTest,
|
XCTest,
|
||||||
"-weak-lswiftXCTest",
|
"-weak-lswiftXCTest",
|
||||||
|
"-Xlinker",
|
||||||
|
"-no_application_extension",
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}";
|
PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}";
|
||||||
PRODUCT_MODULE_NAME = Nimble;
|
PRODUCT_MODULE_NAME = Nimble;
|
||||||
|
@ -2197,9 +2232,12 @@
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||||
METAL_ENABLE_DEBUG_INFO = NO;
|
METAL_ENABLE_DEBUG_INFO = NO;
|
||||||
OTHER_LDFLAGS = (
|
OTHER_LDFLAGS = (
|
||||||
|
"$(inherited)",
|
||||||
"-weak_framework",
|
"-weak_framework",
|
||||||
XCTest,
|
XCTest,
|
||||||
"-weak-lswiftXCTest",
|
"-weak-lswiftXCTest",
|
||||||
|
"-Xlinker",
|
||||||
|
"-no_application_extension",
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}";
|
PRODUCT_BUNDLE_IDENTIFIER = "net.jeffhui.${PRODUCT_NAME:rfc1034identifier}";
|
||||||
PRODUCT_MODULE_NAME = Nimble;
|
PRODUCT_MODULE_NAME = Nimble;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>IDEDidComputeMac32BitWarning</key>
|
<key>BuildSystemType</key>
|
||||||
<true/>
|
<string>Latest</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
|
@ -1,11 +1,21 @@
|
||||||
// swift-tools-version:3.0
|
// swift-tools-version:4.2
|
||||||
|
|
||||||
import PackageDescription
|
import PackageDescription
|
||||||
|
|
||||||
let package = Package(
|
let package = Package(
|
||||||
name: "Nimble",
|
name: "Nimble",
|
||||||
exclude: [
|
products: [
|
||||||
"Sources/NimbleObjectiveC",
|
.library(name: "Nimble", targets: ["Nimble"]),
|
||||||
"Tests/NimbleTests/objc",
|
],
|
||||||
]
|
targets: [
|
||||||
|
.target(
|
||||||
|
name: "Nimble",
|
||||||
|
dependencies: []
|
||||||
|
),
|
||||||
|
.testTarget(
|
||||||
|
name: "NimbleTests",
|
||||||
|
dependencies: ["Nimble"],
|
||||||
|
exclude: ["objc"]
|
||||||
|
),
|
||||||
|
],
|
||||||
|
swiftLanguageVersions: [.v4_2]
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
// swift-tools-version:4.0
|
|
||||||
|
|
||||||
import PackageDescription
|
|
||||||
|
|
||||||
let package = Package(
|
|
||||||
name: "Nimble",
|
|
||||||
products: [
|
|
||||||
.library(name: "Nimble", targets: ["Nimble"]),
|
|
||||||
],
|
|
||||||
targets: [
|
|
||||||
.target(
|
|
||||||
name: "Nimble",
|
|
||||||
dependencies: []
|
|
||||||
),
|
|
||||||
.testTarget(
|
|
||||||
name: "NimbleTests",
|
|
||||||
dependencies: ["Nimble"],
|
|
||||||
exclude: ["objc"]
|
|
||||||
),
|
|
||||||
],
|
|
||||||
swiftLanguageVersions: [4]
|
|
||||||
)
|
|
|
@ -4,6 +4,7 @@
|
||||||
[![CocoaPods](https://img.shields.io/cocoapods/v/Nimble.svg)](https://cocoapods.org/pods/Nimble)
|
[![CocoaPods](https://img.shields.io/cocoapods/v/Nimble.svg)](https://cocoapods.org/pods/Nimble)
|
||||||
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
|
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
|
||||||
[![Platforms](https://img.shields.io/cocoapods/p/Nimble.svg)](https://cocoapods.org/pods/Nimble)
|
[![Platforms](https://img.shields.io/cocoapods/p/Nimble.svg)](https://cocoapods.org/pods/Nimble)
|
||||||
|
[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
|
||||||
|
|
||||||
Use Nimble to express the expected outcomes of Swift
|
Use Nimble to express the expected outcomes of Swift
|
||||||
or Objective-C expressions. Inspired by
|
or Objective-C expressions. Inspired by
|
||||||
|
@ -306,8 +307,7 @@ In Nimble, it's easy to make expectations on values that are updated
|
||||||
asynchronously. Just use `toEventually` or `toEventuallyNot`:
|
asynchronously. Just use `toEventually` or `toEventuallyNot`:
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
// Swift 3.0 and later
|
// Swift
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
ocean.add("dolphins")
|
ocean.add("dolphins")
|
||||||
ocean.add("whales")
|
ocean.add("whales")
|
||||||
|
@ -316,17 +316,6 @@ expect(ocean).toEventually(contain("dolphins", "whales"))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
```swift
|
|
||||||
// Swift 2.3 and earlier
|
|
||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue()) {
|
|
||||||
ocean.add("dolphins")
|
|
||||||
ocean.add("whales")
|
|
||||||
}
|
|
||||||
expect(ocean).toEventually(contain("dolphins", "whales"))
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
```objc
|
```objc
|
||||||
// Objective-C
|
// Objective-C
|
||||||
|
|
||||||
|
@ -857,11 +846,7 @@ Notes:
|
||||||
|
|
||||||
## Swift Error Handling
|
## Swift Error Handling
|
||||||
|
|
||||||
If you're using Swift 2.0 or newer, you can use the `throwError` matcher to check if an error is thrown.
|
You can use the `throwError` matcher to check if an error is thrown.
|
||||||
|
|
||||||
Note:
|
|
||||||
The following code sample references the `Swift.Error` protocol.
|
|
||||||
This is `Swift.ErrorProtocol` in versions of Swift prior to version 3.0.
|
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
// Swift
|
// Swift
|
||||||
|
@ -1277,7 +1262,7 @@ public func equal<T: Equatable>(expectedValue: T?) -> Predicate<T> {
|
||||||
// Predicate { actual in ... }
|
// Predicate { actual in ... }
|
||||||
//
|
//
|
||||||
// But shown with types here for clarity.
|
// But shown with types here for clarity.
|
||||||
return Predicate { (actual: Expression<T>) throws -> PredicateResult in
|
return Predicate { (actualExpression: Expression<T>) throws -> PredicateResult in
|
||||||
let msg = ExpectationMessage.expectedActualValueTo("equal <\(expectedValue)>")
|
let msg = ExpectationMessage.expectedActualValueTo("equal <\(expectedValue)>")
|
||||||
if let actualValue = try actualExpression.evaluate() {
|
if let actualValue = try actualExpression.evaluate() {
|
||||||
return PredicateResult(
|
return PredicateResult(
|
||||||
|
@ -1673,11 +1658,11 @@ backported.
|
||||||
The deprecating plan is a 3 major versions removal. Which is as follows:
|
The deprecating plan is a 3 major versions removal. Which is as follows:
|
||||||
|
|
||||||
1. Introduce new `Predicate` API, deprecation warning for old matcher APIs.
|
1. Introduce new `Predicate` API, deprecation warning for old matcher APIs.
|
||||||
(Nimble `v7.x.x`)
|
(Nimble `v7.x.x` and `v8.x.x`)
|
||||||
2. Introduce warnings on migration-path features (`.predicate`,
|
2. Introduce warnings on migration-path features (`.predicate`,
|
||||||
`Predicate`-constructors with similar arguments to old API). (Nimble
|
`Predicate`-constructors with similar arguments to old API). (Nimble
|
||||||
`v8.x.x`)
|
`v9.x.x`)
|
||||||
3. Remove old API. (Nimble `v9.x.x`)
|
3. Remove old API. (Nimble `v10.x.x`)
|
||||||
|
|
||||||
|
|
||||||
# Installing Nimble
|
# Installing Nimble
|
||||||
|
|
|
@ -13,5 +13,6 @@ public protocol AssertionHandler {
|
||||||
///
|
///
|
||||||
/// @see AssertionHandler
|
/// @see AssertionHandler
|
||||||
public var NimbleAssertionHandler: AssertionHandler = { () -> AssertionHandler in
|
public var NimbleAssertionHandler: AssertionHandler = { () -> AssertionHandler in
|
||||||
|
// swiftlint:disable:previous identifier_name
|
||||||
return isXCTestAvailable() ? NimbleXCTestHandler() : NimbleXCTestUnavailableHandler()
|
return isXCTestAvailable() ? NimbleXCTestHandler() : NimbleXCTestUnavailableHandler()
|
||||||
}()
|
}()
|
||||||
|
|
|
@ -37,21 +37,48 @@ public class AssertionRecorder: AssertionHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension NMBExceptionCapture {
|
||||||
|
internal func tryBlockThrows(_ unsafeBlock: () throws -> Void) throws {
|
||||||
|
var catchedError: Error?
|
||||||
|
tryBlock {
|
||||||
|
do {
|
||||||
|
try unsafeBlock()
|
||||||
|
} catch {
|
||||||
|
catchedError = error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let error = catchedError {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Allows you to temporarily replace the current Nimble assertion handler with
|
/// Allows you to temporarily replace the current Nimble assertion handler with
|
||||||
/// the one provided for the scope of the closure.
|
/// the one provided for the scope of the closure.
|
||||||
///
|
///
|
||||||
/// Once the closure finishes, then the original Nimble assertion handler is restored.
|
/// Once the closure finishes, then the original Nimble assertion handler is restored.
|
||||||
///
|
///
|
||||||
/// @see AssertionHandler
|
/// @see AssertionHandler
|
||||||
public func withAssertionHandler(_ tempAssertionHandler: AssertionHandler, closure: () throws -> Void) {
|
public func withAssertionHandler(_ tempAssertionHandler: AssertionHandler,
|
||||||
|
file: FileString = #file,
|
||||||
|
line: UInt = #line,
|
||||||
|
closure: () throws -> Void) {
|
||||||
let environment = NimbleEnvironment.activeInstance
|
let environment = NimbleEnvironment.activeInstance
|
||||||
let oldRecorder = environment.assertionHandler
|
let oldRecorder = environment.assertionHandler
|
||||||
let capturer = NMBExceptionCapture(handler: nil, finally: ({
|
let capturer = NMBExceptionCapture(handler: nil, finally: ({
|
||||||
environment.assertionHandler = oldRecorder
|
environment.assertionHandler = oldRecorder
|
||||||
}))
|
}))
|
||||||
environment.assertionHandler = tempAssertionHandler
|
environment.assertionHandler = tempAssertionHandler
|
||||||
capturer.tryBlock {
|
|
||||||
try! closure()
|
do {
|
||||||
|
try capturer.tryBlockThrows {
|
||||||
|
try closure()
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
let failureMessage = FailureMessage()
|
||||||
|
failureMessage.stringValue = "unexpected error thrown: <\(error)>"
|
||||||
|
let location = SourceLocation(file: file, line: line)
|
||||||
|
tempAssertionHandler.assert(false, message: failureMessage, location: location)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +92,7 @@ public func withAssertionHandler(_ tempAssertionHandler: AssertionHandler, closu
|
||||||
/// assertion handler when this is true. Defaults to false.
|
/// assertion handler when this is true. Defaults to false.
|
||||||
///
|
///
|
||||||
/// @see gatherFailingExpectations
|
/// @see gatherFailingExpectations
|
||||||
public func gatherExpectations(silently: Bool = false, closure: @escaping () -> Void) -> [AssertionRecord] {
|
public func gatherExpectations(silently: Bool = false, closure: () -> Void) -> [AssertionRecord] {
|
||||||
let previousRecorder = NimbleEnvironment.activeInstance.assertionHandler
|
let previousRecorder = NimbleEnvironment.activeInstance.assertionHandler
|
||||||
let recorder = AssertionRecorder()
|
let recorder = AssertionRecorder()
|
||||||
let handlers: [AssertionHandler]
|
let handlers: [AssertionHandler]
|
||||||
|
@ -92,7 +119,7 @@ public func gatherExpectations(silently: Bool = false, closure: @escaping () ->
|
||||||
///
|
///
|
||||||
/// @see gatherExpectations
|
/// @see gatherExpectations
|
||||||
/// @see raiseException source for an example use case.
|
/// @see raiseException source for an example use case.
|
||||||
public func gatherFailingExpectations(silently: Bool = false, closure: @escaping () -> Void) -> [AssertionRecord] {
|
public func gatherFailingExpectations(silently: Bool = false, closure: () -> Void) -> [AssertionRecord] {
|
||||||
let assertions = gatherExpectations(silently: silently, closure: closure)
|
let assertions = gatherExpectations(silently: silently, closure: closure)
|
||||||
return assertions.filter { assertion in
|
return assertions.filter { assertion in
|
||||||
!assertion.success
|
!assertion.success
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE
|
#if canImport(Darwin) && !SWIFT_PACKAGE
|
||||||
|
|
||||||
private func from(objcPredicate: NMBPredicate) -> Predicate<NSObject> {
|
private func from(objcPredicate: NMBPredicate) -> Predicate<NSObject> {
|
||||||
return Predicate { actualExpression in
|
return Predicate { actualExpression in
|
||||||
let result = objcPredicate.satisfies(({ try! actualExpression.evaluate() }),
|
let result = objcPredicate.satisfies(({ try actualExpression.evaluate() }),
|
||||||
location: actualExpression.location)
|
location: actualExpression.location)
|
||||||
return result.toSwift()
|
return result.toSwift()
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ internal struct ObjCMatcherWrapper: Matcher {
|
||||||
|
|
||||||
func matches(_ actualExpression: Expression<NSObject>, failureMessage: FailureMessage) -> Bool {
|
func matches(_ actualExpression: Expression<NSObject>, failureMessage: FailureMessage) -> Bool {
|
||||||
return matcher.matches(
|
return matcher.matches(
|
||||||
|
// swiftlint:disable:next force_try
|
||||||
({ try! actualExpression.evaluate() }),
|
({ try! actualExpression.evaluate() }),
|
||||||
failureMessage: failureMessage,
|
failureMessage: failureMessage,
|
||||||
location: actualExpression.location)
|
location: actualExpression.location)
|
||||||
|
@ -22,6 +23,7 @@ internal struct ObjCMatcherWrapper: Matcher {
|
||||||
|
|
||||||
func doesNotMatch(_ actualExpression: Expression<NSObject>, failureMessage: FailureMessage) -> Bool {
|
func doesNotMatch(_ actualExpression: Expression<NSObject>, failureMessage: FailureMessage) -> Bool {
|
||||||
return matcher.doesNotMatch(
|
return matcher.doesNotMatch(
|
||||||
|
// swiftlint:disable:next force_try
|
||||||
({ try! actualExpression.evaluate() }),
|
({ try! actualExpression.evaluate() }),
|
||||||
failureMessage: failureMessage,
|
failureMessage: failureMessage,
|
||||||
location: actualExpression.location)
|
location: actualExpression.location)
|
||||||
|
@ -30,11 +32,13 @@ internal struct ObjCMatcherWrapper: Matcher {
|
||||||
|
|
||||||
// Equivalent to Expectation, but for Nimble's Objective-C interface
|
// Equivalent to Expectation, but for Nimble's Objective-C interface
|
||||||
public class NMBExpectation: NSObject {
|
public class NMBExpectation: NSObject {
|
||||||
|
// swiftlint:disable identifier_name
|
||||||
internal let _actualBlock: () -> NSObject?
|
internal let _actualBlock: () -> NSObject?
|
||||||
internal var _negative: Bool
|
internal var _negative: Bool
|
||||||
internal let _file: FileString
|
internal let _file: FileString
|
||||||
internal let _line: UInt
|
internal let _line: UInt
|
||||||
internal var _timeout: TimeInterval = 1.0
|
internal var _timeout: TimeInterval = 1.0
|
||||||
|
// swiftlint:enable identifier_name
|
||||||
|
|
||||||
@objc public init(actualBlock: @escaping () -> NSObject?, negative: Bool, file: FileString, line: UInt) {
|
@objc public init(actualBlock: @escaping () -> NSObject?, negative: Bool, file: FileString, line: UInt) {
|
||||||
self._actualBlock = actualBlock
|
self._actualBlock = actualBlock
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
|
|
||||||
// swiftlint:disable line_length
|
// swiftlint:disable line_length
|
||||||
public typealias MatcherBlock = (_ actualExpression: Expression<NSObject>, _ failureMessage: FailureMessage) -> Bool
|
public typealias MatcherBlock = (_ actualExpression: Expression<NSObject>, _ failureMessage: FailureMessage) throws -> Bool
|
||||||
public typealias FullMatcherBlock = (_ actualExpression: Expression<NSObject>, _ failureMessage: FailureMessage, _ shouldNotMatch: Bool) -> Bool
|
public typealias FullMatcherBlock = (_ actualExpression: Expression<NSObject>, _ failureMessage: FailureMessage, _ shouldNotMatch: Bool) throws -> Bool
|
||||||
// swiftlint:enable line_length
|
// swiftlint:enable line_length
|
||||||
|
|
||||||
public class NMBObjCMatcher: NSObject, NMBMatcher {
|
public class NMBObjCMatcher: NSObject, NMBMatcher {
|
||||||
|
// swiftlint:disable identifier_name
|
||||||
let _match: MatcherBlock
|
let _match: MatcherBlock
|
||||||
let _doesNotMatch: MatcherBlock
|
let _doesNotMatch: MatcherBlock
|
||||||
|
// swiftlint:enable identifier_name
|
||||||
let canMatchNil: Bool
|
let canMatchNil: Bool
|
||||||
|
|
||||||
public init(canMatchNil: Bool, matcher: @escaping MatcherBlock, notMatcher: @escaping MatcherBlock) {
|
public init(canMatchNil: Bool, matcher: @escaping MatcherBlock, notMatcher: @escaping MatcherBlock) {
|
||||||
|
@ -24,7 +26,7 @@ public class NMBObjCMatcher: NSObject, NMBMatcher {
|
||||||
|
|
||||||
public convenience init(canMatchNil: Bool, matcher: @escaping MatcherBlock) {
|
public convenience init(canMatchNil: Bool, matcher: @escaping MatcherBlock) {
|
||||||
self.init(canMatchNil: canMatchNil, matcher: matcher, notMatcher: ({ actualExpression, failureMessage in
|
self.init(canMatchNil: canMatchNil, matcher: matcher, notMatcher: ({ actualExpression, failureMessage in
|
||||||
return !matcher(actualExpression, failureMessage)
|
return try !matcher(actualExpression, failureMessage)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,9 +36,9 @@ public class NMBObjCMatcher: NSObject, NMBMatcher {
|
||||||
|
|
||||||
public convenience init(canMatchNil: Bool, matcher: @escaping FullMatcherBlock) {
|
public convenience init(canMatchNil: Bool, matcher: @escaping FullMatcherBlock) {
|
||||||
self.init(canMatchNil: canMatchNil, matcher: ({ actualExpression, failureMessage in
|
self.init(canMatchNil: canMatchNil, matcher: ({ actualExpression, failureMessage in
|
||||||
return matcher(actualExpression, failureMessage, false)
|
return try matcher(actualExpression, failureMessage, false)
|
||||||
}), notMatcher: ({ actualExpression, failureMessage in
|
}), notMatcher: ({ actualExpression, failureMessage in
|
||||||
return matcher(actualExpression, failureMessage, true)
|
return try matcher(actualExpression, failureMessage, true)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,9 +59,14 @@ public class NMBObjCMatcher: NSObject, NMBMatcher {
|
||||||
|
|
||||||
public func matches(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool {
|
public func matches(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool {
|
||||||
let expr = Expression(expression: actualBlock, location: location)
|
let expr = Expression(expression: actualBlock, location: location)
|
||||||
let result = _match(
|
let result: Bool
|
||||||
expr,
|
do {
|
||||||
failureMessage)
|
result = try _match(expr, failureMessage)
|
||||||
|
} catch let error {
|
||||||
|
failureMessage.stringValue = "unexpected error thrown: <\(error)>"
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
if self.canMatch(Expression(expression: actualBlock, location: location), failureMessage: failureMessage) {
|
if self.canMatch(Expression(expression: actualBlock, location: location), failureMessage: failureMessage) {
|
||||||
return result
|
return result
|
||||||
} else {
|
} else {
|
||||||
|
@ -69,9 +76,14 @@ public class NMBObjCMatcher: NSObject, NMBMatcher {
|
||||||
|
|
||||||
public func doesNotMatch(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool {
|
public func doesNotMatch(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool {
|
||||||
let expr = Expression(expression: actualBlock, location: location)
|
let expr = Expression(expression: actualBlock, location: location)
|
||||||
let result = _doesNotMatch(
|
let result: Bool
|
||||||
expr,
|
do {
|
||||||
failureMessage)
|
result = try _doesNotMatch(expr, failureMessage)
|
||||||
|
} catch let error {
|
||||||
|
failureMessage.stringValue = "unexpected error thrown: <\(error)>"
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
if self.canMatch(Expression(expression: actualBlock, location: location), failureMessage: failureMessage) {
|
if self.canMatch(Expression(expression: actualBlock, location: location), failureMessage: failureMessage) {
|
||||||
return result
|
return result
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import Foundation
|
||||||
|
|
||||||
/// "Global" state of Nimble is stored here. Only DSL functions should access / be aware of this
|
/// "Global" state of Nimble is stored here. Only DSL functions should access / be aware of this
|
||||||
/// class' existence
|
/// class' existence
|
||||||
internal class NimbleEnvironment {
|
internal class NimbleEnvironment: NSObject {
|
||||||
static var activeInstance: NimbleEnvironment {
|
static var activeInstance: NimbleEnvironment {
|
||||||
get {
|
get {
|
||||||
let env = Thread.current.threadDictionary["NimbleEnvironment"]
|
let env = Thread.current.threadDictionary["NimbleEnvironment"]
|
||||||
|
@ -20,6 +20,7 @@ internal class NimbleEnvironment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// swiftlint:disable:next todo
|
||||||
// TODO: eventually migrate the global to this environment value
|
// TODO: eventually migrate the global to this environment value
|
||||||
var assertionHandler: AssertionHandler {
|
var assertionHandler: AssertionHandler {
|
||||||
get { return NimbleAssertionHandler }
|
get { return NimbleAssertionHandler }
|
||||||
|
@ -29,17 +30,14 @@ internal class NimbleEnvironment {
|
||||||
var suppressTVOSAssertionWarning: Bool = false
|
var suppressTVOSAssertionWarning: Bool = false
|
||||||
var awaiter: Awaiter
|
var awaiter: Awaiter
|
||||||
|
|
||||||
init() {
|
override init() {
|
||||||
let timeoutQueue: DispatchQueue
|
let timeoutQueue = DispatchQueue.global(qos: .userInitiated)
|
||||||
if #available(OSX 10.10, *) {
|
|
||||||
timeoutQueue = DispatchQueue.global(qos: .userInitiated)
|
|
||||||
} else {
|
|
||||||
timeoutQueue = DispatchQueue.global(priority: .high)
|
|
||||||
}
|
|
||||||
|
|
||||||
awaiter = Awaiter(
|
awaiter = Awaiter(
|
||||||
waitLock: AssertionWaitLock(),
|
waitLock: AssertionWaitLock(),
|
||||||
asyncQueue: .main,
|
asyncQueue: .main,
|
||||||
timeoutQueue: timeoutQueue)
|
timeoutQueue: timeoutQueue
|
||||||
|
)
|
||||||
|
|
||||||
|
super.init()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,18 +42,29 @@ class NimbleXCTestUnavailableHandler: AssertionHandler {
|
||||||
|
|
||||||
private(set) var currentTestCase: XCTestCase?
|
private(set) var currentTestCase: XCTestCase?
|
||||||
|
|
||||||
|
private var stashed_swift_reportFatalErrorsToDebugger: Bool = false
|
||||||
|
|
||||||
@objc func testCaseWillStart(_ testCase: XCTestCase) {
|
@objc func testCaseWillStart(_ testCase: XCTestCase) {
|
||||||
|
#if swift(>=3.2)
|
||||||
|
stashed_swift_reportFatalErrorsToDebugger = _swift_reportFatalErrorsToDebugger
|
||||||
|
_swift_reportFatalErrorsToDebugger = false
|
||||||
|
#endif
|
||||||
|
|
||||||
currentTestCase = testCase
|
currentTestCase = testCase
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func testCaseDidFinish(_ testCase: XCTestCase) {
|
@objc func testCaseDidFinish(_ testCase: XCTestCase) {
|
||||||
currentTestCase = nil
|
currentTestCase = nil
|
||||||
|
|
||||||
|
#if swift(>=3.2)
|
||||||
|
_swift_reportFatalErrorsToDebugger = stashed_swift_reportFatalErrorsToDebugger
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
func isXCTestAvailable() -> Bool {
|
func isXCTestAvailable() -> Bool {
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
// XCTest is weakly linked and so may not be present
|
// XCTest is weakly linked and so may not be present
|
||||||
return NSClassFromString("XCTestCase") != nil
|
return NSClassFromString("XCTestCase") != nil
|
||||||
#else
|
#else
|
||||||
|
@ -61,20 +72,19 @@ func isXCTestAvailable() -> Bool {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private func recordFailure(_ message: String, location: SourceLocation) {
|
public func recordFailure(_ message: String, location: SourceLocation) {
|
||||||
#if SWIFT_PACKAGE
|
#if SWIFT_PACKAGE
|
||||||
XCTFail("\(message)", file: location.file, line: location.line)
|
XCTFail("\(message)", file: location.file, line: location.line)
|
||||||
#else
|
#else
|
||||||
if let testCase = CurrentTestCaseTracker.sharedInstance.currentTestCase {
|
if let testCase = CurrentTestCaseTracker.sharedInstance.currentTestCase {
|
||||||
#if swift(>=4)
|
|
||||||
let line = Int(location.line)
|
let line = Int(location.line)
|
||||||
#else
|
|
||||||
let line = location.line
|
|
||||||
#endif
|
|
||||||
testCase.recordFailure(withDescription: message, inFile: location.file, atLine: line, expected: true)
|
testCase.recordFailure(withDescription: message, inFile: location.file, atLine: line, expected: true)
|
||||||
} else {
|
} else {
|
||||||
let msg = "Attempted to report a test failure to XCTest while no test case was running. " +
|
let msg = """
|
||||||
"The failure was:\n\"\(message)\"\nIt occurred at: \(location.file):\(location.line)"
|
Attempted to report a test failure to XCTest while no test case was running. The failure was:
|
||||||
|
\"\(message)\"
|
||||||
|
It occurred at: \(location.file):\(location.line)
|
||||||
|
"""
|
||||||
NSException(name: .internalInconsistencyException, reason: msg, userInfo: nil).raise()
|
NSException(name: .internalInconsistencyException, reason: msg, userInfo: nil).raise()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
#if !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS))
|
#if !canImport(Darwin)
|
||||||
// swift-corelibs-foundation doesn't provide NSException at all, so provide a dummy
|
// swift-corelibs-foundation doesn't provide NSException at all, so provide a dummy
|
||||||
class NSException {}
|
class NSException {}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -14,7 +14,7 @@ internal class NMBWait: NSObject {
|
||||||
// About these kind of lines, `@objc` attributes are only required for Objective-C
|
// About these kind of lines, `@objc` attributes are only required for Objective-C
|
||||||
// support, so that should be conditional on Darwin platforms and normal Xcode builds
|
// support, so that should be conditional on Darwin platforms and normal Xcode builds
|
||||||
// (non-SwiftPM builds).
|
// (non-SwiftPM builds).
|
||||||
#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE
|
#if canImport(Darwin) && !SWIFT_PACKAGE
|
||||||
@objc
|
@objc
|
||||||
internal class func until(
|
internal class func until(
|
||||||
timeout: TimeInterval,
|
timeout: TimeInterval,
|
||||||
|
@ -87,13 +87,19 @@ internal class NMBWait: NSObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE
|
#if canImport(Darwin) && !SWIFT_PACKAGE
|
||||||
@objc(untilFile:line:action:)
|
@objc(untilFile:line:action:)
|
||||||
internal class func until(_ file: FileString = #file, line: UInt = #line, action: @escaping (() -> Void) -> Void) {
|
internal class func until(
|
||||||
|
_ file: FileString = #file,
|
||||||
|
line: UInt = #line,
|
||||||
|
action: @escaping (@escaping () -> Void) -> Void) {
|
||||||
until(timeout: 1, file: file, line: line, action: action)
|
until(timeout: 1, file: file, line: line, action: action)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
internal class func until(_ file: FileString = #file, line: UInt = #line, action: @escaping (() -> Void) -> Void) {
|
internal class func until(
|
||||||
|
_ file: FileString = #file,
|
||||||
|
line: UInt = #line,
|
||||||
|
action: @escaping (@escaping () -> Void) -> Void) {
|
||||||
until(timeout: 1, file: file, line: line, action: action)
|
until(timeout: 1, file: file, line: line, action: action)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -43,12 +43,13 @@ internal func nimblePrecondition(
|
||||||
line: UInt = #line) {
|
line: UInt = #line) {
|
||||||
let result = expr()
|
let result = expr()
|
||||||
if !result {
|
if !result {
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
let e = NSException(
|
let exception = NSException(
|
||||||
name: NSExceptionName(name()),
|
name: NSExceptionName(name()),
|
||||||
reason: message(),
|
reason: message(),
|
||||||
userInfo: nil)
|
userInfo: nil
|
||||||
e.raise()
|
)
|
||||||
|
exception.raise()
|
||||||
#else
|
#else
|
||||||
preconditionFailure("\(name()) - \(message())", file: file, line: line)
|
preconditionFailure("\(name()) - \(message())", file: file, line: line)
|
||||||
#endif
|
#endif
|
||||||
|
@ -56,9 +57,12 @@ internal func nimblePrecondition(
|
||||||
}
|
}
|
||||||
|
|
||||||
internal func internalError(_ msg: String, file: FileString = #file, line: UInt = #line) -> Never {
|
internal func internalError(_ msg: String, file: FileString = #file, line: UInt = #line) -> Never {
|
||||||
|
// swiftlint:disable line_length
|
||||||
fatalError(
|
fatalError(
|
||||||
"Nimble Bug Found: \(msg) at \(file):\(line).\n" +
|
"""
|
||||||
"Please file a bug to Nimble: https://github.com/Quick/Nimble/issues with the " +
|
Nimble Bug Found: \(msg) at \(file):\(line).
|
||||||
"code snippet that caused this error."
|
Please file a bug to Nimble: https://github.com/Quick/Nimble/issues with the code snippet that caused this error.
|
||||||
|
"""
|
||||||
)
|
)
|
||||||
|
// swiftlint:enable line_length
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,5 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
// Deprecated
|
|
||||||
internal func expressionMatches<T, U>(_ expression: Expression<T>, matcher: U, to: String, description: String?) -> (Bool, FailureMessage)
|
|
||||||
where U: Matcher, U.ValueType == T {
|
|
||||||
let msg = FailureMessage()
|
|
||||||
msg.userDescription = description
|
|
||||||
msg.to = to
|
|
||||||
do {
|
|
||||||
let pass = try matcher.matches(expression, failureMessage: msg)
|
|
||||||
if msg.actualValue == "" {
|
|
||||||
msg.actualValue = "<\(stringify(try expression.evaluate()))>"
|
|
||||||
}
|
|
||||||
return (pass, msg)
|
|
||||||
} catch let error {
|
|
||||||
msg.stringValue = "unexpected error thrown: <\(error)>"
|
|
||||||
return (false, msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated
|
// Deprecated
|
||||||
internal func expressionDoesNotMatch<T, U>(_ expression: Expression<T>, matcher: U, toNot: String, description: String?) -> (Bool, FailureMessage)
|
internal func expressionDoesNotMatch<T, U>(_ expression: Expression<T>, matcher: U, toNot: String, description: String?) -> (Bool, FailureMessage)
|
||||||
where U: Matcher, U.ValueType == T {
|
where U: Matcher, U.ValueType == T {
|
||||||
|
@ -75,6 +57,10 @@ public struct Expectation<T> {
|
||||||
|
|
||||||
public let expression: Expression<T>
|
public let expression: Expression<T>
|
||||||
|
|
||||||
|
public init(expression: Expression<T>) {
|
||||||
|
self.expression = expression
|
||||||
|
}
|
||||||
|
|
||||||
public func verify(_ pass: Bool, _ message: FailureMessage) {
|
public func verify(_ pass: Bool, _ message: FailureMessage) {
|
||||||
let handler = NimbleEnvironment.activeInstance.assertionHandler
|
let handler = NimbleEnvironment.activeInstance.assertionHandler
|
||||||
handler.assert(pass, message: message, location: expression.location)
|
handler.assert(pass, message: message, location: expression.location)
|
||||||
|
@ -85,8 +71,15 @@ public struct Expectation<T> {
|
||||||
/// DEPRECATED: Tests the actual value using a matcher to match.
|
/// DEPRECATED: Tests the actual value using a matcher to match.
|
||||||
public func to<U>(_ matcher: U, description: String? = nil)
|
public func to<U>(_ matcher: U, description: String? = nil)
|
||||||
where U: Matcher, U.ValueType == T {
|
where U: Matcher, U.ValueType == T {
|
||||||
let (pass, msg) = expressionMatches(expression, matcher: matcher, to: "to", description: description)
|
let (pass, msg) = execute(
|
||||||
verify(pass, msg)
|
expression,
|
||||||
|
.toMatch,
|
||||||
|
matcher.predicate,
|
||||||
|
to: "to",
|
||||||
|
description: description,
|
||||||
|
captureExceptions: false
|
||||||
|
)
|
||||||
|
verify(pass, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// DEPRECATED: Tests the actual value using a matcher to not match.
|
/// DEPRECATED: Tests the actual value using a matcher to not match.
|
||||||
|
@ -127,6 +120,6 @@ public struct Expectation<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// see:
|
// see:
|
||||||
// - AsyncMatcherWrapper for extension
|
// - `async` for extension
|
||||||
// - NMBExpectation for Objective-C interface
|
// - NMBExpectation for Objective-C interface
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ public indirect enum ExpectationMessage {
|
||||||
}
|
}
|
||||||
|
|
||||||
internal func visitLeafs(_ f: (ExpectationMessage) -> ExpectationMessage) -> ExpectationMessage {
|
internal func visitLeafs(_ f: (ExpectationMessage) -> ExpectationMessage) -> ExpectationMessage {
|
||||||
|
// swiftlint:disable:previous identifier_name
|
||||||
switch self {
|
switch self {
|
||||||
case .fail, .expectedTo, .expectedActualValueTo, .expectedCustomValueTo:
|
case .fail, .expectedTo, .expectedActualValueTo, .expectedCustomValueTo:
|
||||||
return f(self)
|
return f(self)
|
||||||
|
@ -90,6 +91,7 @@ public indirect enum ExpectationMessage {
|
||||||
/// Replaces a primary expectation with one returned by f. Preserves all composite expectations
|
/// Replaces a primary expectation with one returned by f. Preserves all composite expectations
|
||||||
/// that were built upon it (aka - all appended(message:) and appended(details:).
|
/// that were built upon it (aka - all appended(message:) and appended(details:).
|
||||||
public func replacedExpectation(_ f: @escaping (ExpectationMessage) -> ExpectationMessage) -> ExpectationMessage {
|
public func replacedExpectation(_ f: @escaping (ExpectationMessage) -> ExpectationMessage) -> ExpectationMessage {
|
||||||
|
// swiftlint:disable:previous identifier_name
|
||||||
func walk(_ msg: ExpectationMessage) -> ExpectationMessage {
|
func walk(_ msg: ExpectationMessage) -> ExpectationMessage {
|
||||||
switch msg {
|
switch msg {
|
||||||
case .fail, .expectedTo, .expectedActualValueTo, .expectedCustomValueTo:
|
case .fail, .expectedTo, .expectedActualValueTo, .expectedCustomValueTo:
|
||||||
|
@ -124,6 +126,7 @@ public indirect enum ExpectationMessage {
|
||||||
return visitLeafs(walk)
|
return visitLeafs(walk)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// swiftlint:disable:next todo
|
||||||
// TODO: test & verify correct behavior
|
// TODO: test & verify correct behavior
|
||||||
internal func prepended(message: String) -> ExpectationMessage {
|
internal func prepended(message: String) -> ExpectationMessage {
|
||||||
return .prepends(message, self)
|
return .prepends(message, self)
|
||||||
|
@ -152,8 +155,10 @@ public indirect enum ExpectationMessage {
|
||||||
// Backwards compatibility: converts ExpectationMessage tree to FailureMessage
|
// Backwards compatibility: converts ExpectationMessage tree to FailureMessage
|
||||||
internal func update(failureMessage: FailureMessage) {
|
internal func update(failureMessage: FailureMessage) {
|
||||||
switch self {
|
switch self {
|
||||||
case let .fail(msg):
|
case let .fail(msg) where !msg.isEmpty:
|
||||||
failureMessage.stringValue = msg
|
failureMessage.stringValue = msg
|
||||||
|
case .fail:
|
||||||
|
break
|
||||||
case let .expectedTo(msg):
|
case let .expectedTo(msg):
|
||||||
failureMessage.actualValue = nil
|
failureMessage.actualValue = nil
|
||||||
failureMessage.postfixMessage = msg
|
failureMessage.postfixMessage = msg
|
||||||
|
@ -181,32 +186,32 @@ public indirect enum ExpectationMessage {
|
||||||
|
|
||||||
extension FailureMessage {
|
extension FailureMessage {
|
||||||
internal func toExpectationMessage() -> ExpectationMessage {
|
internal func toExpectationMessage() -> ExpectationMessage {
|
||||||
let defaultMsg = FailureMessage()
|
let defaultMessage = FailureMessage()
|
||||||
if expected != defaultMsg.expected || _stringValueOverride != nil {
|
if expected != defaultMessage.expected || _stringValueOverride != nil {
|
||||||
return .fail(stringValue)
|
return .fail(stringValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
var msg: ExpectationMessage = .fail(userDescription ?? "")
|
var message: ExpectationMessage = .fail(userDescription ?? "")
|
||||||
if actualValue != "" && actualValue != nil {
|
if actualValue != "" && actualValue != nil {
|
||||||
msg = .expectedCustomValueTo(postfixMessage, actualValue ?? "")
|
message = .expectedCustomValueTo(postfixMessage, actualValue ?? "")
|
||||||
} else if postfixMessage != defaultMsg.postfixMessage {
|
} else if postfixMessage != defaultMessage.postfixMessage {
|
||||||
if actualValue == nil {
|
if actualValue == nil {
|
||||||
msg = .expectedTo(postfixMessage)
|
message = .expectedTo(postfixMessage)
|
||||||
} else {
|
} else {
|
||||||
msg = .expectedActualValueTo(postfixMessage)
|
message = .expectedActualValueTo(postfixMessage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if postfixActual != defaultMsg.postfixActual {
|
if postfixActual != defaultMessage.postfixActual {
|
||||||
msg = .appends(msg, postfixActual)
|
message = .appends(message, postfixActual)
|
||||||
}
|
}
|
||||||
if let m = extendedMessage {
|
if let extended = extendedMessage {
|
||||||
msg = .details(msg, m)
|
message = .details(message, extended)
|
||||||
}
|
}
|
||||||
return msg
|
return message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
|
|
||||||
public class NMBExpectationMessage: NSObject {
|
public class NMBExpectationMessage: NSObject {
|
||||||
private let msg: ExpectationMessage
|
private let msg: ExpectationMessage
|
||||||
|
|
|
@ -24,8 +24,10 @@ internal func memoizedClosure<T>(_ closure: @escaping () throws -> T) -> (Bool)
|
||||||
/// This provides a common consumable API for matchers to utilize to allow
|
/// This provides a common consumable API for matchers to utilize to allow
|
||||||
/// Nimble to change internals to how the captured closure is managed.
|
/// Nimble to change internals to how the captured closure is managed.
|
||||||
public struct Expression<T> {
|
public struct Expression<T> {
|
||||||
|
// swiftlint:disable identifier_name
|
||||||
internal let _expression: (Bool) throws -> T?
|
internal let _expression: (Bool) throws -> T?
|
||||||
internal let _withoutCaching: Bool
|
internal let _withoutCaching: Bool
|
||||||
|
// swiftlint:enable identifier_name
|
||||||
public let location: SourceLocation
|
public let location: SourceLocation
|
||||||
public let isClosure: Bool
|
public let isClosure: Bool
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ public class FailureMessage: NSObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// swiftlint:disable:next identifier_name
|
||||||
internal var _stringValueOverride: String?
|
internal var _stringValueOverride: String?
|
||||||
internal var hasOverriddenStringValue: Bool {
|
internal var hasOverriddenStringValue: Bool {
|
||||||
return _stringValueOverride != nil
|
return _stringValueOverride != nil
|
||||||
|
|
|
@ -63,12 +63,12 @@ private func createPredicate<S>(_ elementMatcher: Predicate<S.Iterator.Element>)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
extension NMBObjCMatcher {
|
extension NMBObjCMatcher {
|
||||||
@objc public class func allPassMatcher(_ matcher: NMBMatcher) -> NMBPredicate {
|
@objc public class func allPassMatcher(_ matcher: NMBMatcher) -> NMBPredicate {
|
||||||
return NMBPredicate { actualExpression in
|
return NMBPredicate { actualExpression in
|
||||||
let location = actualExpression.location
|
let location = actualExpression.location
|
||||||
let actualValue = try! actualExpression.evaluate()
|
let actualValue = try actualExpression.evaluate()
|
||||||
var nsObjects = [NSObject]()
|
var nsObjects = [NSObject]()
|
||||||
|
|
||||||
var collectionIsUsable = true
|
var collectionIsUsable = true
|
||||||
|
@ -99,10 +99,11 @@ extension NMBObjCMatcher {
|
||||||
let expr = Expression(expression: ({ nsObjects }), location: location)
|
let expr = Expression(expression: ({ nsObjects }), location: location)
|
||||||
let pred: Predicate<[NSObject]> = createPredicate(Predicate { expr in
|
let pred: Predicate<[NSObject]> = createPredicate(Predicate { expr in
|
||||||
if let predicate = matcher as? NMBPredicate {
|
if let predicate = matcher as? NMBPredicate {
|
||||||
return predicate.satisfies(({ try! expr.evaluate() }), location: expr.location).toSwift()
|
return predicate.satisfies(({ try expr.evaluate() }), location: expr.location).toSwift()
|
||||||
} else {
|
} else {
|
||||||
let failureMessage = FailureMessage()
|
let failureMessage = FailureMessage()
|
||||||
let result = matcher.matches(
|
let result = matcher.matches(
|
||||||
|
// swiftlint:disable:next force_try
|
||||||
({ try! expr.evaluate() }),
|
({ try! expr.evaluate() }),
|
||||||
failureMessage: failureMessage,
|
failureMessage: failureMessage,
|
||||||
location: expr.location
|
location: expr.location
|
||||||
|
@ -114,7 +115,7 @@ extension NMBObjCMatcher {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return try! pred.satisfies(expr).toObjectiveC()
|
return try pred.satisfies(expr).toObjectiveC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,92 +23,29 @@ private func async<T>(style: ExpectationStyle, predicate: Predicate<T>, timeout:
|
||||||
}
|
}
|
||||||
switch result {
|
switch result {
|
||||||
case .completed: return lastPredicateResult!
|
case .completed: return lastPredicateResult!
|
||||||
case .timedOut: return PredicateResult(status: .fail, message: lastPredicateResult!.message)
|
case .timedOut:
|
||||||
|
let message = lastPredicateResult?.message ?? .fail("timed out before returning a value")
|
||||||
|
return PredicateResult(status: .fail, message: message)
|
||||||
case let .errorThrown(error):
|
case let .errorThrown(error):
|
||||||
return PredicateResult(status: .fail, message: .fail("unexpected error thrown: <\(error)>"))
|
return PredicateResult(status: .fail, message: .fail("unexpected error thrown: <\(error)>"))
|
||||||
case let .raisedException(exception):
|
case let .raisedException(exception):
|
||||||
return PredicateResult(status: .fail, message: .fail("unexpected exception raised: \(exception)"))
|
return PredicateResult(status: .fail, message: .fail("unexpected exception raised: \(exception)"))
|
||||||
case .blockedRunLoop:
|
case .blockedRunLoop:
|
||||||
// swiftlint:disable:next line_length
|
// swiftlint:disable:next line_length
|
||||||
return PredicateResult(status: .fail, message: lastPredicateResult!.message.appended(message: " (timed out, but main thread was unresponsive)."))
|
let message = lastPredicateResult?.message.appended(message: " (timed out, but main run loop was unresponsive).") ??
|
||||||
|
.fail("main run loop was unresponsive")
|
||||||
|
return PredicateResult(status: .fail, message: message)
|
||||||
case .incomplete:
|
case .incomplete:
|
||||||
internalError("Reached .incomplete state for toEventually(...).")
|
internalError("Reached .incomplete state for \(fnName)(...).")
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated
|
|
||||||
internal struct AsyncMatcherWrapper<T, U>: Matcher
|
|
||||||
where U: Matcher, U.ValueType == T {
|
|
||||||
let fullMatcher: U
|
|
||||||
let timeoutInterval: TimeInterval
|
|
||||||
let pollInterval: TimeInterval
|
|
||||||
|
|
||||||
init(fullMatcher: U, timeoutInterval: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval) {
|
|
||||||
self.fullMatcher = fullMatcher
|
|
||||||
self.timeoutInterval = timeoutInterval
|
|
||||||
self.pollInterval = pollInterval
|
|
||||||
}
|
|
||||||
|
|
||||||
func matches(_ actualExpression: Expression<T>, failureMessage: FailureMessage) -> Bool {
|
|
||||||
let uncachedExpression = actualExpression.withoutCaching()
|
|
||||||
let fnName = "expect(...).toEventually(...)"
|
|
||||||
let result = pollBlock(
|
|
||||||
pollInterval: pollInterval,
|
|
||||||
timeoutInterval: timeoutInterval,
|
|
||||||
file: actualExpression.location.file,
|
|
||||||
line: actualExpression.location.line,
|
|
||||||
fnName: fnName) {
|
|
||||||
try self.fullMatcher.matches(uncachedExpression, failureMessage: failureMessage)
|
|
||||||
}
|
|
||||||
switch result {
|
|
||||||
case let .completed(isSuccessful): return isSuccessful
|
|
||||||
case .timedOut: return false
|
|
||||||
case let .errorThrown(error):
|
|
||||||
failureMessage.stringValue = "an unexpected error thrown: <\(error)>"
|
|
||||||
return false
|
|
||||||
case let .raisedException(exception):
|
|
||||||
failureMessage.stringValue = "an unexpected exception thrown: <\(exception)>"
|
|
||||||
return false
|
|
||||||
case .blockedRunLoop:
|
|
||||||
failureMessage.postfixMessage += " (timed out, but main thread was unresponsive)."
|
|
||||||
return false
|
|
||||||
case .incomplete:
|
|
||||||
internalError("Reached .incomplete state for toEventually(...).")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func doesNotMatch(_ actualExpression: Expression<T>, failureMessage: FailureMessage) -> Bool {
|
|
||||||
let uncachedExpression = actualExpression.withoutCaching()
|
|
||||||
let result = pollBlock(
|
|
||||||
pollInterval: pollInterval,
|
|
||||||
timeoutInterval: timeoutInterval,
|
|
||||||
file: actualExpression.location.file,
|
|
||||||
line: actualExpression.location.line,
|
|
||||||
fnName: "expect(...).toEventuallyNot(...)") {
|
|
||||||
try self.fullMatcher.doesNotMatch(uncachedExpression, failureMessage: failureMessage)
|
|
||||||
}
|
|
||||||
switch result {
|
|
||||||
case let .completed(isSuccessful): return isSuccessful
|
|
||||||
case .timedOut: return false
|
|
||||||
case let .errorThrown(error):
|
|
||||||
failureMessage.stringValue = "an unexpected error thrown: <\(error)>"
|
|
||||||
return false
|
|
||||||
case let .raisedException(exception):
|
|
||||||
failureMessage.stringValue = "an unexpected exception thrown: <\(exception)>"
|
|
||||||
return false
|
|
||||||
case .blockedRunLoop:
|
|
||||||
failureMessage.postfixMessage += " (timed out, but main thread was unresponsive)."
|
|
||||||
return false
|
|
||||||
case .incomplete:
|
|
||||||
internalError("Reached .incomplete state for toEventuallyNot(...).")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private let toEventuallyRequiresClosureError = FailureMessage(
|
private let toEventuallyRequiresClosureError = FailureMessage(
|
||||||
// swiftlint:disable:next line_length
|
stringValue: """
|
||||||
stringValue: "expect(...).toEventually(...) requires an explicit closure (eg - expect { ... }.toEventually(...) )\nSwift 1.2 @autoclosure behavior has changed in an incompatible way for Nimble to function"
|
expect(...).toEventually(...) requires an explicit closure (eg - expect { ... }.toEventually(...) )
|
||||||
|
Swift 1.2 @autoclosure behavior has changed in an incompatible way for Nimble to function
|
||||||
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
extension Expectation {
|
extension Expectation {
|
||||||
|
@ -182,14 +119,19 @@ extension Expectation {
|
||||||
public func toEventually<U>(_ matcher: U, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil)
|
public func toEventually<U>(_ matcher: U, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil)
|
||||||
where U: Matcher, U.ValueType == T {
|
where U: Matcher, U.ValueType == T {
|
||||||
if expression.isClosure {
|
if expression.isClosure {
|
||||||
let (pass, msg) = expressionMatches(
|
let (pass, msg) = execute(
|
||||||
expression,
|
expression,
|
||||||
matcher: AsyncMatcherWrapper(
|
.toMatch,
|
||||||
fullMatcher: matcher,
|
async(
|
||||||
timeoutInterval: timeout,
|
style: .toMatch,
|
||||||
pollInterval: pollInterval),
|
predicate: matcher.predicate,
|
||||||
|
timeout: timeout,
|
||||||
|
poll: pollInterval,
|
||||||
|
fnName: "toEventually"
|
||||||
|
),
|
||||||
to: "to eventually",
|
to: "to eventually",
|
||||||
description: description
|
description: description,
|
||||||
|
captureExceptions: false
|
||||||
)
|
)
|
||||||
verify(pass, msg)
|
verify(pass, msg)
|
||||||
} else {
|
} else {
|
||||||
|
@ -208,10 +150,13 @@ extension Expectation {
|
||||||
if expression.isClosure {
|
if expression.isClosure {
|
||||||
let (pass, msg) = expressionDoesNotMatch(
|
let (pass, msg) = expressionDoesNotMatch(
|
||||||
expression,
|
expression,
|
||||||
matcher: AsyncMatcherWrapper(
|
matcher: async(
|
||||||
fullMatcher: matcher,
|
style: .toNotMatch,
|
||||||
timeoutInterval: timeout,
|
predicate: matcher.predicate,
|
||||||
pollInterval: pollInterval),
|
timeout: timeout,
|
||||||
|
poll: pollInterval,
|
||||||
|
fnName: "toEventuallyNot"
|
||||||
|
),
|
||||||
toNot: "to eventually not",
|
toNot: "to eventually not",
|
||||||
description: description
|
description: description
|
||||||
)
|
)
|
|
@ -29,7 +29,7 @@ public func beAKindOf<T>(_ expectedType: T.Type) -> Predicate<Any> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
|
|
||||||
/// A Nimble matcher that succeeds when the actual value is an instance of the given class.
|
/// 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
|
/// @see beAnInstanceOf if you want to match against the exact class
|
||||||
|
@ -59,8 +59,8 @@ public func beAKindOf(_ expectedClass: AnyClass) -> Predicate<NSObject> {
|
||||||
|
|
||||||
extension NMBObjCMatcher {
|
extension NMBObjCMatcher {
|
||||||
@objc public class func beAKindOfMatcher(_ expected: AnyClass) -> NMBMatcher {
|
@objc public class func beAKindOfMatcher(_ expected: AnyClass) -> NMBMatcher {
|
||||||
return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
|
return NMBPredicate { actualExpression in
|
||||||
return try! beAKindOf(expected).matches(actualExpression, failureMessage: failureMessage)
|
return try beAKindOf(expected).satisfies(actualExpression).toObjectiveC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ public func beAnInstanceOf(_ expectedClass: AnyClass) -> Predicate<NSObject> {
|
||||||
} else {
|
} else {
|
||||||
actualString = "<nil>"
|
actualString = "<nil>"
|
||||||
}
|
}
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
let matches = instance != nil && instance!.isMember(of: expectedClass)
|
let matches = instance != nil && instance!.isMember(of: expectedClass)
|
||||||
#else
|
#else
|
||||||
let matches = instance != nil && type(of: instance!) == expectedClass
|
let matches = instance != nil && type(of: instance!) == expectedClass
|
||||||
|
@ -45,11 +45,11 @@ public func beAnInstanceOf(_ expectedClass: AnyClass) -> Predicate<NSObject> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
extension NMBObjCMatcher {
|
extension NMBObjCMatcher {
|
||||||
@objc public class func beAnInstanceOfMatcher(_ expected: AnyClass) -> NMBMatcher {
|
@objc public class func beAnInstanceOfMatcher(_ expected: AnyClass) -> NMBMatcher {
|
||||||
return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
|
return NMBPredicate { actualExpression in
|
||||||
return try! beAnInstanceOf(expected).matches(actualExpression, failureMessage: failureMessage)
|
return try beAnInstanceOf(expected).satisfies(actualExpression).toObjectiveC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
// swiftlint:disable:next identifier_name
|
||||||
public let DefaultDelta = 0.0001
|
public let DefaultDelta = 0.0001
|
||||||
|
|
||||||
internal func isCloseTo(_ actualValue: NMBDoubleConvertible?,
|
internal func isCloseTo(_ actualValue: NMBDoubleConvertible?,
|
||||||
|
@ -34,10 +35,12 @@ public func beCloseTo(_ expectedValue: NMBDoubleConvertible, within delta: Doubl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
public class NMBObjCBeCloseToMatcher: NSObject, NMBMatcher {
|
public class NMBObjCBeCloseToMatcher: NSObject, NMBMatcher {
|
||||||
|
// swiftlint:disable identifier_name
|
||||||
var _expected: NSNumber
|
var _expected: NSNumber
|
||||||
var _delta: CDouble
|
var _delta: CDouble
|
||||||
|
// swiftlint:enable identifier_name
|
||||||
init(expected: NSNumber, within: CDouble) {
|
init(expected: NSNumber, within: CDouble) {
|
||||||
_expected = expected
|
_expected = expected
|
||||||
_delta = within
|
_delta = within
|
||||||
|
@ -49,7 +52,13 @@ public class NMBObjCBeCloseToMatcher: NSObject, NMBMatcher {
|
||||||
})
|
})
|
||||||
let expr = Expression(expression: actualBlock, location: location)
|
let expr = Expression(expression: actualBlock, location: location)
|
||||||
let matcher = beCloseTo(self._expected, within: self._delta)
|
let matcher = beCloseTo(self._expected, within: self._delta)
|
||||||
return try! matcher.matches(expr, failureMessage: failureMessage)
|
|
||||||
|
do {
|
||||||
|
return try matcher.matches(expr, failureMessage: failureMessage)
|
||||||
|
} catch let error {
|
||||||
|
failureMessage.stringValue = "unexpected error thrown: <\(error)>"
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc public func doesNotMatch(_ actualExpression: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool {
|
@objc public func doesNotMatch(_ actualExpression: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool {
|
||||||
|
@ -58,7 +67,13 @@ public class NMBObjCBeCloseToMatcher: NSObject, NMBMatcher {
|
||||||
})
|
})
|
||||||
let expr = Expression(expression: actualBlock, location: location)
|
let expr = Expression(expression: actualBlock, location: location)
|
||||||
let matcher = beCloseTo(self._expected, within: self._delta)
|
let matcher = beCloseTo(self._expected, within: self._delta)
|
||||||
return try! matcher.doesNotMatch(expr, failureMessage: failureMessage)
|
|
||||||
|
do {
|
||||||
|
return try matcher.doesNotMatch(expr, failureMessage: failureMessage)
|
||||||
|
} catch let error {
|
||||||
|
failureMessage.stringValue = "unexpected error thrown: <\(error)>"
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc public var within: (CDouble) -> NMBObjCBeCloseToMatcher {
|
@objc public var within: (CDouble) -> NMBObjCBeCloseToMatcher {
|
||||||
|
@ -98,14 +113,17 @@ public func beCloseTo(_ expectedValues: [Double], within delta: Double = Default
|
||||||
|
|
||||||
infix operator ≈ : ComparisonPrecedence
|
infix operator ≈ : ComparisonPrecedence
|
||||||
|
|
||||||
|
// swiftlint:disable:next identifier_name
|
||||||
public func ≈(lhs: Expectation<[Double]>, rhs: [Double]) {
|
public func ≈(lhs: Expectation<[Double]>, rhs: [Double]) {
|
||||||
lhs.to(beCloseTo(rhs))
|
lhs.to(beCloseTo(rhs))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// swiftlint:disable:next identifier_name
|
||||||
public func ≈(lhs: Expectation<NMBDoubleConvertible>, rhs: NMBDoubleConvertible) {
|
public func ≈(lhs: Expectation<NMBDoubleConvertible>, rhs: NMBDoubleConvertible) {
|
||||||
lhs.to(beCloseTo(rhs))
|
lhs.to(beCloseTo(rhs))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// swiftlint:disable:next identifier_name
|
||||||
public func ≈(lhs: Expectation<NMBDoubleConvertible>, rhs: (expected: NMBDoubleConvertible, delta: Double)) {
|
public func ≈(lhs: Expectation<NMBDoubleConvertible>, rhs: (expected: NMBDoubleConvertible, delta: Double)) {
|
||||||
lhs.to(beCloseTo(rhs.expected, within: rhs.delta))
|
lhs.to(beCloseTo(rhs.expected, within: rhs.delta))
|
||||||
}
|
}
|
||||||
|
@ -121,6 +139,7 @@ precedencegroup PlusMinusOperatorPrecedence {
|
||||||
}
|
}
|
||||||
|
|
||||||
infix operator ± : PlusMinusOperatorPrecedence
|
infix operator ± : PlusMinusOperatorPrecedence
|
||||||
|
// swiftlint:disable:next identifier_name
|
||||||
public func ±(lhs: NMBDoubleConvertible, rhs: Double) -> (expected: NMBDoubleConvertible, delta: Double) {
|
public func ±(lhs: NMBDoubleConvertible, rhs: Double) -> (expected: NMBDoubleConvertible, delta: Double) {
|
||||||
return (expected: lhs, delta: rhs)
|
return (expected: lhs, delta: rhs)
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,17 @@ public func beEmpty<S: Sequence>() -> Predicate<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 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<S: SetAlgebra>() -> Predicate<S> {
|
||||||
|
return Predicate.simple("be empty") { actualExpression in
|
||||||
|
guard let actual = try actualExpression.evaluate() else {
|
||||||
|
return .fail
|
||||||
|
}
|
||||||
|
return PredicateStatus(bool: actual.isEmpty)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A Nimble matcher that succeeds when a value is "empty". For collections, this
|
/// 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.
|
/// means the are no items in that collection. For strings, it is an empty string.
|
||||||
public func beEmpty() -> Predicate<String> {
|
public func beEmpty() -> Predicate<String> {
|
||||||
|
@ -61,19 +72,19 @@ public func beEmpty() -> Predicate<NMBCollection> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
extension NMBObjCMatcher {
|
extension NMBObjCMatcher {
|
||||||
@objc public class func beEmptyMatcher() -> NMBPredicate {
|
@objc public class func beEmptyMatcher() -> NMBPredicate {
|
||||||
return NMBPredicate { actualExpression in
|
return NMBPredicate { actualExpression in
|
||||||
let location = actualExpression.location
|
let location = actualExpression.location
|
||||||
let actualValue = try! actualExpression.evaluate()
|
let actualValue = try actualExpression.evaluate()
|
||||||
|
|
||||||
if let value = actualValue as? NMBCollection {
|
if let value = actualValue as? NMBCollection {
|
||||||
let expr = Expression(expression: ({ value as NMBCollection }), location: location)
|
let expr = Expression(expression: ({ value as NMBCollection }), location: location)
|
||||||
return try! beEmpty().satisfies(expr).toObjectiveC()
|
return try beEmpty().satisfies(expr).toObjectiveC()
|
||||||
} else if let value = actualValue as? NSString {
|
} else if let value = actualValue as? NSString {
|
||||||
let expr = Expression(expression: ({ value as String }), location: location)
|
let expr = Expression(expression: ({ value as String }), location: location)
|
||||||
return try! beEmpty().satisfies(expr).toObjectiveC()
|
return try beEmpty().satisfies(expr).toObjectiveC()
|
||||||
} else if let actualValue = actualValue {
|
} else if let actualValue = actualValue {
|
||||||
// swiftlint:disable:next line_length
|
// swiftlint:disable:next line_length
|
||||||
let badTypeErrorMsg = "be empty (only works for NSArrays, NSSets, NSIndexSets, NSDictionaries, NSHashTables, and NSStrings)"
|
let badTypeErrorMsg = "be empty (only works for NSArrays, NSSets, NSIndexSets, NSDictionaries, NSHashTables, and NSStrings)"
|
||||||
|
|
|
@ -13,13 +13,13 @@ public func beGreaterThan<T: Comparable>(_ expectedValue: T?) -> Predicate<T> {
|
||||||
|
|
||||||
/// A Nimble matcher that succeeds when the actual value is greater than the expected value.
|
/// A Nimble matcher that succeeds when the actual value is greater than the expected value.
|
||||||
public func beGreaterThan(_ expectedValue: NMBComparable?) -> Predicate<NMBComparable> {
|
public func beGreaterThan(_ expectedValue: NMBComparable?) -> Predicate<NMBComparable> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
let errorMessage = "be greater than <\(stringify(expectedValue))>"
|
||||||
failureMessage.postfixMessage = "be greater than <\(stringify(expectedValue))>"
|
return Predicate.simple(errorMessage) { actualExpression in
|
||||||
let actualValue = try actualExpression.evaluate()
|
let actualValue = try actualExpression.evaluate()
|
||||||
let matches = actualValue != nil
|
let matches = actualValue != nil
|
||||||
&& actualValue!.NMB_compare(expectedValue) == ComparisonResult.orderedDescending
|
&& actualValue!.NMB_compare(expectedValue) == ComparisonResult.orderedDescending
|
||||||
return matches
|
return PredicateStatus(bool: matches)
|
||||||
}.requireNonNil
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func ><T: Comparable>(lhs: Expectation<T>, rhs: T) {
|
public func ><T: Comparable>(lhs: Expectation<T>, rhs: T) {
|
||||||
|
@ -30,12 +30,12 @@ public func > (lhs: Expectation<NMBComparable>, rhs: NMBComparable?) {
|
||||||
lhs.to(beGreaterThan(rhs))
|
lhs.to(beGreaterThan(rhs))
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
extension NMBObjCMatcher {
|
extension NMBObjCMatcher {
|
||||||
@objc public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher {
|
@objc public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBMatcher {
|
||||||
return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
|
return NMBPredicate { actualExpression in
|
||||||
let expr = actualExpression.cast { $0 as? NMBComparable }
|
let expr = actualExpression.cast { $0 as? NMBComparable }
|
||||||
return try! beGreaterThan(expected).matches(expr, failureMessage: failureMessage)
|
return try beGreaterThan(expected).satisfies(expr).toObjectiveC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,25 +3,25 @@ import Foundation
|
||||||
/// A Nimble matcher that succeeds when the actual value is greater than
|
/// A Nimble matcher that succeeds when the actual value is greater than
|
||||||
/// or equal to the expected value.
|
/// or equal to the expected value.
|
||||||
public func beGreaterThanOrEqualTo<T: Comparable>(_ expectedValue: T?) -> Predicate<T> {
|
public func beGreaterThanOrEqualTo<T: Comparable>(_ expectedValue: T?) -> Predicate<T> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
let message = "be greater than or equal to <\(stringify(expectedValue))>"
|
||||||
failureMessage.postfixMessage = "be greater than or equal to <\(stringify(expectedValue))>"
|
return Predicate.simple(message) { actualExpression in
|
||||||
let actualValue = try actualExpression.evaluate()
|
let actualValue = try actualExpression.evaluate()
|
||||||
if let actual = actualValue, let expected = expectedValue {
|
if let actual = actualValue, let expected = expectedValue {
|
||||||
return actual >= expected
|
return PredicateStatus(bool: actual >= expected)
|
||||||
}
|
}
|
||||||
return false
|
return .fail
|
||||||
}.requireNonNil
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A Nimble matcher that succeeds when the actual value is greater than
|
/// A Nimble matcher that succeeds when the actual value is greater than
|
||||||
/// or equal to the expected value.
|
/// or equal to the expected value.
|
||||||
public func beGreaterThanOrEqualTo<T: NMBComparable>(_ expectedValue: T?) -> Predicate<T> {
|
public func beGreaterThanOrEqualTo<T: NMBComparable>(_ expectedValue: T?) -> Predicate<T> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
let message = "be greater than or equal to <\(stringify(expectedValue))>"
|
||||||
failureMessage.postfixMessage = "be greater than or equal to <\(stringify(expectedValue))>"
|
return Predicate.simple(message) { actualExpression in
|
||||||
let actualValue = try actualExpression.evaluate()
|
let actualValue = try actualExpression.evaluate()
|
||||||
let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) != ComparisonResult.orderedAscending
|
let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) != ComparisonResult.orderedAscending
|
||||||
return matches
|
return PredicateStatus(bool: matches)
|
||||||
}.requireNonNil
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func >=<T: Comparable>(lhs: Expectation<T>, rhs: T) {
|
public func >=<T: Comparable>(lhs: Expectation<T>, rhs: T) {
|
||||||
|
@ -32,12 +32,12 @@ public func >=<T: NMBComparable>(lhs: Expectation<T>, rhs: T) {
|
||||||
lhs.to(beGreaterThanOrEqualTo(rhs))
|
lhs.to(beGreaterThanOrEqualTo(rhs))
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
extension NMBObjCMatcher {
|
extension NMBObjCMatcher {
|
||||||
@objc public class func beGreaterThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher {
|
@objc public class func beGreaterThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBMatcher {
|
||||||
return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
|
return NMBPredicate { actualExpression in
|
||||||
let expr = actualExpression.cast { $0 as? NMBComparable }
|
let expr = actualExpression.cast { $0 as? NMBComparable }
|
||||||
return try! beGreaterThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage)
|
return try beGreaterThanOrEqualTo(expected).satisfies(expr).toObjectiveC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,20 +3,27 @@ import Foundation
|
||||||
/// A Nimble matcher that succeeds when the actual value is the same instance
|
/// A Nimble matcher that succeeds when the actual value is the same instance
|
||||||
/// as the expected instance.
|
/// as the expected instance.
|
||||||
public func beIdenticalTo(_ expected: Any?) -> Predicate<Any> {
|
public func beIdenticalTo(_ expected: Any?) -> Predicate<Any> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate.define { actualExpression in
|
||||||
#if os(Linux)
|
#if os(Linux) && !swift(>=4.1.50)
|
||||||
let actual = try actualExpression.evaluate() as? AnyObject
|
let actual = try actualExpression.evaluate() as? AnyObject
|
||||||
#else
|
#else
|
||||||
let actual = try actualExpression.evaluate() as AnyObject?
|
let actual = try actualExpression.evaluate() as AnyObject?
|
||||||
#endif
|
#endif
|
||||||
failureMessage.actualValue = "\(identityAsString(actual))"
|
|
||||||
failureMessage.postfixMessage = "be identical to \(identityAsString(expected))"
|
let bool: Bool
|
||||||
#if os(Linux)
|
#if os(Linux) && !swift(>=4.1.50)
|
||||||
return actual === (expected as? AnyObject) && actual !== nil
|
bool = actual === (expected as? AnyObject) && actual !== nil
|
||||||
#else
|
#else
|
||||||
return actual === (expected as AnyObject?) && actual !== nil
|
bool = actual === (expected as AnyObject?) && actual !== nil
|
||||||
#endif
|
#endif
|
||||||
}.requireNonNil
|
return PredicateResult(
|
||||||
|
bool: bool,
|
||||||
|
message: .expectedCustomValueTo(
|
||||||
|
"be identical to \(identityAsString(expected))",
|
||||||
|
"\(identityAsString(actual))"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func === (lhs: Expectation<Any>, rhs: Any?) {
|
public func === (lhs: Expectation<Any>, rhs: Any?) {
|
||||||
|
@ -34,12 +41,12 @@ public func be(_ expected: Any?) -> Predicate<Any> {
|
||||||
return beIdenticalTo(expected)
|
return beIdenticalTo(expected)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
extension NMBObjCMatcher {
|
extension NMBObjCMatcher {
|
||||||
@objc public class func beIdenticalToMatcher(_ expected: NSObject?) -> NMBObjCMatcher {
|
@objc public class func beIdenticalToMatcher(_ expected: NSObject?) -> NMBMatcher {
|
||||||
return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
|
return NMBPredicate { actualExpression in
|
||||||
let aExpr = actualExpression.cast { $0 as Any? }
|
let aExpr = actualExpression.cast { $0 as Any? }
|
||||||
return try! beIdenticalTo(expected).matches(aExpr, failureMessage: failureMessage)
|
return try beIdenticalTo(expected).satisfies(aExpr).toObjectiveC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,23 +2,23 @@ import Foundation
|
||||||
|
|
||||||
/// A Nimble matcher that succeeds when the actual value is less than the expected value.
|
/// A Nimble matcher that succeeds when the actual value is less than the expected value.
|
||||||
public func beLessThan<T: Comparable>(_ expectedValue: T?) -> Predicate<T> {
|
public func beLessThan<T: Comparable>(_ expectedValue: T?) -> Predicate<T> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
let message = "be less than <\(stringify(expectedValue))>"
|
||||||
failureMessage.postfixMessage = "be less than <\(stringify(expectedValue))>"
|
return Predicate.simple(message) { actualExpression in
|
||||||
if let actual = try actualExpression.evaluate(), let expected = expectedValue {
|
if let actual = try actualExpression.evaluate(), let expected = expectedValue {
|
||||||
return actual < expected
|
return PredicateStatus(bool: actual < expected)
|
||||||
}
|
}
|
||||||
return false
|
return .fail
|
||||||
}.requireNonNil
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A Nimble matcher that succeeds when the actual value is less than the expected value.
|
/// A Nimble matcher that succeeds when the actual value is less than the expected value.
|
||||||
public func beLessThan(_ expectedValue: NMBComparable?) -> Predicate<NMBComparable> {
|
public func beLessThan(_ expectedValue: NMBComparable?) -> Predicate<NMBComparable> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
let message = "be less than <\(stringify(expectedValue))>"
|
||||||
failureMessage.postfixMessage = "be less than <\(stringify(expectedValue))>"
|
return Predicate.simple(message) { actualExpression in
|
||||||
let actualValue = try actualExpression.evaluate()
|
let actualValue = try actualExpression.evaluate()
|
||||||
let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) == ComparisonResult.orderedAscending
|
let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) == ComparisonResult.orderedAscending
|
||||||
return matches
|
return PredicateStatus(bool: matches)
|
||||||
}.requireNonNil
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func <<T: Comparable>(lhs: Expectation<T>, rhs: T) {
|
public func <<T: Comparable>(lhs: Expectation<T>, rhs: T) {
|
||||||
|
@ -29,12 +29,12 @@ public func < (lhs: Expectation<NMBComparable>, rhs: NMBComparable?) {
|
||||||
lhs.to(beLessThan(rhs))
|
lhs.to(beLessThan(rhs))
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
extension NMBObjCMatcher {
|
extension NMBObjCMatcher {
|
||||||
@objc public class func beLessThanMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher {
|
@objc public class func beLessThanMatcher(_ expected: NMBComparable?) -> NMBMatcher {
|
||||||
return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
|
return NMBPredicate { actualExpression in
|
||||||
let expr = actualExpression.cast { $0 as? NMBComparable }
|
let expr = actualExpression.cast { $0 as? NMBComparable }
|
||||||
return try! beLessThan(expected).matches(expr, failureMessage: failureMessage)
|
return try beLessThan(expected).satisfies(expr).toObjectiveC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,23 +3,22 @@ import Foundation
|
||||||
/// A Nimble matcher that succeeds when the actual value is less than
|
/// A Nimble matcher that succeeds when the actual value is less than
|
||||||
/// or equal to the expected value.
|
/// or equal to the expected value.
|
||||||
public func beLessThanOrEqualTo<T: Comparable>(_ expectedValue: T?) -> Predicate<T> {
|
public func beLessThanOrEqualTo<T: Comparable>(_ expectedValue: T?) -> Predicate<T> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate.simple("be less than or equal to <\(stringify(expectedValue))>") { actualExpression in
|
||||||
failureMessage.postfixMessage = "be less than or equal to <\(stringify(expectedValue))>"
|
|
||||||
if let actual = try actualExpression.evaluate(), let expected = expectedValue {
|
if let actual = try actualExpression.evaluate(), let expected = expectedValue {
|
||||||
return actual <= expected
|
return PredicateStatus(bool: actual <= expected)
|
||||||
}
|
}
|
||||||
return false
|
return .fail
|
||||||
}.requireNonNil
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A Nimble matcher that succeeds when the actual value is less than
|
/// A Nimble matcher that succeeds when the actual value is less than
|
||||||
/// or equal to the expected value.
|
/// or equal to the expected value.
|
||||||
public func beLessThanOrEqualTo<T: NMBComparable>(_ expectedValue: T?) -> Predicate<T> {
|
public func beLessThanOrEqualTo<T: NMBComparable>(_ expectedValue: T?) -> Predicate<T> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate.simple("be less than or equal to <\(stringify(expectedValue))>") { actualExpression in
|
||||||
failureMessage.postfixMessage = "be less than or equal to <\(stringify(expectedValue))>"
|
|
||||||
let actualValue = try actualExpression.evaluate()
|
let actualValue = try actualExpression.evaluate()
|
||||||
return actualValue != nil && actualValue!.NMB_compare(expectedValue) != ComparisonResult.orderedDescending
|
let matches = actualValue.map { $0.NMB_compare(expectedValue) != .orderedDescending } ?? false
|
||||||
}.requireNonNil
|
return PredicateStatus(bool: matches)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func <=<T: Comparable>(lhs: Expectation<T>, rhs: T) {
|
public func <=<T: Comparable>(lhs: Expectation<T>, rhs: T) {
|
||||||
|
@ -30,12 +29,12 @@ public func <=<T: NMBComparable>(lhs: Expectation<T>, rhs: T) {
|
||||||
lhs.to(beLessThanOrEqualTo(rhs))
|
lhs.to(beLessThanOrEqualTo(rhs))
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
extension NMBObjCMatcher {
|
extension NMBObjCMatcher {
|
||||||
@objc public class func beLessThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher {
|
@objc public class func beLessThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBMatcher {
|
||||||
return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
|
return NMBPredicate { actualExpression in
|
||||||
let expr = actualExpression.cast { $0 as? NMBComparable }
|
let expr = actualExpression.cast { $0 as? NMBComparable }
|
||||||
return try! beLessThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage)
|
return try beLessThanOrEqualTo(expected).satisfies(expr).toObjectiveC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,14 +100,6 @@ public func beTruthy<T: ExpressibleByBooleanLiteral & Equatable>() -> Predicate<
|
||||||
return Predicate.simpleNilable("be truthy") { actualExpression in
|
return Predicate.simpleNilable("be truthy") { actualExpression in
|
||||||
let actualValue = try actualExpression.evaluate()
|
let actualValue = try actualExpression.evaluate()
|
||||||
if let actualValue = actualValue {
|
if let actualValue = actualValue {
|
||||||
// FIXME: This is a workaround to SR-2290.
|
|
||||||
// See:
|
|
||||||
// - https://bugs.swift.org/browse/SR-2290
|
|
||||||
// - https://github.com/norio-nomura/Nimble/pull/5#issuecomment-237835873
|
|
||||||
if let number = actualValue as? NSNumber {
|
|
||||||
return PredicateStatus(bool: number.boolValue == true)
|
|
||||||
}
|
|
||||||
|
|
||||||
return PredicateStatus(bool: actualValue == (true as T))
|
return PredicateStatus(bool: actualValue == (true as T))
|
||||||
}
|
}
|
||||||
return PredicateStatus(bool: actualValue != nil)
|
return PredicateStatus(bool: actualValue != nil)
|
||||||
|
@ -120,47 +112,42 @@ public func beFalsy<T: ExpressibleByBooleanLiteral & Equatable>() -> Predicate<T
|
||||||
return Predicate.simpleNilable("be falsy") { actualExpression in
|
return Predicate.simpleNilable("be falsy") { actualExpression in
|
||||||
let actualValue = try actualExpression.evaluate()
|
let actualValue = try actualExpression.evaluate()
|
||||||
if let actualValue = actualValue {
|
if let actualValue = actualValue {
|
||||||
// FIXME: This is a workaround to SR-2290.
|
|
||||||
// See:
|
|
||||||
// - https://bugs.swift.org/browse/SR-2290
|
|
||||||
// - https://github.com/norio-nomura/Nimble/pull/5#issuecomment-237835873
|
|
||||||
if let number = actualValue as? NSNumber {
|
|
||||||
return PredicateStatus(bool: number.boolValue == false)
|
|
||||||
}
|
|
||||||
|
|
||||||
return PredicateStatus(bool: actualValue == (false as T))
|
return PredicateStatus(bool: actualValue == (false as T))
|
||||||
}
|
}
|
||||||
return PredicateStatus(bool: actualValue == nil)
|
return PredicateStatus(bool: actualValue == nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
extension NMBObjCMatcher {
|
extension NMBObjCMatcher {
|
||||||
@objc public class func beTruthyMatcher() -> NMBObjCMatcher {
|
@objc public class func beTruthyMatcher() -> NMBMatcher {
|
||||||
return NMBObjCMatcher { actualExpression, failureMessage in
|
return NMBPredicate { actualExpression in
|
||||||
let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false }
|
let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false }
|
||||||
return try! beTruthy().matches(expr, failureMessage: failureMessage)
|
return try beTruthy().satisfies(expr).toObjectiveC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc public class func beFalsyMatcher() -> NMBObjCMatcher {
|
@objc public class func beFalsyMatcher() -> NMBMatcher {
|
||||||
return NMBObjCMatcher { actualExpression, failureMessage in
|
return NMBPredicate { actualExpression in
|
||||||
let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false }
|
let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false }
|
||||||
return try! beFalsy().matches(expr, failureMessage: failureMessage)
|
return try beFalsy().satisfies(expr).toObjectiveC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc public class func beTrueMatcher() -> NMBObjCMatcher {
|
@objc public class func beTrueMatcher() -> NMBMatcher {
|
||||||
return NMBObjCMatcher { actualExpression, failureMessage in
|
return NMBPredicate { actualExpression in
|
||||||
let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false }
|
let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false }
|
||||||
return try! beTrue().matches(expr, failureMessage: failureMessage)
|
return try beTrue().satisfies(expr).toObjectiveC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc public class func beFalseMatcher() -> NMBObjCMatcher {
|
@objc public class func beFalseMatcher() -> NMBMatcher {
|
||||||
return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
|
return NMBPredicate { actualExpression in
|
||||||
let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false }
|
let expr = actualExpression.cast { value -> Bool? in
|
||||||
return try! beFalse().matches(expr, failureMessage: failureMessage)
|
guard let value = value else { return nil }
|
||||||
|
return (value as? NSNumber)?.boolValue ?? false
|
||||||
|
}
|
||||||
|
return try beFalse().satisfies(expr).toObjectiveC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,11 +8,11 @@ public func beNil<T>() -> Predicate<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
extension NMBObjCMatcher {
|
extension NMBObjCMatcher {
|
||||||
@objc public class func beNilMatcher() -> NMBObjCMatcher {
|
@objc public class func beNilMatcher() -> NMBMatcher {
|
||||||
return NMBObjCMatcher { actualExpression, failureMessage in
|
return NMBPredicate { actualExpression in
|
||||||
return try! beNil().matches(actualExpression, failureMessage: failureMessage)
|
return try beNil().satisfies(actualExpression).toObjectiveC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,17 +2,18 @@ import Foundation
|
||||||
|
|
||||||
/// A Nimble matcher that succeeds when the actual value is Void.
|
/// A Nimble matcher that succeeds when the actual value is Void.
|
||||||
public func beVoid() -> Predicate<()> {
|
public func beVoid() -> Predicate<()> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate.simpleNilable("be void") { actualExpression in
|
||||||
failureMessage.postfixMessage = "be void"
|
|
||||||
let actualValue: ()? = try actualExpression.evaluate()
|
let actualValue: ()? = try actualExpression.evaluate()
|
||||||
return actualValue != nil
|
return PredicateStatus(bool: actualValue != nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func == (lhs: Expectation<()>, rhs: ()) {
|
extension Expectation where T == () {
|
||||||
lhs.to(beVoid())
|
public static func == (lhs: Expectation<()>, rhs: ()) {
|
||||||
}
|
lhs.to(beVoid())
|
||||||
|
}
|
||||||
|
|
||||||
public func != (lhs: Expectation<()>, rhs: ()) {
|
public static func != (lhs: Expectation<()>, rhs: ()) {
|
||||||
lhs.toNot(beVoid())
|
lhs.toNot(beVoid())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,24 +35,24 @@ public func beginWith(_ startingElement: Any) -> Predicate<NMBOrderedCollection>
|
||||||
public func beginWith(_ startingSubstring: String) -> Predicate<String> {
|
public func beginWith(_ startingSubstring: String) -> Predicate<String> {
|
||||||
return Predicate.simple("begin with <\(startingSubstring)>") { actualExpression in
|
return Predicate.simple("begin with <\(startingSubstring)>") { actualExpression in
|
||||||
if let actual = try actualExpression.evaluate() {
|
if let actual = try actualExpression.evaluate() {
|
||||||
let range = actual.range(of: startingSubstring)
|
return PredicateStatus(bool: actual.hasPrefix(startingSubstring))
|
||||||
return PredicateStatus(bool: range != nil && range!.lowerBound == actual.startIndex)
|
|
||||||
}
|
}
|
||||||
return .fail
|
return .fail
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
extension NMBObjCMatcher {
|
extension NMBObjCMatcher {
|
||||||
@objc public class func beginWithMatcher(_ expected: Any) -> NMBObjCMatcher {
|
@objc public class func beginWithMatcher(_ expected: Any) -> NMBMatcher {
|
||||||
return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
|
return NMBPredicate { actualExpression in
|
||||||
let actual = try! actualExpression.evaluate()
|
let actual = try actualExpression.evaluate()
|
||||||
if (actual as? String) != nil {
|
if actual is String {
|
||||||
let expr = actualExpression.cast { $0 as? String }
|
let expr = actualExpression.cast { $0 as? String }
|
||||||
return try! beginWith(expected as! String).matches(expr, failureMessage: failureMessage)
|
// swiftlint:disable:next force_cast
|
||||||
|
return try beginWith(expected as! String).satisfies(expr).toObjectiveC()
|
||||||
} else {
|
} else {
|
||||||
let expr = actualExpression.cast { $0 as? NMBOrderedCollection }
|
let expr = actualExpression.cast { $0 as? NMBOrderedCollection }
|
||||||
return try! beginWith(expected).matches(expr, failureMessage: failureMessage)
|
return try beginWith(expected).satisfies(expr).toObjectiveC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,43 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
/// A Nimble matcher that succeeds when the actual sequence contains the expected value.
|
/// A Nimble matcher that succeeds when the actual sequence contains the expected values.
|
||||||
public func contain<S: Sequence, T: Equatable>(_ items: T...) -> Predicate<S>
|
public func contain<S: Sequence, T: Equatable>(_ items: T...) -> Predicate<S>
|
||||||
where S.Iterator.Element == T {
|
where S.Element == T {
|
||||||
return contain(items)
|
return contain(items)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A Nimble matcher that succeeds when the actual sequence contains the expected values.
|
||||||
public func contain<S: Sequence, T: Equatable>(_ items: [T]) -> Predicate<S>
|
public func contain<S: Sequence, T: Equatable>(_ items: [T]) -> Predicate<S>
|
||||||
where S.Iterator.Element == T {
|
where S.Element == T {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in
|
||||||
failureMessage.postfixMessage = "contain <\(arrayAsString(items))>"
|
|
||||||
if let actual = try actualExpression.evaluate() {
|
if let actual = try actualExpression.evaluate() {
|
||||||
return items.all {
|
let matches = items.allSatisfy {
|
||||||
return actual.contains($0)
|
return actual.contains($0)
|
||||||
}
|
}
|
||||||
|
return PredicateStatus(bool: matches)
|
||||||
|
}
|
||||||
|
return .fail
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A Nimble matcher that succeeds when the actual set contains the expected values.
|
||||||
|
public func contain<S: SetAlgebra, T: Equatable>(_ items: T...) -> Predicate<S>
|
||||||
|
where S.Element == T {
|
||||||
|
return contain(items)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A Nimble matcher that succeeds when the actual set contains the expected values.
|
||||||
|
public func contain<S: SetAlgebra, T: Equatable>(_ items: [T]) -> Predicate<S>
|
||||||
|
where S.Element == T {
|
||||||
|
return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in
|
||||||
|
if let actual = try actualExpression.evaluate() {
|
||||||
|
let matches = items.allSatisfy {
|
||||||
|
return actual.contains($0)
|
||||||
|
}
|
||||||
|
return PredicateStatus(bool: matches)
|
||||||
|
}
|
||||||
|
return .fail
|
||||||
}
|
}
|
||||||
return false
|
|
||||||
}.requireNonNil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A Nimble matcher that succeeds when the actual string contains the expected substring.
|
/// A Nimble matcher that succeeds when the actual string contains the expected substring.
|
||||||
|
@ -25,16 +46,16 @@ public func contain(_ substrings: String...) -> Predicate<String> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public func contain(_ substrings: [String]) -> Predicate<String> {
|
public func contain(_ substrings: [String]) -> Predicate<String> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate.simple("contain <\(arrayAsString(substrings))>") { actualExpression in
|
||||||
failureMessage.postfixMessage = "contain <\(arrayAsString(substrings))>"
|
|
||||||
if let actual = try actualExpression.evaluate() {
|
if let actual = try actualExpression.evaluate() {
|
||||||
return substrings.all {
|
let matches = substrings.allSatisfy {
|
||||||
let range = actual.range(of: $0)
|
let range = actual.range(of: $0)
|
||||||
return range != nil && !range!.isEmpty
|
return range != nil && !range!.isEmpty
|
||||||
}
|
}
|
||||||
|
return PredicateStatus(bool: matches)
|
||||||
}
|
}
|
||||||
return false
|
return .fail
|
||||||
}.requireNonNil
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A Nimble matcher that succeeds when the actual string contains the expected substring.
|
/// A Nimble matcher that succeeds when the actual string contains the expected substring.
|
||||||
|
@ -43,13 +64,13 @@ public func contain(_ substrings: NSString...) -> Predicate<NSString> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public func contain(_ substrings: [NSString]) -> Predicate<NSString> {
|
public func contain(_ substrings: [NSString]) -> Predicate<NSString> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate.simple("contain <\(arrayAsString(substrings))>") { actualExpression in
|
||||||
failureMessage.postfixMessage = "contain <\(arrayAsString(substrings))>"
|
|
||||||
if let actual = try actualExpression.evaluate() {
|
if let actual = try actualExpression.evaluate() {
|
||||||
return substrings.all { actual.range(of: $0.description).length != 0 }
|
let matches = substrings.allSatisfy { actual.range(of: $0.description).length != 0 }
|
||||||
|
return PredicateStatus(bool: matches)
|
||||||
}
|
}
|
||||||
return false
|
return .fail
|
||||||
}.requireNonNil
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A Nimble matcher that succeeds when the actual collection contains the expected object.
|
/// A Nimble matcher that succeeds when the actual collection contains the expected object.
|
||||||
|
@ -58,37 +79,45 @@ public func contain(_ items: Any?...) -> Predicate<NMBContainer> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public func contain(_ items: [Any?]) -> Predicate<NMBContainer> {
|
public func contain(_ items: [Any?]) -> Predicate<NMBContainer> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in
|
||||||
failureMessage.postfixMessage = "contain <\(arrayAsString(items))>"
|
guard let actual = try actualExpression.evaluate() else { return .fail }
|
||||||
guard let actual = try actualExpression.evaluate() else { return false }
|
let matches = items.allSatisfy { item in
|
||||||
return items.all { item in
|
return item.map { actual.contains($0) } ?? false
|
||||||
return item != nil && actual.contains(item!)
|
|
||||||
}
|
}
|
||||||
}.requireNonNil
|
return PredicateStatus(bool: matches)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
extension NMBObjCMatcher {
|
extension NMBObjCMatcher {
|
||||||
@objc public class func containMatcher(_ expected: [NSObject]) -> NMBObjCMatcher {
|
@objc public class func containMatcher(_ expected: [NSObject]) -> NMBMatcher {
|
||||||
return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
|
return NMBPredicate { actualExpression in
|
||||||
let location = actualExpression.location
|
let location = actualExpression.location
|
||||||
let actualValue = try! actualExpression.evaluate()
|
let actualValue = try actualExpression.evaluate()
|
||||||
if let value = actualValue as? NMBContainer {
|
if let value = actualValue as? NMBContainer {
|
||||||
let expr = Expression(expression: ({ value as NMBContainer }), location: location)
|
let expr = Expression(expression: ({ value as NMBContainer }), location: location)
|
||||||
|
|
||||||
// A straightforward cast on the array causes this to crash, so we have to cast the individual items
|
// A straightforward cast on the array causes this to crash, so we have to cast the individual items
|
||||||
let expectedOptionals: [Any?] = expected.map({ $0 as Any? })
|
let expectedOptionals: [Any?] = expected.map({ $0 as Any? })
|
||||||
return try! contain(expectedOptionals).matches(expr, failureMessage: failureMessage)
|
return try contain(expectedOptionals).satisfies(expr).toObjectiveC()
|
||||||
} else if let value = actualValue as? NSString {
|
} else if let value = actualValue as? NSString {
|
||||||
let expr = Expression(expression: ({ value as String }), location: location)
|
let expr = Expression(expression: ({ value as String }), location: location)
|
||||||
return try! contain(expected as! [String]).matches(expr, failureMessage: failureMessage)
|
// swiftlint:disable:next force_cast
|
||||||
} else if actualValue != nil {
|
return try contain(expected as! [String]).satisfies(expr).toObjectiveC()
|
||||||
// swiftlint:disable:next line_length
|
|
||||||
failureMessage.postfixMessage = "contain <\(arrayAsString(expected))> (only works for NSArrays, NSSets, NSHashTables, and NSStrings)"
|
|
||||||
} else {
|
|
||||||
failureMessage.postfixMessage = "contain <\(arrayAsString(expected))>"
|
|
||||||
}
|
}
|
||||||
return false
|
|
||||||
|
let message: ExpectationMessage
|
||||||
|
if actualValue != nil {
|
||||||
|
message = ExpectationMessage.expectedActualValueTo(
|
||||||
|
// swiftlint:disable:next line_length
|
||||||
|
"contain <\(arrayAsString(expected))> (only works for NSArrays, NSSets, NSHashTables, and NSStrings)"
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
message = ExpectationMessage
|
||||||
|
.expectedActualValueTo("contain <\(arrayAsString(expected))>")
|
||||||
|
.appendedBeNilHint()
|
||||||
|
}
|
||||||
|
return NMBPredicateResult(status: .fail, message: message.toObjectiveC())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,43 +2,44 @@ import Foundation
|
||||||
|
|
||||||
public func containElementSatisfying<S: Sequence, T>(_ predicate: @escaping ((T) -> Bool), _ predicateDescription: String = "") -> Predicate<S> where S.Iterator.Element == T {
|
public func containElementSatisfying<S: Sequence, T>(_ predicate: @escaping ((T) -> Bool), _ predicateDescription: String = "") -> Predicate<S> where S.Iterator.Element == T {
|
||||||
|
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate.define { actualExpression in
|
||||||
failureMessage.actualValue = nil
|
let message: ExpectationMessage
|
||||||
|
|
||||||
if predicateDescription == "" {
|
if predicateDescription == "" {
|
||||||
failureMessage.postfixMessage = "find object in collection that satisfies predicate"
|
message = .expectedTo("find object in collection that satisfies predicate")
|
||||||
} else {
|
} else {
|
||||||
failureMessage.postfixMessage = "find object in collection \(predicateDescription)"
|
message = .expectedTo("find object in collection \(predicateDescription)")
|
||||||
}
|
}
|
||||||
|
|
||||||
if let sequence = try actualExpression.evaluate() {
|
if let sequence = try actualExpression.evaluate() {
|
||||||
for object in sequence {
|
for object in sequence {
|
||||||
if predicate(object) {
|
if predicate(object) {
|
||||||
return true
|
return PredicateResult(bool: true, message: message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return PredicateResult(bool: false, message: message)
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return PredicateResult(status: .fail, message: message)
|
||||||
}.requireNonNil
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
extension NMBObjCMatcher {
|
extension NMBObjCMatcher {
|
||||||
@objc public class func containElementSatisfyingMatcher(_ predicate: @escaping ((NSObject) -> Bool)) -> NMBObjCMatcher {
|
@objc public class func containElementSatisfyingMatcher(_ predicate: @escaping ((NSObject) -> Bool)) -> NMBMatcher {
|
||||||
return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
|
return NMBPredicate { actualExpression in
|
||||||
let value = try! actualExpression.evaluate()
|
let value = try actualExpression.evaluate()
|
||||||
guard let enumeration = value as? NSFastEnumeration else {
|
guard let enumeration = value as? NSFastEnumeration else {
|
||||||
// swiftlint:disable:next line_length
|
let message = ExpectationMessage.fail(
|
||||||
failureMessage.postfixMessage = "containElementSatisfying must be provided an NSFastEnumeration object"
|
"containElementSatisfying must be provided an NSFastEnumeration object"
|
||||||
failureMessage.actualValue = nil
|
)
|
||||||
failureMessage.expected = ""
|
return NMBPredicateResult(status: .fail, message: message.toObjectiveC())
|
||||||
failureMessage.to = ""
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let message = ExpectationMessage
|
||||||
|
.expectedTo("find object in collection that satisfies predicate")
|
||||||
|
.toObjectiveC()
|
||||||
|
|
||||||
var iterator = NSFastEnumerationIterator(enumeration)
|
var iterator = NSFastEnumerationIterator(enumeration)
|
||||||
while let item = iterator.next() {
|
while let item = iterator.next() {
|
||||||
guard let object = item as? NSObject else {
|
guard let object = item as? NSObject else {
|
||||||
|
@ -46,14 +47,11 @@ public func containElementSatisfying<S: Sequence, T>(_ predicate: @escaping ((T)
|
||||||
}
|
}
|
||||||
|
|
||||||
if predicate(object) {
|
if predicate(object) {
|
||||||
return true
|
return NMBPredicateResult(status: .matches, message: message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
failureMessage.actualValue = nil
|
return NMBPredicateResult(status: .doesNotMatch, message: message)
|
||||||
failureMessage.postfixMessage = ""
|
|
||||||
failureMessage.to = "to find object in collection that satisfies predicate"
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
/// A Nimble matcher that succeeds when the actual sequence contain the same elements in the same order to the exepected sequence.
|
||||||
|
public func elementsEqual<S: Sequence>(_ expectedValue: S?) -> Predicate<S> where S.Element: Equatable {
|
||||||
|
// A matcher abstraction for https://developer.apple.com/documentation/swift/sequence/2949668-elementsequal
|
||||||
|
return Predicate.define("elementsEqual <\(stringify(expectedValue))>") { (actualExpression, msg) in
|
||||||
|
let actualValue = try actualExpression.evaluate()
|
||||||
|
switch (expectedValue, actualValue) {
|
||||||
|
case (nil, _?):
|
||||||
|
return PredicateResult(status: .fail, message: msg.appendedBeNilHint())
|
||||||
|
case (nil, nil), (_, nil):
|
||||||
|
return PredicateResult(status: .fail, message: msg)
|
||||||
|
case (let expected?, let actual?):
|
||||||
|
let matches = expected.elementsEqual(actual)
|
||||||
|
return PredicateResult(bool: matches, message: msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,9 +4,7 @@ import Foundation
|
||||||
/// is equal to the expected value.
|
/// is equal to the expected value.
|
||||||
public func endWith<S: Sequence, T: Equatable>(_ endingElement: T) -> Predicate<S>
|
public func endWith<S: Sequence, T: Equatable>(_ endingElement: T) -> Predicate<S>
|
||||||
where S.Iterator.Element == T {
|
where S.Iterator.Element == T {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate.simple("end with <\(endingElement)>") { actualExpression in
|
||||||
failureMessage.postfixMessage = "end with <\(endingElement)>"
|
|
||||||
|
|
||||||
if let actualValue = try actualExpression.evaluate() {
|
if let actualValue = try actualExpression.evaluate() {
|
||||||
var actualGenerator = actualValue.makeIterator()
|
var actualGenerator = actualValue.makeIterator()
|
||||||
var lastItem: T?
|
var lastItem: T?
|
||||||
|
@ -16,55 +14,54 @@ public func endWith<S: Sequence, T: Equatable>(_ endingElement: T) -> Predicate<
|
||||||
item = actualGenerator.next()
|
item = actualGenerator.next()
|
||||||
} while(item != nil)
|
} while(item != nil)
|
||||||
|
|
||||||
return lastItem == endingElement
|
return PredicateStatus(bool: lastItem == endingElement)
|
||||||
}
|
}
|
||||||
return false
|
return .fail
|
||||||
}.requireNonNil
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A Nimble matcher that succeeds when the actual collection's last element
|
/// A Nimble matcher that succeeds when the actual collection's last element
|
||||||
/// is equal to the expected object.
|
/// is equal to the expected object.
|
||||||
public func endWith(_ endingElement: Any) -> Predicate<NMBOrderedCollection> {
|
public func endWith(_ endingElement: Any) -> Predicate<NMBOrderedCollection> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate.simple("end with <\(endingElement)>") { actualExpression in
|
||||||
failureMessage.postfixMessage = "end with <\(endingElement)>"
|
guard let collection = try actualExpression.evaluate() else { return .fail }
|
||||||
guard let collection = try actualExpression.evaluate() else { return false }
|
guard collection.count > 0 else { return PredicateStatus(bool: false) }
|
||||||
guard collection.count > 0 else { return false }
|
|
||||||
#if os(Linux)
|
#if os(Linux)
|
||||||
guard let collectionValue = collection.object(at: collection.count - 1) as? NSObject else {
|
guard let collectionValue = collection.object(at: collection.count - 1) as? NSObject else {
|
||||||
return false
|
return .fail
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
let collectionValue = collection.object(at: collection.count - 1) as AnyObject
|
let collectionValue = collection.object(at: collection.count - 1) as AnyObject
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return collectionValue.isEqual(endingElement)
|
return PredicateStatus(bool: collectionValue.isEqual(endingElement))
|
||||||
}.requireNonNil
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A Nimble matcher that succeeds when the actual string contains the expected substring
|
/// A Nimble matcher that succeeds when the actual string contains the expected substring
|
||||||
/// where the expected substring's location is the actual string's length minus the
|
/// where the expected substring's location is the actual string's length minus the
|
||||||
/// expected substring's length.
|
/// expected substring's length.
|
||||||
public func endWith(_ endingSubstring: String) -> Predicate<String> {
|
public func endWith(_ endingSubstring: String) -> Predicate<String> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate.simple("end with <\(endingSubstring)>") { actualExpression in
|
||||||
failureMessage.postfixMessage = "end with <\(endingSubstring)>"
|
|
||||||
if let collection = try actualExpression.evaluate() {
|
if let collection = try actualExpression.evaluate() {
|
||||||
return collection.hasSuffix(endingSubstring)
|
return PredicateStatus(bool: collection.hasSuffix(endingSubstring))
|
||||||
}
|
}
|
||||||
return false
|
return .fail
|
||||||
}.requireNonNil
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
extension NMBObjCMatcher {
|
extension NMBObjCMatcher {
|
||||||
@objc public class func endWithMatcher(_ expected: Any) -> NMBObjCMatcher {
|
@objc public class func endWithMatcher(_ expected: Any) -> NMBMatcher {
|
||||||
return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
|
return NMBPredicate { actualExpression in
|
||||||
let actual = try! actualExpression.evaluate()
|
let actual = try actualExpression.evaluate()
|
||||||
if (actual as? String) != nil {
|
if actual is String {
|
||||||
let expr = actualExpression.cast { $0 as? String }
|
let expr = actualExpression.cast { $0 as? String }
|
||||||
return try! endWith(expected as! String).matches(expr, failureMessage: failureMessage)
|
// swiftlint:disable:next force_cast
|
||||||
|
return try endWith(expected as! String).satisfies(expr).toObjectiveC()
|
||||||
} else {
|
} else {
|
||||||
let expr = actualExpression.cast { $0 as? NMBOrderedCollection }
|
let expr = actualExpression.cast { $0 as? NMBOrderedCollection }
|
||||||
return try! endWith(expected).matches(expr, failureMessage: failureMessage)
|
return try endWith(expected).satisfies(expr).toObjectiveC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,103 +7,30 @@ import Foundation
|
||||||
public func equal<T: Equatable>(_ expectedValue: T?) -> Predicate<T> {
|
public func equal<T: Equatable>(_ expectedValue: T?) -> Predicate<T> {
|
||||||
return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in
|
return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in
|
||||||
let actualValue = try actualExpression.evaluate()
|
let actualValue = try actualExpression.evaluate()
|
||||||
let matches = actualValue == expectedValue && expectedValue != nil
|
switch (expectedValue, actualValue) {
|
||||||
if expectedValue == nil || actualValue == nil {
|
case (nil, _?):
|
||||||
if expectedValue == nil && actualValue != nil {
|
return PredicateResult(status: .fail, message: msg.appendedBeNilHint())
|
||||||
return PredicateResult(
|
case (nil, nil), (_, nil):
|
||||||
status: .fail,
|
|
||||||
message: msg.appendedBeNilHint()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
return PredicateResult(status: .fail, message: msg)
|
return PredicateResult(status: .fail, message: msg)
|
||||||
|
case (let expected?, let actual?):
|
||||||
|
let matches = expected == actual
|
||||||
|
return PredicateResult(bool: matches, message: msg)
|
||||||
}
|
}
|
||||||
return PredicateResult(status: PredicateStatus(bool: matches), message: msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A Nimble matcher that succeeds when the actual value is equal to the expected value.
|
|
||||||
/// Values can support equal by supporting the Equatable protocol.
|
|
||||||
///
|
|
||||||
/// @see beCloseTo if you want to match imprecise types (eg - floats, doubles).
|
|
||||||
public func equal<T, C: Equatable>(_ expectedValue: [T: C]?) -> Predicate<[T: C]> {
|
|
||||||
return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in
|
|
||||||
let actualValue = try actualExpression.evaluate()
|
|
||||||
if expectedValue == nil || actualValue == nil {
|
|
||||||
if expectedValue == nil && actualValue != nil {
|
|
||||||
return PredicateResult(
|
|
||||||
status: .fail,
|
|
||||||
message: msg.appendedBeNilHint()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
return PredicateResult(status: .fail, message: msg)
|
|
||||||
}
|
|
||||||
return PredicateResult(
|
|
||||||
status: PredicateStatus(bool: expectedValue! == actualValue!),
|
|
||||||
message: msg
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A Nimble matcher that succeeds when the actual collection is equal to the expected collection.
|
|
||||||
/// Items must implement the Equatable protocol.
|
|
||||||
public func equal<T: Equatable>(_ expectedValue: [T]?) -> Predicate<[T]> {
|
|
||||||
return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in
|
|
||||||
let actualValue = try actualExpression.evaluate()
|
|
||||||
if expectedValue == nil || actualValue == nil {
|
|
||||||
if expectedValue == nil && actualValue != nil {
|
|
||||||
return PredicateResult(
|
|
||||||
status: .fail,
|
|
||||||
message: msg.appendedBeNilHint()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
return PredicateResult(
|
|
||||||
status: .fail,
|
|
||||||
message: msg
|
|
||||||
)
|
|
||||||
}
|
|
||||||
return PredicateResult(
|
|
||||||
bool: expectedValue! == actualValue!,
|
|
||||||
message: msg
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A Nimble matcher allowing comparison of collection with optional type
|
/// A Nimble matcher allowing comparison of collection with optional type
|
||||||
public func equal<T: Equatable>(_ expectedValue: [T?]) -> Predicate<[T?]> {
|
public func equal<T: Equatable>(_ expectedValue: [T?]) -> Predicate<[T?]> {
|
||||||
return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in
|
return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in
|
||||||
if let actualValue = try actualExpression.evaluate() {
|
guard let actualValue = try actualExpression.evaluate() else {
|
||||||
let doesNotMatch = PredicateResult(
|
|
||||||
status: .doesNotMatch,
|
|
||||||
message: msg
|
|
||||||
)
|
|
||||||
|
|
||||||
if expectedValue.count != actualValue.count {
|
|
||||||
return doesNotMatch
|
|
||||||
}
|
|
||||||
|
|
||||||
for (index, item) in actualValue.enumerated() {
|
|
||||||
let otherItem = expectedValue[index]
|
|
||||||
if item == nil && otherItem == nil {
|
|
||||||
continue
|
|
||||||
} else if item == nil && otherItem != nil {
|
|
||||||
return doesNotMatch
|
|
||||||
} else if item != nil && otherItem == nil {
|
|
||||||
return doesNotMatch
|
|
||||||
} else if item! != otherItem! {
|
|
||||||
return doesNotMatch
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return PredicateResult(
|
|
||||||
status: .matches,
|
|
||||||
message: msg
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
return PredicateResult(
|
return PredicateResult(
|
||||||
status: .fail,
|
status: .fail,
|
||||||
message: msg.appendedBeNilHint()
|
message: msg.appendedBeNilHint()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let matches = expectedValue == actualValue
|
||||||
|
return PredicateResult(bool: matches, message: msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,44 +55,45 @@ private func equal<T>(_ expectedValue: Set<T>?, stringify: @escaping (Set<T>?) -
|
||||||
var errorMessage: ExpectationMessage =
|
var errorMessage: ExpectationMessage =
|
||||||
.expectedActualValueTo("equal <\(stringify(expectedValue))>")
|
.expectedActualValueTo("equal <\(stringify(expectedValue))>")
|
||||||
|
|
||||||
if let expectedValue = expectedValue {
|
guard let expectedValue = expectedValue else {
|
||||||
if let actualValue = try actualExpression.evaluate() {
|
|
||||||
errorMessage = .expectedCustomValueTo(
|
|
||||||
"equal <\(stringify(expectedValue))>",
|
|
||||||
"<\(stringify(actualValue))>"
|
|
||||||
)
|
|
||||||
|
|
||||||
if expectedValue == actualValue {
|
|
||||||
return PredicateResult(
|
|
||||||
status: .matches,
|
|
||||||
message: errorMessage
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
let missing = expectedValue.subtracting(actualValue)
|
|
||||||
if missing.count > 0 {
|
|
||||||
errorMessage = errorMessage.appended(message: ", missing <\(stringify(missing))>")
|
|
||||||
}
|
|
||||||
|
|
||||||
let extra = actualValue.subtracting(expectedValue)
|
|
||||||
if extra.count > 0 {
|
|
||||||
errorMessage = errorMessage.appended(message: ", extra <\(stringify(extra))>")
|
|
||||||
}
|
|
||||||
return PredicateResult(
|
|
||||||
status: .doesNotMatch,
|
|
||||||
message: errorMessage
|
|
||||||
)
|
|
||||||
}
|
|
||||||
return PredicateResult(
|
|
||||||
status: .fail,
|
|
||||||
message: errorMessage.appendedBeNilHint()
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
return PredicateResult(
|
return PredicateResult(
|
||||||
status: .fail,
|
status: .fail,
|
||||||
message: errorMessage.appendedBeNilHint()
|
message: errorMessage.appendedBeNilHint()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guard let actualValue = try actualExpression.evaluate() else {
|
||||||
|
return PredicateResult(
|
||||||
|
status: .fail,
|
||||||
|
message: errorMessage.appendedBeNilHint()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
errorMessage = .expectedCustomValueTo(
|
||||||
|
"equal <\(stringify(expectedValue))>",
|
||||||
|
"<\(stringify(actualValue))>"
|
||||||
|
)
|
||||||
|
|
||||||
|
if expectedValue == actualValue {
|
||||||
|
return PredicateResult(
|
||||||
|
status: .matches,
|
||||||
|
message: errorMessage
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
let missing = expectedValue.subtracting(actualValue)
|
||||||
|
if missing.count > 0 {
|
||||||
|
errorMessage = errorMessage.appended(message: ", missing <\(stringify(missing))>")
|
||||||
|
}
|
||||||
|
|
||||||
|
let extra = actualValue.subtracting(expectedValue)
|
||||||
|
if extra.count > 0 {
|
||||||
|
errorMessage = errorMessage.appended(message: ", extra <\(stringify(extra))>")
|
||||||
|
}
|
||||||
|
return PredicateResult(
|
||||||
|
status: .doesNotMatch,
|
||||||
|
message: errorMessage
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,11 +137,11 @@ public func !=<T, C: Equatable>(lhs: Expectation<[T: C]>, rhs: [T: C]?) {
|
||||||
lhs.toNot(equal(rhs))
|
lhs.toNot(equal(rhs))
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
extension NMBObjCMatcher {
|
extension NMBObjCMatcher {
|
||||||
@objc public class func equalMatcher(_ expected: NSObject) -> NMBMatcher {
|
@objc public class func equalMatcher(_ expected: NSObject) -> NMBMatcher {
|
||||||
return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
|
return NMBPredicate { actualExpression in
|
||||||
return try! equal(expected).matches(actualExpression, failureMessage: failureMessage)
|
return try equal(expected).satisfies(actualExpression).toObjectiveC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,52 +7,67 @@ import Foundation
|
||||||
|
|
||||||
/// A Nimble matcher that succeeds when the actual Collection's count equals
|
/// A Nimble matcher that succeeds when the actual Collection's count equals
|
||||||
/// the expected value
|
/// the expected value
|
||||||
public func haveCount<T: Collection>(_ expectedValue: T.IndexDistance) -> Predicate<T> {
|
public func haveCount<T: Collection>(_ expectedValue: Int) -> Predicate<T> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate.define { actualExpression in
|
||||||
if let actualValue = try actualExpression.evaluate() {
|
if let actualValue = try actualExpression.evaluate() {
|
||||||
// swiftlint:disable:next line_length
|
let message = ExpectationMessage
|
||||||
failureMessage.postfixMessage = "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))"
|
.expectedCustomValueTo(
|
||||||
|
"have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))",
|
||||||
|
"\(actualValue.count)"
|
||||||
|
)
|
||||||
|
.appended(details: "Actual Value: \(stringify(actualValue))")
|
||||||
|
|
||||||
let result = expectedValue == actualValue.count
|
let result = expectedValue == actualValue.count
|
||||||
failureMessage.actualValue = "\(actualValue.count)"
|
return PredicateResult(bool: result, message: message)
|
||||||
failureMessage.extendedMessage = "Actual Value: \(stringify(actualValue))"
|
|
||||||
return result
|
|
||||||
} else {
|
} else {
|
||||||
return false
|
return PredicateResult(status: .fail, message: .fail(""))
|
||||||
}
|
}
|
||||||
}.requireNonNil
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A Nimble matcher that succeeds when the actual collection's count equals
|
/// A Nimble matcher that succeeds when the actual collection's count equals
|
||||||
/// the expected value
|
/// the expected value
|
||||||
public func haveCount(_ expectedValue: Int) -> Predicate<NMBCollection> {
|
public func haveCount(_ expectedValue: Int) -> Predicate<NMBCollection> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate { actualExpression in
|
||||||
if let actualValue = try actualExpression.evaluate() {
|
if let actualValue = try actualExpression.evaluate() {
|
||||||
// swiftlint:disable:next line_length
|
let message = ExpectationMessage
|
||||||
failureMessage.postfixMessage = "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))"
|
.expectedCustomValueTo(
|
||||||
|
"have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))",
|
||||||
|
"\(actualValue.count)"
|
||||||
|
)
|
||||||
|
.appended(details: "Actual Value: \(stringify(actualValue))")
|
||||||
|
|
||||||
let result = expectedValue == actualValue.count
|
let result = expectedValue == actualValue.count
|
||||||
failureMessage.actualValue = "\(actualValue.count)"
|
return PredicateResult(bool: result, message: message)
|
||||||
failureMessage.extendedMessage = "Actual Value: \(stringify(actualValue))"
|
|
||||||
return result
|
|
||||||
} else {
|
} else {
|
||||||
return false
|
return PredicateResult(status: .fail, message: .fail(""))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
extension NMBObjCMatcher {
|
extension NMBObjCMatcher {
|
||||||
@objc public class func haveCountMatcher(_ expected: NSNumber) -> NMBObjCMatcher {
|
@objc public class func haveCountMatcher(_ expected: NSNumber) -> NMBMatcher {
|
||||||
return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
|
return NMBPredicate { actualExpression in
|
||||||
let location = actualExpression.location
|
let location = actualExpression.location
|
||||||
let actualValue = try! actualExpression.evaluate()
|
let actualValue = try actualExpression.evaluate()
|
||||||
if let value = actualValue as? NMBCollection {
|
if let value = actualValue as? NMBCollection {
|
||||||
let expr = Expression(expression: ({ value as NMBCollection}), location: location)
|
let expr = Expression(expression: ({ value as NMBCollection}), location: location)
|
||||||
return try! haveCount(expected.intValue).matches(expr, failureMessage: failureMessage)
|
return try haveCount(expected.intValue).satisfies(expr).toObjectiveC()
|
||||||
} else if let actualValue = actualValue {
|
|
||||||
failureMessage.postfixMessage = "get type of NSArray, NSSet, NSDictionary, or NSHashTable"
|
|
||||||
failureMessage.actualValue = "\(String(describing: type(of: actualValue)))"
|
|
||||||
}
|
}
|
||||||
return false
|
|
||||||
|
let message: ExpectationMessage
|
||||||
|
if let actualValue = actualValue {
|
||||||
|
message = ExpectationMessage.expectedCustomValueTo(
|
||||||
|
"get type of NSArray, NSSet, NSDictionary, or NSHashTable",
|
||||||
|
"\(String(describing: type(of: actualValue)))"
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
message = ExpectationMessage
|
||||||
|
.expectedActualValueTo("have a collection with count \(stringify(expected.intValue))")
|
||||||
|
.appendedBeNilHint()
|
||||||
|
}
|
||||||
|
return NMBPredicateResult(status: .fail, message: message.toObjectiveC())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,26 +3,25 @@ import Foundation
|
||||||
/// A Nimble matcher that succeeds when the actual string satisfies the regular expression
|
/// A Nimble matcher that succeeds when the actual string satisfies the regular expression
|
||||||
/// described by the expected string.
|
/// described by the expected string.
|
||||||
public func match(_ expectedValue: String?) -> Predicate<String> {
|
public func match(_ expectedValue: String?) -> Predicate<String> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate.simple("match <\(stringify(expectedValue))>") { actualExpression in
|
||||||
failureMessage.postfixMessage = "match <\(stringify(expectedValue))>"
|
|
||||||
|
|
||||||
if let actual = try actualExpression.evaluate() {
|
if let actual = try actualExpression.evaluate() {
|
||||||
if let regexp = expectedValue {
|
if let regexp = expectedValue {
|
||||||
return actual.range(of: regexp, options: .regularExpression) != nil
|
let bool = actual.range(of: regexp, options: .regularExpression) != nil
|
||||||
|
return PredicateStatus(bool: bool)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return .fail
|
||||||
}.requireNonNil
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
|
|
||||||
extension NMBObjCMatcher {
|
extension NMBObjCMatcher {
|
||||||
@objc public class func matchMatcher(_ expected: NSString) -> NMBMatcher {
|
@objc public class func matchMatcher(_ expected: NSString) -> NMBMatcher {
|
||||||
return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
|
return NMBPredicate { actualExpression in
|
||||||
let actual = actualExpression.cast { $0 as? String }
|
let actual = actualExpression.cast { $0 as? String }
|
||||||
return try! match(expected.description).matches(actual, failureMessage: failureMessage)
|
return try match(expected.description).satisfies(actual).toObjectiveC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,16 +6,24 @@ import Foundation
|
||||||
/// Errors are tried to be compared by their implementation of Equatable,
|
/// Errors are tried to be compared by their implementation of Equatable,
|
||||||
/// otherwise they fallback to comparison by _domain and _code.
|
/// otherwise they fallback to comparison by _domain and _code.
|
||||||
public func matchError<T: Error>(_ error: T) -> Predicate<Error> {
|
public func matchError<T: Error>(_ error: T) -> Predicate<Error> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate.define { actualExpression in
|
||||||
let actualError: Error? = try actualExpression.evaluate()
|
let actualError = try actualExpression.evaluate()
|
||||||
|
|
||||||
|
let failureMessage = FailureMessage()
|
||||||
|
setFailureMessageForError(
|
||||||
|
failureMessage,
|
||||||
|
postfixMessageVerb: "match",
|
||||||
|
actualError: actualError,
|
||||||
|
error: error
|
||||||
|
)
|
||||||
|
|
||||||
setFailureMessageForError(failureMessage, postfixMessageVerb: "match", actualError: actualError, error: error)
|
|
||||||
var matches = false
|
var matches = false
|
||||||
if let actualError = actualError, errorMatchesExpectedError(actualError, expectedError: error) {
|
if let actualError = actualError, errorMatchesExpectedError(actualError, expectedError: error) {
|
||||||
matches = true
|
matches = true
|
||||||
}
|
}
|
||||||
return matches
|
|
||||||
}.requireNonNil
|
return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A Nimble matcher that succeeds when the actual expression evaluates to an
|
/// A Nimble matcher that succeeds when the actual expression evaluates to an
|
||||||
|
@ -24,35 +32,45 @@ public func matchError<T: Error>(_ error: T) -> Predicate<Error> {
|
||||||
/// Errors are tried to be compared by their implementation of Equatable,
|
/// Errors are tried to be compared by their implementation of Equatable,
|
||||||
/// otherwise they fallback to comparision by _domain and _code.
|
/// otherwise they fallback to comparision by _domain and _code.
|
||||||
public func matchError<T: Error & Equatable>(_ error: T) -> Predicate<Error> {
|
public func matchError<T: Error & Equatable>(_ error: T) -> Predicate<Error> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate.define { actualExpression in
|
||||||
let actualError: Error? = try actualExpression.evaluate()
|
let actualError = try actualExpression.evaluate()
|
||||||
|
|
||||||
setFailureMessageForError(failureMessage, postfixMessageVerb: "match", actualError: actualError, error: error)
|
let failureMessage = FailureMessage()
|
||||||
|
setFailureMessageForError(
|
||||||
|
failureMessage,
|
||||||
|
postfixMessageVerb: "match",
|
||||||
|
actualError: actualError,
|
||||||
|
error: error
|
||||||
|
)
|
||||||
|
|
||||||
var matches = false
|
var matches = false
|
||||||
if let actualError = actualError as? T, error == actualError {
|
if let actualError = actualError as? T, error == actualError {
|
||||||
matches = true
|
matches = true
|
||||||
}
|
}
|
||||||
return matches
|
|
||||||
}.requireNonNil
|
return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A Nimble matcher that succeeds when the actual expression evaluates to an
|
/// A Nimble matcher that succeeds when the actual expression evaluates to an
|
||||||
/// error of the specified type
|
/// error of the specified type
|
||||||
public func matchError<T: Error>(_ errorType: T.Type) -> Predicate<Error> {
|
public func matchError<T: Error>(_ errorType: T.Type) -> Predicate<Error> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate.define { actualExpression in
|
||||||
let actualError: Error? = try actualExpression.evaluate()
|
let actualError = try actualExpression.evaluate()
|
||||||
|
|
||||||
|
let failureMessage = FailureMessage()
|
||||||
setFailureMessageForError(
|
setFailureMessageForError(
|
||||||
failureMessage,
|
failureMessage,
|
||||||
postfixMessageVerb: "match",
|
postfixMessageVerb: "match",
|
||||||
actualError: actualError,
|
actualError: actualError,
|
||||||
errorType: errorType
|
errorType: errorType
|
||||||
)
|
)
|
||||||
|
|
||||||
var matches = false
|
var matches = false
|
||||||
if actualError as? T != nil {
|
if actualError as? T != nil {
|
||||||
matches = true
|
matches = true
|
||||||
}
|
}
|
||||||
return matches
|
|
||||||
}.requireNonNil
|
return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
// `CGFloat` is in Foundation (swift-corelibs-foundation) on Linux.
|
// `CGFloat` is in Foundation (swift-corelibs-foundation) on Linux.
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
import CoreGraphics
|
import CoreGraphics
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ extension Matcher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
/// Objective-C interface to the Swift variant of Matcher.
|
/// Objective-C interface to the Swift variant of Matcher.
|
||||||
@objc public protocol NMBMatcher {
|
@objc public protocol NMBMatcher {
|
||||||
func matches(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool
|
func matches(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool
|
||||||
|
@ -41,7 +41,8 @@ public protocol NMBContainer {
|
||||||
func contains(_ anObject: Any) -> Bool
|
func contains(_ anObject: Any) -> Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
|
// swiftlint:disable:next todo
|
||||||
// FIXME: NSHashTable can not conform to NMBContainer since swift-DEVELOPMENT-SNAPSHOT-2016-04-25-a
|
// FIXME: NSHashTable can not conform to NMBContainer since swift-DEVELOPMENT-SNAPSHOT-2016-04-25-a
|
||||||
//extension NSHashTable : NMBContainer {} // Corelibs Foundation does not include this class yet
|
//extension NSHashTable : NMBContainer {} // Corelibs Foundation does not include this class yet
|
||||||
#endif
|
#endif
|
||||||
|
@ -54,7 +55,7 @@ public protocol NMBCollection {
|
||||||
var count: Int { get }
|
var count: Int { get }
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
extension NSHashTable: NMBCollection {} // Corelibs Foundation does not include these classes yet
|
extension NSHashTable: NMBCollection {} // Corelibs Foundation does not include these classes yet
|
||||||
extension NSMapTable: NMBCollection {}
|
extension NSMapTable: NMBCollection {}
|
||||||
#endif
|
#endif
|
||||||
|
@ -131,7 +132,7 @@ extension NSDate: TestOutputStringConvertible {
|
||||||
/// beGreaterThan(), beGreaterThanOrEqualTo(), and equal() matchers.
|
/// beGreaterThan(), beGreaterThanOrEqualTo(), and equal() matchers.
|
||||||
///
|
///
|
||||||
/// Types that conform to Swift's Comparable protocol will work implicitly too
|
/// Types that conform to Swift's Comparable protocol will work implicitly too
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
@objc public protocol NMBComparable {
|
@objc public protocol NMBComparable {
|
||||||
func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult
|
func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult
|
||||||
}
|
}
|
||||||
|
@ -144,11 +145,13 @@ public protocol NMBComparable {
|
||||||
|
|
||||||
extension NSNumber: NMBComparable {
|
extension NSNumber: NMBComparable {
|
||||||
public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult {
|
public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult {
|
||||||
|
// swiftlint:disable:next force_cast
|
||||||
return compare(otherObject as! NSNumber)
|
return compare(otherObject as! NSNumber)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
extension NSString: NMBComparable {
|
extension NSString: NMBComparable {
|
||||||
public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult {
|
public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult {
|
||||||
|
// swiftlint:disable:next force_cast
|
||||||
return compare(otherObject as! String)
|
return compare(otherObject as! String)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,9 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
// A workaround to SR-6419.
|
|
||||||
extension NotificationCenter {
|
|
||||||
#if !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS))
|
|
||||||
#if swift(>=4.0)
|
|
||||||
#if swift(>=4.0.2)
|
|
||||||
#else
|
|
||||||
func addObserver(forName name: Notification.Name?, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Void) -> NSObjectProtocol {
|
|
||||||
return addObserver(forName: name, object: obj, queue: queue, usingBlock: block)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#elseif swift(>=3.2)
|
|
||||||
#if swift(>=3.2.2)
|
|
||||||
#else
|
|
||||||
// swiftlint:disable:next line_length
|
|
||||||
func addObserver(forName name: Notification.Name?, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Void) -> NSObjectProtocol {
|
|
||||||
return addObserver(forName: name, object: obj, queue: queue, usingBlock: block)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
// swiftlint:disable:next line_length
|
|
||||||
func addObserver(forName name: Notification.Name?, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Void) -> NSObjectProtocol {
|
|
||||||
return addObserver(forName: name, object: obj, queue: queue, usingBlock: block)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
internal class NotificationCollector {
|
internal class NotificationCollector {
|
||||||
private(set) var observedNotifications: [Notification]
|
private(set) var observedNotifications: [Notification]
|
||||||
private let notificationCenter: NotificationCenter
|
private let notificationCenter: NotificationCenter
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
private var token: AnyObject?
|
private var token: AnyObject?
|
||||||
#else
|
#else
|
||||||
private var token: NSObjectProtocol?
|
private var token: NSObjectProtocol?
|
||||||
|
@ -43,14 +16,14 @@ internal class NotificationCollector {
|
||||||
|
|
||||||
func startObserving() {
|
func startObserving() {
|
||||||
// swiftlint:disable:next line_length
|
// swiftlint:disable:next line_length
|
||||||
self.token = self.notificationCenter.addObserver(forName: nil, object: nil, queue: nil, using: { [weak self] n in
|
self.token = self.notificationCenter.addObserver(forName: nil, object: nil, queue: nil) { [weak self] notification in
|
||||||
// linux-swift gets confused by .append(n)
|
// linux-swift gets confused by .append(n)
|
||||||
self?.observedNotifications.append(n)
|
self?.observedNotifications.append(notification)
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deinit {
|
deinit {
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
if let token = self.token {
|
if let token = self.token {
|
||||||
self.notificationCenter.removeObserver(token)
|
self.notificationCenter.removeObserver(token)
|
||||||
}
|
}
|
||||||
|
@ -74,7 +47,8 @@ public func postNotifications<T>(
|
||||||
let collector = NotificationCollector(notificationCenter: center)
|
let collector = NotificationCollector(notificationCenter: center)
|
||||||
collector.startObserving()
|
collector.startObserving()
|
||||||
var once: Bool = false
|
var once: Bool = false
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
|
||||||
|
return Predicate { actualExpression in
|
||||||
let collectorNotificationsExpression = Expression(memoizedExpression: { _ in
|
let collectorNotificationsExpression = Expression(memoizedExpression: { _ in
|
||||||
return collector.observedNotifications
|
return collector.observedNotifications
|
||||||
}, location: actualExpression.location, withoutCaching: true)
|
}, location: actualExpression.location, withoutCaching: true)
|
||||||
|
@ -85,12 +59,13 @@ public func postNotifications<T>(
|
||||||
_ = try actualExpression.evaluate()
|
_ = try actualExpression.evaluate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let failureMessage = FailureMessage()
|
||||||
let match = try notificationsMatcher.matches(collectorNotificationsExpression, failureMessage: failureMessage)
|
let match = try notificationsMatcher.matches(collectorNotificationsExpression, failureMessage: failureMessage)
|
||||||
if collector.observedNotifications.isEmpty {
|
if collector.observedNotifications.isEmpty {
|
||||||
failureMessage.actualValue = "no notifications"
|
failureMessage.actualValue = "no notifications"
|
||||||
} else {
|
} else {
|
||||||
failureMessage.actualValue = "<\(stringify(collector.observedNotifications))>"
|
failureMessage.actualValue = "<\(stringify(collector.observedNotifications))>"
|
||||||
}
|
}
|
||||||
return match
|
return PredicateResult(bool: match, message: failureMessage.toExpectationMessage())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,6 +218,7 @@ extension Predicate: Matcher {
|
||||||
extension Predicate {
|
extension Predicate {
|
||||||
// Someday, make this public? Needs documentation
|
// Someday, make this public? Needs documentation
|
||||||
internal func after(f: @escaping (Expression<T>, PredicateResult) throws -> PredicateResult) -> Predicate<T> {
|
internal func after(f: @escaping (Expression<T>, PredicateResult) throws -> PredicateResult) -> Predicate<T> {
|
||||||
|
// swiftlint:disable:previous identifier_name
|
||||||
return Predicate { actual -> PredicateResult in
|
return Predicate { actual -> PredicateResult in
|
||||||
let result = try self.satisfies(actual)
|
let result = try self.satisfies(actual)
|
||||||
return try f(actual, result)
|
return try f(actual, result)
|
||||||
|
@ -241,8 +242,8 @@ extension Predicate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
public typealias PredicateBlock = (_ actualExpression: Expression<NSObject>) -> NMBPredicateResult
|
public typealias PredicateBlock = (_ actualExpression: Expression<NSObject>) throws -> NMBPredicateResult
|
||||||
|
|
||||||
public class NMBPredicate: NSObject {
|
public class NMBPredicate: NSObject {
|
||||||
private let predicate: PredicateBlock
|
private let predicate: PredicateBlock
|
||||||
|
@ -251,9 +252,13 @@ public class NMBPredicate: NSObject {
|
||||||
self.predicate = predicate
|
self.predicate = predicate
|
||||||
}
|
}
|
||||||
|
|
||||||
func satisfies(_ expression: @escaping () -> NSObject?, location: SourceLocation) -> NMBPredicateResult {
|
func satisfies(_ expression: @escaping () throws -> NSObject?, location: SourceLocation) -> NMBPredicateResult {
|
||||||
let expr = Expression(expression: expression, location: location)
|
let expr = Expression(expression: expression, location: location)
|
||||||
return self.predicate(expr)
|
do {
|
||||||
|
return try self.predicate(expr)
|
||||||
|
} catch let error {
|
||||||
|
return PredicateResult(status: .fail, message: .fail("unexpected error thrown: <\(error)>")).toObjectiveC()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +312,7 @@ final public class NMBPredicateStatus: NSObject {
|
||||||
public static let doesNotMatch: NMBPredicateStatus = NMBPredicateStatus(status: 1)
|
public static let doesNotMatch: NMBPredicateStatus = NMBPredicateStatus(status: 1)
|
||||||
public static let fail: NMBPredicateStatus = NMBPredicateStatus(status: 2)
|
public static let fail: NMBPredicateStatus = NMBPredicateStatus(status: 2)
|
||||||
|
|
||||||
public override var hashValue: Int { return self.status.hashValue }
|
public override var hash: Int { return self.status.hashValue }
|
||||||
|
|
||||||
public override func isEqual(_ object: Any?) -> Bool {
|
public override func isEqual(_ object: Any?) -> Bool {
|
||||||
guard let otherPredicate = object as? NMBPredicateStatus else {
|
guard let otherPredicate = object as? NMBPredicateStatus else {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import Foundation
|
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 (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE
|
#if canImport(Darwin) && !SWIFT_PACKAGE
|
||||||
|
|
||||||
/// A Nimble matcher that succeeds when the actual expression raises an
|
/// A Nimble matcher that succeeds when the actual expression raises an
|
||||||
/// exception with the specified name, reason, and/or userInfo.
|
/// exception with the specified name, reason, and/or userInfo.
|
||||||
|
@ -17,18 +17,21 @@ public func raiseException(
|
||||||
reason: String? = nil,
|
reason: String? = nil,
|
||||||
userInfo: NSDictionary? = nil,
|
userInfo: NSDictionary? = nil,
|
||||||
closure: ((NSException) -> Void)? = nil) -> Predicate<Any> {
|
closure: ((NSException) -> Void)? = nil) -> Predicate<Any> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate { actualExpression in
|
||||||
|
|
||||||
var exception: NSException?
|
var exception: NSException?
|
||||||
let capture = NMBExceptionCapture(handler: ({ e in
|
let capture = NMBExceptionCapture(handler: ({ e in
|
||||||
exception = e
|
exception = e
|
||||||
}), finally: nil)
|
}), finally: nil)
|
||||||
|
|
||||||
capture.tryBlock {
|
do {
|
||||||
_ = try! actualExpression.evaluate()
|
try capture.tryBlockThrows {
|
||||||
return
|
_ = try actualExpression.evaluate()
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
return PredicateResult(status: .fail, message: .fail("unexpected error thrown: <\(error)>"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let failureMessage = FailureMessage()
|
||||||
setFailureMessageForException(
|
setFailureMessageForException(
|
||||||
failureMessage,
|
failureMessage,
|
||||||
exception: exception,
|
exception: exception,
|
||||||
|
@ -37,13 +40,15 @@ public func raiseException(
|
||||||
userInfo: userInfo,
|
userInfo: userInfo,
|
||||||
closure: closure
|
closure: closure
|
||||||
)
|
)
|
||||||
return exceptionMatchesNonNilFieldsOrClosure(
|
|
||||||
|
let matches = exceptionMatchesNonNilFieldsOrClosure(
|
||||||
exception,
|
exception,
|
||||||
named: named,
|
named: named,
|
||||||
reason: reason,
|
reason: reason,
|
||||||
userInfo: userInfo,
|
userInfo: userInfo,
|
||||||
closure: closure
|
closure: closure
|
||||||
)
|
)
|
||||||
|
return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,10 +122,12 @@ internal func exceptionMatchesNonNilFieldsOrClosure(
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NMBObjCRaiseExceptionMatcher: NSObject, NMBMatcher {
|
public class NMBObjCRaiseExceptionMatcher: NSObject, NMBMatcher {
|
||||||
|
// swiftlint:disable identifier_name
|
||||||
internal var _name: String?
|
internal var _name: String?
|
||||||
internal var _reason: String?
|
internal var _reason: String?
|
||||||
internal var _userInfo: NSDictionary?
|
internal var _userInfo: NSDictionary?
|
||||||
internal var _block: ((NSException) -> Void)?
|
internal var _block: ((NSException) -> Void)?
|
||||||
|
// swiftlint:enable identifier_name
|
||||||
|
|
||||||
internal init(name: String?, reason: String?, userInfo: NSDictionary?, block: ((NSException) -> Void)?) {
|
internal init(name: String?, reason: String?, userInfo: NSDictionary?, block: ((NSException) -> Void)?) {
|
||||||
_name = name
|
_name = name
|
||||||
|
@ -133,12 +140,17 @@ public class NMBObjCRaiseExceptionMatcher: NSObject, NMBMatcher {
|
||||||
let block: () -> Any? = ({ _ = actualBlock(); return nil })
|
let block: () -> Any? = ({ _ = actualBlock(); return nil })
|
||||||
let expr = Expression(expression: block, location: location)
|
let expr = Expression(expression: block, location: location)
|
||||||
|
|
||||||
return try! raiseException(
|
do {
|
||||||
named: _name,
|
return try raiseException(
|
||||||
reason: _reason,
|
named: _name,
|
||||||
userInfo: _userInfo,
|
reason: _reason,
|
||||||
closure: _block
|
userInfo: _userInfo,
|
||||||
).matches(expr, failureMessage: failureMessage)
|
closure: _block
|
||||||
|
).matches(expr, failureMessage: failureMessage)
|
||||||
|
} catch let error {
|
||||||
|
failureMessage.stringValue = "unexpected error thrown: <\(error)>"
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc public func doesNotMatch(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool {
|
@objc public func doesNotMatch(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool {
|
||||||
|
|
|
@ -4,33 +4,11 @@ import Foundation
|
||||||
/// provided in the variable list of matchers.
|
/// provided in the variable list of matchers.
|
||||||
public func satisfyAllOf<T, U>(_ matchers: U...) -> Predicate<T>
|
public func satisfyAllOf<T, U>(_ matchers: U...) -> Predicate<T>
|
||||||
where U: Matcher, U.ValueType == T {
|
where U: Matcher, U.ValueType == T {
|
||||||
return satisfyAllOf(matchers)
|
return satisfyAllOf(matchers.map { $0.predicate })
|
||||||
}
|
|
||||||
|
|
||||||
/// Deprecated. Please use `satisfyAnyOf<T>(_) -> Predicate<T>` instead.
|
|
||||||
internal func satisfyAllOf<T, U>(_ matchers: [U]) -> Predicate<T>
|
|
||||||
where U: Matcher, U.ValueType == T {
|
|
||||||
return NonNilMatcherFunc<T> { actualExpression, failureMessage in
|
|
||||||
let postfixMessages = NSMutableArray()
|
|
||||||
var matches = true
|
|
||||||
for matcher in matchers {
|
|
||||||
if try matcher.doesNotMatch(actualExpression, failureMessage: failureMessage) {
|
|
||||||
matches = false
|
|
||||||
}
|
|
||||||
postfixMessages.add(NSString(string: "{\(failureMessage.postfixMessage)}"))
|
|
||||||
}
|
|
||||||
|
|
||||||
failureMessage.postfixMessage = "match all of: " + postfixMessages.componentsJoined(by: ", and ")
|
|
||||||
if let actualValue = try actualExpression.evaluate() {
|
|
||||||
failureMessage.actualValue = "\(actualValue)"
|
|
||||||
}
|
|
||||||
|
|
||||||
return matches
|
|
||||||
}.predicate
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal func satisfyAllOf<T>(_ predicates: [Predicate<T>]) -> Predicate<T> {
|
internal func satisfyAllOf<T>(_ predicates: [Predicate<T>]) -> Predicate<T> {
|
||||||
return Predicate { actualExpression in
|
return Predicate.define { actualExpression in
|
||||||
var postfixMessages = [String]()
|
var postfixMessages = [String]()
|
||||||
var matches = true
|
var matches = true
|
||||||
for predicate in predicates {
|
for predicate in predicates {
|
||||||
|
@ -53,18 +31,15 @@ internal func satisfyAllOf<T>(_ predicates: [Predicate<T>]) -> Predicate<T> {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return PredicateResult(
|
return PredicateResult(bool: matches, message: msg)
|
||||||
bool: matches,
|
}
|
||||||
message: msg
|
|
||||||
)
|
|
||||||
}.requireNonNil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public func && <T>(left: Predicate<T>, right: Predicate<T>) -> Predicate<T> {
|
public func && <T>(left: Predicate<T>, right: Predicate<T>) -> Predicate<T> {
|
||||||
return satisfyAllOf(left, right)
|
return satisfyAllOf(left, right)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
extension NMBObjCMatcher {
|
extension NMBObjCMatcher {
|
||||||
@objc public class func satisfyAllOfMatcher(_ matchers: [NMBMatcher]) -> NMBPredicate {
|
@objc public class func satisfyAllOfMatcher(_ matchers: [NMBMatcher]) -> NMBPredicate {
|
||||||
return NMBPredicate { actualExpression in
|
return NMBPredicate { actualExpression in
|
||||||
|
@ -82,11 +57,15 @@ extension NMBObjCMatcher {
|
||||||
let elementEvaluator = Predicate<NSObject> { expression in
|
let elementEvaluator = Predicate<NSObject> { expression in
|
||||||
if let predicate = matcher as? NMBPredicate {
|
if let predicate = matcher as? NMBPredicate {
|
||||||
// swiftlint:disable:next line_length
|
// swiftlint:disable:next line_length
|
||||||
return predicate.satisfies({ try! expression.evaluate() }, location: actualExpression.location).toSwift()
|
return predicate.satisfies({ try expression.evaluate() }, location: actualExpression.location).toSwift()
|
||||||
} else {
|
} else {
|
||||||
let failureMessage = FailureMessage()
|
let failureMessage = FailureMessage()
|
||||||
// swiftlint:disable:next line_length
|
let success = matcher.matches(
|
||||||
let success = matcher.matches({ try! expression.evaluate() }, failureMessage: failureMessage, location: actualExpression.location)
|
// swiftlint:disable:next force_try
|
||||||
|
{ try! expression.evaluate() },
|
||||||
|
failureMessage: failureMessage,
|
||||||
|
location: actualExpression.location
|
||||||
|
)
|
||||||
return PredicateResult(bool: success, message: failureMessage.toExpectationMessage())
|
return PredicateResult(bool: success, message: failureMessage.toExpectationMessage())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,7 +73,7 @@ extension NMBObjCMatcher {
|
||||||
elementEvaluators.append(elementEvaluator)
|
elementEvaluators.append(elementEvaluator)
|
||||||
}
|
}
|
||||||
|
|
||||||
return try! satisfyAllOf(elementEvaluators).satisfies(actualExpression).toObjectiveC()
|
return try satisfyAllOf(elementEvaluators).satisfies(actualExpression).toObjectiveC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,33 +4,11 @@ import Foundation
|
||||||
/// provided in the variable list of matchers.
|
/// provided in the variable list of matchers.
|
||||||
public func satisfyAnyOf<T, U>(_ matchers: U...) -> Predicate<T>
|
public func satisfyAnyOf<T, U>(_ matchers: U...) -> Predicate<T>
|
||||||
where U: Matcher, U.ValueType == T {
|
where U: Matcher, U.ValueType == T {
|
||||||
return satisfyAnyOf(matchers)
|
return satisfyAnyOf(matchers.map { $0.predicate })
|
||||||
}
|
|
||||||
|
|
||||||
/// Deprecated. Please use `satisfyAnyOf<T>(_) -> Predicate<T>` instead.
|
|
||||||
internal func satisfyAnyOf<T, U>(_ matchers: [U]) -> Predicate<T>
|
|
||||||
where U: Matcher, U.ValueType == T {
|
|
||||||
return NonNilMatcherFunc<T> { actualExpression, failureMessage in
|
|
||||||
let postfixMessages = NSMutableArray()
|
|
||||||
var matches = false
|
|
||||||
for matcher in matchers {
|
|
||||||
if try matcher.matches(actualExpression, failureMessage: failureMessage) {
|
|
||||||
matches = true
|
|
||||||
}
|
|
||||||
postfixMessages.add(NSString(string: "{\(failureMessage.postfixMessage)}"))
|
|
||||||
}
|
|
||||||
|
|
||||||
failureMessage.postfixMessage = "match one of: " + postfixMessages.componentsJoined(by: ", or ")
|
|
||||||
if let actualValue = try actualExpression.evaluate() {
|
|
||||||
failureMessage.actualValue = "\(actualValue)"
|
|
||||||
}
|
|
||||||
|
|
||||||
return matches
|
|
||||||
}.predicate
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal func satisfyAnyOf<T>(_ predicates: [Predicate<T>]) -> Predicate<T> {
|
internal func satisfyAnyOf<T>(_ predicates: [Predicate<T>]) -> Predicate<T> {
|
||||||
return Predicate { actualExpression in
|
return Predicate.define { actualExpression in
|
||||||
var postfixMessages = [String]()
|
var postfixMessages = [String]()
|
||||||
var matches = false
|
var matches = false
|
||||||
for predicate in predicates {
|
for predicate in predicates {
|
||||||
|
@ -53,11 +31,8 @@ internal func satisfyAnyOf<T>(_ predicates: [Predicate<T>]) -> Predicate<T> {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return PredicateResult(
|
return PredicateResult(bool: matches, message: msg)
|
||||||
status: PredicateStatus(bool: matches),
|
}
|
||||||
message: msg
|
|
||||||
)
|
|
||||||
}.requireNonNil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public func || <T>(left: Predicate<T>, right: Predicate<T>) -> Predicate<T> {
|
public func || <T>(left: Predicate<T>, right: Predicate<T>) -> Predicate<T> {
|
||||||
|
@ -72,7 +47,7 @@ public func || <T>(left: MatcherFunc<T>, right: MatcherFunc<T>) -> Predicate<T>
|
||||||
return satisfyAnyOf(left, right)
|
return satisfyAnyOf(left, right)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
extension NMBObjCMatcher {
|
extension NMBObjCMatcher {
|
||||||
@objc public class func satisfyAnyOfMatcher(_ matchers: [NMBMatcher]) -> NMBPredicate {
|
@objc public class func satisfyAnyOfMatcher(_ matchers: [NMBMatcher]) -> NMBPredicate {
|
||||||
return NMBPredicate { actualExpression in
|
return NMBPredicate { actualExpression in
|
||||||
|
@ -90,11 +65,15 @@ extension NMBObjCMatcher {
|
||||||
let elementEvaluator = Predicate<NSObject> { expression in
|
let elementEvaluator = Predicate<NSObject> { expression in
|
||||||
if let predicate = matcher as? NMBPredicate {
|
if let predicate = matcher as? NMBPredicate {
|
||||||
// swiftlint:disable:next line_length
|
// swiftlint:disable:next line_length
|
||||||
return predicate.satisfies({ try! expression.evaluate() }, location: actualExpression.location).toSwift()
|
return predicate.satisfies({ try expression.evaluate() }, location: actualExpression.location).toSwift()
|
||||||
} else {
|
} else {
|
||||||
let failureMessage = FailureMessage()
|
let failureMessage = FailureMessage()
|
||||||
// swiftlint:disable:next line_length
|
let success = matcher.matches(
|
||||||
let success = matcher.matches({ try! expression.evaluate() }, failureMessage: failureMessage, location: actualExpression.location)
|
// swiftlint:disable:next force_try
|
||||||
|
{ try! expression.evaluate() },
|
||||||
|
failureMessage: failureMessage,
|
||||||
|
location: actualExpression.location
|
||||||
|
)
|
||||||
return PredicateResult(bool: success, message: failureMessage.toExpectationMessage())
|
return PredicateResult(bool: success, message: failureMessage.toExpectationMessage())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,7 +81,7 @@ extension NMBObjCMatcher {
|
||||||
elementEvaluators.append(elementEvaluator)
|
elementEvaluators.append(elementEvaluator)
|
||||||
}
|
}
|
||||||
|
|
||||||
return try! satisfyAnyOf(elementEvaluators).satisfies(actualExpression).toObjectiveC()
|
return try satisfyAnyOf(elementEvaluators).satisfies(actualExpression).toObjectiveC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public func throwAssertion() -> Predicate<Void> {
|
public func throwAssertion() -> Predicate<Void> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate { actualExpression in
|
||||||
#if arch(x86_64) && (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE
|
#if arch(x86_64) && canImport(Darwin) && !SWIFT_PACKAGE
|
||||||
failureMessage.postfixMessage = "throw an assertion"
|
let message = ExpectationMessage.expectedTo("throw an assertion")
|
||||||
failureMessage.actualValue = nil
|
|
||||||
|
|
||||||
var succeeded = true
|
|
||||||
|
|
||||||
|
var actualError: Error?
|
||||||
let caughtException: BadInstructionException? = catchBadInstruction {
|
let caughtException: BadInstructionException? = catchBadInstruction {
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
if !NimbleEnvironment.activeInstance.suppressTVOSAssertionWarning {
|
if !NimbleEnvironment.activeInstance.suppressTVOSAssertionWarning {
|
||||||
|
@ -27,30 +25,27 @@ public func throwAssertion() -> Predicate<Void> {
|
||||||
#endif
|
#endif
|
||||||
do {
|
do {
|
||||||
try actualExpression.evaluate()
|
try actualExpression.evaluate()
|
||||||
} catch let error {
|
} catch {
|
||||||
succeeded = false
|
actualError = error
|
||||||
failureMessage.postfixMessage += "; threw error instead <\(error)>"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !succeeded {
|
if let actualError = actualError {
|
||||||
return false
|
return PredicateResult(
|
||||||
|
bool: false,
|
||||||
|
message: message.appended(message: "; threw error instead <\(actualError)>")
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
return PredicateResult(bool: caughtException != nil, message: message)
|
||||||
}
|
}
|
||||||
|
|
||||||
if caughtException == nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
#elseif SWIFT_PACKAGE
|
#elseif SWIFT_PACKAGE
|
||||||
fatalError("The throwAssertion Nimble matcher does not currently support Swift CLI." +
|
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" +
|
" You can silence this error by placing the test case inside an #if !SWIFT_PACKAGE" +
|
||||||
" conditional statement")
|
" conditional statement")
|
||||||
#else
|
#else
|
||||||
fatalError("The throwAssertion Nimble matcher can only run on x86_64 platforms with " +
|
fatalError("The throwAssertion Nimble matcher can only run on x86_64 platforms with " +
|
||||||
"Objective-C (e.g. Mac, iPhone 5s or later simulators). You can silence this error " +
|
"Objective-C (e.g. macOS, iPhone 5s or later simulators). You can silence this error " +
|
||||||
"by placing the test case inside an #if arch(x86_64) or (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) conditional statement")
|
"by placing the test case inside an #if arch(x86_64) or canImport(Darwin) conditional statement")
|
||||||
// swiftlint:disable:previous line_length
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,22 +12,19 @@ import Foundation
|
||||||
/// nil arguments indicates that the matcher should not attempt to match against
|
/// nil arguments indicates that the matcher should not attempt to match against
|
||||||
/// that parameter.
|
/// that parameter.
|
||||||
public func throwError() -> Predicate<Any> {
|
public func throwError() -> Predicate<Any> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate { actualExpression in
|
||||||
|
|
||||||
var actualError: Error?
|
var actualError: Error?
|
||||||
do {
|
do {
|
||||||
_ = try actualExpression.evaluate()
|
_ = try actualExpression.evaluate()
|
||||||
} catch let catchedError {
|
} catch {
|
||||||
actualError = catchedError
|
actualError = error
|
||||||
}
|
}
|
||||||
|
|
||||||
failureMessage.postfixMessage = "throw any error"
|
|
||||||
if let actualError = actualError {
|
if let actualError = actualError {
|
||||||
failureMessage.actualValue = "<\(actualError)>"
|
return PredicateResult(bool: true, message: .expectedCustomValueTo("throw any error", "<\(actualError)>"))
|
||||||
} else {
|
} else {
|
||||||
failureMessage.actualValue = "no error"
|
return PredicateResult(bool: false, message: .expectedCustomValueTo("throw any error", "no error"))
|
||||||
}
|
}
|
||||||
return actualError != nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,15 +40,15 @@ public func throwError() -> Predicate<Any> {
|
||||||
/// nil arguments indicates that the matcher should not attempt to match against
|
/// nil arguments indicates that the matcher should not attempt to match against
|
||||||
/// that parameter.
|
/// that parameter.
|
||||||
public func throwError<T: Error>(_ error: T, closure: ((Error) -> Void)? = nil) -> Predicate<Any> {
|
public func throwError<T: Error>(_ error: T, closure: ((Error) -> Void)? = nil) -> Predicate<Any> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate { actualExpression in
|
||||||
|
|
||||||
var actualError: Error?
|
var actualError: Error?
|
||||||
do {
|
do {
|
||||||
_ = try actualExpression.evaluate()
|
_ = try actualExpression.evaluate()
|
||||||
} catch let catchedError {
|
} catch {
|
||||||
actualError = catchedError
|
actualError = error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let failureMessage = FailureMessage()
|
||||||
setFailureMessageForError(
|
setFailureMessageForError(
|
||||||
failureMessage,
|
failureMessage,
|
||||||
actualError: actualError,
|
actualError: actualError,
|
||||||
|
@ -59,20 +56,23 @@ public func throwError<T: Error>(_ error: T, closure: ((Error) -> Void)? = nil)
|
||||||
errorType: nil,
|
errorType: nil,
|
||||||
closure: closure
|
closure: closure
|
||||||
)
|
)
|
||||||
|
|
||||||
var matches = false
|
var matches = false
|
||||||
if let actualError = actualError, errorMatchesExpectedError(actualError, expectedError: error) {
|
if let actualError = actualError, errorMatchesExpectedError(actualError, expectedError: error) {
|
||||||
matches = true
|
matches = true
|
||||||
|
|
||||||
if let closure = closure {
|
if let closure = closure {
|
||||||
let assertions = gatherFailingExpectations {
|
let assertions = gatherFailingExpectations {
|
||||||
closure(actualError)
|
closure(actualError)
|
||||||
}
|
}
|
||||||
let messages = assertions.map { $0.message }
|
let messages = assertions.map { $0.message }
|
||||||
if messages.count > 0 {
|
if !messages.isEmpty {
|
||||||
matches = false
|
matches = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return matches
|
|
||||||
|
return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,15 +88,15 @@ public func throwError<T: Error>(_ error: T, closure: ((Error) -> Void)? = nil)
|
||||||
/// nil arguments indicates that the matcher should not attempt to match against
|
/// nil arguments indicates that the matcher should not attempt to match against
|
||||||
/// that parameter.
|
/// that parameter.
|
||||||
public func throwError<T: Error & Equatable>(_ error: T, closure: ((T) -> Void)? = nil) -> Predicate<Any> {
|
public func throwError<T: Error & Equatable>(_ error: T, closure: ((T) -> Void)? = nil) -> Predicate<Any> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate { actualExpression in
|
||||||
|
|
||||||
var actualError: Error?
|
var actualError: Error?
|
||||||
do {
|
do {
|
||||||
_ = try actualExpression.evaluate()
|
_ = try actualExpression.evaluate()
|
||||||
} catch let catchedError {
|
} catch {
|
||||||
actualError = catchedError
|
actualError = error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let failureMessage = FailureMessage()
|
||||||
setFailureMessageForError(
|
setFailureMessageForError(
|
||||||
failureMessage,
|
failureMessage,
|
||||||
actualError: actualError,
|
actualError: actualError,
|
||||||
|
@ -104,6 +104,7 @@ public func throwError<T: Error & Equatable>(_ error: T, closure: ((T) -> Void)?
|
||||||
errorType: nil,
|
errorType: nil,
|
||||||
closure: closure
|
closure: closure
|
||||||
)
|
)
|
||||||
|
|
||||||
var matches = false
|
var matches = false
|
||||||
if let actualError = actualError as? T, error == actualError {
|
if let actualError = actualError as? T, error == actualError {
|
||||||
matches = true
|
matches = true
|
||||||
|
@ -113,12 +114,13 @@ public func throwError<T: Error & Equatable>(_ error: T, closure: ((T) -> Void)?
|
||||||
closure(actualError)
|
closure(actualError)
|
||||||
}
|
}
|
||||||
let messages = assertions.map { $0.message }
|
let messages = assertions.map { $0.message }
|
||||||
if messages.count > 0 {
|
if !messages.isEmpty {
|
||||||
matches = false
|
matches = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return matches
|
|
||||||
|
return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,15 +138,15 @@ public func throwError<T: Error & Equatable>(_ error: T, closure: ((T) -> Void)?
|
||||||
public func throwError<T: Error>(
|
public func throwError<T: Error>(
|
||||||
errorType: T.Type,
|
errorType: T.Type,
|
||||||
closure: ((T) -> Void)? = nil) -> Predicate<Any> {
|
closure: ((T) -> Void)? = nil) -> Predicate<Any> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate { actualExpression in
|
||||||
|
|
||||||
var actualError: Error?
|
var actualError: Error?
|
||||||
do {
|
do {
|
||||||
_ = try actualExpression.evaluate()
|
_ = try actualExpression.evaluate()
|
||||||
} catch let catchedError {
|
} catch {
|
||||||
actualError = catchedError
|
actualError = error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let failureMessage = FailureMessage()
|
||||||
setFailureMessageForError(
|
setFailureMessageForError(
|
||||||
failureMessage,
|
failureMessage,
|
||||||
actualError: actualError,
|
actualError: actualError,
|
||||||
|
@ -152,16 +154,18 @@ public func throwError<T: Error>(
|
||||||
errorType: errorType,
|
errorType: errorType,
|
||||||
closure: closure
|
closure: closure
|
||||||
)
|
)
|
||||||
|
|
||||||
var matches = false
|
var matches = false
|
||||||
if let actualError = actualError {
|
if let actualError = actualError {
|
||||||
matches = true
|
matches = true
|
||||||
|
|
||||||
if let actualError = actualError as? T {
|
if let actualError = actualError as? T {
|
||||||
if let closure = closure {
|
if let closure = closure {
|
||||||
let assertions = gatherFailingExpectations {
|
let assertions = gatherFailingExpectations {
|
||||||
closure(actualError)
|
closure(actualError)
|
||||||
}
|
}
|
||||||
let messages = assertions.map { $0.message }
|
let messages = assertions.map { $0.message }
|
||||||
if messages.count > 0 {
|
if !messages.isEmpty {
|
||||||
matches = false
|
matches = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,14 +180,14 @@ public func throwError<T: Error>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let messages = assertions.map { $0.message }
|
let messages = assertions.map { $0.message }
|
||||||
if messages.count > 0 {
|
if !messages.isEmpty {
|
||||||
matches = false
|
matches = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return matches
|
return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,15 +199,15 @@ public func throwError<T: Error>(
|
||||||
///
|
///
|
||||||
/// The closure only gets called when an error was thrown.
|
/// The closure only gets called when an error was thrown.
|
||||||
public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate<Any> {
|
public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate<Any> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate { actualExpression in
|
||||||
|
|
||||||
var actualError: Error?
|
var actualError: Error?
|
||||||
do {
|
do {
|
||||||
_ = try actualExpression.evaluate()
|
_ = try actualExpression.evaluate()
|
||||||
} catch let catchedError {
|
} catch {
|
||||||
actualError = catchedError
|
actualError = error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let failureMessage = FailureMessage()
|
||||||
setFailureMessageForError(failureMessage, actualError: actualError, closure: closure)
|
setFailureMessageForError(failureMessage, actualError: actualError, closure: closure)
|
||||||
|
|
||||||
var matches = false
|
var matches = false
|
||||||
|
@ -214,11 +218,12 @@ public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate<Any> {
|
||||||
closure(actualError)
|
closure(actualError)
|
||||||
}
|
}
|
||||||
let messages = assertions.map { $0.message }
|
let messages = assertions.map { $0.message }
|
||||||
if messages.count > 0 {
|
if !messages.isEmpty {
|
||||||
matches = false
|
matches = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return matches
|
|
||||||
|
return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,15 +235,15 @@ public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate<Any> {
|
||||||
///
|
///
|
||||||
/// The closure only gets called when an error was thrown.
|
/// The closure only gets called when an error was thrown.
|
||||||
public func throwError<T: Error>(closure: @escaping ((T) -> Void)) -> Predicate<Any> {
|
public func throwError<T: Error>(closure: @escaping ((T) -> Void)) -> Predicate<Any> {
|
||||||
return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
|
return Predicate { actualExpression in
|
||||||
|
|
||||||
var actualError: Error?
|
var actualError: Error?
|
||||||
do {
|
do {
|
||||||
_ = try actualExpression.evaluate()
|
_ = try actualExpression.evaluate()
|
||||||
} catch let catchedError {
|
} catch {
|
||||||
actualError = catchedError
|
actualError = error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let failureMessage = FailureMessage()
|
||||||
setFailureMessageForError(failureMessage, actualError: actualError, closure: closure)
|
setFailureMessageForError(failureMessage, actualError: actualError, closure: closure)
|
||||||
|
|
||||||
var matches = false
|
var matches = false
|
||||||
|
@ -249,10 +254,11 @@ public func throwError<T: Error>(closure: @escaping ((T) -> Void)) -> Predicate<
|
||||||
closure(actualError)
|
closure(actualError)
|
||||||
}
|
}
|
||||||
let messages = assertions.map { $0.message }
|
let messages = assertions.map { $0.message }
|
||||||
if messages.count > 0 {
|
if !messages.isEmpty {
|
||||||
matches = false
|
matches = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return matches
|
|
||||||
|
return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import CoreFoundation
|
||||||
import Dispatch
|
import Dispatch
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
#if !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS))
|
#if canImport(CDispatch)
|
||||||
import CDispatch
|
import CDispatch
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ internal class AssertionWaitLock: WaitLock {
|
||||||
|
|
||||||
func acquireWaitingLock(_ fnName: String, file: FileString, line: UInt) {
|
func acquireWaitingLock(_ fnName: String, file: FileString, line: UInt) {
|
||||||
let info = WaitingInfo(name: fnName, file: file, lineNumber: line)
|
let info = WaitingInfo(name: fnName, file: file, lineNumber: line)
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
let isMainThread = Thread.isMainThread
|
let isMainThread = Thread.isMainThread
|
||||||
#else
|
#else
|
||||||
let isMainThread = _CFIsMainThread()
|
let isMainThread = _CFIsMainThread()
|
||||||
|
@ -45,10 +45,15 @@ internal class AssertionWaitLock: WaitLock {
|
||||||
nimblePrecondition(
|
nimblePrecondition(
|
||||||
currentWaiter == nil,
|
currentWaiter == nil,
|
||||||
"InvalidNimbleAPIUsage",
|
"InvalidNimbleAPIUsage",
|
||||||
"Nested async expectations are not allowed to avoid creating flaky tests.\n\n" +
|
"""
|
||||||
"The call to\n\t\(info)\n" +
|
Nested async expectations are not allowed to avoid creating flaky tests.
|
||||||
"triggered this exception because\n\t\(currentWaiter!)\n" +
|
|
||||||
"is currently managing the main run loop."
|
The call to
|
||||||
|
\t\(info)
|
||||||
|
triggered this exception because
|
||||||
|
\t\(currentWaiter!)
|
||||||
|
is currently managing the main run loop.
|
||||||
|
"""
|
||||||
)
|
)
|
||||||
currentWaiter = info
|
currentWaiter = info
|
||||||
}
|
}
|
||||||
|
@ -180,25 +185,18 @@ internal class AwaitPromiseBuilder<T> {
|
||||||
// checked.
|
// checked.
|
||||||
//
|
//
|
||||||
// In addition, stopping the run loop is used to halt code executed on the main run loop.
|
// In addition, stopping the run loop is used to halt code executed on the main run loop.
|
||||||
#if swift(>=4.0)
|
|
||||||
trigger.timeoutSource.schedule(
|
trigger.timeoutSource.schedule(
|
||||||
deadline: DispatchTime.now() + timeoutInterval,
|
deadline: DispatchTime.now() + timeoutInterval,
|
||||||
repeating: .never,
|
repeating: .never,
|
||||||
leeway: timeoutLeeway
|
leeway: timeoutLeeway
|
||||||
)
|
)
|
||||||
#else
|
|
||||||
trigger.timeoutSource.scheduleOneshot(
|
|
||||||
deadline: DispatchTime.now() + timeoutInterval,
|
|
||||||
leeway: timeoutLeeway
|
|
||||||
)
|
|
||||||
#endif
|
|
||||||
trigger.timeoutSource.setEventHandler {
|
trigger.timeoutSource.setEventHandler {
|
||||||
guard self.promise.asyncResult.isIncomplete() else { return }
|
guard self.promise.asyncResult.isIncomplete() else { return }
|
||||||
let timedOutSem = DispatchSemaphore(value: 0)
|
let timedOutSem = DispatchSemaphore(value: 0)
|
||||||
let semTimedOutOrBlocked = DispatchSemaphore(value: 0)
|
let semTimedOutOrBlocked = DispatchSemaphore(value: 0)
|
||||||
semTimedOutOrBlocked.signal()
|
semTimedOutOrBlocked.signal()
|
||||||
let runLoop = CFRunLoopGetMain()
|
let runLoop = CFRunLoopGetMain()
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
let runLoopMode = CFRunLoopMode.defaultMode.rawValue
|
let runLoopMode = CFRunLoopMode.defaultMode.rawValue
|
||||||
#else
|
#else
|
||||||
let runLoopMode = kCFRunLoopDefaultMode
|
let runLoopMode = kCFRunLoopDefaultMode
|
||||||
|
@ -263,7 +261,11 @@ internal class AwaitPromiseBuilder<T> {
|
||||||
self.trigger.timeoutSource.resume()
|
self.trigger.timeoutSource.resume()
|
||||||
while self.promise.asyncResult.isIncomplete() {
|
while self.promise.asyncResult.isIncomplete() {
|
||||||
// Stopping the run loop does not work unless we run only 1 mode
|
// 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)
|
_ = RunLoop.current.run(mode: .defaultRunLoopMode, before: .distantFuture)
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
self.trigger.timeoutSource.cancel()
|
self.trigger.timeoutSource.cancel()
|
||||||
|
@ -329,11 +331,7 @@ internal class Awaiter {
|
||||||
let asyncSource = createTimerSource(asyncQueue)
|
let asyncSource = createTimerSource(asyncQueue)
|
||||||
let trigger = AwaitTrigger(timeoutSource: timeoutSource, actionSource: asyncSource) {
|
let trigger = AwaitTrigger(timeoutSource: timeoutSource, actionSource: asyncSource) {
|
||||||
let interval = DispatchTimeInterval.nanoseconds(Int(pollInterval * TimeInterval(NSEC_PER_SEC)))
|
let interval = DispatchTimeInterval.nanoseconds(Int(pollInterval * TimeInterval(NSEC_PER_SEC)))
|
||||||
#if swift(>=4.0)
|
|
||||||
asyncSource.schedule(deadline: .now(), repeating: interval, leeway: pollLeeway)
|
asyncSource.schedule(deadline: .now(), repeating: interval, leeway: pollLeeway)
|
||||||
#else
|
|
||||||
asyncSource.scheduleRepeating(deadline: .now(), interval: interval, leeway: pollLeeway)
|
|
||||||
#endif
|
|
||||||
asyncSource.setEventHandler {
|
asyncSource.setEventHandler {
|
||||||
do {
|
do {
|
||||||
if let result = try closure() {
|
if let result = try closure() {
|
|
@ -1,12 +1,14 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
#if !swift(>=4.2)
|
||||||
extension Sequence {
|
extension Sequence {
|
||||||
internal func all(_ fn: (Iterator.Element) -> Bool) -> Bool {
|
internal func allSatisfy(_ predicate: (Element) throws -> Bool) rethrows -> Bool {
|
||||||
for item in self {
|
for item in self {
|
||||||
if !fn(item) {
|
if try !predicate(item) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -2,7 +2,7 @@ import Foundation
|
||||||
|
|
||||||
internal func identityAsString(_ value: Any?) -> String {
|
internal func identityAsString(_ value: Any?) -> String {
|
||||||
let anyObject: AnyObject?
|
let anyObject: AnyObject?
|
||||||
#if os(Linux)
|
#if os(Linux) && !swift(>=4.1.50)
|
||||||
anyObject = value as? AnyObject
|
anyObject = value as? AnyObject
|
||||||
#else
|
#else
|
||||||
anyObject = value as AnyObject?
|
anyObject = value as AnyObject?
|
||||||
|
@ -122,6 +122,7 @@ extension String: TestOutputStringConvertible {
|
||||||
extension Data: TestOutputStringConvertible {
|
extension Data: TestOutputStringConvertible {
|
||||||
public var testDescription: String {
|
public var testDescription: String {
|
||||||
#if os(Linux)
|
#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)
|
// FIXME: Swift on Linux triggers a segfault when calling NSData's hash() (last checked on 03-11-16)
|
||||||
return "Data<length=\(count)>"
|
return "Data<length=\(count)>"
|
||||||
#else
|
#else
|
||||||
|
@ -158,7 +159,7 @@ public func stringify<T>(_ value: T?) -> String {
|
||||||
return String(describing: value)
|
return String(describing: value)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if canImport(Darwin)
|
||||||
@objc public class NMBStringer: NSObject {
|
@objc public class NMBStringer: NSObject {
|
||||||
@objc public class func stringify(_ obj: Any?) -> String {
|
@objc public class func stringify(_ obj: Any?) -> String {
|
||||||
return Nimble.stringify(obj)
|
return Nimble.stringify(obj)
|
||||||
|
|
|
@ -1,37 +1,8 @@
|
||||||
import XCTest
|
import XCTest
|
||||||
@testable import NimbleTests
|
|
||||||
|
|
||||||
// This is the entry point for NimbleTests on Linux
|
import NimbleTests
|
||||||
|
|
||||||
XCTMain([
|
var tests = [XCTestCaseEntry]()
|
||||||
testCase(AsyncTest.allTests),
|
tests += NimbleTests.__allTests()
|
||||||
testCase(SynchronousTest.allTests),
|
|
||||||
testCase(UserDescriptionTest.allTests),
|
|
||||||
|
|
||||||
// Matchers
|
XCTMain(tests)
|
||||||
testCase(AllPassTest.allTests),
|
|
||||||
testCase(BeAKindOfSwiftTest.allTests),
|
|
||||||
testCase(BeAnInstanceOfTest.allTests),
|
|
||||||
testCase(BeCloseToTest.allTests),
|
|
||||||
testCase(BeginWithTest.allTests),
|
|
||||||
testCase(BeGreaterThanOrEqualToTest.allTests),
|
|
||||||
testCase(BeGreaterThanTest.allTests),
|
|
||||||
testCase(BeIdenticalToObjectTest.allTests),
|
|
||||||
testCase(BeIdenticalToTest.allTests),
|
|
||||||
testCase(BeLessThanOrEqualToTest.allTests),
|
|
||||||
testCase(BeLessThanTest.allTests),
|
|
||||||
testCase(BeTruthyTest.allTests),
|
|
||||||
testCase(BeTrueTest.allTests),
|
|
||||||
testCase(BeFalsyTest.allTests),
|
|
||||||
testCase(BeFalseTest.allTests),
|
|
||||||
testCase(BeNilTest.allTests),
|
|
||||||
testCase(ContainTest.allTests),
|
|
||||||
testCase(EndWithTest.allTests),
|
|
||||||
testCase(EqualTest.allTests),
|
|
||||||
testCase(HaveCountTest.allTests),
|
|
||||||
testCase(MatchTest.allTests),
|
|
||||||
// testCase(RaisesExceptionTest.allTests),
|
|
||||||
testCase(ThrowErrorTest.allTests),
|
|
||||||
testCase(SatisfyAnyOfTest.allTests),
|
|
||||||
testCase(PostNotificationTest.allTests),
|
|
||||||
])
|
|
||||||
|
|
|
@ -4,25 +4,6 @@ import XCTest
|
||||||
import Nimble
|
import Nimble
|
||||||
|
|
||||||
final class AsyncTest: XCTestCase, XCTestCaseProvider {
|
final class AsyncTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (AsyncTest) -> () throws -> Void)] {
|
|
||||||
return [
|
|
||||||
("testToEventuallyPositiveMatches", testToEventuallyPositiveMatches),
|
|
||||||
("testToEventuallyNegativeMatches", testToEventuallyNegativeMatches),
|
|
||||||
("testWaitUntilWithCustomDefaultsTimeout", testWaitUntilWithCustomDefaultsTimeout),
|
|
||||||
("testWaitUntilPositiveMatches", testWaitUntilPositiveMatches),
|
|
||||||
("testToEventuallyWithCustomDefaultTimeout", testToEventuallyWithCustomDefaultTimeout),
|
|
||||||
("testWaitUntilTimesOutIfNotCalled", testWaitUntilTimesOutIfNotCalled),
|
|
||||||
("testWaitUntilTimesOutWhenExceedingItsTime", testWaitUntilTimesOutWhenExceedingItsTime),
|
|
||||||
("testWaitUntilNegativeMatches", testWaitUntilNegativeMatches),
|
|
||||||
("testWaitUntilDetectsStalledMainThreadActivity", testWaitUntilDetectsStalledMainThreadActivity),
|
|
||||||
("testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed", testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed),
|
|
||||||
("testWaitUntilErrorsIfDoneIsCalledMultipleTimes", testWaitUntilErrorsIfDoneIsCalledMultipleTimes),
|
|
||||||
("testWaitUntilMustBeInMainThread", testWaitUntilMustBeInMainThread),
|
|
||||||
("testToEventuallyMustBeInMainThread", testToEventuallyMustBeInMainThread),
|
|
||||||
("testSubjectUnderTestIsReleasedFromMemory", testSubjectUnderTestIsReleasedFromMemory),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
class Error: Swift.Error {}
|
class Error: Swift.Error {}
|
||||||
let errorToThrow = Error()
|
let errorToThrow = Error()
|
||||||
|
|
||||||
|
@ -70,20 +51,12 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider {
|
||||||
|
|
||||||
var asyncOperation: () -> Void = { sleepThenSetValueTo(1) }
|
var asyncOperation: () -> Void = { sleepThenSetValueTo(1) }
|
||||||
|
|
||||||
if #available(OSX 10.10, *) {
|
DispatchQueue.global().async(execute: asyncOperation)
|
||||||
DispatchQueue.global().async(execute: asyncOperation)
|
|
||||||
} else {
|
|
||||||
DispatchQueue.global(priority: .default).async(execute: asyncOperation)
|
|
||||||
}
|
|
||||||
expect { value }.toEventually(equal(1))
|
expect { value }.toEventually(equal(1))
|
||||||
|
|
||||||
asyncOperation = { sleepThenSetValueTo(0) }
|
asyncOperation = { sleepThenSetValueTo(0) }
|
||||||
|
|
||||||
if #available(OSX 10.10, *) {
|
DispatchQueue.global().async(execute: asyncOperation)
|
||||||
DispatchQueue.global().async(execute: asyncOperation)
|
|
||||||
} else {
|
|
||||||
DispatchQueue.global(priority: .default).async(execute: asyncOperation)
|
|
||||||
}
|
|
||||||
expect { value }.toEventuallyNot(equal(1))
|
expect { value }.toEventuallyNot(equal(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,11 +97,7 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider {
|
||||||
done()
|
done()
|
||||||
waiting = false
|
waiting = false
|
||||||
}
|
}
|
||||||
if #available(OSX 10.10, *) {
|
DispatchQueue.global().async(execute: asyncOperation)
|
||||||
DispatchQueue.global().async(execute: asyncOperation)
|
|
||||||
} else {
|
|
||||||
DispatchQueue.global(priority: .default).async(execute: asyncOperation)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,15 +130,16 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider {
|
||||||
func testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed() {
|
func testCombiningAsyncWaitUntilAndToEventuallyIsNotAllowed() {
|
||||||
// Currently we are unable to catch Objective-C exceptions when built by the Swift Package Manager
|
// Currently we are unable to catch Objective-C exceptions when built by the Swift Package Manager
|
||||||
#if !SWIFT_PACKAGE
|
#if !SWIFT_PACKAGE
|
||||||
let referenceLine = #line + 9
|
let referenceLine = #line + 10
|
||||||
var msg = "Unexpected exception raised: Nested async expectations are not allowed "
|
let msg = """
|
||||||
msg += "to avoid creating flaky tests."
|
Unexpected exception raised: Nested async expectations are not allowed to avoid creating flaky tests.
|
||||||
msg += "\n\n"
|
|
||||||
msg += "The call to\n\t"
|
The call to
|
||||||
msg += "expect(...).toEventually(...) at \(#file):\(referenceLine + 7)\n"
|
\texpect(...).toEventually(...) at \(#file):\(referenceLine + 7)
|
||||||
msg += "triggered this exception because\n\t"
|
triggered this exception because
|
||||||
msg += "waitUntil(...) at \(#file):\(referenceLine + 1)\n"
|
\twaitUntil(...) at \(#file):\(referenceLine + 1)
|
||||||
msg += "is currently managing the main run loop."
|
is currently managing the main run loop.
|
||||||
|
"""
|
||||||
failsWithErrorMessage(msg) { // reference line
|
failsWithErrorMessage(msg) { // reference line
|
||||||
waitUntil(timeout: 2.0) { done in
|
waitUntil(timeout: 2.0) { done in
|
||||||
var protected: Int = 0
|
var protected: Int = 0
|
||||||
|
@ -204,11 +174,7 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider {
|
||||||
}.to(raiseException(named: "InvalidNimbleAPIUsage"))
|
}.to(raiseException(named: "InvalidNimbleAPIUsage"))
|
||||||
executedAsyncBlock = true
|
executedAsyncBlock = true
|
||||||
}
|
}
|
||||||
if #available(OSX 10.10, *) {
|
DispatchQueue.global().async(execute: asyncOperation)
|
||||||
DispatchQueue.global().async(execute: asyncOperation)
|
|
||||||
} else {
|
|
||||||
DispatchQueue.global(priority: .default).async(execute: asyncOperation)
|
|
||||||
}
|
|
||||||
expect(executedAsyncBlock).toEventually(beTruthy())
|
expect(executedAsyncBlock).toEventually(beTruthy())
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -222,11 +188,7 @@ final class AsyncTest: XCTestCase, XCTestCaseProvider {
|
||||||
}.to(raiseException(named: "InvalidNimbleAPIUsage"))
|
}.to(raiseException(named: "InvalidNimbleAPIUsage"))
|
||||||
executedAsyncBlock = true
|
executedAsyncBlock = true
|
||||||
}
|
}
|
||||||
if #available(OSX 10.10, *) {
|
DispatchQueue.global().async(execute: asyncOperation)
|
||||||
DispatchQueue.global().async(execute: asyncOperation)
|
|
||||||
} else {
|
|
||||||
DispatchQueue.global(priority: .default).async(execute: asyncOperation)
|
|
||||||
}
|
|
||||||
expect(executedAsyncBlock).toEventually(beTruthy())
|
expect(executedAsyncBlock).toEventually(beTruthy())
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import XCTest
|
||||||
// XCTestCaseProvider should be adopted by all XCTestCase subclasses. It provides a
|
// 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`
|
// 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
|
// list for swift-corelibs-xctest which is unable to dynamically discover tests. Note
|
||||||
// that only `static var allTests` needs to be explicitly implemented, as `allTestNames`
|
// that only `static var __allTests` needs to be explicitly implemented, as `allTestNames`
|
||||||
// has a default implementation provided by a protocol extension.
|
// has a default implementation provided by a protocol extension.
|
||||||
|
|
||||||
// Implementation note: This is broken down into two separate protocols because we need a
|
// Implementation note: This is broken down into two separate protocols because we need a
|
||||||
|
@ -12,7 +12,7 @@ import XCTest
|
||||||
|
|
||||||
public protocol XCTestCaseProviderStatic {
|
public protocol XCTestCaseProviderStatic {
|
||||||
// This should be explicitly implemented by XCTestCase subclasses
|
// This should be explicitly implemented by XCTestCase subclasses
|
||||||
static var allTests: [(String, (Self) -> () throws -> Void)] { get }
|
static var __allTests: [(String, (Self) -> () -> ())] { get }
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol XCTestCaseNameProvider {
|
public protocol XCTestCaseNameProvider {
|
||||||
|
@ -20,17 +20,21 @@ public protocol XCTestCaseNameProvider {
|
||||||
var allTestNames: [String] { get }
|
var allTestNames: [String] { get }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if os(macOS)
|
||||||
public protocol XCTestCaseProvider: XCTestCaseProviderStatic, XCTestCaseNameProvider {}
|
public protocol XCTestCaseProvider: XCTestCaseProviderStatic, XCTestCaseNameProvider {}
|
||||||
|
|
||||||
extension XCTestCaseProvider {
|
extension XCTestCaseProvider {
|
||||||
var allTestNames: [String] {
|
var allTestNames: [String] {
|
||||||
return type(of: self).allTests.map({ name, _ in
|
return type(of: self).__allTests.map({ name, _ in
|
||||||
return name
|
return name
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
public protocol XCTestCaseProvider {}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
|
#if os(macOS)
|
||||||
|
|
||||||
extension XCTestCase {
|
extension XCTestCase {
|
||||||
override open func tearDown() {
|
override open func tearDown() {
|
||||||
|
@ -45,7 +49,13 @@ extension XCTestCase {
|
||||||
extension XCTestCaseNameProvider {
|
extension XCTestCaseNameProvider {
|
||||||
fileprivate func assertContainsTest(_ name: String) {
|
fileprivate func assertContainsTest(_ name: String) {
|
||||||
let contains = self.allTestNames.contains(name)
|
let contains = self.allTestNames.contains(name)
|
||||||
XCTAssert(contains, "Test '\(name)' is missing from the allTests array")
|
XCTAssert(
|
||||||
|
contains,
|
||||||
|
"""
|
||||||
|
Test '\(name)' is missing from the __allTests array.
|
||||||
|
Please run `$ swift test --generate-linuxmain` to update the manifests.
|
||||||
|
"""
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,12 @@ import Foundation
|
||||||
@testable import Nimble
|
@testable import Nimble
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
func failsWithErrorMessage(_ messages: [String], file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: @escaping () throws -> Void) {
|
func failsWithErrorMessage(_ messages: [String], file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: () throws -> Void) {
|
||||||
var filePath = file
|
var filePath = file
|
||||||
var lineNumber = line
|
var lineNumber = line
|
||||||
|
|
||||||
let recorder = AssertionRecorder()
|
let recorder = AssertionRecorder()
|
||||||
withAssertionHandler(recorder, closure: closure)
|
withAssertionHandler(recorder, file: file, line: line, closure: closure)
|
||||||
|
|
||||||
for msg in messages {
|
for msg in messages {
|
||||||
var lastFailure: AssertionRecord?
|
var lastFailure: AssertionRecord?
|
||||||
|
@ -37,7 +37,12 @@ func failsWithErrorMessage(_ messages: [String], file: FileString = #file, line:
|
||||||
} else {
|
} else {
|
||||||
let knownFailures = recorder.assertions.filter { !$0.success }.map { $0.message.stringValue }
|
let knownFailures = recorder.assertions.filter { !$0.success }.map { $0.message.stringValue }
|
||||||
let knownFailuresJoined = knownFailures.joined(separator: ", ")
|
let knownFailuresJoined = knownFailures.joined(separator: ", ")
|
||||||
message = "Expected error message (\(msg)), got (\(knownFailuresJoined))\n\nAssertions Received:\n\(recorder.assertions)"
|
message = """
|
||||||
|
Expected error message (\(msg)), got (\(knownFailuresJoined))
|
||||||
|
|
||||||
|
Assertions Received:
|
||||||
|
\(recorder.assertions)
|
||||||
|
"""
|
||||||
}
|
}
|
||||||
NimbleAssertionHandler.assert(false,
|
NimbleAssertionHandler.assert(false,
|
||||||
message: FailureMessage(stringValue: message),
|
message: FailureMessage(stringValue: message),
|
||||||
|
@ -45,7 +50,7 @@ func failsWithErrorMessage(_ messages: [String], file: FileString = #file, line:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func failsWithErrorMessage(_ message: String, file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: @escaping () -> Void) {
|
func failsWithErrorMessage(_ message: String, file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: () -> Void) {
|
||||||
return failsWithErrorMessage(
|
return failsWithErrorMessage(
|
||||||
[message],
|
[message],
|
||||||
file: file,
|
file: file,
|
||||||
|
@ -55,7 +60,7 @@ func failsWithErrorMessage(_ message: String, file: FileString = #file, line: UI
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func failsWithErrorMessageForNil(_ message: String, file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: @escaping () -> Void) {
|
func failsWithErrorMessageForNil(_ message: String, file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: () -> Void) {
|
||||||
failsWithErrorMessage("\(message) (use beNil() to match nils)", file: file, line: line, preferOriginalSourceLocation: preferOriginalSourceLocation, closure: closure)
|
failsWithErrorMessage("\(message) (use beNil() to match nils)", file: file, line: line, preferOriginalSourceLocation: preferOriginalSourceLocation, closure: closure)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,15 +73,15 @@ func deferToMainQueue(action: @escaping () -> Void) {
|
||||||
|
|
||||||
#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE
|
#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE
|
||||||
public class NimbleHelper: NSObject {
|
public class NimbleHelper: NSObject {
|
||||||
@objc public class func expectFailureMessage(_ message: NSString, block: @escaping () -> Void, file: FileString, line: UInt) {
|
@objc public class func expectFailureMessage(_ message: NSString, block: () -> Void, file: FileString, line: UInt) {
|
||||||
failsWithErrorMessage(String(describing: message), file: file, line: line, preferOriginalSourceLocation: true, closure: block)
|
failsWithErrorMessage(String(describing: message), file: file, line: line, preferOriginalSourceLocation: true, closure: block)
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc public class func expectFailureMessages(_ messages: [NSString], block: @escaping () -> Void, file: FileString, line: UInt) {
|
@objc public class func expectFailureMessages(_ messages: [NSString], block: () -> Void, file: FileString, line: UInt) {
|
||||||
failsWithErrorMessage(messages.map({String(describing: $0)}), file: file, line: line, preferOriginalSourceLocation: true, closure: block)
|
failsWithErrorMessage(messages.map({String(describing: $0)}), file: file, line: line, preferOriginalSourceLocation: true, closure: block)
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc public class func expectFailureMessageForNil(_ message: NSString, block: @escaping () -> Void, file: FileString, line: UInt) {
|
@objc public class func expectFailureMessageForNil(_ message: NSString, block: () -> Void, file: FileString, line: UInt) {
|
||||||
failsWithErrorMessageForNil(String(describing: message), file: file, line: line, preferOriginalSourceLocation: true, closure: block)
|
failsWithErrorMessageForNil(String(describing: message), file: file, line: line, preferOriginalSourceLocation: true, closure: block)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,17 +43,6 @@ extension Optional where Wrapped: Comparable {
|
||||||
}
|
}
|
||||||
|
|
||||||
final class AllPassTest: XCTestCase, XCTestCaseProvider {
|
final class AllPassTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (AllPassTest) -> () throws -> Void)] {
|
|
||||||
return [
|
|
||||||
("testAllPassArray", testAllPassArray),
|
|
||||||
("testAllPassMatcher", testAllPassMatcher),
|
|
||||||
("testAllPassCollectionsWithOptionalsDontWork", testAllPassCollectionsWithOptionalsDontWork),
|
|
||||||
("testAllPassCollectionsWithOptionalsUnwrappingOneOptionalLayer", testAllPassCollectionsWithOptionalsUnwrappingOneOptionalLayer),
|
|
||||||
("testAllPassSet", testAllPassSet),
|
|
||||||
("testAllPassWithNilAsExpectedValue", testAllPassWithNilAsExpectedValue),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
func testAllPassArray() {
|
func testAllPassArray() {
|
||||||
expect([1, 2, 3, 4]).to(allPass({$0 < 5}))
|
expect([1, 2, 3, 4]).to(allPass({$0 < 5}))
|
||||||
expect([1, 2, 3, 4]).toNot(allPass({$0 > 5}))
|
expect([1, 2, 3, 4]).toNot(allPass({$0 > 5}))
|
||||||
|
|
|
@ -8,13 +8,6 @@ private class TestClassConformingToProtocol: TestProtocol {}
|
||||||
private struct TestStructConformingToProtocol: TestProtocol {}
|
private struct TestStructConformingToProtocol: TestProtocol {}
|
||||||
|
|
||||||
final class BeAKindOfSwiftTest: XCTestCase, XCTestCaseProvider {
|
final class BeAKindOfSwiftTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (BeAKindOfSwiftTest) -> () throws -> Void)] {
|
|
||||||
return [
|
|
||||||
("testPositiveMatch", testPositiveMatch),
|
|
||||||
("testFailureMessages", testFailureMessages),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
enum TestEnum {
|
enum TestEnum {
|
||||||
case one, two
|
case one, two
|
||||||
}
|
}
|
||||||
|
@ -54,23 +47,17 @@ final class BeAKindOfSwiftTest: XCTestCase, XCTestCaseProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
|
||||||
|
|
||||||
final class BeAKindOfObjCTest: XCTestCase, XCTestCaseProvider {
|
final class BeAKindOfObjCTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (BeAKindOfObjCTest) -> () throws -> Void)] {
|
|
||||||
return [
|
|
||||||
("testPositiveMatch", testPositiveMatch),
|
|
||||||
("testFailureMessages", testFailureMessages),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
func testPositiveMatch() {
|
func testPositiveMatch() {
|
||||||
|
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
||||||
expect(TestNull()).to(beAKindOf(NSNull.self))
|
expect(TestNull()).to(beAKindOf(NSNull.self))
|
||||||
expect(NSObject()).to(beAKindOf(NSObject.self))
|
expect(NSObject()).to(beAKindOf(NSObject.self))
|
||||||
expect(NSNumber(value: 1)).toNot(beAKindOf(NSDate.self))
|
expect(NSNumber(value: 1)).toNot(beAKindOf(NSDate.self))
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func testFailureMessages() {
|
func testFailureMessages() {
|
||||||
|
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
||||||
failsWithErrorMessageForNil("expected to not be a kind of NSNull, got <nil>") {
|
failsWithErrorMessageForNil("expected to not be a kind of NSNull, got <nil>") {
|
||||||
expect(nil as NSNull?).toNot(beAKindOf(NSNull.self))
|
expect(nil as NSNull?).toNot(beAKindOf(NSNull.self))
|
||||||
}
|
}
|
||||||
|
@ -83,7 +70,6 @@ final class BeAKindOfObjCTest: XCTestCase, XCTestCaseProvider {
|
||||||
failsWithErrorMessage("expected to not be a kind of NSNumber, got <__NSCFNumber instance>") {
|
failsWithErrorMessage("expected to not be a kind of NSNumber, got <__NSCFNumber instance>") {
|
||||||
expect(NSNumber(value: 1)).toNot(beAKindOf(NSNumber.self))
|
expect(NSNumber(value: 1)).toNot(beAKindOf(NSNumber.self))
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -7,15 +7,6 @@ private class TestClassConformingToProtocol: TestProtocol {}
|
||||||
private struct TestStructConformingToProtocol: TestProtocol {}
|
private struct TestStructConformingToProtocol: TestProtocol {}
|
||||||
|
|
||||||
final class BeAnInstanceOfTest: XCTestCase, XCTestCaseProvider {
|
final class BeAnInstanceOfTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (BeAnInstanceOfTest) -> () throws -> Void)] {
|
|
||||||
return [
|
|
||||||
("testPositiveMatch", testPositiveMatch),
|
|
||||||
("testPositiveMatchSwiftTypes", testPositiveMatchSwiftTypes),
|
|
||||||
("testFailureMessages", testFailureMessages),
|
|
||||||
("testFailureMessagesSwiftTypes", testFailureMessagesSwiftTypes),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
func testPositiveMatch() {
|
func testPositiveMatch() {
|
||||||
expect(NSNull()).to(beAnInstanceOf(NSNull.self))
|
expect(NSNull()).to(beAnInstanceOf(NSNull.self))
|
||||||
expect(NSNumber(value: 1)).toNot(beAnInstanceOf(NSDate.self))
|
expect(NSNumber(value: 1)).toNot(beAnInstanceOf(NSDate.self))
|
||||||
|
|
|
@ -3,24 +3,6 @@ import XCTest
|
||||||
import Nimble
|
import Nimble
|
||||||
|
|
||||||
final class BeCloseToTest: XCTestCase, XCTestCaseProvider {
|
final class BeCloseToTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (BeCloseToTest) -> () throws -> Void)] {
|
|
||||||
return [
|
|
||||||
("testBeCloseTo", testBeCloseTo),
|
|
||||||
("testBeCloseToWithin", testBeCloseToWithin),
|
|
||||||
("testBeCloseToWithNSNumber", testBeCloseToWithNSNumber),
|
|
||||||
("testBeCloseToWithDate", testBeCloseToWithDate),
|
|
||||||
("testBeCloseToWithNSDate", testBeCloseToWithNSDate),
|
|
||||||
("testBeCloseToOperator", testBeCloseToOperator),
|
|
||||||
("testBeCloseToWithinOperator", testBeCloseToWithinOperator),
|
|
||||||
("testPlusMinusOperator", testPlusMinusOperator),
|
|
||||||
("testBeCloseToOperatorWithDate", testBeCloseToOperatorWithDate),
|
|
||||||
("testBeCloseToWithinOperatorWithDate", testBeCloseToWithinOperatorWithDate),
|
|
||||||
("testPlusMinusOperatorWithDate", testPlusMinusOperatorWithDate),
|
|
||||||
("testBeCloseToArray", testBeCloseToArray),
|
|
||||||
("testBeCloseToWithCGFloat", testBeCloseToWithCGFloat),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
func testBeCloseTo() {
|
func testBeCloseTo() {
|
||||||
expect(1.2).to(beCloseTo(1.2001))
|
expect(1.2).to(beCloseTo(1.2001))
|
||||||
expect(1.2 as CDouble).to(beCloseTo(1.2001))
|
expect(1.2 as CDouble).to(beCloseTo(1.2001))
|
||||||
|
@ -34,8 +16,8 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider {
|
||||||
func testBeCloseToWithin() {
|
func testBeCloseToWithin() {
|
||||||
expect(1.2).to(beCloseTo(9.300, within: 10))
|
expect(1.2).to(beCloseTo(9.300, within: 10))
|
||||||
|
|
||||||
failsWithErrorMessage("expected to not be close to <1.2001> (within 1), got <1.2>") {
|
failsWithErrorMessage("expected to not be close to <1.2001> (within 1.1), got <1.2>") {
|
||||||
expect(1.2).toNot(beCloseTo(1.2001, within: 1.0))
|
expect(1.2).toNot(beCloseTo(1.2001, within: 1.1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,8 +26,8 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider {
|
||||||
expect(NSNumber(value: 1.2)).to(beCloseTo(NSNumber(value: 9.300), within: 10))
|
expect(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).to(beCloseTo(NSNumber(value: 9.300), within: 10))
|
||||||
|
|
||||||
failsWithErrorMessage("expected to not be close to <1.2001> (within 1), got <1.2>") {
|
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.0))
|
expect(NSNumber(value: 1.2)).toNot(beCloseTo(1.2001, within: 1.1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,8 +35,8 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider {
|
||||||
expect(CGFloat(1.2)).to(beCloseTo(1.2001))
|
expect(CGFloat(1.2)).to(beCloseTo(1.2001))
|
||||||
expect(CGFloat(1.2)).to(beCloseTo(CGFloat(1.2001)))
|
expect(CGFloat(1.2)).to(beCloseTo(CGFloat(1.2001)))
|
||||||
|
|
||||||
failsWithErrorMessage("expected to not be close to <1.2001> (within 1), got <1.2>") {
|
failsWithErrorMessage("expected to not be close to <1.2001> (within 1.1), got <1.2>") {
|
||||||
expect(CGFloat(1.2)).toNot(beCloseTo(1.2001, within: 1.0))
|
expect(CGFloat(1.2)).toNot(beCloseTo(1.2001, within: 1.1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,11 +71,11 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider {
|
||||||
expect(1.2) ≈ (9.300, 10)
|
expect(1.2) ≈ (9.300, 10)
|
||||||
expect(1.2) == (9.300, 10)
|
expect(1.2) == (9.300, 10)
|
||||||
|
|
||||||
failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") {
|
failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") {
|
||||||
expect(1.2) ≈ (1.0, 0.1)
|
expect(1.3) ≈ (1.1, 0.1)
|
||||||
}
|
}
|
||||||
failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") {
|
failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") {
|
||||||
expect(1.2) == (1.0, 0.1)
|
expect(1.3) == (1.1, 0.1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,11 +83,11 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider {
|
||||||
expect(1.2) ≈ 9.300 ± 10
|
expect(1.2) ≈ 9.300 ± 10
|
||||||
expect(1.2) == 9.300 ± 10
|
expect(1.2) == 9.300 ± 10
|
||||||
|
|
||||||
failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") {
|
failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") {
|
||||||
expect(1.2) ≈ 1.0 ± 0.1
|
expect(1.3) ≈ 1.1 ± 0.1
|
||||||
}
|
}
|
||||||
failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") {
|
failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") {
|
||||||
expect(1.2) == 1.0 ± 0.1
|
expect(1.3) == 1.1 ± 0.1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,11 +132,11 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider {
|
||||||
expect([0.0, 1.1, 2.2]) ≈ [0.0001, 1.1001, 2.2001]
|
expect([0.0, 1.1, 2.2]) ≈ [0.0001, 1.1001, 2.2001]
|
||||||
expect([0.0, 1.1, 2.2]).to(beCloseTo([0.1, 1.2, 2.3], within: 0.1))
|
expect([0.0, 1.1, 2.2]).to(beCloseTo([0.1, 1.2, 2.3], within: 0.1))
|
||||||
|
|
||||||
failsWithErrorMessage("expected to be close to <[0, 1]> (each within 0.0001), got <[0, 1.1]>") {
|
failsWithErrorMessage("expected to be close to <[0.1, 1.1]> (each within 0.0001), got <[0.1, 1.2]>") {
|
||||||
expect([0.0, 1.1]) ≈ [0.0, 1.0]
|
expect([0.1, 1.2]) ≈ [0.1, 1.1]
|
||||||
}
|
}
|
||||||
failsWithErrorMessage("expected to be close to <[0.2, 1.2]> (each within 0.1), got <[0, 1.1]>") {
|
failsWithErrorMessage("expected to be close to <[0.3, 1.3]> (each within 0.1), got <[0.1, 1.2]>") {
|
||||||
expect([0.0, 1.1]).to(beCloseTo([0.2, 1.2], within: 0.1))
|
expect([0.1, 1.2]).to(beCloseTo([0.3, 1.3], within: 0.1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,6 @@ import XCTest
|
||||||
import Nimble
|
import Nimble
|
||||||
|
|
||||||
final class BeEmptyTest: XCTestCase, XCTestCaseProvider {
|
final class BeEmptyTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (BeEmptyTest) -> () throws -> Void)] {
|
|
||||||
return [
|
|
||||||
("testBeEmptyPositive", testBeEmptyPositive),
|
|
||||||
("testBeEmptyNegative", testBeEmptyNegative),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
func testBeEmptyPositive() {
|
func testBeEmptyPositive() {
|
||||||
expect([] as [Int]).to(beEmpty())
|
expect([] as [Int]).to(beEmpty())
|
||||||
expect([1]).toNot(beEmpty())
|
expect([1]).toNot(beEmpty())
|
||||||
|
@ -41,16 +34,12 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider {
|
||||||
|
|
||||||
expect("").to(beEmpty())
|
expect("").to(beEmpty())
|
||||||
expect("foo").toNot(beEmpty())
|
expect("foo").toNot(beEmpty())
|
||||||
|
|
||||||
|
expect([] as TestOptionSet).to(beEmpty())
|
||||||
|
expect(TestOptionSet.one).toNot(beEmpty())
|
||||||
}
|
}
|
||||||
|
|
||||||
func testBeEmptyNegative() {
|
func testBeEmptyNegative() {
|
||||||
failsWithErrorMessageForNil("expected to be empty, got <nil>") {
|
|
||||||
expect(nil as NSString?).to(beEmpty())
|
|
||||||
}
|
|
||||||
failsWithErrorMessageForNil("expected to not be empty, got <nil>") {
|
|
||||||
expect(nil as [CInt]?).toNot(beEmpty())
|
|
||||||
}
|
|
||||||
|
|
||||||
failsWithErrorMessage("expected to not be empty, got <()>") {
|
failsWithErrorMessage("expected to not be empty, got <()>") {
|
||||||
expect(NSArray()).toNot(beEmpty())
|
expect(NSArray()).toNot(beEmpty())
|
||||||
}
|
}
|
||||||
|
@ -58,12 +47,14 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider {
|
||||||
expect([1]).to(beEmpty())
|
expect([1]).to(beEmpty())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
||||||
failsWithErrorMessage("expected to not be empty, got <{()}>") {
|
failsWithErrorMessage("expected to not be empty, got <{()}>") {
|
||||||
expect(NSSet()).toNot(beEmpty())
|
expect(NSSet()).toNot(beEmpty())
|
||||||
}
|
}
|
||||||
failsWithErrorMessage("expected to be empty, got <{(1)}>") {
|
failsWithErrorMessage("expected to be empty, got <{(1)}>") {
|
||||||
expect(NSSet(object: NSNumber(value: 1))).to(beEmpty())
|
expect(NSSet(object: NSNumber(value: 1))).to(beEmpty())
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
failsWithErrorMessage("expected to not be empty, got <()>") {
|
failsWithErrorMessage("expected to not be empty, got <()>") {
|
||||||
expect(NSIndexSet()).toNot(beEmpty())
|
expect(NSIndexSet()).toNot(beEmpty())
|
||||||
|
@ -78,5 +69,49 @@ final class BeEmptyTest: XCTestCase, XCTestCaseProvider {
|
||||||
failsWithErrorMessage("expected to be empty, got <foo>") {
|
failsWithErrorMessage("expected to be empty, got <foo>") {
|
||||||
expect("foo").to(beEmpty())
|
expect("foo").to(beEmpty())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
failsWithErrorMessage("expected to not be empty, got <TestOptionSet(rawValue: 0)>") {
|
||||||
|
expect([] as TestOptionSet).toNot(beEmpty())
|
||||||
|
}
|
||||||
|
failsWithErrorMessage("expected to be empty, got <TestOptionSet(rawValue: 1)>") {
|
||||||
|
expect(TestOptionSet.one).to(beEmpty())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func testNilMatches() {
|
||||||
|
failsWithErrorMessageForNil("expected to be empty, got <nil>") {
|
||||||
|
expect(nil as NSString?).to(beEmpty())
|
||||||
|
}
|
||||||
|
failsWithErrorMessageForNil("expected to not be empty, got <nil>") {
|
||||||
|
expect(nil as NSString?).toNot(beEmpty())
|
||||||
|
}
|
||||||
|
|
||||||
|
failsWithErrorMessageForNil("expected to be empty, got <nil>") {
|
||||||
|
expect(nil as [CInt]?).to(beEmpty())
|
||||||
|
}
|
||||||
|
failsWithErrorMessageForNil("expected to not be empty, got <nil>") {
|
||||||
|
expect(nil as [CInt]?).toNot(beEmpty())
|
||||||
|
}
|
||||||
|
|
||||||
|
failsWithErrorMessageForNil("expected to be empty, got <nil>") {
|
||||||
|
expect(nil as TestOptionSet?).to(beEmpty())
|
||||||
|
}
|
||||||
|
failsWithErrorMessageForNil("expected to not be empty, got <nil>") {
|
||||||
|
expect(nil as TestOptionSet?).toNot(beEmpty())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private struct TestOptionSet: OptionSet, CustomStringConvertible {
|
||||||
|
let rawValue: Int
|
||||||
|
|
||||||
|
static let one = TestOptionSet(rawValue: 1 << 0)
|
||||||
|
|
||||||
|
init(rawValue: Int) {
|
||||||
|
self.rawValue = rawValue
|
||||||
|
}
|
||||||
|
|
||||||
|
var description: String {
|
||||||
|
return "TestOptionSet(rawValue: \(rawValue))"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,6 @@ import XCTest
|
||||||
import Nimble
|
import Nimble
|
||||||
|
|
||||||
final class BeGreaterThanOrEqualToTest: XCTestCase, XCTestCaseProvider {
|
final class BeGreaterThanOrEqualToTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (BeGreaterThanOrEqualToTest) -> () throws -> Void)] {
|
|
||||||
return [
|
|
||||||
("testGreaterThanOrEqualTo", testGreaterThanOrEqualTo),
|
|
||||||
("testGreaterThanOrEqualToOperator", testGreaterThanOrEqualToOperator),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
func testGreaterThanOrEqualTo() {
|
func testGreaterThanOrEqualTo() {
|
||||||
expect(10).to(beGreaterThanOrEqualTo(10))
|
expect(10).to(beGreaterThanOrEqualTo(10))
|
||||||
expect(10).to(beGreaterThanOrEqualTo(2))
|
expect(10).to(beGreaterThanOrEqualTo(2))
|
||||||
|
|
|
@ -3,13 +3,6 @@ import XCTest
|
||||||
import Nimble
|
import Nimble
|
||||||
|
|
||||||
final class BeGreaterThanTest: XCTestCase, XCTestCaseProvider {
|
final class BeGreaterThanTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (BeGreaterThanTest) -> () throws -> Void)] {
|
|
||||||
return [
|
|
||||||
("testGreaterThan", testGreaterThan),
|
|
||||||
("testGreaterThanOperator", testGreaterThanOperator),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
func testGreaterThan() {
|
func testGreaterThan() {
|
||||||
expect(10).to(beGreaterThan(2))
|
expect(10).to(beGreaterThan(2))
|
||||||
expect(1).toNot(beGreaterThan(2))
|
expect(1).toNot(beGreaterThan(2))
|
||||||
|
|
|
@ -3,17 +3,6 @@ import XCTest
|
||||||
import Nimble
|
import Nimble
|
||||||
|
|
||||||
final class BeIdenticalToObjectTest: XCTestCase, XCTestCaseProvider {
|
final class BeIdenticalToObjectTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (BeIdenticalToObjectTest) -> () throws -> Void)] {
|
|
||||||
return [
|
|
||||||
("testBeIdenticalToPositive", testBeIdenticalToPositive),
|
|
||||||
("testBeIdenticalToNegative", testBeIdenticalToNegative),
|
|
||||||
("testBeIdenticalToPositiveMessage", testBeIdenticalToPositiveMessage),
|
|
||||||
("testBeIdenticalToNegativeMessage", testBeIdenticalToNegativeMessage),
|
|
||||||
("testFailsOnNils", testFailsOnNils),
|
|
||||||
("testOperators", testOperators),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
private class BeIdenticalToObjectTester {}
|
private class BeIdenticalToObjectTester {}
|
||||||
private let testObjectA = BeIdenticalToObjectTester()
|
private let testObjectA = BeIdenticalToObjectTester()
|
||||||
private let testObjectB = BeIdenticalToObjectTester()
|
private let testObjectB = BeIdenticalToObjectTester()
|
||||||
|
|
|
@ -3,17 +3,6 @@ import XCTest
|
||||||
@testable import Nimble
|
@testable import Nimble
|
||||||
|
|
||||||
final class BeIdenticalToTest: XCTestCase, XCTestCaseProvider {
|
final class BeIdenticalToTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (BeIdenticalToTest) -> () throws -> Void)] {
|
|
||||||
return [
|
|
||||||
("testBeIdenticalToPositive", testBeIdenticalToPositive),
|
|
||||||
("testBeIdenticalToNegative", testBeIdenticalToNegative),
|
|
||||||
("testBeIdenticalToPositiveMessage", testBeIdenticalToPositiveMessage),
|
|
||||||
("testBeIdenticalToNegativeMessage", testBeIdenticalToNegativeMessage),
|
|
||||||
("testOperators", testOperators),
|
|
||||||
("testBeAlias", testBeAlias),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
func testBeIdenticalToPositive() {
|
func testBeIdenticalToPositive() {
|
||||||
let value = NSDate()
|
let value = NSDate()
|
||||||
expect(value).to(beIdenticalTo(value))
|
expect(value).to(beIdenticalTo(value))
|
||||||
|
|
|
@ -3,13 +3,6 @@ import XCTest
|
||||||
import Nimble
|
import Nimble
|
||||||
|
|
||||||
final class BeLessThanOrEqualToTest: XCTestCase, XCTestCaseProvider {
|
final class BeLessThanOrEqualToTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (BeLessThanOrEqualToTest) -> () throws -> Void)] {
|
|
||||||
return [
|
|
||||||
("testLessThanOrEqualTo", testLessThanOrEqualTo),
|
|
||||||
("testLessThanOrEqualToOperator", testLessThanOrEqualToOperator),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
func testLessThanOrEqualTo() {
|
func testLessThanOrEqualTo() {
|
||||||
expect(10).to(beLessThanOrEqualTo(10))
|
expect(10).to(beLessThanOrEqualTo(10))
|
||||||
expect(2).to(beLessThanOrEqualTo(10))
|
expect(2).to(beLessThanOrEqualTo(10))
|
||||||
|
|
|
@ -3,13 +3,6 @@ import XCTest
|
||||||
import Nimble
|
import Nimble
|
||||||
|
|
||||||
final class BeLessThanTest: XCTestCase, XCTestCaseProvider {
|
final class BeLessThanTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (BeLessThanTest) -> () throws -> Void)] {
|
|
||||||
return [
|
|
||||||
("testLessThan", testLessThan),
|
|
||||||
("testLessThanOperator", testLessThanOperator),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
func testLessThan() {
|
func testLessThan() {
|
||||||
expect(2).to(beLessThan(10))
|
expect(2).to(beLessThan(10))
|
||||||
expect(2).toNot(beLessThan(1))
|
expect(2).toNot(beLessThan(1))
|
||||||
|
|
|
@ -30,18 +30,6 @@ enum ConvertsToBool: ExpressibleByBooleanLiteral, CustomStringConvertible {
|
||||||
}
|
}
|
||||||
|
|
||||||
final class BeTruthyTest: XCTestCase, XCTestCaseProvider {
|
final class BeTruthyTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (BeTruthyTest) -> () throws -> Void)] {
|
|
||||||
return [
|
|
||||||
("testShouldMatchNonNilTypes", testShouldMatchNonNilTypes),
|
|
||||||
("testShouldMatchTrue", testShouldMatchTrue),
|
|
||||||
("testShouldNotMatchNilTypes", testShouldNotMatchNilTypes),
|
|
||||||
("testShouldNotMatchFalse", testShouldNotMatchFalse),
|
|
||||||
("testShouldNotMatchNilBools", testShouldNotMatchNilBools),
|
|
||||||
("testShouldMatchBoolConvertibleTypesThatConvertToTrue", testShouldMatchBoolConvertibleTypesThatConvertToTrue),
|
|
||||||
("testShouldNotMatchBoolConvertibleTypesThatConvertToFalse", testShouldNotMatchBoolConvertibleTypesThatConvertToFalse),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
func testShouldMatchNonNilTypes() {
|
func testShouldMatchNonNilTypes() {
|
||||||
expect(true as Bool?).to(beTruthy())
|
expect(true as Bool?).to(beTruthy())
|
||||||
|
|
||||||
|
@ -123,14 +111,6 @@ final class BeTruthyTest: XCTestCase, XCTestCaseProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
final class BeTrueTest: XCTestCase, XCTestCaseProvider {
|
final class BeTrueTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (BeTrueTest) -> () throws -> Void)] {
|
|
||||||
return [
|
|
||||||
("testShouldMatchTrue", testShouldMatchTrue),
|
|
||||||
("testShouldNotMatchFalse", testShouldNotMatchFalse),
|
|
||||||
("testShouldNotMatchNilBools", testShouldNotMatchNilBools),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
func testShouldMatchTrue() {
|
func testShouldMatchTrue() {
|
||||||
expect(true).to(beTrue())
|
expect(true).to(beTrue())
|
||||||
|
|
||||||
|
@ -159,16 +139,6 @@ final class BeTrueTest: XCTestCase, XCTestCaseProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
final class BeFalsyTest: XCTestCase, XCTestCaseProvider {
|
final class BeFalsyTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (BeFalsyTest) -> () throws -> Void)] {
|
|
||||||
return [
|
|
||||||
("testShouldMatchNilTypes", testShouldMatchNilTypes),
|
|
||||||
("testShouldNotMatchTrue", testShouldNotMatchTrue),
|
|
||||||
("testShouldNotMatchNonNilTypes", testShouldNotMatchNonNilTypes),
|
|
||||||
("testShouldMatchFalse", testShouldMatchFalse),
|
|
||||||
("testShouldMatchNilBools", testShouldMatchNilBools),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
func testShouldMatchNilTypes() {
|
func testShouldMatchNilTypes() {
|
||||||
expect(false as Bool?).to(beFalsy())
|
expect(false as Bool?).to(beFalsy())
|
||||||
|
|
||||||
|
@ -234,14 +204,6 @@ final class BeFalsyTest: XCTestCase, XCTestCaseProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
final class BeFalseTest: XCTestCase, XCTestCaseProvider {
|
final class BeFalseTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (BeFalseTest) -> () throws -> Void)] {
|
|
||||||
return [
|
|
||||||
("testShouldNotMatchTrue", testShouldNotMatchTrue),
|
|
||||||
("testShouldMatchFalse", testShouldMatchFalse),
|
|
||||||
("testShouldNotMatchNilBools", testShouldNotMatchNilBools),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
func testShouldNotMatchTrue() {
|
func testShouldNotMatchTrue() {
|
||||||
expect(true).toNot(beFalse())
|
expect(true).toNot(beFalse())
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,6 @@ import XCTest
|
||||||
import Nimble
|
import Nimble
|
||||||
|
|
||||||
final class BeNilTest: XCTestCase, XCTestCaseProvider {
|
final class BeNilTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (BeNilTest) -> () throws -> Void)] {
|
|
||||||
return [
|
|
||||||
("testBeNil", testBeNil),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
func producesNil() -> [Int]? {
|
func producesNil() -> [Int]? {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,6 @@ import XCTest
|
||||||
import Nimble
|
import Nimble
|
||||||
|
|
||||||
final class BeVoidTest: XCTestCase, XCTestCaseProvider {
|
final class BeVoidTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (BeVoidTest) -> () throws -> Void)] {
|
|
||||||
return [
|
|
||||||
("testBeVoid", testBeVoid),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
func testBeVoid() {
|
func testBeVoid() {
|
||||||
expect(()).to(beVoid())
|
expect(()).to(beVoid())
|
||||||
expect(() as ()?).to(beVoid())
|
expect(() as ()?).to(beVoid())
|
||||||
|
|
|
@ -3,13 +3,6 @@ import XCTest
|
||||||
import Nimble
|
import Nimble
|
||||||
|
|
||||||
final class BeginWithTest: XCTestCase, XCTestCaseProvider {
|
final class BeginWithTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (BeginWithTest) -> () throws -> Void)] {
|
|
||||||
return [
|
|
||||||
("testPositiveMatches", testPositiveMatches),
|
|
||||||
("testNegativeMatches", testNegativeMatches),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
func testPositiveMatches() {
|
func testPositiveMatches() {
|
||||||
expect([1, 2, 3]).to(beginWith(1))
|
expect([1, 2, 3]).to(beginWith(1))
|
||||||
expect([1, 2, 3]).toNot(beginWith(2))
|
expect([1, 2, 3]).toNot(beginWith(2))
|
||||||
|
|
|
@ -3,20 +3,6 @@ import XCTest
|
||||||
import Nimble
|
import Nimble
|
||||||
|
|
||||||
final class ContainElementSatisfyingTest: XCTestCase, XCTestCaseProvider {
|
final class ContainElementSatisfyingTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (ContainElementSatisfyingTest) -> () throws -> Void)] {
|
|
||||||
return [
|
|
||||||
("testContainElementSatisfying", testContainElementSatisfying),
|
|
||||||
("testContainElementSatisfyingDefaultErrorMessage", testContainElementSatisfyingDefaultErrorMessage),
|
|
||||||
("testContainElementSatisfyingSpecificErrorMessage", testContainElementSatisfyingSpecificErrorMessage),
|
|
||||||
("testContainElementSatisfyingNegativeCase",
|
|
||||||
testContainElementSatisfyingNegativeCase),
|
|
||||||
("testContainElementSatisfyingNegativeCaseDefaultErrorMessage",
|
|
||||||
testContainElementSatisfyingNegativeCaseDefaultErrorMessage),
|
|
||||||
("testContainElementSatisfyingNegativeCaseSpecificErrorMessage",
|
|
||||||
testContainElementSatisfyingNegativeCaseSpecificErrorMessage),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
func testContainElementSatisfying() {
|
func testContainElementSatisfying() {
|
||||||
var orderIndifferentArray = [1, 2, 3]
|
var orderIndifferentArray = [1, 2, 3]
|
||||||
expect(orderIndifferentArray).to(containElementSatisfying({ number in
|
expect(orderIndifferentArray).to(containElementSatisfying({ number in
|
||||||
|
|
|
@ -3,22 +3,12 @@ import XCTest
|
||||||
import Nimble
|
import Nimble
|
||||||
|
|
||||||
final class ContainTest: XCTestCase, XCTestCaseProvider {
|
final class ContainTest: XCTestCase, XCTestCaseProvider {
|
||||||
static var allTests: [(String, (ContainTest) -> () throws -> Void)] {
|
func testContainSequence() {
|
||||||
return [
|
|
||||||
("testContain", testContain),
|
|
||||||
("testContainSubstring", testContainSubstring),
|
|
||||||
("testContainObjCSubstring", testContainObjCSubstring),
|
|
||||||
("testVariadicArguments", testVariadicArguments),
|
|
||||||
("testCollectionArguments", testCollectionArguments),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
func testContain() {
|
|
||||||
expect([1, 2, 3]).to(contain(1))
|
expect([1, 2, 3]).to(contain(1))
|
||||||
|
expect([1, 2, 3]).toNot(contain(4))
|
||||||
expect([1, 2, 3] as [CInt]).to(contain(1 as CInt))
|
expect([1, 2, 3] as [CInt]).to(contain(1 as CInt))
|
||||||
expect([1, 2, 3] as [CInt]).toNot(contain(4 as CInt))
|
expect([1, 2, 3] as [CInt]).toNot(contain(4 as CInt))
|
||||||
expect(["foo", "bar", "baz"]).to(contain("baz"))
|
expect(["foo", "bar", "baz"]).to(contain("baz"))
|
||||||
expect([1, 2, 3]).toNot(contain(4))
|
|
||||||
expect(["foo", "bar", "baz"]).toNot(contain("ba"))
|
expect(["foo", "bar", "baz"]).toNot(contain("ba"))
|
||||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
||||||
expect(NSArray(array: ["a"])).to(contain(NSString(string: "a")))
|
expect(NSArray(array: ["a"])).to(contain(NSString(string: "a")))
|
||||||
|
@ -41,6 +31,25 @@ final class ContainTest: XCTestCase, XCTestCaseProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testContainSetAlgebra() {
|
||||||
|
expect([.a, .b, .c] as TestOptionSet).to(contain(.a))
|
||||||
|
expect([.a, .b, .c] as TestOptionSet).toNot(contain(.d))
|
||||||
|
|
||||||
|
failsWithErrorMessage("expected to contain <8>, got <7>") {
|
||||||
|
expect([.a, .b, .c] as TestOptionSet).to(contain(.d))
|
||||||
|
}
|
||||||
|
failsWithErrorMessage("expected to not contain <2>, got <7>") {
|
||||||
|
expect([.a, .b, .c] as TestOptionSet).toNot(contain(.b))
|
||||||
|
}
|
||||||
|
|
||||||
|
failsWithErrorMessageForNil("expected to contain <1>, got <nil>") {
|
||||||
|
expect(nil as TestOptionSet?).to(contain(.a))
|
||||||
|
}
|
||||||
|
failsWithErrorMessageForNil("expected to not contain <1>, got <nil>") {
|
||||||
|
expect(nil as TestOptionSet?).toNot(contain(.a))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func testContainSubstring() {
|
func testContainSubstring() {
|
||||||
expect("foo").to(contain("o"))
|
expect("foo").to(contain("o"))
|
||||||
expect("foo").to(contain("oo"))
|
expect("foo").to(contain("oo"))
|
||||||
|
@ -93,3 +102,23 @@ final class ContainTest: XCTestCase, XCTestCaseProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private struct TestOptionSet: OptionSet, CustomStringConvertible {
|
||||||
|
let rawValue: Int
|
||||||
|
|
||||||
|
// swiftlint:disable identifier_name
|
||||||
|
static let a = TestOptionSet(rawValue: 1 << 0)
|
||||||
|
static let b = TestOptionSet(rawValue: 1 << 1)
|
||||||
|
static let c = TestOptionSet(rawValue: 1 << 2)
|
||||||
|
static let d = TestOptionSet(rawValue: 1 << 3)
|
||||||
|
static let e = TestOptionSet(rawValue: 1 << 4)
|
||||||
|
// swiftlint:enable identifier_name
|
||||||
|
|
||||||
|
init(rawValue: Int) {
|
||||||
|
self.rawValue = rawValue
|
||||||
|
}
|
||||||
|
|
||||||
|
var description: String {
|
||||||
|
return "\(rawValue)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue