diff --git a/.circleci/config.yml b/.circleci/config.yml
new file mode 100644
index 0000000..a557a40
--- /dev/null
+++ b/.circleci/config.yml
@@ -0,0 +1,45 @@
+version: 2
+jobs:
+ build-and-test:
+ macos:
+ xcode: "10.2.0"
+
+ steps:
+ - checkout
+ - restore_cache:
+ keys:
+ - v2-dep-{{ .Branch }}-
+ - v2-dep-master-
+ - v2-dep-
+
+ - run:
+ name: Update ruby and cocoapods
+ command: |
+ sudo gem install cocoapods
+ sudo gem cleanup
+ curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf
+
+ - run:
+ name: Carthage
+ command: carthage update
+
+ - run:
+ name: Test
+ command: |
+ cd Demo
+ pod install
+ xcodebuild -workspace 'Demo.xcworkspace' -scheme 'Demo' -configuration 'Debug' -sdk iphonesimulator -destination 'name=iPhone Xs' build test | xcpretty -c
+
+ - run:
+ name: Pod lib lint
+ command: pod lib lint --allow-warnings
+
+ - save_cache:
+ key: v2-dep-{{ .Branch }}-{{ epoch }}
+ paths:
+ - Carthage
+workflows:
+ version: 2
+ build-and-test:
+ jobs:
+ - build-and-test
diff --git a/.gitignore b/.gitignore
index 13d6044..a0e4ea2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,3 +29,24 @@ Carthage/
fastlane/README.md
fastlane/report.xml
+
+# CocoaPods
+#
+# We recommend against adding the Pods directory to your .gitignore. However
+# you should judge for yourself, the pros and cons are mentioned at:
+# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
+#
+Pods/
+
+# fastlane
+#
+# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
+# screenshots whenever they are needed.
+# For more information about the recommended setup visit:
+# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
+
+fastlane/report.xml
+fastlane/Preview.html
+fastlane/screenshots
+fastlane/test_output
+screenshots
diff --git a/Changelog.md b/Changelog.md
index a913c5f..78a38a1 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -9,6 +9,8 @@ Current master
5.0.0
-----
- Update to Swift 5.0 and Xcode 10.2 See [#59](https://github.com/RxSwiftCommunity/NSObject-Rx/pull/67) - [@fassko](https://github.com/fassko)
+- Build in Circle CI 2.0 and remove Pods from repo. See [#59](https://github.com/RxSwiftCommunity/NSObject-Rx/pull/68) - [@fassko](https://github.com/fassko)
+- Increase watchOS minimum version. See [#59](https://github.com/RxSwiftCommunity/NSObject-Rx/pull/68) - [@fassko](https://github.com/fassko)
4.4.1
-----
diff --git a/Demo/Demo.xcodeproj/project.pbxproj b/Demo/Demo.xcodeproj/project.pbxproj
index 4e57d46..3df524f 100644
--- a/Demo/Demo.xcodeproj/project.pbxproj
+++ b/Demo/Demo.xcodeproj/project.pbxproj
@@ -273,7 +273,7 @@
files = (
);
inputPaths = (
- "${SRCROOT}/Pods/Target Support Files/Pods-DemoTests/Pods-DemoTests-frameworks.sh",
+ "${PODS_ROOT}/Target Support Files/Pods-DemoTests/Pods-DemoTests-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/NSObject+Rx/NSObject_Rx.framework",
"${BUILT_PRODUCTS_DIR}/Nimble/Nimble.framework",
"${BUILT_PRODUCTS_DIR}/Quick/Quick.framework",
@@ -288,7 +288,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DemoTests/Pods-DemoTests-frameworks.sh\"\n";
+ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-DemoTests/Pods-DemoTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
diff --git a/Demo/Demo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Demo/Demo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 0000000..18d9810
--- /dev/null
+++ b/Demo/Demo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/Demo/Podfile.lock b/Demo/Podfile.lock
index 3d2bac8..de7978c 100644
--- a/Demo/Podfile.lock
+++ b/Demo/Podfile.lock
@@ -1,9 +1,9 @@
PODS:
- - Nimble (7.3.1)
- - "NSObject+Rx (4.4.0)":
- - RxSwift (~> 4.3)
- - Quick (1.3.1)
- - RxSwift (4.3.1)
+ - Nimble (8.0.1)
+ - "NSObject+Rx (5.0.0)":
+ - RxSwift (~> 5.0)
+ - Quick (2.1.0)
+ - RxSwift (5.0.0)
DEPENDENCIES:
- Nimble
@@ -22,11 +22,11 @@ EXTERNAL SOURCES:
:path: "../"
SPEC CHECKSUMS:
- Nimble: 04f732da099ea4d153122aec8c2a88fd0c7219ae
- "NSObject+Rx": e9d2b56cd4bf13a42f4ee326b638c49c84bf4707
- Quick: d17304d58d0d169dd0bd1c6e5c28e3318de32a1a
- RxSwift: fe0fd770a43acdb7d0a53da411c9b892e69bb6e4
+ Nimble: 45f786ae66faa9a709624227fae502db55a8bdd0
+ "NSObject+Rx": 8ecb1e4714f3d35ac91485d2a769b7ab4b62e697
+ Quick: 4be43f6634acfa727dd106bdf3929ce125ffa79d
+ RxSwift: 8b0671caa829a763bbce7271095859121cbd895f
PODFILE CHECKSUM: 4f420ecd33a82075e360098bbed0ccaadfeb1728
-COCOAPODS: 1.5.3
+COCOAPODS: 1.6.1
diff --git a/Demo/Pods/Local Podspecs/NSObject+Rx.podspec.json b/Demo/Pods/Local Podspecs/NSObject+Rx.podspec.json
deleted file mode 100644
index 9a04215..0000000
--- a/Demo/Pods/Local Podspecs/NSObject+Rx.podspec.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "name": "NSObject+Rx",
- "version": "4.4.0",
- "summary": "Handy RxSwift extensions on NSObject.",
- "description": "Right now, we just have a `rx_disposeBag` property, but we're open to PRs!",
- "homepage": "https://github.com/RxSwiftCommunity/NSObject-Rx",
- "license": {
- "type": "MIT",
- "file": "LICENSE"
- },
- "authors": {
- "Ash Furrow": "ash@ashfurrow.com"
- },
- "social_media_url": "http://twitter.com/ashfurrow",
- "platforms": {
- "ios": "8.0",
- "osx": "10.10",
- "watchos": "2.0",
- "tvos": "9.0"
- },
- "source": {
- "git": "https://github.com/RxSwiftCommunity/NSObject-Rx.git",
- "tag": "4.4.0"
- },
- "source_files": "*.swift",
- "frameworks": "Foundation",
- "dependencies": {
- "RxSwift": [
- "~> 4.3"
- ]
- }
-}
diff --git a/Demo/Pods/Manifest.lock b/Demo/Pods/Manifest.lock
deleted file mode 100644
index 3d2bac8..0000000
--- a/Demo/Pods/Manifest.lock
+++ /dev/null
@@ -1,32 +0,0 @@
-PODS:
- - Nimble (7.3.1)
- - "NSObject+Rx (4.4.0)":
- - RxSwift (~> 4.3)
- - Quick (1.3.1)
- - RxSwift (4.3.1)
-
-DEPENDENCIES:
- - Nimble
- - "NSObject+Rx (from `../`)"
- - Quick
- - RxSwift
-
-SPEC REPOS:
- https://github.com/cocoapods/specs.git:
- - Nimble
- - Quick
- - RxSwift
-
-EXTERNAL SOURCES:
- "NSObject+Rx":
- :path: "../"
-
-SPEC CHECKSUMS:
- Nimble: 04f732da099ea4d153122aec8c2a88fd0c7219ae
- "NSObject+Rx": e9d2b56cd4bf13a42f4ee326b638c49c84bf4707
- Quick: d17304d58d0d169dd0bd1c6e5c28e3318de32a1a
- RxSwift: fe0fd770a43acdb7d0a53da411c9b892e69bb6e4
-
-PODFILE CHECKSUM: 4f420ecd33a82075e360098bbed0ccaadfeb1728
-
-COCOAPODS: 1.5.3
diff --git a/Demo/Pods/Nimble/LICENSE b/Demo/Pods/Nimble/LICENSE
deleted file mode 100644
index 82b84bf..0000000
--- a/Demo/Pods/Nimble/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
-Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright 2016 Quick Team
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/Demo/Pods/Nimble/README.md b/Demo/Pods/Nimble/README.md
deleted file mode 100644
index 19c562f..0000000
--- a/Demo/Pods/Nimble/README.md
+++ /dev/null
@@ -1,1764 +0,0 @@
-# Nimble
-
-[![Build Status](https://travis-ci.org/Quick/Nimble.svg?branch=master)](https://travis-ci.org/Quick/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)
-[![Platforms](https://img.shields.io/cocoapods/p/Nimble.svg)](https://cocoapods.org/pods/Nimble)
-
-Use Nimble to express the expected outcomes of Swift
-or Objective-C expressions. Inspired by
-[Cedar](https://github.com/pivotal/cedar).
-
-```swift
-// Swift
-expect(1 + 1).to(equal(2))
-expect(1.2).to(beCloseTo(1.1, within: 0.1))
-expect(3) > 2
-expect("seahorse").to(contain("sea"))
-expect(["Atlantic", "Pacific"]).toNot(contain("Mississippi"))
-expect(ocean.isClean).toEventually(beTruthy())
-```
-
-# How to Use Nimble
-
-
-
-**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
-
-- [Some Background: Expressing Outcomes Using Assertions in XCTest](#some-background-expressing-outcomes-using-assertions-in-xctest)
-- [Nimble: Expectations Using `expect(...).to`](#nimble-expectations-using-expectto)
- - [Custom Failure Messages](#custom-failure-messages)
- - [Type Safety](#type-safety)
- - [Operator Overloads](#operator-overloads)
- - [Lazily Computed Values](#lazily-computed-values)
- - [C Primitives](#c-primitives)
- - [Asynchronous Expectations](#asynchronous-expectations)
- - [Objective-C Support](#objective-c-support)
- - [Disabling Objective-C Shorthand](#disabling-objective-c-shorthand)
-- [Built-in Matcher Functions](#built-in-matcher-functions)
- - [Type Checking](#type-checking)
- - [Equivalence](#equivalence)
- - [Identity](#identity)
- - [Comparisons](#comparisons)
- - [Types/Classes](#typesclasses)
- - [Truthiness](#truthiness)
- - [Swift Assertions](#swift-assertions)
- - [Swift Error Handling](#swift-error-handling)
- - [Exceptions](#exceptions)
- - [Collection Membership](#collection-membership)
- - [Strings](#strings)
- - [Collection Elements](#collection-elements)
- - [Collection Count](#collection-count)
- - [Notifications](#notifications)
- - [Matching a value to any of a group of matchers](#matching-a-value-to-any-of-a-group-of-matchers)
- - [Custom Validation](#custom-validation)
-- [Writing Your Own Matchers](#writing-your-own-matchers)
- - [PredicateResult](#predicateresult)
- - [Lazy Evaluation](#lazy-evaluation)
- - [Type Checking via Swift Generics](#type-checking-via-swift-generics)
- - [Customizing Failure Messages](#customizing-failure-messages)
- - [Basic Customization](#basic-customization)
- - [Full Customization](#full-customization)
- - [Supporting Objective-C](#supporting-objective-c)
- - [Properly Handling `nil` in Objective-C Matchers](#properly-handling-nil-in-objective-c-matchers)
- - [Migrating from the Old Matcher API](#migrating-from-the-old-matcher-api)
- - [Minimal Step - Use `.predicate`](#minimal-step---use-predicate)
- - [Convert to use `Predicate` Type with Old Matcher Constructor](#convert-to-use-predicate-type-with-old-matcher-constructor)
- - [Convert to `Predicate` Type with Preferred Constructor](#convert-to-predicate-type-with-preferred-constructor)
- - [Deprecation Roadmap](#deprecation-roadmap)
-- [Installing Nimble](#installing-nimble)
- - [Installing Nimble as a Submodule](#installing-nimble-as-a-submodule)
- - [Installing Nimble via CocoaPods](#installing-nimble-via-cocoapods)
- - [Using Nimble without XCTest](#using-nimble-without-xctest)
-
-
-
-# Some Background: Expressing Outcomes Using Assertions in XCTest
-
-Apple's Xcode includes the XCTest framework, which provides
-assertion macros to test whether code behaves properly.
-For example, to assert that `1 + 1 = 2`, XCTest has you write:
-
-```swift
-// Swift
-
-XCTAssertEqual(1 + 1, 2, "expected one plus one to equal two")
-```
-
-Or, in Objective-C:
-
-```objc
-// Objective-C
-
-XCTAssertEqual(1 + 1, 2, @"expected one plus one to equal two");
-```
-
-XCTest assertions have a couple of drawbacks:
-
-1. **Not enough macros.** There's no easy way to assert that a string
- contains a particular substring, or that a number is less than or
- equal to another.
-2. **It's hard to write asynchronous tests.** XCTest forces you to write
- a lot of boilerplate code.
-
-Nimble addresses these concerns.
-
-# Nimble: Expectations Using `expect(...).to`
-
-Nimble allows you to express expectations using a natural,
-easily understood language:
-
-```swift
-// Swift
-
-import Nimble
-
-expect(seagull.squawk).to(equal("Squee!"))
-```
-
-```objc
-// Objective-C
-
-@import Nimble;
-
-expect(seagull.squawk).to(equal(@"Squee!"));
-```
-
-> The `expect` function autocompletes to include `file:` and `line:`,
- but these parameters are optional. Use the default values to have
- Xcode highlight the correct line when an expectation is not met.
-
-To perform the opposite expectation--to assert something is *not*
-equal--use `toNot` or `notTo`:
-
-```swift
-// Swift
-
-import Nimble
-
-expect(seagull.squawk).toNot(equal("Oh, hello there!"))
-expect(seagull.squawk).notTo(equal("Oh, hello there!"))
-```
-
-```objc
-// Objective-C
-
-@import Nimble;
-
-expect(seagull.squawk).toNot(equal(@"Oh, hello there!"));
-expect(seagull.squawk).notTo(equal(@"Oh, hello there!"));
-```
-
-## Custom Failure Messages
-
-Would you like to add more information to the test's failure messages? Use the `description` optional argument to add your own text:
-
-```swift
-// Swift
-
-expect(1 + 1).to(equal(3))
-// failed - expected to equal <3>, got <2>
-
-expect(1 + 1).to(equal(3), description: "Make sure libKindergartenMath is loaded")
-// failed - Make sure libKindergartenMath is loaded
-// expected to equal <3>, got <2>
-```
-
-Or the *WithDescription version in Objective-C:
-
-```objc
-// Objective-C
-
-@import Nimble;
-
-expect(@(1+1)).to(equal(@3));
-// failed - expected to equal <3.0000>, got <2.0000>
-
-expect(@(1+1)).toWithDescription(equal(@3), @"Make sure libKindergartenMath is loaded");
-// failed - Make sure libKindergartenMath is loaded
-// expected to equal <3.0000>, got <2.0000>
-```
-
-## Type Safety
-
-Nimble makes sure you don't compare two types that don't match:
-
-```swift
-// Swift
-
-// Does not compile:
-expect(1 + 1).to(equal("Squee!"))
-```
-
-> Nimble uses generics--only available in Swift--to ensure
- type correctness. That means type checking is
- not available when using Nimble in Objective-C. :sob:
-
-## Operator Overloads
-
-Tired of so much typing? With Nimble, you can use overloaded operators
-like `==` for equivalence, or `>` for comparisons:
-
-```swift
-// Swift
-
-// Passes if squawk does not equal "Hi!":
-expect(seagull.squawk) != "Hi!"
-
-// Passes if 10 is greater than 2:
-expect(10) > 2
-```
-
-> Operator overloads are only available in Swift, so you won't be able
- to use this syntax in Objective-C. :broken_heart:
-
-## Lazily Computed Values
-
-The `expect` function doesn't evaluate the value it's given until it's
-time to match. So Nimble can test whether an expression raises an
-exception once evaluated:
-
-```swift
-// Swift
-
-// Note: Swift currently doesn't have exceptions.
-// Only Objective-C code can raise exceptions
-// that Nimble will catch.
-// (see https://github.com/Quick/Nimble/issues/220#issuecomment-172667064)
-let exception = NSException(
- name: NSInternalInconsistencyException,
- reason: "Not enough fish in the sea.",
- userInfo: ["something": "is fishy"])
-expect { exception.raise() }.to(raiseException())
-
-// Also, you can customize raiseException to be more specific
-expect { exception.raise() }.to(raiseException(named: NSInternalInconsistencyException))
-expect { exception.raise() }.to(raiseException(
- named: NSInternalInconsistencyException,
- reason: "Not enough fish in the sea"))
-expect { exception.raise() }.to(raiseException(
- named: NSInternalInconsistencyException,
- reason: "Not enough fish in the sea",
- userInfo: ["something": "is fishy"]))
-```
-
-Objective-C works the same way, but you must use the `expectAction`
-macro when making an expectation on an expression that has no return
-value:
-
-```objc
-// Objective-C
-
-NSException *exception = [NSException exceptionWithName:NSInternalInconsistencyException
- reason:@"Not enough fish in the sea."
- userInfo:nil];
-expectAction(^{ [exception raise]; }).to(raiseException());
-
-// Use the property-block syntax to be more specific.
-expectAction(^{ [exception raise]; }).to(raiseException().named(NSInternalInconsistencyException));
-expectAction(^{ [exception raise]; }).to(raiseException().
- named(NSInternalInconsistencyException).
- reason("Not enough fish in the sea"));
-expectAction(^{ [exception raise]; }).to(raiseException().
- named(NSInternalInconsistencyException).
- reason("Not enough fish in the sea").
- userInfo(@{@"something": @"is fishy"}));
-
-// You can also pass a block for custom matching of the raised exception
-expectAction(exception.raise()).to(raiseException().satisfyingBlock(^(NSException *exception) {
- expect(exception.name).to(beginWith(NSInternalInconsistencyException));
-}));
-```
-
-## C Primitives
-
-Some testing frameworks make it hard to test primitive C values.
-In Nimble, it just works:
-
-```swift
-// Swift
-
-let actual: CInt = 1
-let expectedValue: CInt = 1
-expect(actual).to(equal(expectedValue))
-```
-
-In fact, Nimble uses type inference, so you can write the above
-without explicitly specifying both types:
-
-```swift
-// Swift
-
-expect(1 as CInt).to(equal(1))
-```
-
-> In Objective-C, Nimble only supports Objective-C objects. To
- make expectations on primitive C values, wrap then in an object
- literal:
-
-```objc
-expect(@(1 + 1)).to(equal(@2));
-```
-
-## Asynchronous Expectations
-
-In Nimble, it's easy to make expectations on values that are updated
-asynchronously. Just use `toEventually` or `toEventuallyNot`:
-
-```swift
-// Swift 3.0 and later
-
-DispatchQueue.main.async {
- ocean.add("dolphins")
- ocean.add("whales")
-}
-expect(ocean).toEventually(contain("dolphins", "whales"))
-```
-
-
-```swift
-// Swift 2.3 and earlier
-
-dispatch_async(dispatch_get_main_queue()) {
- ocean.add("dolphins")
- ocean.add("whales")
-}
-expect(ocean).toEventually(contain("dolphins", "whales"))
-```
-
-
-```objc
-// Objective-C
-
-dispatch_async(dispatch_get_main_queue(), ^{
- [ocean add:@"dolphins"];
- [ocean add:@"whales"];
-});
-expect(ocean).toEventually(contain(@"dolphins", @"whales"));
-```
-
-Note: toEventually triggers its polls on the main thread. Blocking the main
-thread will cause Nimble to stop the run loop. This can cause test pollution
-for whatever incomplete code that was running on the main thread. Blocking the
-main thread can be caused by blocking IO, calls to sleep(), deadlocks, and
-synchronous IPC.
-
-In the above example, `ocean` is constantly re-evaluated. If it ever
-contains dolphins and whales, the expectation passes. If `ocean` still
-doesn't contain them, even after being continuously re-evaluated for one
-whole second, the expectation fails.
-
-Sometimes it takes more than a second for a value to update. In those
-cases, use the `timeout` parameter:
-
-```swift
-// Swift
-
-// Waits three seconds for ocean to contain "starfish":
-expect(ocean).toEventually(contain("starfish"), timeout: 3)
-
-// Evaluate someValue every 0.2 seconds repeatedly until it equals 100, or fails if it timeouts after 5.5 seconds.
-expect(someValue).toEventually(equal(100), timeout: 5.5, pollInterval: 0.2)
-```
-
-```objc
-// Objective-C
-
-// Waits three seconds for ocean to contain "starfish":
-expect(ocean).withTimeout(3).toEventually(contain(@"starfish"));
-```
-
-You can also provide a callback by using the `waitUntil` function:
-
-```swift
-// Swift
-
-waitUntil { done in
- ocean.goFish { success in
- expect(success).to(beTrue())
- done()
- }
-}
-```
-
-```objc
-// Objective-C
-
-waitUntil(^(void (^done)(void)){
- [ocean goFishWithHandler:^(BOOL success){
- expect(success).to(beTrue());
- done();
- }];
-});
-```
-
-`waitUntil` also optionally takes a timeout parameter:
-
-```swift
-// Swift
-
-waitUntil(timeout: 10) { done in
- ocean.goFish { success in
- expect(success).to(beTrue())
- done()
- }
-}
-```
-
-```objc
-// Objective-C
-
-waitUntilTimeout(10, ^(void (^done)(void)){
- [ocean goFishWithHandler:^(BOOL success){
- expect(success).to(beTrue());
- done();
- }];
-});
-```
-
-Note: `waitUntil` triggers its timeout code on the main thread. Blocking the main
-thread will cause Nimble to stop the run loop to continue. This can cause test
-pollution for whatever incomplete code that was running on the main thread.
-Blocking the main thread can be caused by blocking IO, calls to sleep(),
-deadlocks, and synchronous IPC.
-
-In some cases (e.g. when running on slower machines) it can be useful to modify
-the default timeout and poll interval values. This can be done as follows:
-
-```swift
-// Swift
-
-// Increase the global timeout to 5 seconds:
-Nimble.AsyncDefaults.Timeout = 5
-
-// Slow the polling interval to 0.1 seconds:
-Nimble.AsyncDefaults.PollInterval = 0.1
-```
-
-## Objective-C Support
-
-Nimble has full support for Objective-C. However, there are two things
-to keep in mind when using Nimble in Objective-C:
-
-1. All parameters passed to the `expect` function, as well as matcher
- functions like `equal`, must be Objective-C objects or can be converted into
- an `NSObject` equivalent:
-
- ```objc
- // Objective-C
-
- @import Nimble;
-
- expect(@(1 + 1)).to(equal(@2));
- expect(@"Hello world").to(contain(@"world"));
-
- // Boxed as NSNumber *
- expect(2).to(equal(2));
- expect(1.2).to(beLessThan(2.0));
- expect(true).to(beTruthy());
-
- // Boxed as NSString *
- expect("Hello world").to(equal("Hello world"));
-
- // Boxed as NSRange
- expect(NSMakeRange(1, 10)).to(equal(NSMakeRange(1, 10)));
- ```
-
-2. To make an expectation on an expression that does not return a value,
- such as `-[NSException raise]`, use `expectAction` instead of
- `expect`:
-
- ```objc
- // Objective-C
-
- expectAction(^{ [exception raise]; }).to(raiseException());
- ```
-
-The following types are currently converted to an `NSObject` type:
-
- - **C Numeric types** are converted to `NSNumber *`
- - `NSRange` is converted to `NSValue *`
- - `char *` is converted to `NSString *`
-
-For the following matchers:
-
-- `equal`
-- `beGreaterThan`
-- `beGreaterThanOrEqual`
-- `beLessThan`
-- `beLessThanOrEqual`
-- `beCloseTo`
-- `beTrue`
-- `beFalse`
-- `beTruthy`
-- `beFalsy`
-- `haveCount`
-
-If you would like to see more, [file an issue](https://github.com/Quick/Nimble/issues).
-
-## Disabling Objective-C Shorthand
-
-Nimble provides a shorthand for expressing expectations using the
-`expect` function. To disable this shorthand in Objective-C, define the
-`NIMBLE_DISABLE_SHORT_SYNTAX` macro somewhere in your code before
-importing Nimble:
-
-```objc
-#define NIMBLE_DISABLE_SHORT_SYNTAX 1
-
-@import Nimble;
-
-NMB_expect(^{ return seagull.squawk; }, __FILE__, __LINE__).to(NMB_equal(@"Squee!"));
-```
-
-> Disabling the shorthand is useful if you're testing functions with
- names that conflict with Nimble functions, such as `expect` or
- `equal`. If that's not the case, there's no point in disabling the
- shorthand.
-
-# Built-in Matcher Functions
-
-Nimble includes a wide variety of matcher functions.
-
-## Type Checking
-
-Nimble supports checking the type membership of any kind of object, whether
-Objective-C conformant or not:
-
-```swift
-// Swift
-
-protocol SomeProtocol{}
-class SomeClassConformingToProtocol: SomeProtocol{}
-struct SomeStructConformingToProtocol: SomeProtocol{}
-
-// The following tests pass
-expect(1).to(beAKindOf(Int.self))
-expect("turtle").to(beAKindOf(String.self))
-
-let classObject = SomeClassConformingToProtocol()
-expect(classObject).to(beAKindOf(SomeProtocol.self))
-expect(classObject).to(beAKindOf(SomeClassConformingToProtocol.self))
-expect(classObject).toNot(beAKindOf(SomeStructConformingToProtocol.self))
-
-let structObject = SomeStructConformingToProtocol()
-expect(structObject).to(beAKindOf(SomeProtocol.self))
-expect(structObject).to(beAKindOf(SomeStructConformingToProtocol.self))
-expect(structObject).toNot(beAKindOf(SomeClassConformingToProtocol.self))
-```
-
-```objc
-// Objective-C
-
-// The following tests pass
-NSMutableArray *array = [NSMutableArray array];
-expect(array).to(beAKindOf([NSArray class]));
-expect(@1).toNot(beAKindOf([NSNull class]));
-```
-
-Objects can be tested for their exact types using the `beAnInstanceOf` matcher:
-
-```swift
-// Swift
-
-protocol SomeProtocol{}
-class SomeClassConformingToProtocol: SomeProtocol{}
-struct SomeStructConformingToProtocol: SomeProtocol{}
-
-// Unlike the 'beKindOf' matcher, the 'beAnInstanceOf' matcher only
-// passes if the object is the EXACT type requested. The following
-// tests pass -- note its behavior when working in an inheritance hierarchy.
-expect(1).to(beAnInstanceOf(Int.self))
-expect("turtle").to(beAnInstanceOf(String.self))
-
-let classObject = SomeClassConformingToProtocol()
-expect(classObject).toNot(beAnInstanceOf(SomeProtocol.self))
-expect(classObject).to(beAnInstanceOf(SomeClassConformingToProtocol.self))
-expect(classObject).toNot(beAnInstanceOf(SomeStructConformingToProtocol.self))
-
-let structObject = SomeStructConformingToProtocol()
-expect(structObject).toNot(beAnInstanceOf(SomeProtocol.self))
-expect(structObject).to(beAnInstanceOf(SomeStructConformingToProtocol.self))
-expect(structObject).toNot(beAnInstanceOf(SomeClassConformingToProtocol.self))
-```
-
-## Equivalence
-
-```swift
-// Swift
-
-// Passes if 'actual' is equivalent to 'expected':
-expect(actual).to(equal(expected))
-expect(actual) == expected
-
-// Passes if 'actual' is not equivalent to 'expected':
-expect(actual).toNot(equal(expected))
-expect(actual) != expected
-```
-
-```objc
-// Objective-C
-
-// Passes if 'actual' is equivalent to 'expected':
-expect(actual).to(equal(expected))
-
-// Passes if 'actual' is not equivalent to 'expected':
-expect(actual).toNot(equal(expected))
-```
-
-Values must be `Equatable`, `Comparable`, or subclasses of `NSObject`.
-`equal` will always fail when used to compare one or more `nil` values.
-
-## Identity
-
-```swift
-// Swift
-
-// Passes if 'actual' has the same pointer address as 'expected':
-expect(actual).to(beIdenticalTo(expected))
-expect(actual) === expected
-
-// Passes if 'actual' does not have the same pointer address as 'expected':
-expect(actual).toNot(beIdenticalTo(expected))
-expect(actual) !== expected
-```
-
-It is important to remember that `beIdenticalTo` only makes sense when comparing
-types with reference semantics, which have a notion of identity. In Swift,
-that means types that are defined as a `class`.
-
-This matcher will not work when comparing types with value semantics such as
-those defined as a `struct` or `enum`. If you need to compare two value types,
-consider what it means for instances of your type to be identical. This may mean
-comparing individual properties or, if it makes sense to do so, conforming your type
-to `Equatable` and using Nimble's equivalence matchers instead.
-
-
-```objc
-// Objective-C
-
-// Passes if 'actual' has the same pointer address as 'expected':
-expect(actual).to(beIdenticalTo(expected));
-
-// Passes if 'actual' does not have the same pointer address as 'expected':
-expect(actual).toNot(beIdenticalTo(expected));
-```
-
-## Comparisons
-
-```swift
-// Swift
-
-expect(actual).to(beLessThan(expected))
-expect(actual) < expected
-
-expect(actual).to(beLessThanOrEqualTo(expected))
-expect(actual) <= expected
-
-expect(actual).to(beGreaterThan(expected))
-expect(actual) > expected
-
-expect(actual).to(beGreaterThanOrEqualTo(expected))
-expect(actual) >= expected
-```
-
-```objc
-// Objective-C
-
-expect(actual).to(beLessThan(expected));
-expect(actual).to(beLessThanOrEqualTo(expected));
-expect(actual).to(beGreaterThan(expected));
-expect(actual).to(beGreaterThanOrEqualTo(expected));
-```
-
-> Values given to the comparison matchers above must implement
- `Comparable`.
-
-Because of how computers represent floating point numbers, assertions
-that two floating point numbers be equal will sometimes fail. To express
-that two numbers should be close to one another within a certain margin
-of error, use `beCloseTo`:
-
-```swift
-// Swift
-
-expect(actual).to(beCloseTo(expected, within: delta))
-```
-
-```objc
-// Objective-C
-
-expect(actual).to(beCloseTo(expected).within(delta));
-```
-
-For example, to assert that `10.01` is close to `10`, you can write:
-
-```swift
-// Swift
-
-expect(10.01).to(beCloseTo(10, within: 0.1))
-```
-
-```objc
-// Objective-C
-
-expect(@(10.01)).to(beCloseTo(@10).within(0.1));
-```
-
-There is also an operator shortcut available in Swift:
-
-```swift
-// Swift
-
-expect(actual) ≈ expected
-expect(actual) ≈ (expected, delta)
-
-```
-(Type option+x to get `≈` on a U.S. keyboard)
-
-The former version uses the default delta of 0.0001. Here is yet another way to do this:
-
-```swift
-// Swift
-
-expect(actual) ≈ expected ± delta
-expect(actual) == expected ± delta
-
-```
-(Type option+shift+= to get `±` on a U.S. keyboard)
-
-If you are comparing arrays of floating point numbers, you'll find the following useful:
-
-```swift
-// Swift
-
-expect([0.0, 2.0]) ≈ [0.0001, 2.0001]
-expect([0.0, 2.0]).to(beCloseTo([0.1, 2.1], within: 0.1))
-
-```
-
-> Values given to the `beCloseTo` matcher must be coercable into a
- `Double`.
-
-## Types/Classes
-
-```swift
-// Swift
-
-// Passes if 'instance' is an instance of 'aClass':
-expect(instance).to(beAnInstanceOf(aClass))
-
-// Passes if 'instance' is an instance of 'aClass' or any of its subclasses:
-expect(instance).to(beAKindOf(aClass))
-```
-
-```objc
-// Objective-C
-
-// Passes if 'instance' is an instance of 'aClass':
-expect(instance).to(beAnInstanceOf(aClass));
-
-// Passes if 'instance' is an instance of 'aClass' or any of its subclasses:
-expect(instance).to(beAKindOf(aClass));
-```
-
-> Instances must be Objective-C objects: subclasses of `NSObject`,
- or Swift objects bridged to Objective-C with the `@objc` prefix.
-
-For example, to assert that `dolphin` is a kind of `Mammal`:
-
-```swift
-// Swift
-
-expect(dolphin).to(beAKindOf(Mammal))
-```
-
-```objc
-// Objective-C
-
-expect(dolphin).to(beAKindOf([Mammal class]));
-```
-
-> `beAnInstanceOf` uses the `-[NSObject isMemberOfClass:]` method to
- test membership. `beAKindOf` uses `-[NSObject isKindOfClass:]`.
-
-## Truthiness
-
-```swift
-// Passes if 'actual' is not nil, true, or an object with a boolean value of true:
-expect(actual).to(beTruthy())
-
-// Passes if 'actual' is only true (not nil or an object conforming to Boolean true):
-expect(actual).to(beTrue())
-
-// Passes if 'actual' is nil, false, or an object with a boolean value of false:
-expect(actual).to(beFalsy())
-
-// Passes if 'actual' is only false (not nil or an object conforming to Boolean false):
-expect(actual).to(beFalse())
-
-// Passes if 'actual' is nil:
-expect(actual).to(beNil())
-```
-
-```objc
-// Objective-C
-
-// Passes if 'actual' is not nil, true, or an object with a boolean value of true:
-expect(actual).to(beTruthy());
-
-// Passes if 'actual' is only true (not nil or an object conforming to Boolean true):
-expect(actual).to(beTrue());
-
-// Passes if 'actual' is nil, false, or an object with a boolean value of false:
-expect(actual).to(beFalsy());
-
-// Passes if 'actual' is only false (not nil or an object conforming to Boolean false):
-expect(actual).to(beFalse());
-
-// Passes if 'actual' is nil:
-expect(actual).to(beNil());
-```
-
-## Swift Assertions
-
-If you're using Swift, you can use the `throwAssertion` matcher to check if an assertion is thrown (e.g. `fatalError()`). This is made possible by [@mattgallagher](https://github.com/mattgallagher)'s [CwlPreconditionTesting](https://github.com/mattgallagher/CwlPreconditionTesting) library.
-
-```swift
-// Swift
-
-// Passes if 'somethingThatThrows()' throws an assertion,
-// such as by calling 'fatalError()' or if a precondition fails:
-expect { try somethingThatThrows() }.to(throwAssertion())
-expect { () -> Void in fatalError() }.to(throwAssertion())
-expect { precondition(false) }.to(throwAssertion())
-
-// Passes if throwing an NSError is not equal to throwing an assertion:
-expect { throw NSError(domain: "test", code: 0, userInfo: nil) }.toNot(throwAssertion())
-
-// Passes if the code after the precondition check is not run:
-var reachedPoint1 = false
-var reachedPoint2 = false
-expect {
- reachedPoint1 = true
- precondition(false, "condition message")
- reachedPoint2 = true
-}.to(throwAssertion())
-
-expect(reachedPoint1) == true
-expect(reachedPoint2) == false
-```
-
-Notes:
-
-* This feature is only available in Swift.
-* It is only supported for `x86_64` binaries, meaning _you cannot run this matcher on iOS devices, only simulators_.
-* The tvOS simulator is supported, but using a different mechanism, requiring you to turn off the `Debug executable` scheme setting for your tvOS scheme's Test configuration.
-
-## Swift Error Handling
-
-If you're using Swift 2.0 or newer, you can use the `throwError` matcher to check if an error is thrown.
-
-Note:
-The following code sample references the `Swift.Error` protocol.
-This is `Swift.ErrorProtocol` in versions of Swift prior to version 3.0.
-
-```swift
-// Swift
-
-// Passes if 'somethingThatThrows()' throws an 'Error':
-expect { try somethingThatThrows() }.to(throwError())
-
-// Passes if 'somethingThatThrows()' throws an error within a particular domain:
-expect { try somethingThatThrows() }.to(throwError { (error: Error) in
- expect(error._domain).to(equal(NSCocoaErrorDomain))
-})
-
-// Passes if 'somethingThatThrows()' throws a particular error enum case:
-expect { try somethingThatThrows() }.to(throwError(NSCocoaError.PropertyListReadCorruptError))
-
-// Passes if 'somethingThatThrows()' throws an error of a particular type:
-expect { try somethingThatThrows() }.to(throwError(errorType: NimbleError.self))
-```
-
-When working directly with `Error` values, using the `matchError` matcher
-allows you to perform certain checks on the error itself without having to
-explicitly cast the error.
-
-The `matchError` matcher allows you to check whether or not the error:
-
-- is the same _type_ of error you are expecting.
-- represents a particular error value that you are expecting.
-
-This can be useful when using `Result` or `Promise` types, for example.
-
-```swift
-// Swift
-
-let actual: Error = ...
-
-// Passes if 'actual' represents any error value from the NimbleErrorEnum type:
-expect(actual).to(matchError(NimbleErrorEnum.self))
-
-// Passes if 'actual' represents the case 'timeout' from the NimbleErrorEnum type:
-expect(actual).to(matchError(NimbleErrorEnum.timeout))
-
-// Passes if 'actual' contains an NSError equal to the one provided:
-expect(actual).to(matchError(NSError(domain: "err", code: 123, userInfo: nil)))
-```
-
-Note: This feature is only available in Swift.
-
-## Exceptions
-
-```swift
-// Swift
-
-// Passes if 'actual', when evaluated, raises an exception:
-expect(actual).to(raiseException())
-
-// Passes if 'actual' raises an exception with the given name:
-expect(actual).to(raiseException(named: name))
-
-// Passes if 'actual' raises an exception with the given name and reason:
-expect(actual).to(raiseException(named: name, reason: reason))
-
-// Passes if 'actual' raises an exception which passes expectations defined in the given closure:
-// (in this case, if the exception's name begins with "a r")
-expect { exception.raise() }.to(raiseException { (exception: NSException) in
- expect(exception.name).to(beginWith("a r"))
-})
-```
-
-```objc
-// Objective-C
-
-// Passes if 'actual', when evaluated, raises an exception:
-expect(actual).to(raiseException())
-
-// Passes if 'actual' raises an exception with the given name
-expect(actual).to(raiseException().named(name))
-
-// Passes if 'actual' raises an exception with the given name and reason:
-expect(actual).to(raiseException().named(name).reason(reason))
-
-// Passes if 'actual' raises an exception and it passes expectations defined in the given block:
-// (in this case, if name begins with "a r")
-expect(actual).to(raiseException().satisfyingBlock(^(NSException *exception) {
- expect(exception.name).to(beginWith(@"a r"));
-}));
-```
-
-Note: Swift currently doesn't have exceptions (see [#220](https://github.com/Quick/Nimble/issues/220#issuecomment-172667064)).
-Only Objective-C code can raise exceptions that Nimble will catch.
-
-## Collection Membership
-
-```swift
-// Swift
-
-// Passes if all of the expected values are members of 'actual':
-expect(actual).to(contain(expected...))
-
-// Passes if 'actual' is empty (i.e. it contains no elements):
-expect(actual).to(beEmpty())
-```
-
-```objc
-// Objective-C
-
-// Passes if expected is a member of 'actual':
-expect(actual).to(contain(expected));
-
-// Passes if 'actual' is empty (i.e. it contains no elements):
-expect(actual).to(beEmpty());
-```
-
-> In Swift `contain` takes any number of arguments. The expectation
- passes if all of them are members of the collection. In Objective-C,
- `contain` only takes one argument [for now](https://github.com/Quick/Nimble/issues/27).
-
-For example, to assert that a list of sea creature names contains
-"dolphin" and "starfish":
-
-```swift
-// Swift
-
-expect(["whale", "dolphin", "starfish"]).to(contain("dolphin", "starfish"))
-```
-
-```objc
-// Objective-C
-
-expect(@[@"whale", @"dolphin", @"starfish"]).to(contain(@"dolphin"));
-expect(@[@"whale", @"dolphin", @"starfish"]).to(contain(@"starfish"));
-```
-
-> `contain` and `beEmpty` expect collections to be instances of
- `NSArray`, `NSSet`, or a Swift collection composed of `Equatable` elements.
-
-To test whether a set of elements is present at the beginning or end of
-an ordered collection, use `beginWith` and `endWith`:
-
-```swift
-// Swift
-
-// Passes if the elements in expected appear at the beginning of 'actual':
-expect(actual).to(beginWith(expected...))
-
-// Passes if the the elements in expected come at the end of 'actual':
-expect(actual).to(endWith(expected...))
-```
-
-```objc
-// Objective-C
-
-// Passes if the elements in expected appear at the beginning of 'actual':
-expect(actual).to(beginWith(expected));
-
-// Passes if the the elements in expected come at the end of 'actual':
-expect(actual).to(endWith(expected));
-```
-
-> `beginWith` and `endWith` expect collections to be instances of
- `NSArray`, or ordered Swift collections composed of `Equatable`
- elements.
-
- Like `contain`, in Objective-C `beginWith` and `endWith` only support
- a single argument [for now](https://github.com/Quick/Nimble/issues/27).
-
-For code that returns collections of complex objects without a strict
-ordering, there is the `containElementSatisfying` matcher:
-
-```swift
-// Swift
-
-struct Turtle {
- let color: String
-}
-
-let turtles: [Turtle] = functionThatReturnsSomeTurtlesInAnyOrder()
-
-// This set of matchers passes regardless of whether the array is
-// [{color: "blue"}, {color: "green"}] or [{color: "green"}, {color: "blue"}]:
-
-expect(turtles).to(containElementSatisfying({ turtle in
- return turtle.color == "green"
-}))
-expect(turtles).to(containElementSatisfying({ turtle in
- return turtle.color == "blue"
-}, "that is a turtle with color 'blue'"))
-
-// The second matcher will incorporate the provided string in the error message
-// should it fail
-```
-
-```objc
-// Objective-C
-
-@interface Turtle : NSObject
-@property (nonatomic, readonly, nonnull) NSString *color;
-@end
-
-@implementation Turtle
-@end
-
-NSArray * __nonnull turtles = functionThatReturnsSomeTurtlesInAnyOrder();
-
-// This set of matchers passes regardless of whether the array is
-// [{color: "blue"}, {color: "green"}] or [{color: "green"}, {color: "blue"}]:
-
-expect(turtles).to(containElementSatisfying(^BOOL(id __nonnull object) {
- return [[turtle color] isEqualToString:@"green"];
-}));
-expect(turtles).to(containElementSatisfying(^BOOL(id __nonnull object) {
- return [[turtle color] isEqualToString:@"blue"];
-}));
-```
-
-## Strings
-
-```swift
-// Swift
-
-// Passes if 'actual' contains 'substring':
-expect(actual).to(contain(substring))
-
-// Passes if 'actual' begins with 'prefix':
-expect(actual).to(beginWith(prefix))
-
-// Passes if 'actual' ends with 'suffix':
-expect(actual).to(endWith(suffix))
-
-// Passes if 'actual' represents the empty string, "":
-expect(actual).to(beEmpty())
-
-// Passes if 'actual' matches the regular expression defined in 'expected':
-expect(actual).to(match(expected))
-```
-
-```objc
-// Objective-C
-
-// Passes if 'actual' contains 'substring':
-expect(actual).to(contain(expected));
-
-// Passes if 'actual' begins with 'prefix':
-expect(actual).to(beginWith(prefix));
-
-// Passes if 'actual' ends with 'suffix':
-expect(actual).to(endWith(suffix));
-
-// Passes if 'actual' represents the empty string, "":
-expect(actual).to(beEmpty());
-
-// Passes if 'actual' matches the regular expression defined in 'expected':
-expect(actual).to(match(expected))
-```
-
-## Collection Elements
-
-Nimble provides a means to check that all elements of a collection pass a given expectation.
-
-### Swift
-
-In Swift, the collection must be an instance of a type conforming to
-`Sequence`.
-
-```swift
-// Swift
-
-// Providing a custom function:
-expect([1, 2, 3, 4]).to(allPass { $0! < 5 })
-
-// Composing the expectation with another matcher:
-expect([1, 2, 3, 4]).to(allPass(beLessThan(5)))
-```
-
-### Objective-C
-
-In Objective-C, the collection must be an instance of a type which implements
-the `NSFastEnumeration` protocol, and whose elements are instances of a type
-which subclasses `NSObject`.
-
-Additionally, unlike in Swift, there is no override to specify a custom
-matcher function.
-
-```objc
-// Objective-C
-
-expect(@[@1, @2, @3, @4]).to(allPass(beLessThan(@5)));
-```
-
-## Collection Count
-
-```swift
-// Swift
-
-// Passes if 'actual' contains the 'expected' number of elements:
-expect(actual).to(haveCount(expected))
-
-// Passes if 'actual' does _not_ contain the 'expected' number of elements:
-expect(actual).notTo(haveCount(expected))
-```
-
-```objc
-// Objective-C
-
-// Passes if 'actual' contains the 'expected' number of elements:
-expect(actual).to(haveCount(expected))
-
-// Passes if 'actual' does _not_ contain the 'expected' number of elements:
-expect(actual).notTo(haveCount(expected))
-```
-
-For Swift, the actual value must be an instance of a type conforming to `Collection`.
-For example, instances of `Array`, `Dictionary`, or `Set`.
-
-For Objective-C, the actual value must be one of the following classes, or their subclasses:
-
- - `NSArray`,
- - `NSDictionary`,
- - `NSSet`, or
- - `NSHashTable`.
-
-## Notifications
-
-```swift
-// Swift
-let testNotification = Notification(name: "Foo", object: nil)
-
-// passes if the closure in expect { ... } posts a notification to the default
-// notification center.
-expect {
- NotificationCenter.default.postNotification(testNotification)
-}.to(postNotifications(equal([testNotification]))
-
-// passes if the closure in expect { ... } posts a notification to a given
-// notification center
-let notificationCenter = NotificationCenter()
-expect {
- notificationCenter.postNotification(testNotification)
-}.to(postNotifications(equal([testNotification]), fromNotificationCenter: notificationCenter))
-```
-
-> This matcher is only available in Swift.
-
-## Matching a value to any of a group of matchers
-
-```swift
-// Swift
-
-// passes if actual is either less than 10 or greater than 20
-expect(actual).to(satisfyAnyOf(beLessThan(10), beGreaterThan(20)))
-
-// can include any number of matchers -- the following will pass
-// **be careful** -- too many matchers can be the sign of an unfocused test
-expect(6).to(satisfyAnyOf(equal(2), equal(3), equal(4), equal(5), equal(6), equal(7)))
-
-// in Swift you also have the option to use the || operator to achieve a similar function
-expect(82).to(beLessThan(50) || beGreaterThan(80))
-```
-
-```objc
-// Objective-C
-
-// passes if actual is either less than 10 or greater than 20
-expect(actual).to(satisfyAnyOf(beLessThan(@10), beGreaterThan(@20)))
-
-// can include any number of matchers -- the following will pass
-// **be careful** -- too many matchers can be the sign of an unfocused test
-expect(@6).to(satisfyAnyOf(equal(@2), equal(@3), equal(@4), equal(@5), equal(@6), equal(@7)))
-```
-
-Note: This matcher allows you to chain any number of matchers together. This provides flexibility,
- but if you find yourself chaining many matchers together in one test, consider whether you
- could instead refactor that single test into multiple, more precisely focused tests for
- better coverage.
-
-## Custom Validation
-
-```swift
-// Swift
-
-// passes if .succeeded is returned from the closure
-expect({
- guard case .enumCaseWithAssociatedValueThatIDontCareAbout = actual else {
- return .failed(reason: "wrong enum case")
- }
-
- return .succeeded
-}).to(succeed())
-
-// passes if .failed is returned from the closure
-expect({
- guard case .enumCaseWithAssociatedValueThatIDontCareAbout = actual else {
- return .failed(reason: "wrong enum case")
- }
-
- return .succeeded
-}).notTo(succeed())
-```
-
-The `String` provided with `.failed()` is shown when the test fails.
-
-When using `toEventually()` be careful not to make state changes or run process intensive code since this closure will be ran many times.
-
-# Writing Your Own Matchers
-
-In Nimble, matchers are Swift functions that take an expected
-value and return a `Predicate` closure. Take `equal`, for example:
-
-```swift
-// Swift
-
-public func equal(expectedValue: T?) -> Predicate {
- // Can be shortened to:
- // Predicate { actual in ... }
- //
- // But shown with types here for clarity.
- return Predicate { (actual: Expression) throws -> PredicateResult in
- let msg = ExpectationMessage.expectedActualValueTo("equal <\(expectedValue)>")
- if let actualValue = try actualExpression.evaluate() {
- return PredicateResult(
- bool: actualValue == expectedValue!,
- message: msg
- )
- } else {
- return PredicateResult(
- status: .fail,
- message: msg.appendedBeNilHint()
- )
- }
- }
-}
-```
-
-The return value of a `Predicate` closure is a `PredicateResult` that indicates
-whether the actual value matches the expectation and what error message to
-display on failure.
-
-> The actual `equal` matcher function does not match when
- `expected` are nil; the example above has been edited for brevity.
-
-Since matchers are just Swift functions, you can define them anywhere:
-at the top of your test file, in a file shared by all of your tests, or
-in an Xcode project you distribute to others.
-
-> If you write a matcher you think everyone can use, consider adding it
- to Nimble's built-in set of matchers by sending a pull request! Or
- distribute it yourself via GitHub.
-
-For examples of how to write your own matchers, just check out the
-[`Matchers` directory](https://github.com/Quick/Nimble/tree/master/Sources/Nimble/Matchers)
-to see how Nimble's built-in set of matchers are implemented. You can
-also check out the tips below.
-
-## PredicateResult
-
-`PredicateResult` is the return struct that `Predicate` return to indicate
-success and failure. A `PredicateResult` is made up of two values:
-`PredicateStatus` and `ExpectationMessage`.
-
-Instead of a boolean, `PredicateStatus` captures a trinary set of values:
-
-```swift
-// Swift
-
-public enum PredicateStatus {
-// The predicate "passes" with the given expression
-// eg - expect(1).to(equal(1))
-case matches
-
-// The predicate "fails" with the given expression
-// eg - expect(1).toNot(equal(1))
-case doesNotMatch
-
-// The predicate never "passes" with the given expression, even if negated
-// eg - expect(nil as Int?).toNot(equal(1))
-case fail
-
-// ...
-}
-```
-
-Meanwhile, `ExpectationMessage` provides messaging semantics for error reporting.
-
-```swift
-// Swift
-
-public indirect enum ExpectationMessage {
-// Emits standard error message:
-// eg - "expected to , got "
-case expectedActualValueTo(/* message: */ String)
-
-// Allows any free-form message
-// eg - ""
-case fail(/* message: */ String)
-
-// ...
-}
-```
-
-Predicates should usually depend on either `.expectedActualValueTo(..)` or
-`.fail(..)` when reporting errors. Special cases can be used for the other enum
-cases.
-
-Finally, if your Predicate utilizes other Predicates, you can utilize
-`.appended(details:)` and `.appended(message:)` methods to annotate an existing
-error with more details.
-
-A common message to append is failing on nils. For that, `.appendedBeNilHint()`
-can be used.
-
-## Lazy Evaluation
-
-`actualExpression` is a lazy, memoized closure around the value provided to the
-`expect` function. The expression can either be a closure or a value directly
-passed to `expect(...)`. In order to determine whether that value matches,
-custom matchers should call `actualExpression.evaluate()`:
-
-```swift
-// Swift
-
-public func beNil() -> Predicate {
- // Predicate.simpleNilable(..) automatically generates ExpectationMessage for
- // us based on the string we provide to it. Also, the 'Nilable' postfix indicates
- // that this Predicate supports matching against nil actualExpressions, instead of
- // always resulting in a PredicateStatus.fail result -- which is true for
- // Predicate.simple(..)
- return Predicate.simpleNilable("be nil") { actualExpression in
- let actualValue = try actualExpression.evaluate()
- return PredicateStatus(bool: actualValue == nil)
- }
-}
-```
-
-In the above example, `actualExpression` is not `nil` -- it is a closure
-that returns a value. The value it returns, which is accessed via the
-`evaluate()` method, may be `nil`. If that value is `nil`, the `beNil`
-matcher function returns `true`, indicating that the expectation passed.
-
-## Type Checking via Swift Generics
-
-Using Swift's generics, matchers can constrain the type of the actual value
-passed to the `expect` function by modifying the return type.
-
-For example, the following matcher, `haveDescription`, only accepts actual
-values that implement the `Printable` protocol. It checks their `description`
-against the one provided to the matcher function, and passes if they are the same:
-
-```swift
-// Swift
-
-public func haveDescription(description: String) -> Predicate {
- return Predicate.simple("have description") { actual in
- return PredicateStatus(bool: actual.evaluate().description == description)
- }
-}
-```
-
-## Customizing Failure Messages
-
-When using `Predicate.simple(..)` or `Predicate.simpleNilable(..)`, Nimble
-outputs the following failure message when an expectation fails:
-
-```swift
-// where `message` is the first string argument and
-// `actual` is the actual value received in `expect(..)`
-"expected to \(message), got <\(actual)>"
-```
-
-You can customize this message by modifying the way you create a `Predicate`.
-
-### Basic Customization
-
-For slightly more complex error messaging, receive the created failure message
-with `Predicate.define(..)`:
-
-```swift
-// Swift
-
-public func equal(_ expectedValue: T?) -> Predicate {
- return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in
- let actualValue = try actualExpression.evaluate()
- let matches = actualValue == expectedValue && expectedValue != nil
- if expectedValue == nil || actualValue == nil {
- if expectedValue == nil && actualValue != nil {
- return PredicateResult(
- status: .fail,
- message: msg.appendedBeNilHint()
- )
- }
- return PredicateResult(status: .fail, message: msg)
- }
- return PredicateResult(bool: matches, message: msg)
- }
-}
-```
-
-In the example above, `msg` is defined based on the string given to
-`Predicate.define`. The code looks akin to:
-
-```swift
-// Swift
-
-let msg = ExpectationMessage.expectedActualValueTo("equal <\(stringify(expectedValue))>")
-```
-
-### Full Customization
-
-To fully customize the behavior of the Predicate, use the overload that expects
-a `PredicateResult` to be returned.
-
-Along with `PredicateResult`, there are other `ExpectationMessage` enum values you can use:
-
-```swift
-public indirect enum ExpectationMessage {
-// Emits standard error message:
-// eg - "expected to , got "
-case expectedActualValueTo(/* message: */ String)
-
-// Allows any free-form message
-// eg - ""
-case fail(/* message: */ String)
-
-// Emits standard error message with a custom actual value instead of the default.
-// eg - "expected to , got "
-case expectedCustomValueTo(/* message: */ String, /* actual: */ String)
-
-// Emits standard error message without mentioning the actual value
-// eg - "expected to "
-case expectedTo(/* message: */ String)
-
-// ...
-}
-```
-
-For matchers that compose other matchers, there are a handful of helper
-functions to annotate messages.
-
-`appended(message: String)` is used to append to the original failure message:
-
-```swift
-// produces "expected to be true, got (use beFalse() for inverse)"
-// appended message do show up inline in Xcode.
-.expectedActualValueTo("be true").appended(message: " (use beFalse() for inverse)")
-```
-
-For a more comprehensive message that spans multiple lines, use
-`appended(details: String)` instead:
-
-```swift
-// produces "expected to be true, got \n\nuse beFalse() for inverse\nor use beNil()"
-// details do not show inline in Xcode, but do show up in test logs.
-.expectedActualValueTo("be true").appended(details: "use beFalse() for inverse\nor use beNil()")
-```
-
-## Supporting Objective-C
-
-To use a custom matcher written in Swift from Objective-C, you'll have
-to extend the `NMBObjCMatcher` class, adding a new class method for your
-custom matcher. The example below defines the class method
-`+[NMBObjCMatcher beNilMatcher]`:
-
-```swift
-// Swift
-
-extension NMBObjCMatcher {
- public class func beNilMatcher() -> NMBObjCMatcher {
- return NMBObjCMatcher { actualBlock, failureMessage, location in
- let block = ({ actualBlock() as NSObject? })
- let expr = Expression(expression: block, location: location)
- return beNil().matches(expr, failureMessage: failureMessage)
- }
- }
-}
-```
-
-The above allows you to use the matcher from Objective-C:
-
-```objc
-// Objective-C
-
-expect(actual).to([NMBObjCMatcher beNilMatcher]());
-```
-
-To make the syntax easier to use, define a C function that calls the
-class method:
-
-```objc
-// Objective-C
-
-FOUNDATION_EXPORT id beNil() {
- return [NMBObjCMatcher beNilMatcher];
-}
-```
-
-### Properly Handling `nil` in Objective-C Matchers
-
-When supporting Objective-C, make sure you handle `nil` appropriately.
-Like [Cedar](https://github.com/pivotal/cedar/issues/100),
-**most matchers do not match with nil**. This is to bring prevent test
-writers from being surprised by `nil` values where they did not expect
-them.
-
-Nimble provides the `beNil` matcher function for test writer that want
-to make expectations on `nil` objects:
-
-```objc
-// Objective-C
-
-expect(nil).to(equal(nil)); // fails
-expect(nil).to(beNil()); // passes
-```
-
-If your matcher does not want to match with nil, you use `NonNilMatcherFunc`
-and the `canMatchNil` constructor on `NMBObjCMatcher`. Using both types will
-automatically generate expected value failure messages when they're nil.
-
-```swift
-
-public func beginWith(startingElement: T) -> NonNilMatcherFunc {
- return NonNilMatcherFunc { actualExpression, failureMessage in
- failureMessage.postfixMessage = "begin with <\(startingElement)>"
- if let actualValue = actualExpression.evaluate() {
- var actualGenerator = actualValue.makeIterator()
- return actualGenerator.next() == startingElement
- }
- return false
- }
-}
-
-extension NMBObjCMatcher {
- public class func beginWithMatcher(expected: AnyObject) -> NMBObjCMatcher {
- return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
- let actual = actualExpression.evaluate()
- let expr = actualExpression.cast { $0 as? NMBOrderedCollection }
- return beginWith(expected).matches(expr, failureMessage: failureMessage)
- }
- }
-}
-```
-
-## Migrating from the Old Matcher API
-
-Previously (`<7.0.0`), Nimble supported matchers via the following types:
-
-- `Matcher`
-- `NonNilMatcherFunc`
-- `MatcherFunc`
-
-All of those types have been replaced by `Predicate`. While migrating can be a
-lot of work, Nimble currently provides several steps to aid migration of your
-custom matchers:
-
-### Minimal Step - Use `.predicate`
-
-Nimble provides an extension to the old types that automatically naively
-converts those types to the newer `Predicate`.
-
-```swift
-// Swift
-public func beginWith(startingElement: T) -> Predicate {
- return NonNilMatcherFunc { actualExpression, failureMessage in
- failureMessage.postfixMessage = "begin with <\(startingElement)>"
- if let actualValue = actualExpression.evaluate() {
- var actualGenerator = actualValue.makeIterator()
- return actualGenerator.next() == startingElement
- }
- return false
- }.predicate
-}
-```
-
-This is the simpliest way to externally support `Predicate` which allows easier
-composition than the old Nimble matcher interface, with minimal effort to change.
-
-### Convert to use `Predicate` Type with Old Matcher Constructor
-
-The second most convenient step is to utilize special constructors that
-`Predicate` supports that closely align to the constructors of the old Nimble
-matcher types.
-
-```swift
-// Swift
-public func beginWith(startingElement: T) -> Predicate {
- return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in
- failureMessage.postfixMessage = "begin with <\(startingElement)>"
- if let actualValue = actualExpression.evaluate() {
- var actualGenerator = actualValue.makeIterator()
- return actualGenerator.next() == startingElement
- }
- return false
- }
-}
-```
-
-This allows you to completely drop the old types from your code, although the
-intended behavior may alter slightly to what is desired.
-
-### Convert to `Predicate` Type with Preferred Constructor
-
-Finally, you can convert to the native `Predicate` format using one of the
-constructors not used to assist in the migration.
-
-### Deprecation Roadmap
-
-Nimble 7 introduces `Predicate` but will support the old types with warning
-deprecations. A couple major releases of Nimble will remain backwards
-compatible with the old matcher api, although new features may not be
-backported.
-
-The deprecating plan is a 3 major versions removal. Which is as follows:
-
- 1. Introduce new `Predicate` API, deprecation warning for old matcher APIs.
- (Nimble `v7.x.x`)
- 2. Introduce warnings on migration-path features (`.predicate`,
- `Predicate`-constructors with similar arguments to old API). (Nimble
- `v8.x.x`)
- 3. Remove old API. (Nimble `v9.x.x`)
-
-
-# Installing Nimble
-
-> Nimble can be used on its own, or in conjunction with its sister
- project, [Quick](https://github.com/Quick/Quick). To install both
- Quick and Nimble, follow [the installation instructions in the Quick
- Documentation](https://github.com/Quick/Quick/blob/master/Documentation/en-us/InstallingQuick.md).
-
-Nimble can currently be installed in one of two ways: using CocoaPods, or with
-git submodules.
-
-## Installing Nimble as a Submodule
-
-To use Nimble as a submodule to test your macOS, iOS or tvOS applications, follow
-these 4 easy steps:
-
-1. Clone the Nimble repository
-2. Add Nimble.xcodeproj to the Xcode workspace for your project
-3. Link Nimble.framework to your test target
-4. Start writing expectations!
-
-For more detailed instructions on each of these steps,
-read [How to Install Quick](https://github.com/Quick/Quick#how-to-install-quick).
-Ignore the steps involving adding Quick to your project in order to
-install just Nimble.
-
-## Installing Nimble via CocoaPods
-
-To use Nimble in CocoaPods to test your macOS, iOS or tvOS applications, add
-Nimble to your podfile and add the ```use_frameworks!``` line to enable Swift
-support for CocoaPods.
-
-```ruby
-platform :ios, '8.0'
-
-source 'https://github.com/CocoaPods/Specs.git'
-
-# Whatever pods you need for your app go here
-
-target 'YOUR_APP_NAME_HERE_Tests', :exclusive => true do
- use_frameworks!
- pod 'Nimble', '~> 6.0.0'
-end
-```
-
-Finally run `pod install`.
-
-## Using Nimble without XCTest
-
-Nimble is integrated with XCTest to allow it work well when used in Xcode test
-bundles, however it can also be used in a standalone app. After installing
-Nimble using one of the above methods, there are two additional steps required
-to make this work.
-
-1. Create a custom assertion handler and assign an instance of it to the
- global `NimbleAssertionHandler` variable. For example:
-
-```swift
-class MyAssertionHandler : AssertionHandler {
- func assert(assertion: Bool, message: FailureMessage, location: SourceLocation) {
- if (!assertion) {
- print("Expectation failed: \(message.stringValue)")
- }
- }
-}
-```
-```swift
-// Somewhere before you use any assertions
-NimbleAssertionHandler = MyAssertionHandler()
-```
-
-2. Add a post-build action to fix an issue with the Swift XCTest support
- library being unnecessarily copied into your app
- * Edit your scheme in Xcode, and navigate to Build -> Post-actions
- * Click the "+" icon and select "New Run Script Action"
- * Open the "Provide build settings from" dropdown and select your target
- * Enter the following script contents:
-```
-rm "${SWIFT_STDLIB_TOOL_DESTINATION_DIR}/libswiftXCTest.dylib"
-```
-
-You can now use Nimble assertions in your code and handle failures as you see
-fit.
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift b/Demo/Pods/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift
deleted file mode 100644
index 2e58fdf..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift
+++ /dev/null
@@ -1,17 +0,0 @@
-import Foundation
-
-/// Protocol for the assertion handler that Nimble uses for all expectations.
-public protocol AssertionHandler {
- func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation)
-}
-
-/// Global backing interface for assertions that Nimble creates.
-/// Defaults to a private test handler that passes through to XCTest.
-///
-/// If XCTest is not available, you must assign your own assertion handler
-/// before using any matchers, otherwise Nimble will abort the program.
-///
-/// @see AssertionHandler
-public var NimbleAssertionHandler: AssertionHandler = { () -> AssertionHandler in
- return isXCTestAvailable() ? NimbleXCTestHandler() : NimbleXCTestUnavailableHandler()
-}()
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Adapters/AssertionDispatcher.swift b/Demo/Pods/Nimble/Sources/Nimble/Adapters/AssertionDispatcher.swift
deleted file mode 100644
index 94a9030..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Adapters/AssertionDispatcher.swift
+++ /dev/null
@@ -1,19 +0,0 @@
-/// AssertionDispatcher allows multiple AssertionHandlers to receive
-/// assertion messages.
-///
-/// @warning Does not fully dispatch if one of the handlers raises an exception.
-/// This is possible with XCTest-based assertion handlers.
-///
-public class AssertionDispatcher: AssertionHandler {
- let handlers: [AssertionHandler]
-
- public init(handlers: [AssertionHandler]) {
- self.handlers = handlers
- }
-
- public func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) {
- for handler in handlers {
- handler.assert(assertion, message: message, location: location)
- }
- }
-}
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift b/Demo/Pods/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift
deleted file mode 100644
index cc39636..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift
+++ /dev/null
@@ -1,100 +0,0 @@
-import Foundation
-
-/// A data structure that stores information about an assertion when
-/// AssertionRecorder is set as the Nimble assertion handler.
-///
-/// @see AssertionRecorder
-/// @see AssertionHandler
-public struct AssertionRecord: CustomStringConvertible {
- /// Whether the assertion succeeded or failed
- public let success: Bool
- /// The failure message the assertion would display on failure.
- public let message: FailureMessage
- /// The source location the expectation occurred on.
- public let location: SourceLocation
-
- public var description: String {
- return "AssertionRecord { success=\(success), message='\(message.stringValue)', location=\(location) }"
- }
-}
-
-/// An AssertionHandler that silently records assertions that Nimble makes.
-/// This is useful for testing failure messages for matchers.
-///
-/// @see AssertionHandler
-public class AssertionRecorder: AssertionHandler {
- /// All the assertions that were captured by this recorder
- public var assertions = [AssertionRecord]()
-
- public init() {}
-
- public func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) {
- assertions.append(
- AssertionRecord(
- success: assertion,
- message: message,
- location: location))
- }
-}
-
-/// Allows you to temporarily replace the current Nimble assertion handler with
-/// the one provided for the scope of the closure.
-///
-/// Once the closure finishes, then the original Nimble assertion handler is restored.
-///
-/// @see AssertionHandler
-public func withAssertionHandler(_ tempAssertionHandler: AssertionHandler, closure: () throws -> Void) {
- let environment = NimbleEnvironment.activeInstance
- let oldRecorder = environment.assertionHandler
- let capturer = NMBExceptionCapture(handler: nil, finally: ({
- environment.assertionHandler = oldRecorder
- }))
- environment.assertionHandler = tempAssertionHandler
- capturer.tryBlock {
- try! closure()
- }
-}
-
-/// Captures expectations that occur in the given closure. Note that all
-/// expectations will still go through to the default Nimble handler.
-///
-/// This can be useful if you want to gather information about expectations
-/// that occur within a closure.
-///
-/// @param silently expectations are no longer send to the default Nimble
-/// assertion handler when this is true. Defaults to false.
-///
-/// @see gatherFailingExpectations
-public func gatherExpectations(silently: Bool = false, closure: () -> Void) -> [AssertionRecord] {
- let previousRecorder = NimbleEnvironment.activeInstance.assertionHandler
- let recorder = AssertionRecorder()
- let handlers: [AssertionHandler]
-
- if silently {
- handlers = [recorder]
- } else {
- handlers = [recorder, previousRecorder]
- }
-
- let dispatcher = AssertionDispatcher(handlers: handlers)
- withAssertionHandler(dispatcher, closure: closure)
- return recorder.assertions
-}
-
-/// Captures failed expectations that occur in the given closure. Note that all
-/// expectations will still go through to the default Nimble handler.
-///
-/// This can be useful if you want to gather information about failed
-/// expectations that occur within a closure.
-///
-/// @param silently expectations are no longer send to the default Nimble
-/// assertion handler when this is true. Defaults to false.
-///
-/// @see gatherExpectations
-/// @see raiseException source for an example use case.
-public func gatherFailingExpectations(silently: Bool = false, closure: () -> Void) -> [AssertionRecord] {
- let assertions = gatherExpectations(silently: silently, closure: closure)
- return assertions.filter { assertion in
- !assertion.success
- }
-}
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift b/Demo/Pods/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift
deleted file mode 100644
index add7d3f..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift
+++ /dev/null
@@ -1,187 +0,0 @@
-import Foundation
-
-#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE
-
-private func from(objcPredicate: NMBPredicate) -> Predicate {
- return Predicate { actualExpression in
- let result = objcPredicate.satisfies(({ try actualExpression.evaluate() }),
- location: actualExpression.location)
- return result.toSwift()
- }
-}
-
-internal struct ObjCMatcherWrapper: Matcher {
- let matcher: NMBMatcher
-
- func matches(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool {
- return matcher.matches(
- ({ try! actualExpression.evaluate() }),
- failureMessage: failureMessage,
- location: actualExpression.location)
- }
-
- func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool {
- return matcher.doesNotMatch(
- ({ try! actualExpression.evaluate() }),
- failureMessage: failureMessage,
- location: actualExpression.location)
- }
-}
-
-// Equivalent to Expectation, but for Nimble's Objective-C interface
-public class NMBExpectation: NSObject {
- internal let _actualBlock: () -> NSObject?
- internal var _negative: Bool
- internal let _file: FileString
- internal let _line: UInt
- internal var _timeout: TimeInterval = 1.0
-
- @objc public init(actualBlock: @escaping () -> NSObject?, negative: Bool, file: FileString, line: UInt) {
- self._actualBlock = actualBlock
- self._negative = negative
- self._file = file
- self._line = line
- }
-
- private var expectValue: Expectation {
- return expect(_file, line: _line) {
- self._actualBlock() as NSObject?
- }
- }
-
- @objc public var withTimeout: (TimeInterval) -> NMBExpectation {
- return ({ timeout in self._timeout = timeout
- return self
- })
- }
-
- @objc public var to: (NMBMatcher) -> Void {
- return ({ matcher in
- if let pred = matcher as? NMBPredicate {
- self.expectValue.to(from(objcPredicate: pred))
- } else {
- self.expectValue.to(ObjCMatcherWrapper(matcher: matcher))
- }
- })
- }
-
- @objc public var toWithDescription: (NMBMatcher, String) -> Void {
- return ({ matcher, description in
- if let pred = matcher as? NMBPredicate {
- self.expectValue.to(from(objcPredicate: pred), description: description)
- } else {
- self.expectValue.to(ObjCMatcherWrapper(matcher: matcher), description: description)
- }
- })
- }
-
- @objc public var toNot: (NMBMatcher) -> Void {
- return ({ matcher in
- if let pred = matcher as? NMBPredicate {
- self.expectValue.toNot(from(objcPredicate: pred))
- } else {
- self.expectValue.toNot(ObjCMatcherWrapper(matcher: matcher))
- }
- })
- }
-
- @objc public var toNotWithDescription: (NMBMatcher, String) -> Void {
- return ({ matcher, description in
- if let pred = matcher as? NMBPredicate {
- self.expectValue.toNot(from(objcPredicate: pred), description: description)
- } else {
- self.expectValue.toNot(ObjCMatcherWrapper(matcher: matcher), description: description)
- }
- })
- }
-
- @objc public var notTo: (NMBMatcher) -> Void { return toNot }
-
- @objc public var notToWithDescription: (NMBMatcher, String) -> Void { return toNotWithDescription }
-
- @objc public var toEventually: (NMBMatcher) -> Void {
- return ({ matcher in
- if let pred = matcher as? NMBPredicate {
- self.expectValue.toEventually(
- from(objcPredicate: pred),
- timeout: self._timeout,
- description: nil
- )
- } else {
- self.expectValue.toEventually(
- ObjCMatcherWrapper(matcher: matcher),
- timeout: self._timeout,
- description: nil
- )
- }
- })
- }
-
- @objc public var toEventuallyWithDescription: (NMBMatcher, String) -> Void {
- return ({ matcher, description in
- if let pred = matcher as? NMBPredicate {
- self.expectValue.toEventually(
- from(objcPredicate: pred),
- timeout: self._timeout,
- description: description
- )
- } else {
- self.expectValue.toEventually(
- ObjCMatcherWrapper(matcher: matcher),
- timeout: self._timeout,
- description: description
- )
- }
- })
- }
-
- @objc public var toEventuallyNot: (NMBMatcher) -> Void {
- return ({ matcher in
- if let pred = matcher as? NMBPredicate {
- self.expectValue.toEventuallyNot(
- from(objcPredicate: pred),
- timeout: self._timeout,
- description: nil
- )
- } else {
- self.expectValue.toEventuallyNot(
- ObjCMatcherWrapper(matcher: matcher),
- timeout: self._timeout,
- description: nil
- )
- }
- })
- }
-
- @objc public var toEventuallyNotWithDescription: (NMBMatcher, String) -> Void {
- return ({ matcher, description in
- if let pred = matcher as? NMBPredicate {
- self.expectValue.toEventuallyNot(
- from(objcPredicate: pred),
- timeout: self._timeout,
- description: description
- )
- } else {
- self.expectValue.toEventuallyNot(
- ObjCMatcherWrapper(matcher: matcher),
- timeout: self._timeout,
- description: description
- )
- }
- })
- }
-
- @objc public var toNotEventually: (NMBMatcher) -> Void {
- return toEventuallyNot
- }
-
- @objc public var toNotEventuallyWithDescription: (NMBMatcher, String) -> Void {
- return toEventuallyNotWithDescription
- }
-
- @objc public class func failWithMessage(_ message: String, file: FileString, line: UInt) {
- fail(message, location: SourceLocation(file: file, line: line))
- }
-}
-
-#endif
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift b/Demo/Pods/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift
deleted file mode 100644
index a114dff..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift
+++ /dev/null
@@ -1,93 +0,0 @@
-import Foundation
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-
-// swiftlint:disable line_length
-public typealias MatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage) throws -> Bool
-public typealias FullMatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage, _ shouldNotMatch: Bool) throws -> Bool
-// swiftlint:enable line_length
-
-public class NMBObjCMatcher: NSObject, NMBMatcher {
- let _match: MatcherBlock
- let _doesNotMatch: MatcherBlock
- let canMatchNil: Bool
-
- public init(canMatchNil: Bool, matcher: @escaping MatcherBlock, notMatcher: @escaping MatcherBlock) {
- self.canMatchNil = canMatchNil
- self._match = matcher
- self._doesNotMatch = notMatcher
- }
-
- public convenience init(matcher: @escaping MatcherBlock) {
- self.init(canMatchNil: true, matcher: matcher)
- }
-
- public convenience init(canMatchNil: Bool, matcher: @escaping MatcherBlock) {
- self.init(canMatchNil: canMatchNil, matcher: matcher, notMatcher: ({ actualExpression, failureMessage in
- return try !matcher(actualExpression, failureMessage)
- }))
- }
-
- public convenience init(matcher: @escaping FullMatcherBlock) {
- self.init(canMatchNil: true, matcher: matcher)
- }
-
- public convenience init(canMatchNil: Bool, matcher: @escaping FullMatcherBlock) {
- self.init(canMatchNil: canMatchNil, matcher: ({ actualExpression, failureMessage in
- return try matcher(actualExpression, failureMessage, false)
- }), notMatcher: ({ actualExpression, failureMessage in
- return try matcher(actualExpression, failureMessage, true)
- }))
- }
-
- private func canMatch(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool {
- do {
- if !canMatchNil {
- if try actualExpression.evaluate() == nil {
- failureMessage.postfixActual = " (use beNil() to match nils)"
- return false
- }
- }
- } catch let error {
- failureMessage.actualValue = "an unexpected error thrown: \(error)"
- return false
- }
- return true
- }
-
- public func matches(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool {
- let expr = Expression(expression: actualBlock, location: location)
- let result: Bool
- do {
- result = try _match(expr, failureMessage)
- } catch let error {
- failureMessage.stringValue = "unexpected error thrown: <\(error)>"
- return false
- }
-
- if self.canMatch(Expression(expression: actualBlock, location: location), failureMessage: failureMessage) {
- return result
- } else {
- return false
- }
- }
-
- public func doesNotMatch(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool {
- let expr = Expression(expression: actualBlock, location: location)
- let result: Bool
- do {
- result = try _doesNotMatch(expr, failureMessage)
- } catch let error {
- failureMessage.stringValue = "unexpected error thrown: <\(error)>"
- return false
- }
-
- if self.canMatch(Expression(expression: actualBlock, location: location), failureMessage: failureMessage) {
- return result
- } else {
- return false
- }
- }
-}
-
-#endif
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift b/Demo/Pods/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift
deleted file mode 100644
index e1b5432..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift
+++ /dev/null
@@ -1,45 +0,0 @@
-import Dispatch
-import Foundation
-
-/// "Global" state of Nimble is stored here. Only DSL functions should access / be aware of this
-/// class' existence
-internal class NimbleEnvironment {
- static var activeInstance: NimbleEnvironment {
- get {
- let env = Thread.current.threadDictionary["NimbleEnvironment"]
- if let env = env as? NimbleEnvironment {
- return env
- } else {
- let newEnv = NimbleEnvironment()
- self.activeInstance = newEnv
- return newEnv
- }
- }
- set {
- Thread.current.threadDictionary["NimbleEnvironment"] = newValue
- }
- }
-
- // TODO: eventually migrate the global to this environment value
- var assertionHandler: AssertionHandler {
- get { return NimbleAssertionHandler }
- set { NimbleAssertionHandler = newValue }
- }
-
- var suppressTVOSAssertionWarning: Bool = false
- var awaiter: Awaiter
-
- init() {
- let timeoutQueue: DispatchQueue
- if #available(OSX 10.10, *) {
- timeoutQueue = DispatchQueue.global(qos: .userInitiated)
- } else {
- timeoutQueue = DispatchQueue.global(priority: .high)
- }
-
- awaiter = Awaiter(
- waitLock: AssertionWaitLock(),
- asyncQueue: .main,
- timeoutQueue: timeoutQueue)
- }
-}
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift b/Demo/Pods/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift
deleted file mode 100644
index 14bb045..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift
+++ /dev/null
@@ -1,92 +0,0 @@
-import Foundation
-import XCTest
-
-/// Default handler for Nimble. This assertion handler passes failures along to
-/// XCTest.
-public class NimbleXCTestHandler: AssertionHandler {
- public func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) {
- if !assertion {
- recordFailure("\(message.stringValue)\n", location: location)
- }
- }
-}
-
-/// Alternative handler for Nimble. This assertion handler passes failures along
-/// to XCTest by attempting to reduce the failure message size.
-public class NimbleShortXCTestHandler: AssertionHandler {
- public func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) {
- if !assertion {
- let msg: String
- if let actual = message.actualValue {
- msg = "got: \(actual) \(message.postfixActual)"
- } else {
- msg = "expected \(message.to) \(message.postfixMessage)"
- }
- recordFailure("\(msg)\n", location: location)
- }
- }
-}
-
-/// Fallback handler in case XCTest is unavailable. This assertion handler will abort
-/// the program if it is invoked.
-class NimbleXCTestUnavailableHandler: AssertionHandler {
- func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) {
- fatalError("XCTest is not available and no custom assertion handler was configured. Aborting.")
- }
-}
-
-#if !SWIFT_PACKAGE
-/// Helper class providing access to the currently executing XCTestCase instance, if any
-@objc final internal class CurrentTestCaseTracker: NSObject, XCTestObservation {
- @objc static let sharedInstance = CurrentTestCaseTracker()
-
- private(set) var currentTestCase: XCTestCase?
-
- private var stashed_swift_reportFatalErrorsToDebugger: Bool = false
-
- @objc func testCaseWillStart(_ testCase: XCTestCase) {
- #if swift(>=3.2)
- stashed_swift_reportFatalErrorsToDebugger = _swift_reportFatalErrorsToDebugger
- _swift_reportFatalErrorsToDebugger = false
- #endif
-
- currentTestCase = testCase
- }
-
- @objc func testCaseDidFinish(_ testCase: XCTestCase) {
- currentTestCase = nil
-
- #if swift(>=3.2)
- _swift_reportFatalErrorsToDebugger = stashed_swift_reportFatalErrorsToDebugger
- #endif
- }
-}
-#endif
-
-func isXCTestAvailable() -> Bool {
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
- // XCTest is weakly linked and so may not be present
- return NSClassFromString("XCTestCase") != nil
-#else
- return true
-#endif
-}
-
-public func recordFailure(_ message: String, location: SourceLocation) {
-#if SWIFT_PACKAGE
- XCTFail("\(message)", file: location.file, line: location.line)
-#else
- if let testCase = CurrentTestCaseTracker.sharedInstance.currentTestCase {
- #if swift(>=4)
- let line = Int(location.line)
- #else
- let line = location.line
- #endif
- testCase.recordFailure(withDescription: message, inFile: location.file, atLine: line, expected: true)
- } else {
- let msg = "Attempted to report a test failure to XCTest while no test case was running. " +
- "The failure was:\n\"\(message)\"\nIt occurred at: \(location.file):\(location.line)"
- NSException(name: .internalInconsistencyException, reason: msg, userInfo: nil).raise()
- }
-#endif
-}
diff --git a/Demo/Pods/Nimble/Sources/Nimble/DSL+Wait.swift b/Demo/Pods/Nimble/Sources/Nimble/DSL+Wait.swift
deleted file mode 100644
index e874136..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/DSL+Wait.swift
+++ /dev/null
@@ -1,116 +0,0 @@
-import Dispatch
-import Foundation
-
-private enum ErrorResult {
- case exception(NSException)
- case error(Error)
- case none
-}
-
-/// Only classes, protocols, methods, properties, and subscript declarations can be
-/// bridges to Objective-C via the @objc keyword. This class encapsulates callback-style
-/// asynchronous waiting logic so that it may be called from Objective-C and Swift.
-internal class NMBWait: NSObject {
-// About these kind of lines, `@objc` attributes are only required for Objective-C
-// support, so that should be conditional on Darwin platforms and normal Xcode builds
-// (non-SwiftPM builds).
-#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE
- @objc
- internal class func until(
- timeout: TimeInterval,
- file: FileString = #file,
- line: UInt = #line,
- action: @escaping (@escaping () -> Void) -> Void) {
- return throwableUntil(timeout: timeout, file: file, line: line) { done in
- action(done)
- }
- }
-#else
- internal class func until(
- timeout: TimeInterval,
- file: FileString = #file,
- line: UInt = #line,
- action: @escaping (@escaping () -> Void) -> Void) {
- return throwableUntil(timeout: timeout, file: file, line: line) { done in
- action(done)
- }
- }
-#endif
-
- // Using a throwable closure makes this method not objc compatible.
- internal class func throwableUntil(
- timeout: TimeInterval,
- file: FileString = #file,
- line: UInt = #line,
- action: @escaping (@escaping () -> Void) throws -> Void) {
- let awaiter = NimbleEnvironment.activeInstance.awaiter
- let leeway = timeout / 2.0
- // swiftlint:disable:next line_length
- let result = awaiter.performBlock(file: file, line: line) { (done: @escaping (ErrorResult) -> Void) throws -> Void in
- DispatchQueue.main.async {
- let capture = NMBExceptionCapture(
- handler: ({ exception in
- done(.exception(exception))
- }),
- finally: ({ })
- )
- capture.tryBlock {
- do {
- try action {
- done(.none)
- }
- } catch let e {
- done(.error(e))
- }
- }
- }
- }.timeout(timeout, forcefullyAbortTimeout: leeway).wait("waitUntil(...)", file: file, line: line)
-
- switch result {
- case .incomplete: internalError("Reached .incomplete state for waitUntil(...).")
- case .blockedRunLoop:
- fail(blockedRunLoopErrorMessageFor("-waitUntil()", leeway: leeway),
- file: file, line: line)
- case .timedOut:
- let pluralize = (timeout == 1 ? "" : "s")
- fail("Waited more than \(timeout) second\(pluralize)", file: file, line: line)
- case let .raisedException(exception):
- fail("Unexpected exception raised: \(exception)")
- case let .errorThrown(error):
- fail("Unexpected error thrown: \(error)")
- case .completed(.exception(let exception)):
- fail("Unexpected exception raised: \(exception)")
- case .completed(.error(let error)):
- fail("Unexpected error thrown: \(error)")
- case .completed(.none): // success
- break
- }
- }
-
-#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE
- @objc(untilFile:line:action:)
- internal class func until(_ file: FileString = #file, line: UInt = #line, action: @escaping (() -> Void) -> Void) {
- until(timeout: 1, file: file, line: line, action: action)
- }
-#else
- internal class func until(_ file: FileString = #file, line: UInt = #line, action: @escaping (() -> Void) -> Void) {
- until(timeout: 1, file: file, line: line, action: action)
- }
-#endif
-}
-
-internal func blockedRunLoopErrorMessageFor(_ fnName: String, leeway: TimeInterval) -> String {
- // swiftlint:disable:next line_length
- return "\(fnName) timed out but was unable to run the timeout handler because the main thread is unresponsive (\(leeway) seconds is allow after the wait times out). Conditions that may cause this include processing blocking IO on the main thread, calls to sleep(), deadlocks, and synchronous IPC. Nimble forcefully stopped run loop which may cause future failures in test run."
-}
-
-/// Wait asynchronously until the done closure is called or the timeout has been reached.
-///
-/// @discussion
-/// Call the done() closure to indicate the waiting has completed.
-///
-/// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function
-/// is executing. Any attempts to touch the run loop may cause non-deterministic behavior.
-public func waitUntil(timeout: TimeInterval = AsyncDefaults.Timeout, file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) -> Void) {
- NMBWait.until(timeout: timeout, file: file, line: line, action: action)
-}
diff --git a/Demo/Pods/Nimble/Sources/Nimble/DSL.swift b/Demo/Pods/Nimble/Sources/Nimble/DSL.swift
deleted file mode 100644
index e49bb0c..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/DSL.swift
+++ /dev/null
@@ -1,64 +0,0 @@
-import Foundation
-
-/// Make an expectation on a given actual value. The value given is lazily evaluated.
-public func expect(_ expression: @autoclosure @escaping () throws -> T?, file: FileString = #file, line: UInt = #line) -> Expectation {
- return Expectation(
- expression: Expression(
- expression: expression,
- location: SourceLocation(file: file, line: line),
- isClosure: true))
-}
-
-/// Make an expectation on a given actual value. The closure is lazily invoked.
-public func expect(_ file: FileString = #file, line: UInt = #line, expression: @escaping () throws -> T?) -> Expectation {
- return Expectation(
- expression: Expression(
- expression: expression,
- location: SourceLocation(file: file, line: line),
- isClosure: true))
-}
-
-/// Always fails the test with a message and a specified location.
-public func fail(_ message: String, location: SourceLocation) {
- let handler = NimbleEnvironment.activeInstance.assertionHandler
- handler.assert(false, message: FailureMessage(stringValue: message), location: location)
-}
-
-/// Always fails the test with a message.
-public func fail(_ message: String, file: FileString = #file, line: UInt = #line) {
- fail(message, location: SourceLocation(file: file, line: line))
-}
-
-/// Always fails the test.
-public func fail(_ file: FileString = #file, line: UInt = #line) {
- fail("fail() always fails", file: file, line: line)
-}
-
-/// Like Swift's precondition(), but raises NSExceptions instead of sigaborts
-internal func nimblePrecondition(
- _ expr: @autoclosure() -> Bool,
- _ name: @autoclosure() -> String,
- _ message: @autoclosure() -> String,
- file: StaticString = #file,
- line: UInt = #line) {
- let result = expr()
- if !result {
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
- let e = NSException(
- name: NSExceptionName(name()),
- reason: message(),
- userInfo: nil)
- e.raise()
-#else
- preconditionFailure("\(name()) - \(message())", file: file, line: line)
-#endif
- }
-}
-
-internal func internalError(_ msg: String, file: FileString = #file, line: UInt = #line) -> Never {
- fatalError(
- "Nimble Bug Found: \(msg) at \(file):\(line).\n" +
- "Please file a bug to Nimble: https://github.com/Quick/Nimble/issues with the " +
- "code snippet that caused this error."
- )
-}
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Expectation.swift b/Demo/Pods/Nimble/Sources/Nimble/Expectation.swift
deleted file mode 100644
index 41625a1..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Expectation.swift
+++ /dev/null
@@ -1,125 +0,0 @@
-import Foundation
-
-// Deprecated
-internal func expressionDoesNotMatch(_ expression: Expression, matcher: U, toNot: String, description: String?) -> (Bool, FailureMessage)
- where U: Matcher, U.ValueType == T {
- let msg = FailureMessage()
- msg.userDescription = description
- msg.to = toNot
- do {
- let pass = try matcher.doesNotMatch(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)
- }
-}
-
-internal func execute(_ expression: Expression, _ style: ExpectationStyle, _ predicate: Predicate, to: String, description: String?, captureExceptions: Bool = true) -> (Bool, FailureMessage) {
- func run() -> (Bool, FailureMessage) {
- let msg = FailureMessage()
- msg.userDescription = description
- msg.to = to
- do {
- let result = try predicate.satisfies(expression)
- result.message.update(failureMessage: msg)
- if msg.actualValue == "" {
- msg.actualValue = "<\(stringify(try expression.evaluate()))>"
- }
- return (result.toBoolean(expectation: style), msg)
- } catch let error {
- msg.stringValue = "unexpected error thrown: <\(error)>"
- return (false, msg)
- }
- }
-
- var result: (Bool, FailureMessage) = (false, FailureMessage())
- if captureExceptions {
- let capture = NMBExceptionCapture(handler: ({ exception -> Void in
- let msg = FailureMessage()
- msg.stringValue = "unexpected exception raised: \(exception)"
- result = (false, msg)
- }), finally: nil)
- capture.tryBlock {
- result = run()
- }
- } else {
- result = run()
- }
-
- return result
-}
-
-public struct Expectation {
-
- public let expression: Expression
-
- public init(expression: Expression) {
- self.expression = expression
- }
-
- public func verify(_ pass: Bool, _ message: FailureMessage) {
- let handler = NimbleEnvironment.activeInstance.assertionHandler
- handler.assert(pass, message: message, location: expression.location)
- }
-
- ////////////////// OLD API /////////////////////
-
- /// DEPRECATED: Tests the actual value using a matcher to match.
- public func to(_ matcher: U, description: String? = nil)
- where U: Matcher, U.ValueType == T {
- let (pass, msg) = execute(
- expression,
- .toMatch,
- matcher.predicate,
- to: "to",
- description: description,
- captureExceptions: false
- )
- verify(pass, msg)
- }
-
- /// DEPRECATED: Tests the actual value using a matcher to not match.
- public func toNot(_ matcher: U, description: String? = nil)
- where U: Matcher, U.ValueType == T {
- // swiftlint:disable:next line_length
- let (pass, msg) = expressionDoesNotMatch(expression, matcher: matcher, toNot: "to not", description: description)
- verify(pass, msg)
- }
-
- /// DEPRECATED: Tests the actual value using a matcher to not match.
- ///
- /// Alias to toNot().
- public func notTo(_ matcher: U, description: String? = nil)
- where U: Matcher, U.ValueType == T {
- toNot(matcher, description: description)
- }
-
- ////////////////// NEW API /////////////////////
-
- /// Tests the actual value using a matcher to match.
- public func to(_ predicate: Predicate, description: String? = nil) {
- let (pass, msg) = execute(expression, .toMatch, predicate, to: "to", description: description)
- verify(pass, msg)
- }
-
- /// Tests the actual value using a matcher to not match.
- public func toNot(_ predicate: Predicate, description: String? = nil) {
- let (pass, msg) = execute(expression, .toNotMatch, predicate, to: "to not", description: description)
- verify(pass, msg)
- }
-
- /// Tests the actual value using a matcher to not match.
- ///
- /// Alias to toNot().
- public func notTo(_ predicate: Predicate, description: String? = nil) {
- toNot(predicate, description: description)
- }
-
- // see:
- // - `async` for extension
- // - NMBExpectation for Objective-C interface
-}
diff --git a/Demo/Pods/Nimble/Sources/Nimble/ExpectationMessage.swift b/Demo/Pods/Nimble/Sources/Nimble/ExpectationMessage.swift
deleted file mode 100644
index 7aae341..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/ExpectationMessage.swift
+++ /dev/null
@@ -1,264 +0,0 @@
-import Foundation
-
-public indirect enum ExpectationMessage {
- // --- Primary Expectations ---
- /// includes actual value in output ("expected to , got ")
- case expectedActualValueTo(/* message: */ String)
- /// uses a custom actual value string in output ("expected to , got ")
- case expectedCustomValueTo(/* message: */ String, /* actual: */ String)
- /// excludes actual value in output ("expected to ")
- case expectedTo(/* message: */ String)
- /// allows any free-form message ("")
- case fail(/* message: */ String)
-
- // --- Composite Expectations ---
- // Generally, you'll want the methods, appended(message:) and appended(details:) instead.
-
- /// Not Fully Implemented Yet.
- case prepends(/* Prepended Message */ String, ExpectationMessage)
-
- /// appends after an existing message (" (use beNil() to match nils)")
- case appends(ExpectationMessage, /* Appended Message */ String)
-
- /// provides long-form multi-line explainations ("\n\n")
- case details(ExpectationMessage, String)
-
- internal var sampleMessage: String {
- let asStr = toString(actual: "", expected: "expected", to: "to")
- let asFailureMessage = FailureMessage()
- update(failureMessage: asFailureMessage)
- // swiftlint:disable:next line_length
- return "(toString(actual:expected:to:) -> \(asStr) || update(failureMessage:) -> \(asFailureMessage.stringValue))"
- }
-
- /// Returns the smallest message after the "expected to" string that summarizes the error.
- ///
- /// Returns the message part from ExpectationMessage, ignoring all .appends and .details.
- public var expectedMessage: String {
- switch self {
- case let .fail(msg):
- return msg
- case let .expectedTo(msg):
- return msg
- case let .expectedActualValueTo(msg):
- return msg
- case let .expectedCustomValueTo(msg, _):
- return msg
- case let .prepends(_, expectation):
- return expectation.expectedMessage
- case let .appends(expectation, msg):
- return "\(expectation.expectedMessage)\(msg)"
- case let .details(expectation, _):
- return expectation.expectedMessage
- }
- }
-
- /// Appends a message after the primary expectation message
- public func appended(message: String) -> ExpectationMessage {
- switch self {
- case .fail, .expectedTo, .expectedActualValueTo, .expectedCustomValueTo, .appends, .prepends:
- return .appends(self, message)
- case let .details(expectation, msg):
- return .details(expectation.appended(message: message), msg)
- }
- }
-
- /// Appends a message hinting to use beNil() for when the actual value given was nil.
- public func appendedBeNilHint() -> ExpectationMessage {
- return appended(message: " (use beNil() to match nils)")
- }
-
- /// Appends a detailed (aka - multiline) message after the primary expectation message
- /// Detailed messages will be placed after .appended(message:) calls.
- public func appended(details: String) -> ExpectationMessage {
- return .details(self, details)
- }
-
- internal func visitLeafs(_ f: (ExpectationMessage) -> ExpectationMessage) -> ExpectationMessage {
- switch self {
- case .fail, .expectedTo, .expectedActualValueTo, .expectedCustomValueTo:
- return f(self)
- case let .prepends(msg, expectation):
- return .prepends(msg, expectation.visitLeafs(f))
- case let .appends(expectation, msg):
- return .appends(expectation.visitLeafs(f), msg)
- case let .details(expectation, msg):
- return .details(expectation.visitLeafs(f), msg)
- }
- }
-
- /// Replaces a primary expectation with one returned by f. Preserves all composite expectations
- /// that were built upon it (aka - all appended(message:) and appended(details:).
- public func replacedExpectation(_ f: @escaping (ExpectationMessage) -> ExpectationMessage) -> ExpectationMessage {
- func walk(_ msg: ExpectationMessage) -> ExpectationMessage {
- switch msg {
- case .fail, .expectedTo, .expectedActualValueTo, .expectedCustomValueTo:
- return f(msg)
- default:
- return msg
- }
- }
- return visitLeafs(walk)
- }
-
- /// Wraps a primary expectation with text before and after it.
- /// Alias to prepended(message: before).appended(message: after)
- public func wrappedExpectation(before: String, after: String) -> ExpectationMessage {
- return prepended(expectation: before).appended(message: after)
- }
-
- /// Prepends a message by modifying the primary expectation
- public func prepended(expectation message: String) -> ExpectationMessage {
- func walk(_ msg: ExpectationMessage) -> ExpectationMessage {
- switch msg {
- case let .expectedTo(msg):
- return .expectedTo(message + msg)
- case let .expectedActualValueTo(msg):
- return .expectedActualValueTo(message + msg)
- case let .expectedCustomValueTo(msg, actual):
- return .expectedCustomValueTo(message + msg, actual)
- default:
- return msg.visitLeafs(walk)
- }
- }
- return visitLeafs(walk)
- }
-
- // TODO: test & verify correct behavior
- internal func prepended(message: String) -> ExpectationMessage {
- return .prepends(message, self)
- }
-
- /// Converts the tree of ExpectationMessages into a final built string.
- public func toString(actual: String, expected: String = "expected", to: String = "to") -> String {
- switch self {
- case let .fail(msg):
- return msg
- case let .expectedTo(msg):
- return "\(expected) \(to) \(msg)"
- case let .expectedActualValueTo(msg):
- return "\(expected) \(to) \(msg), got \(actual)"
- case let .expectedCustomValueTo(msg, actual):
- return "\(expected) \(to) \(msg), got \(actual)"
- case let .prepends(msg, expectation):
- return "\(msg)\(expectation.toString(actual: actual, expected: expected, to: to))"
- case let .appends(expectation, msg):
- return "\(expectation.toString(actual: actual, expected: expected, to: to))\(msg)"
- case let .details(expectation, msg):
- return "\(expectation.toString(actual: actual, expected: expected, to: to))\n\n\(msg)"
- }
- }
-
- // Backwards compatibility: converts ExpectationMessage tree to FailureMessage
- internal func update(failureMessage: FailureMessage) {
- switch self {
- case let .fail(msg) where !msg.isEmpty:
- failureMessage.stringValue = msg
- case .fail:
- break
- case let .expectedTo(msg):
- failureMessage.actualValue = nil
- failureMessage.postfixMessage = msg
- case let .expectedActualValueTo(msg):
- failureMessage.postfixMessage = msg
- case let .expectedCustomValueTo(msg, actual):
- failureMessage.postfixMessage = msg
- failureMessage.actualValue = actual
- case let .prepends(msg, expectation):
- expectation.update(failureMessage: failureMessage)
- if let desc = failureMessage.userDescription {
- failureMessage.userDescription = "\(msg)\(desc)"
- } else {
- failureMessage.userDescription = msg
- }
- case let .appends(expectation, msg):
- expectation.update(failureMessage: failureMessage)
- failureMessage.appendMessage(msg)
- case let .details(expectation, msg):
- expectation.update(failureMessage: failureMessage)
- failureMessage.appendDetails(msg)
- }
- }
-}
-
-extension FailureMessage {
- internal func toExpectationMessage() -> ExpectationMessage {
- let defaultMsg = FailureMessage()
- if expected != defaultMsg.expected || _stringValueOverride != nil {
- return .fail(stringValue)
- }
-
- var msg: ExpectationMessage = .fail(userDescription ?? "")
- if actualValue != "" && actualValue != nil {
- msg = .expectedCustomValueTo(postfixMessage, actualValue ?? "")
- } else if postfixMessage != defaultMsg.postfixMessage {
- if actualValue == nil {
- msg = .expectedTo(postfixMessage)
- } else {
- msg = .expectedActualValueTo(postfixMessage)
- }
- }
- if postfixActual != defaultMsg.postfixActual {
- msg = .appends(msg, postfixActual)
- }
- if let m = extendedMessage {
- msg = .details(msg, m)
- }
- return msg
- }
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-
-public class NMBExpectationMessage: NSObject {
- private let msg: ExpectationMessage
-
- internal init(swift msg: ExpectationMessage) {
- self.msg = msg
- }
-
- public init(expectedTo message: String) {
- self.msg = .expectedTo(message)
- }
- public init(expectedActualValueTo message: String) {
- self.msg = .expectedActualValueTo(message)
- }
-
- public init(expectedActualValueTo message: String, customActualValue actual: String) {
- self.msg = .expectedCustomValueTo(message, actual)
- }
-
- public init(fail message: String) {
- self.msg = .fail(message)
- }
-
- public init(prepend message: String, child: NMBExpectationMessage) {
- self.msg = .prepends(message, child.msg)
- }
-
- public init(appendedMessage message: String, child: NMBExpectationMessage) {
- self.msg = .appends(child.msg, message)
- }
-
- public init(prependedMessage message: String, child: NMBExpectationMessage) {
- self.msg = .prepends(message, child.msg)
- }
-
- public init(details message: String, child: NMBExpectationMessage) {
- self.msg = .details(child.msg, message)
- }
-
- public func appendedBeNilHint() -> NMBExpectationMessage {
- return NMBExpectationMessage(swift: msg.appendedBeNilHint())
- }
-
- public func toSwift() -> ExpectationMessage { return self.msg }
-}
-
-extension ExpectationMessage {
- func toObjectiveC() -> NMBExpectationMessage {
- return NMBExpectationMessage(swift: self)
- }
-}
-
-#endif
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Expression.swift b/Demo/Pods/Nimble/Sources/Nimble/Expression.swift
deleted file mode 100644
index 5a233fd..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Expression.swift
+++ /dev/null
@@ -1,99 +0,0 @@
-import Foundation
-
-// Memoizes the given closure, only calling the passed
-// closure once; even if repeat calls to the returned closure
-internal func memoizedClosure(_ closure: @escaping () throws -> T) -> (Bool) throws -> T {
- var cache: T?
- return ({ withoutCaching in
- if withoutCaching || cache == nil {
- cache = try closure()
- }
- return cache!
- })
-}
-
-/// Expression represents the closure of the value inside expect(...).
-/// Expressions are memoized by default. This makes them safe to call
-/// evaluate() multiple times without causing a re-evaluation of the underlying
-/// closure.
-///
-/// @warning Since the closure can be any code, Objective-C code may choose
-/// to raise an exception. Currently, Expression does not memoize
-/// exception raising.
-///
-/// This provides a common consumable API for matchers to utilize to allow
-/// Nimble to change internals to how the captured closure is managed.
-public struct Expression {
- internal let _expression: (Bool) throws -> T?
- internal let _withoutCaching: Bool
- public let location: SourceLocation
- public let isClosure: Bool
-
- /// Creates a new expression struct. Normally, expect(...) will manage this
- /// creation process. The expression is memoized.
- ///
- /// @param expression The closure that produces a given value.
- /// @param location The source location that this closure originates from.
- /// @param isClosure A bool indicating if the captured expression is a
- /// closure or internally produced closure. Some matchers
- /// may require closures. For example, toEventually()
- /// requires an explicit closure. This gives Nimble
- /// flexibility if @autoclosure behavior changes between
- /// Swift versions. Nimble internals always sets this true.
- public init(expression: @escaping () throws -> T?, location: SourceLocation, isClosure: Bool = true) {
- self._expression = memoizedClosure(expression)
- self.location = location
- self._withoutCaching = false
- self.isClosure = isClosure
- }
-
- /// Creates a new expression struct. Normally, expect(...) will manage this
- /// creation process.
- ///
- /// @param expression The closure that produces a given value.
- /// @param location The source location that this closure originates from.
- /// @param withoutCaching Indicates if the struct should memoize the given
- /// closure's result. Subsequent evaluate() calls will
- /// not call the given closure if this is true.
- /// @param isClosure A bool indicating if the captured expression is a
- /// closure or internally produced closure. Some matchers
- /// may require closures. For example, toEventually()
- /// requires an explicit closure. This gives Nimble
- /// flexibility if @autoclosure behavior changes between
- /// Swift versions. Nimble internals always sets this true.
- public init(memoizedExpression: @escaping (Bool) throws -> T?, location: SourceLocation, withoutCaching: Bool, isClosure: Bool = true) {
- self._expression = memoizedExpression
- self.location = location
- self._withoutCaching = withoutCaching
- self.isClosure = isClosure
- }
-
- /// Returns a new Expression from the given expression. Identical to a map()
- /// on this type. This should be used only to typecast the Expression's
- /// closure value.
- ///
- /// The returned expression will preserve location and isClosure.
- ///
- /// @param block The block that can cast the current Expression value to a
- /// new type.
- public func cast(_ block: @escaping (T?) throws -> U?) -> Expression {
- return Expression(
- expression: ({ try block(self.evaluate()) }),
- location: self.location,
- isClosure: self.isClosure
- )
- }
-
- public func evaluate() throws -> T? {
- return try self._expression(_withoutCaching)
- }
-
- public func withoutCaching() -> Expression {
- return Expression(
- memoizedExpression: self._expression,
- location: location,
- withoutCaching: true,
- isClosure: isClosure
- )
- }
-}
diff --git a/Demo/Pods/Nimble/Sources/Nimble/FailureMessage.swift b/Demo/Pods/Nimble/Sources/Nimble/FailureMessage.swift
deleted file mode 100644
index 2bc57eb..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/FailureMessage.swift
+++ /dev/null
@@ -1,92 +0,0 @@
-import Foundation
-
-/// Encapsulates the failure message that matchers can report to the end user.
-///
-/// This is shared state between Nimble and matchers that mutate this value.
-public class FailureMessage: NSObject {
- public var expected: String = "expected"
- public var actualValue: String? = "" // empty string -> use default; nil -> exclude
- public var to: String = "to"
- public var postfixMessage: String = "match"
- public var postfixActual: String = ""
- /// An optional message that will be appended as a new line and provides additional details
- /// about the failure. This message will only be visible in the issue navigator / in logs but
- /// not directly in the source editor since only a single line is presented there.
- public var extendedMessage: String?
- public var userDescription: String?
-
- public var stringValue: String {
- get {
- if let value = _stringValueOverride {
- return value
- } else {
- return computeStringValue()
- }
- }
- set {
- _stringValueOverride = newValue
- }
- }
-
- internal var _stringValueOverride: String?
- internal var hasOverriddenStringValue: Bool {
- return _stringValueOverride != nil
- }
-
- public override init() {
- }
-
- public init(stringValue: String) {
- _stringValueOverride = stringValue
- }
-
- internal func stripNewlines(_ str: String) -> String {
- let whitespaces = CharacterSet.whitespacesAndNewlines
- return str
- .components(separatedBy: "\n")
- .map { line in line.trimmingCharacters(in: whitespaces) }
- .joined(separator: "")
- }
-
- internal func computeStringValue() -> String {
- var value = "\(expected) \(to) \(postfixMessage)"
- if let actualValue = actualValue {
- value = "\(expected) \(to) \(postfixMessage), got \(actualValue)\(postfixActual)"
- }
- value = stripNewlines(value)
-
- if let extendedMessage = extendedMessage {
- value += "\n\(stripNewlines(extendedMessage))"
- }
-
- if let userDescription = userDescription {
- return "\(userDescription)\n\(value)"
- }
-
- return value
- }
-
- internal func appendMessage(_ msg: String) {
- if hasOverriddenStringValue {
- stringValue += "\(msg)"
- } else if actualValue != nil {
- postfixActual += msg
- } else {
- postfixMessage += msg
- }
- }
-
- internal func appendDetails(_ msg: String) {
- if hasOverriddenStringValue {
- if let desc = userDescription {
- stringValue = "\(desc)\n\(stringValue)"
- }
- stringValue += "\n\(msg)"
- } else {
- if let desc = userDescription {
- userDescription = desc
- }
- extendedMessage = msg
- }
- }
-}
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/AllPass.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/AllPass.swift
deleted file mode 100644
index cc6c24f..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/AllPass.swift
+++ /dev/null
@@ -1,121 +0,0 @@
-import Foundation
-
-public func allPass
- (_ passFunc: @escaping (T?) throws -> Bool) -> Predicate
- where U: Sequence, T == U.Iterator.Element {
- let matcher = Predicate.simpleNilable("pass a condition") { actualExpression in
- return PredicateStatus(bool: try passFunc(try actualExpression.evaluate()))
- }
- return createPredicate(matcher)
-}
-
-public func allPass
- (_ passName: String, _ passFunc: @escaping (T?) throws -> Bool) -> Predicate
- where U: Sequence, T == U.Iterator.Element {
- let matcher = Predicate.simpleNilable(passName) { actualExpression in
- return PredicateStatus(bool: try passFunc(try actualExpression.evaluate()))
- }
- return createPredicate(matcher)
-}
-
-public func allPass(_ elementMatcher: M) -> Predicate
- where S: Sequence, M: Matcher, S.Iterator.Element == M.ValueType {
- return createPredicate(elementMatcher.predicate)
-}
-
-public func allPass(_ elementPredicate: Predicate) -> Predicate
- where S: Sequence {
- return createPredicate(elementPredicate)
-}
-
-private func createPredicate(_ elementMatcher: Predicate) -> Predicate
- where S: Sequence {
- return Predicate { actualExpression in
- guard let actualValue = try actualExpression.evaluate() else {
- return PredicateResult(
- status: .fail,
- message: .appends(.expectedTo("all pass"), " (use beNil() to match nils)")
- )
- }
-
- var failure: ExpectationMessage = .expectedTo("all pass")
- for currentElement in actualValue {
- let exp = Expression(
- expression: {currentElement}, location: actualExpression.location)
- let predicateResult = try elementMatcher.satisfies(exp)
- if predicateResult.status == .matches {
- failure = predicateResult.message.prepended(expectation: "all ")
- } else {
- failure = predicateResult.message
- .replacedExpectation({ .expectedTo($0.expectedMessage) })
- .wrappedExpectation(
- before: "all ",
- after: ", but failed first at element <\(stringify(currentElement))>"
- + " in <\(stringify(actualValue))>"
- )
- return PredicateResult(status: .doesNotMatch, message: failure)
- }
- }
- failure = failure.replacedExpectation({ expectation in
- return .expectedTo(expectation.expectedMessage)
- })
- return PredicateResult(status: .matches, message: failure)
- }
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-extension NMBObjCMatcher {
- @objc public class func allPassMatcher(_ matcher: NMBMatcher) -> NMBPredicate {
- return NMBPredicate { actualExpression in
- let location = actualExpression.location
- let actualValue = try actualExpression.evaluate()
- var nsObjects = [NSObject]()
-
- var collectionIsUsable = true
- if let value = actualValue as? NSFastEnumeration {
- var generator = NSFastEnumerationIterator(value)
- while let obj = generator.next() {
- if let nsObject = obj as? NSObject {
- nsObjects.append(nsObject)
- } else {
- collectionIsUsable = false
- break
- }
- }
- } else {
- collectionIsUsable = false
- }
-
- if !collectionIsUsable {
- return NMBPredicateResult(
- status: NMBPredicateStatus.fail,
- message: NMBExpectationMessage(
- // swiftlint:disable:next line_length
- fail: "allPass can only be used with types which implement NSFastEnumeration (NSArray, NSSet, ...), and whose elements subclass NSObject, got <\(actualValue?.description ?? "nil")>"
- )
- )
- }
-
- let expr = Expression(expression: ({ nsObjects }), location: location)
- let pred: Predicate<[NSObject]> = createPredicate(Predicate { expr in
- if let predicate = matcher as? NMBPredicate {
- return predicate.satisfies(({ try expr.evaluate() }), location: expr.location).toSwift()
- } else {
- let failureMessage = FailureMessage()
- let result = matcher.matches(
- ({ try! expr.evaluate() }),
- failureMessage: failureMessage,
- location: expr.location
- )
- let expectationMsg = failureMessage.toExpectationMessage()
- return PredicateResult(
- bool: result,
- message: expectationMsg
- )
- }
- })
- return try pred.satisfies(expr).toObjectiveC()
- }
- }
-}
-#endif
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/Async.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/Async.swift
deleted file mode 100644
index 63e863e..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/Async.swift
+++ /dev/null
@@ -1,175 +0,0 @@
-import Foundation
-
-/// If you are running on a slower machine, it could be useful to increase the default timeout value
-/// or slow down poll interval. Default timeout interval is 1, and poll interval is 0.01.
-public struct AsyncDefaults {
- public static var Timeout: TimeInterval = 1
- public static var PollInterval: TimeInterval = 0.01
-}
-
-private func async(style: ExpectationStyle, predicate: Predicate, timeout: TimeInterval, poll: TimeInterval, fnName: String) -> Predicate {
- return Predicate { actualExpression in
- let uncachedExpression = actualExpression.withoutCaching()
- let fnName = "expect(...).\(fnName)(...)"
- var lastPredicateResult: PredicateResult?
- let result = pollBlock(
- pollInterval: poll,
- timeoutInterval: timeout,
- file: actualExpression.location.file,
- line: actualExpression.location.line,
- fnName: fnName) {
- lastPredicateResult = try predicate.satisfies(uncachedExpression)
- return lastPredicateResult!.toBoolean(expectation: style)
- }
- switch result {
- case .completed: return lastPredicateResult!
- case .timedOut: return PredicateResult(status: .fail, message: lastPredicateResult!.message)
- case let .errorThrown(error):
- return PredicateResult(status: .fail, message: .fail("unexpected error thrown: <\(error)>"))
- case let .raisedException(exception):
- return PredicateResult(status: .fail, message: .fail("unexpected exception raised: \(exception)"))
- case .blockedRunLoop:
- // swiftlint:disable:next line_length
- return PredicateResult(status: .fail, message: lastPredicateResult!.message.appended(message: " (timed out, but main thread was unresponsive)."))
- case .incomplete:
- internalError("Reached .incomplete state for \(fnName)(...).")
- }
- }
-}
-
-private let toEventuallyRequiresClosureError = FailureMessage(
- // swiftlint:disable:next line_length
- stringValue: "expect(...).toEventually(...) requires an explicit closure (eg - expect { ... }.toEventually(...) )\nSwift 1.2 @autoclosure behavior has changed in an incompatible way for Nimble to function"
-)
-
-extension Expectation {
- /// Tests the actual value using a matcher to match by checking continuously
- /// at each pollInterval until the timeout is reached.
- ///
- /// @discussion
- /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function
- /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior.
- public func toEventually(_ predicate: Predicate, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) {
- nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue)
-
- let (pass, msg) = execute(
- expression,
- .toMatch,
- async(style: .toMatch, predicate: predicate, timeout: timeout, poll: pollInterval, fnName: "toEventually"),
- to: "to eventually",
- description: description,
- captureExceptions: false
- )
- verify(pass, msg)
- }
-
- /// Tests the actual value using a matcher to not match by checking
- /// continuously at each pollInterval until the timeout is reached.
- ///
- /// @discussion
- /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function
- /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior.
- public func toEventuallyNot(_ predicate: Predicate, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) {
- nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue)
-
- let (pass, msg) = execute(
- expression,
- .toNotMatch,
- async(
- style: .toNotMatch,
- predicate: predicate,
- timeout: timeout,
- poll: pollInterval,
- fnName: "toEventuallyNot"
- ),
- to: "to eventually not",
- description: description,
- captureExceptions: false
- )
- verify(pass, msg)
- }
-
- /// Tests the actual value using a matcher to not match by checking
- /// continuously at each pollInterval until the timeout is reached.
- ///
- /// Alias of toEventuallyNot()
- ///
- /// @discussion
- /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function
- /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior.
- public func toNotEventually(_ predicate: Predicate, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) {
- return toEventuallyNot(predicate, timeout: timeout, pollInterval: pollInterval, description: description)
- }
-}
-
-// Deprecated
-extension Expectation {
- /// Tests the actual value using a matcher to match by checking continuously
- /// at each pollInterval until the timeout is reached.
- ///
- /// @discussion
- /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function
- /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior.
- public func toEventually(_ matcher: U, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil)
- where U: Matcher, U.ValueType == T {
- if expression.isClosure {
- let (pass, msg) = execute(
- expression,
- .toMatch,
- async(
- style: .toMatch,
- predicate: matcher.predicate,
- timeout: timeout,
- poll: pollInterval,
- fnName: "toEventually"
- ),
- to: "to eventually",
- description: description,
- captureExceptions: false
- )
- verify(pass, msg)
- } else {
- verify(false, toEventuallyRequiresClosureError)
- }
- }
-
- /// Tests the actual value using a matcher to not match by checking
- /// continuously at each pollInterval until the timeout is reached.
- ///
- /// @discussion
- /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function
- /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior.
- public func toEventuallyNot(_ matcher: U, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil)
- where U: Matcher, U.ValueType == T {
- if expression.isClosure {
- let (pass, msg) = expressionDoesNotMatch(
- expression,
- matcher: async(
- style: .toNotMatch,
- predicate: matcher.predicate,
- timeout: timeout,
- poll: pollInterval,
- fnName: "toEventuallyNot"
- ),
- toNot: "to eventually not",
- description: description
- )
- verify(pass, msg)
- } else {
- verify(false, toEventuallyRequiresClosureError)
- }
- }
-
- /// Tests the actual value using a matcher to not match by checking
- /// continuously at each pollInterval until the timeout is reached.
- ///
- /// Alias of toEventuallyNot()
- ///
- /// @discussion
- /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function
- /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior.
- public func toNotEventually(_ matcher: U, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil)
- where U: Matcher, U.ValueType == T {
- return toEventuallyNot(matcher, timeout: timeout, pollInterval: pollInterval, description: description)
- }
-}
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift
deleted file mode 100644
index 5d0f5a1..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift
+++ /dev/null
@@ -1,68 +0,0 @@
-import Foundation
-
-private func matcherMessage(forType expectedType: T.Type) -> String {
- return "be a kind of \(String(describing: expectedType))"
-}
-private func matcherMessage(forClass expectedClass: AnyClass) -> String {
- return "be a kind of \(String(describing: expectedClass))"
-}
-
-/// A Nimble matcher that succeeds when the actual value is an instance of the given class.
-public func beAKindOf(_ expectedType: T.Type) -> Predicate {
- return Predicate.define { actualExpression in
- let message: ExpectationMessage
-
- let instance = try actualExpression.evaluate()
- guard let validInstance = instance else {
- message = .expectedCustomValueTo(matcherMessage(forType: expectedType), "")
- return PredicateResult(status: .fail, message: message)
- }
- message = .expectedCustomValueTo(
- "be a kind of \(String(describing: expectedType))",
- "<\(String(describing: type(of: validInstance))) instance>"
- )
-
- return PredicateResult(
- bool: validInstance is T,
- message: message
- )
- }
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-
-/// 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
-public func beAKindOf(_ expectedClass: AnyClass) -> Predicate {
- return Predicate.define { actualExpression in
- let message: ExpectationMessage
- let status: PredicateStatus
-
- let instance = try actualExpression.evaluate()
- if let validInstance = instance {
- status = PredicateStatus(bool: instance != nil && instance!.isKind(of: expectedClass))
- message = .expectedCustomValueTo(
- matcherMessage(forClass: expectedClass),
- "<\(String(describing: type(of: validInstance))) instance>"
- )
- } else {
- status = .fail
- message = .expectedCustomValueTo(
- matcherMessage(forClass: expectedClass),
- ""
- )
- }
-
- return PredicateResult(status: status, message: message)
- }
-}
-
-extension NMBObjCMatcher {
- @objc public class func beAKindOfMatcher(_ expected: AnyClass) -> NMBMatcher {
- return NMBPredicate { actualExpression in
- return try beAKindOf(expected).satisfies(actualExpression).toObjectiveC()
- }
- }
-}
-
-#endif
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift
deleted file mode 100644
index bc1b02c..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift
+++ /dev/null
@@ -1,56 +0,0 @@
-import Foundation
-
-/// A Nimble matcher that succeeds when the actual value is an _exact_ instance of the given class.
-public func beAnInstanceOf(_ expectedType: T.Type) -> Predicate {
- let errorMessage = "be an instance of \(String(describing: expectedType))"
- return Predicate.define { actualExpression in
- let instance = try actualExpression.evaluate()
- guard let validInstance = instance else {
- return PredicateResult(
- status: .doesNotMatch,
- message: .expectedActualValueTo(errorMessage)
- )
- }
-
- let actualString = "<\(String(describing: type(of: validInstance))) instance>"
-
- return PredicateResult(
- status: PredicateStatus(bool: type(of: validInstance) == expectedType),
- message: .expectedCustomValueTo(errorMessage, actualString)
- )
- }
-}
-
-/// A Nimble matcher that succeeds when the actual value is an instance of the given class.
-/// @see beAKindOf if you want to match against subclasses
-public func beAnInstanceOf(_ expectedClass: AnyClass) -> Predicate {
- let errorMessage = "be an instance of \(String(describing: expectedClass))"
- return Predicate.define { actualExpression in
- let instance = try actualExpression.evaluate()
- let actualString: String
- if let validInstance = instance {
- actualString = "<\(String(describing: type(of: validInstance))) instance>"
- } else {
- actualString = ""
- }
- #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
- let matches = instance != nil && instance!.isMember(of: expectedClass)
- #else
- let matches = instance != nil && type(of: instance!) == expectedClass
- #endif
- return PredicateResult(
- status: PredicateStatus(bool: matches),
- message: .expectedCustomValueTo(errorMessage, actualString)
- )
- }
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-extension NMBObjCMatcher {
- @objc public class func beAnInstanceOfMatcher(_ expected: AnyClass) -> NMBMatcher {
- return NMBPredicate { actualExpression in
- return try beAnInstanceOf(expected).satisfies(actualExpression).toObjectiveC()
- }
- }
-}
-#endif
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift
deleted file mode 100644
index b1e6f4c..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift
+++ /dev/null
@@ -1,138 +0,0 @@
-import Foundation
-
-public let DefaultDelta = 0.0001
-
-internal func isCloseTo(_ actualValue: NMBDoubleConvertible?,
- expectedValue: NMBDoubleConvertible,
- delta: Double)
- -> PredicateResult {
- let errorMessage = "be close to <\(stringify(expectedValue))> (within \(stringify(delta)))"
- return PredicateResult(
- bool: actualValue != nil &&
- abs(actualValue!.doubleValue - expectedValue.doubleValue) < delta,
- message: .expectedCustomValueTo(errorMessage, "<\(stringify(actualValue))>")
- )
-}
-
-/// A Nimble matcher that succeeds when a value is close to another. This is used for floating
-/// point values which can have imprecise results when doing arithmetic on them.
-///
-/// @see equal
-public func beCloseTo(_ expectedValue: Double, within delta: Double = DefaultDelta) -> Predicate {
- return Predicate.define { actualExpression in
- return isCloseTo(try actualExpression.evaluate(), expectedValue: expectedValue, delta: delta)
- }
-}
-
-/// A Nimble matcher that succeeds when a value is close to another. This is used for floating
-/// point values which can have imprecise results when doing arithmetic on them.
-///
-/// @see equal
-public func beCloseTo(_ expectedValue: NMBDoubleConvertible, within delta: Double = DefaultDelta) -> Predicate {
- return Predicate.define { actualExpression in
- return isCloseTo(try actualExpression.evaluate(), expectedValue: expectedValue, delta: delta)
- }
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-public class NMBObjCBeCloseToMatcher: NSObject, NMBMatcher {
- var _expected: NSNumber
- var _delta: CDouble
- init(expected: NSNumber, within: CDouble) {
- _expected = expected
- _delta = within
- }
-
- @objc public func matches(_ actualExpression: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool {
- let actualBlock: () -> NMBDoubleConvertible? = ({
- return actualExpression() as? NMBDoubleConvertible
- })
- let expr = Expression(expression: actualBlock, location: location)
- let matcher = beCloseTo(self._expected, within: self._delta)
-
- do {
- return try matcher.matches(expr, failureMessage: failureMessage)
- } catch let error {
- failureMessage.stringValue = "unexpected error thrown: <\(error)>"
- return false
- }
- }
-
- @objc public func doesNotMatch(_ actualExpression: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool {
- let actualBlock: () -> NMBDoubleConvertible? = ({
- return actualExpression() as? NMBDoubleConvertible
- })
- let expr = Expression(expression: actualBlock, location: location)
- let matcher = beCloseTo(self._expected, within: self._delta)
-
- do {
- return try matcher.doesNotMatch(expr, failureMessage: failureMessage)
- } catch let error {
- failureMessage.stringValue = "unexpected error thrown: <\(error)>"
- return false
- }
- }
-
- @objc public var within: (CDouble) -> NMBObjCBeCloseToMatcher {
- return ({ delta in
- return NMBObjCBeCloseToMatcher(expected: self._expected, within: delta)
- })
- }
-}
-
-extension NMBObjCMatcher {
- @objc public class func beCloseToMatcher(_ expected: NSNumber, within: CDouble) -> NMBObjCBeCloseToMatcher {
- return NMBObjCBeCloseToMatcher(expected: expected, within: within)
- }
-}
-#endif
-
-public func beCloseTo(_ expectedValues: [Double], within delta: Double = DefaultDelta) -> Predicate<[Double]> {
- let errorMessage = "be close to <\(stringify(expectedValues))> (each within \(stringify(delta)))"
- return Predicate.simple(errorMessage) { actualExpression in
- if let actual = try actualExpression.evaluate() {
- if actual.count != expectedValues.count {
- return .doesNotMatch
- } else {
- for (index, actualItem) in actual.enumerated() {
- if fabs(actualItem - expectedValues[index]) > delta {
- return .doesNotMatch
- }
- }
- return .matches
- }
- }
- return .doesNotMatch
- }
-}
-
-// MARK: - Operators
-
-infix operator ≈ : ComparisonPrecedence
-
-public func ≈(lhs: Expectation<[Double]>, rhs: [Double]) {
- lhs.to(beCloseTo(rhs))
-}
-
-public func ≈(lhs: Expectation, rhs: NMBDoubleConvertible) {
- lhs.to(beCloseTo(rhs))
-}
-
-public func ≈(lhs: Expectation, rhs: (expected: NMBDoubleConvertible, delta: Double)) {
- lhs.to(beCloseTo(rhs.expected, within: rhs.delta))
-}
-
-public func == (lhs: Expectation, rhs: (expected: NMBDoubleConvertible, delta: Double)) {
- lhs.to(beCloseTo(rhs.expected, within: rhs.delta))
-}
-
-// make this higher precedence than exponents so the Doubles either end aren't pulled in
-// unexpectantly
-precedencegroup PlusMinusOperatorPrecedence {
- higherThan: BitwiseShiftPrecedence
-}
-
-infix operator ± : PlusMinusOperatorPrecedence
-public func ±(lhs: NMBDoubleConvertible, rhs: Double) -> (expected: NMBDoubleConvertible, delta: Double) {
- return (expected: lhs, delta: rhs)
-}
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeEmpty.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeEmpty.swift
deleted file mode 100644
index 8d73dcc..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeEmpty.swift
+++ /dev/null
@@ -1,95 +0,0 @@
-import Foundation
-
-/// A Nimble matcher that succeeds when a value is "empty". For collections, this
-/// means the are no items in that collection. For strings, it is an empty string.
-public func beEmpty() -> Predicate {
- return Predicate.simple("be empty") { actualExpression in
- let actualSeq = try actualExpression.evaluate()
- if actualSeq == nil {
- return .fail
- }
- var generator = actualSeq!.makeIterator()
- return PredicateStatus(bool: generator.next() == nil)
- }
-}
-
-/// A Nimble matcher that succeeds when a value is "empty". For collections, this
-/// means the are no items in that collection. For strings, it is an empty string.
-public func beEmpty() -> Predicate {
- return Predicate.simple("be empty") { actualExpression in
- let actualString = try actualExpression.evaluate()
- return PredicateStatus(bool: actualString == nil || NSString(string: actualString!).length == 0)
- }
-}
-
-/// A Nimble matcher that succeeds when a value is "empty". For collections, this
-/// means the are no items in that collection. For NSString instances, it is an empty string.
-public func beEmpty() -> Predicate {
- return Predicate.simple("be empty") { actualExpression in
- let actualString = try actualExpression.evaluate()
- return PredicateStatus(bool: actualString == nil || actualString!.length == 0)
- }
-}
-
-// Without specific overrides, beEmpty() is ambiguous for NSDictionary, NSArray,
-// etc, since they conform to Sequence as well as NMBCollection.
-
-/// A Nimble matcher that succeeds when a value is "empty". For collections, this
-/// means the are no items in that collection. For strings, it is an empty string.
-public func beEmpty() -> Predicate {
- return Predicate.simple("be empty") { actualExpression in
- let actualDictionary = try actualExpression.evaluate()
- return PredicateStatus(bool: actualDictionary == nil || actualDictionary!.count == 0)
- }
-}
-
-/// A Nimble matcher that succeeds when a value is "empty". For collections, this
-/// means the are no items in that collection. For strings, it is an empty string.
-public func beEmpty() -> Predicate {
- return Predicate.simple("be empty") { actualExpression in
- let actualArray = try actualExpression.evaluate()
- return PredicateStatus(bool: actualArray == nil || actualArray!.count == 0)
- }
-}
-
-/// A Nimble matcher that succeeds when a value is "empty". For collections, this
-/// means the are no items in that collection. For strings, it is an empty string.
-public func beEmpty() -> Predicate {
- return Predicate.simple("be empty") { actualExpression in
- let actual = try actualExpression.evaluate()
- return PredicateStatus(bool: actual == nil || actual!.count == 0)
- }
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-extension NMBObjCMatcher {
- @objc public class func beEmptyMatcher() -> NMBPredicate {
- return NMBPredicate { actualExpression in
- let location = actualExpression.location
- let actualValue = try actualExpression.evaluate()
-
- if let value = actualValue as? NMBCollection {
- let expr = Expression(expression: ({ value as NMBCollection }), location: location)
- return try beEmpty().satisfies(expr).toObjectiveC()
- } else if let value = actualValue as? NSString {
- let expr = Expression(expression: ({ value as String }), location: location)
- return try beEmpty().satisfies(expr).toObjectiveC()
- } else if let actualValue = actualValue {
- // swiftlint:disable:next line_length
- let badTypeErrorMsg = "be empty (only works for NSArrays, NSSets, NSIndexSets, NSDictionaries, NSHashTables, and NSStrings)"
- return NMBPredicateResult(
- status: NMBPredicateStatus.fail,
- message: NMBExpectationMessage(
- expectedActualValueTo: badTypeErrorMsg,
- customActualValue: "\(String(describing: type(of: actualValue))) type"
- )
- )
- }
- return NMBPredicateResult(
- status: NMBPredicateStatus.fail,
- message: NMBExpectationMessage(expectedActualValueTo: "be empty").appendedBeNilHint()
- )
- }
- }
-}
-#endif
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift
deleted file mode 100644
index b86f25d..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift
+++ /dev/null
@@ -1,42 +0,0 @@
-import Foundation
-
-/// A Nimble matcher that succeeds when the actual value is greater than the expected value.
-public func beGreaterThan(_ expectedValue: T?) -> Predicate {
- let errorMessage = "be greater than <\(stringify(expectedValue))>"
- return Predicate.simple(errorMessage) { actualExpression in
- if let actual = try actualExpression.evaluate(), let expected = expectedValue {
- return PredicateStatus(bool: actual > expected)
- }
- return .fail
- }
-}
-
-/// A Nimble matcher that succeeds when the actual value is greater than the expected value.
-public func beGreaterThan(_ expectedValue: NMBComparable?) -> Predicate {
- let errorMessage = "be greater than <\(stringify(expectedValue))>"
- return Predicate.simple(errorMessage) { actualExpression in
- let actualValue = try actualExpression.evaluate()
- let matches = actualValue != nil
- && actualValue!.NMB_compare(expectedValue) == ComparisonResult.orderedDescending
- return PredicateStatus(bool: matches)
- }
-}
-
-public func >(lhs: Expectation, rhs: T) {
- lhs.to(beGreaterThan(rhs))
-}
-
-public func > (lhs: Expectation, rhs: NMBComparable?) {
- lhs.to(beGreaterThan(rhs))
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-extension NMBObjCMatcher {
- @objc public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher {
- return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
- let expr = actualExpression.cast { $0 as? NMBComparable }
- return try beGreaterThan(expected).matches(expr, failureMessage: failureMessage)
- }
- }
-}
-#endif
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift
deleted file mode 100644
index 2a3ca4a..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift
+++ /dev/null
@@ -1,44 +0,0 @@
-import Foundation
-
-/// A Nimble matcher that succeeds when the actual value is greater than
-/// or equal to the expected value.
-public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Predicate {
- let message = "be greater than or equal to <\(stringify(expectedValue))>"
- return Predicate.simple(message) { actualExpression in
- let actualValue = try actualExpression.evaluate()
- if let actual = actualValue, let expected = expectedValue {
- return PredicateStatus(bool: actual >= expected)
- }
- return .fail
- }
-}
-
-/// A Nimble matcher that succeeds when the actual value is greater than
-/// or equal to the expected value.
-public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Predicate {
- let message = "be greater than or equal to <\(stringify(expectedValue))>"
- return Predicate.simple(message) { actualExpression in
- let actualValue = try actualExpression.evaluate()
- let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) != ComparisonResult.orderedAscending
- return PredicateStatus(bool: matches)
- }
-}
-
-public func >=(lhs: Expectation, rhs: T) {
- lhs.to(beGreaterThanOrEqualTo(rhs))
-}
-
-public func >=(lhs: Expectation, rhs: T) {
- lhs.to(beGreaterThanOrEqualTo(rhs))
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-extension NMBObjCMatcher {
- @objc public class func beGreaterThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher {
- return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
- let expr = actualExpression.cast { $0 as? NMBComparable }
- return try beGreaterThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage)
- }
- }
-}
-#endif
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift
deleted file mode 100644
index 94758c2..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift
+++ /dev/null
@@ -1,53 +0,0 @@
-import Foundation
-
-/// A Nimble matcher that succeeds when the actual value is the same instance
-/// as the expected instance.
-public func beIdenticalTo(_ expected: Any?) -> Predicate {
- return Predicate.define { actualExpression in
- #if os(Linux)
- let actual = try actualExpression.evaluate() as? AnyObject
- #else
- let actual = try actualExpression.evaluate() as AnyObject?
- #endif
-
- let bool: Bool
- #if os(Linux)
- bool = actual === (expected as? AnyObject) && actual !== nil
- #else
- bool = actual === (expected as AnyObject?) && actual !== nil
- #endif
- return PredicateResult(
- bool: bool,
- message: .expectedCustomValueTo(
- "be identical to \(identityAsString(expected))",
- "\(identityAsString(actual))"
- )
- )
- }
-}
-
-public func === (lhs: Expectation, rhs: Any?) {
- lhs.to(beIdenticalTo(rhs))
-}
-public func !== (lhs: Expectation, rhs: Any?) {
- lhs.toNot(beIdenticalTo(rhs))
-}
-
-/// A Nimble matcher that succeeds when the actual value is the same instance
-/// as the expected instance.
-///
-/// Alias for "beIdenticalTo".
-public func be(_ expected: Any?) -> Predicate {
- return beIdenticalTo(expected)
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-extension NMBObjCMatcher {
- @objc public class func beIdenticalToMatcher(_ expected: NSObject?) -> NMBObjCMatcher {
- return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
- let aExpr = actualExpression.cast { $0 as Any? }
- return try beIdenticalTo(expected).matches(aExpr, failureMessage: failureMessage)
- }
- }
-}
-#endif
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeLessThan.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeLessThan.swift
deleted file mode 100644
index e1fbf1e..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeLessThan.swift
+++ /dev/null
@@ -1,41 +0,0 @@
-import Foundation
-
-/// A Nimble matcher that succeeds when the actual value is less than the expected value.
-public func beLessThan(_ expectedValue: T?) -> Predicate {
- let message = "be less than <\(stringify(expectedValue))>"
- return Predicate.simple(message) { actualExpression in
- if let actual = try actualExpression.evaluate(), let expected = expectedValue {
- return PredicateStatus(bool: actual < expected)
- }
- return .fail
- }
-}
-
-/// A Nimble matcher that succeeds when the actual value is less than the expected value.
-public func beLessThan(_ expectedValue: NMBComparable?) -> Predicate {
- let message = "be less than <\(stringify(expectedValue))>"
- return Predicate.simple(message) { actualExpression in
- let actualValue = try actualExpression.evaluate()
- let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) == ComparisonResult.orderedAscending
- return PredicateStatus(bool: matches)
- }
-}
-
-public func <(lhs: Expectation, rhs: T) {
- lhs.to(beLessThan(rhs))
-}
-
-public func < (lhs: Expectation, rhs: NMBComparable?) {
- lhs.to(beLessThan(rhs))
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-extension NMBObjCMatcher {
- @objc public class func beLessThanMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher {
- return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
- let expr = actualExpression.cast { $0 as? NMBComparable }
- return try beLessThan(expected).matches(expr, failureMessage: failureMessage)
- }
- }
-}
-#endif
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift
deleted file mode 100644
index c37cb16..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift
+++ /dev/null
@@ -1,41 +0,0 @@
-import Foundation
-
-/// A Nimble matcher that succeeds when the actual value is less than
-/// or equal to the expected value.
-public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predicate {
- return Predicate.simple("be less than or equal to <\(stringify(expectedValue))>") { actualExpression in
- if let actual = try actualExpression.evaluate(), let expected = expectedValue {
- return PredicateStatus(bool: actual <= expected)
- }
- return .fail
- }
-}
-
-/// A Nimble matcher that succeeds when the actual value is less than
-/// or equal to the expected value.
-public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predicate {
- return Predicate.simple("be less than or equal to <\(stringify(expectedValue))>") { actualExpression in
- let actualValue = try actualExpression.evaluate()
- let matches = actualValue.map { $0.NMB_compare(expectedValue) != .orderedDescending } ?? false
- return PredicateStatus(bool: matches)
- }
-}
-
-public func <=(lhs: Expectation, rhs: T) {
- lhs.to(beLessThanOrEqualTo(rhs))
-}
-
-public func <=(lhs: Expectation, rhs: T) {
- lhs.to(beLessThanOrEqualTo(rhs))
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-extension NMBObjCMatcher {
- @objc public class func beLessThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher {
- return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
- let expr = actualExpression.cast { $0 as? NMBComparable }
- return try beLessThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage)
- }
- }
-}
-#endif
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeLogical.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeLogical.swift
deleted file mode 100644
index 035500e..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeLogical.swift
+++ /dev/null
@@ -1,167 +0,0 @@
-import Foundation
-
-extension Int8: ExpressibleByBooleanLiteral {
- public init(booleanLiteral value: Bool) {
- self = NSNumber(value: value).int8Value
- }
-}
-
-extension UInt8: ExpressibleByBooleanLiteral {
- public init(booleanLiteral value: Bool) {
- self = NSNumber(value: value).uint8Value
- }
-}
-
-extension Int16: ExpressibleByBooleanLiteral {
- public init(booleanLiteral value: Bool) {
- self = NSNumber(value: value).int16Value
- }
-}
-
-extension UInt16: ExpressibleByBooleanLiteral {
- public init(booleanLiteral value: Bool) {
- self = NSNumber(value: value).uint16Value
- }
-}
-
-extension Int32: ExpressibleByBooleanLiteral {
- public init(booleanLiteral value: Bool) {
- self = NSNumber(value: value).int32Value
- }
-}
-
-extension UInt32: ExpressibleByBooleanLiteral {
- public init(booleanLiteral value: Bool) {
- self = NSNumber(value: value).uint32Value
- }
-}
-
-extension Int64: ExpressibleByBooleanLiteral {
- public init(booleanLiteral value: Bool) {
- self = NSNumber(value: value).int64Value
- }
-}
-
-extension UInt64: ExpressibleByBooleanLiteral {
- public init(booleanLiteral value: Bool) {
- self = NSNumber(value: value).uint64Value
- }
-}
-
-extension Float: ExpressibleByBooleanLiteral {
- public init(booleanLiteral value: Bool) {
- self = NSNumber(value: value).floatValue
- }
-}
-
-extension Double: ExpressibleByBooleanLiteral {
- public init(booleanLiteral value: Bool) {
- self = NSNumber(value: value).doubleValue
- }
-}
-
-extension Int: ExpressibleByBooleanLiteral {
- public init(booleanLiteral value: Bool) {
- self = NSNumber(value: value).intValue
- }
-}
-
-extension UInt: ExpressibleByBooleanLiteral {
- public init(booleanLiteral value: Bool) {
- self = NSNumber(value: value).uintValue
- }
-}
-
-internal func rename(_ matcher: Predicate, failureMessage message: ExpectationMessage) -> Predicate {
- return Predicate { actualExpression in
- let result = try matcher.satisfies(actualExpression)
- return PredicateResult(status: result.status, message: message)
- }.requireNonNil
-}
-
-// MARK: beTrue() / beFalse()
-
-/// A Nimble matcher that succeeds when the actual value is exactly true.
-/// This matcher will not match against nils.
-public func beTrue() -> Predicate {
- return rename(equal(true), failureMessage: .expectedActualValueTo("be true"))
-}
-
-/// A Nimble matcher that succeeds when the actual value is exactly false.
-/// This matcher will not match against nils.
-public func beFalse() -> Predicate {
- return rename(equal(false), failureMessage: .expectedActualValueTo("be false"))
-}
-
-// MARK: beTruthy() / beFalsy()
-
-/// A Nimble matcher that succeeds when the actual value is not logically false.
-public func beTruthy() -> Predicate {
- return Predicate.simpleNilable("be truthy") { actualExpression in
- let actualValue = try actualExpression.evaluate()
- if let actualValue = actualValue {
- // FIXME: This is a workaround to SR-2290.
- // See:
- // - https://bugs.swift.org/browse/SR-2290
- // - https://github.com/norio-nomura/Nimble/pull/5#issuecomment-237835873
- if let number = actualValue as? NSNumber {
- return PredicateStatus(bool: number.boolValue == true)
- }
-
- return PredicateStatus(bool: actualValue == (true as T))
- }
- return PredicateStatus(bool: actualValue != nil)
- }
-}
-
-/// A Nimble matcher that succeeds when the actual value is logically false.
-/// This matcher will match against nils.
-public func beFalsy() -> Predicate {
- return Predicate.simpleNilable("be falsy") { actualExpression in
- let actualValue = try actualExpression.evaluate()
- if let actualValue = actualValue {
- // FIXME: This is a workaround to SR-2290.
- // See:
- // - https://bugs.swift.org/browse/SR-2290
- // - https://github.com/norio-nomura/Nimble/pull/5#issuecomment-237835873
- if let number = actualValue as? NSNumber {
- return PredicateStatus(bool: number.boolValue == false)
- }
-
- return PredicateStatus(bool: actualValue == (false as T))
- }
- return PredicateStatus(bool: actualValue == nil)
- }
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-extension NMBObjCMatcher {
- @objc public class func beTruthyMatcher() -> NMBObjCMatcher {
- return NMBObjCMatcher { actualExpression, failureMessage in
- let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false }
- return try beTruthy().matches(expr, failureMessage: failureMessage)
- }
- }
-
- @objc public class func beFalsyMatcher() -> NMBObjCMatcher {
- return NMBObjCMatcher { actualExpression, failureMessage in
- let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false }
- return try beFalsy().matches(expr, failureMessage: failureMessage)
- }
- }
-
- @objc public class func beTrueMatcher() -> NMBObjCMatcher {
- return NMBObjCMatcher { actualExpression, failureMessage in
- let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false }
- return try beTrue().matches(expr, failureMessage: failureMessage)
- }
- }
-
- @objc public class func beFalseMatcher() -> NMBObjCMatcher {
- return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
- let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false }
- return try beFalse().matches(expr, failureMessage: failureMessage)
- }
- }
-}
-#endif
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeNil.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeNil.swift
deleted file mode 100644
index 387420b..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeNil.swift
+++ /dev/null
@@ -1,19 +0,0 @@
-import Foundation
-
-/// A Nimble matcher that succeeds when the actual value is nil.
-public func beNil() -> Predicate {
- return Predicate.simpleNilable("be nil") { actualExpression in
- let actualValue = try actualExpression.evaluate()
- return PredicateStatus(bool: actualValue == nil)
- }
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-extension NMBObjCMatcher {
- @objc public class func beNilMatcher() -> NMBObjCMatcher {
- return NMBObjCMatcher { actualExpression, failureMessage in
- return try beNil().matches(actualExpression, failureMessage: failureMessage)
- }
- }
-}
-#endif
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeVoid.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeVoid.swift
deleted file mode 100644
index a9dbc28..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeVoid.swift
+++ /dev/null
@@ -1,17 +0,0 @@
-import Foundation
-
-/// A Nimble matcher that succeeds when the actual value is Void.
-public func beVoid() -> Predicate<()> {
- return Predicate.simpleNilable("be void") { actualExpression in
- let actualValue: ()? = try actualExpression.evaluate()
- return PredicateStatus(bool: actualValue != nil)
- }
-}
-
-public func == (lhs: Expectation<()>, rhs: ()) {
- lhs.to(beVoid())
-}
-
-public func != (lhs: Expectation<()>, rhs: ()) {
- lhs.toNot(beVoid())
-}
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeginWith.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeginWith.swift
deleted file mode 100644
index a013f9f..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/BeginWith.swift
+++ /dev/null
@@ -1,60 +0,0 @@
-import Foundation
-
-/// A Nimble matcher that succeeds when the actual sequence's first element
-/// is equal to the expected value.
-public func beginWith(_ startingElement: T) -> Predicate
- where S.Iterator.Element == T {
- return Predicate.simple("begin with <\(startingElement)>") { actualExpression in
- if let actualValue = try actualExpression.evaluate() {
- var actualGenerator = actualValue.makeIterator()
- return PredicateStatus(bool: actualGenerator.next() == startingElement)
- }
- return .fail
- }
-}
-
-/// A Nimble matcher that succeeds when the actual collection's first element
-/// is equal to the expected object.
-public func beginWith(_ startingElement: Any) -> Predicate {
- return Predicate.simple("begin with <\(startingElement)>") { actualExpression in
- guard let collection = try actualExpression.evaluate() else { return .fail }
- guard collection.count > 0 else { return .doesNotMatch }
- #if os(Linux)
- guard let collectionValue = collection.object(at: 0) as? NSObject else {
- return .fail
- }
- #else
- let collectionValue = collection.object(at: 0) as AnyObject
- #endif
- return PredicateStatus(bool: collectionValue.isEqual(startingElement))
- }
-}
-
-/// A Nimble matcher that succeeds when the actual string contains expected substring
-/// where the expected substring's location is zero.
-public func beginWith(_ startingSubstring: String) -> Predicate {
- return Predicate.simple("begin with <\(startingSubstring)>") { actualExpression in
- if let actual = try actualExpression.evaluate() {
- let range = actual.range(of: startingSubstring)
- return PredicateStatus(bool: range != nil && range!.lowerBound == actual.startIndex)
- }
- return .fail
- }
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-extension NMBObjCMatcher {
- @objc public class func beginWithMatcher(_ expected: Any) -> NMBObjCMatcher {
- return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
- let actual = try actualExpression.evaluate()
- if (actual as? String) != nil {
- let expr = actualExpression.cast { $0 as? String }
- return try beginWith(expected as! String).matches(expr, failureMessage: failureMessage)
- } else {
- let expr = actualExpression.cast { $0 as? NMBOrderedCollection }
- return try beginWith(expected).matches(expr, failureMessage: failureMessage)
- }
- }
- }
-}
-#endif
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/Contain.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/Contain.swift
deleted file mode 100644
index 2c84c5c..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/Contain.swift
+++ /dev/null
@@ -1,95 +0,0 @@
-import Foundation
-
-/// A Nimble matcher that succeeds when the actual sequence contains the expected value.
-public func contain(_ items: T...) -> Predicate
- where S.Iterator.Element == T {
- return contain(items)
-}
-
-public func contain(_ items: [T]) -> Predicate
- where S.Iterator.Element == T {
- return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in
- if let actual = try actualExpression.evaluate() {
- let matches = items.all {
- return actual.contains($0)
- }
- return PredicateStatus(bool: matches)
- }
- return .fail
- }
-}
-
-/// A Nimble matcher that succeeds when the actual string contains the expected substring.
-public func contain(_ substrings: String...) -> Predicate {
- return contain(substrings)
-}
-
-public func contain(_ substrings: [String]) -> Predicate {
- return Predicate.simple("contain <\(arrayAsString(substrings))>") { actualExpression in
- if let actual = try actualExpression.evaluate() {
- let matches = substrings.all {
- let range = actual.range(of: $0)
- return range != nil && !range!.isEmpty
- }
- return PredicateStatus(bool: matches)
- }
- return .fail
- }
-}
-
-/// A Nimble matcher that succeeds when the actual string contains the expected substring.
-public func contain(_ substrings: NSString...) -> Predicate {
- return contain(substrings)
-}
-
-public func contain(_ substrings: [NSString]) -> Predicate {
- return Predicate.simple("contain <\(arrayAsString(substrings))>") { actualExpression in
- if let actual = try actualExpression.evaluate() {
- let matches = substrings.all { actual.range(of: $0.description).length != 0 }
- return PredicateStatus(bool: matches)
- }
- return .fail
- }
-}
-
-/// A Nimble matcher that succeeds when the actual collection contains the expected object.
-public func contain(_ items: Any?...) -> Predicate {
- return contain(items)
-}
-
-public func contain(_ items: [Any?]) -> Predicate {
- return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in
- guard let actual = try actualExpression.evaluate() else { return .fail }
- let matches = items.all { item in
- return item.map { actual.contains($0) } ?? false
- }
- return PredicateStatus(bool: matches)
- }
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-extension NMBObjCMatcher {
- @objc public class func containMatcher(_ expected: [NSObject]) -> NMBObjCMatcher {
- return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
- let location = actualExpression.location
- let actualValue = try actualExpression.evaluate()
- if let value = actualValue as? NMBContainer {
- let expr = Expression(expression: ({ value as NMBContainer }), location: location)
-
- // A straightforward cast on the array causes this to crash, so we have to cast the individual items
- let expectedOptionals: [Any?] = expected.map({ $0 as Any? })
- return try contain(expectedOptionals).matches(expr, failureMessage: failureMessage)
- } else if let value = actualValue as? NSString {
- let expr = Expression(expression: ({ value as String }), location: location)
- return try contain(expected as! [String]).matches(expr, failureMessage: failureMessage)
- } else if actualValue != nil {
- // swiftlint:disable:next line_length
- failureMessage.postfixMessage = "contain <\(arrayAsString(expected))> (only works for NSArrays, NSSets, NSHashTables, and NSStrings)"
- } else {
- failureMessage.postfixMessage = "contain <\(arrayAsString(expected))>"
- }
- return false
- }
- }
-}
-#endif
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift
deleted file mode 100644
index 8a23a6c..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift
+++ /dev/null
@@ -1,58 +0,0 @@
-import Foundation
-
-public func containElementSatisfying(_ predicate: @escaping ((T) -> Bool), _ predicateDescription: String = "") -> Predicate where S.Iterator.Element == T {
-
- return Predicate.define { actualExpression in
- let message: ExpectationMessage
- if predicateDescription == "" {
- message = .expectedTo("find object in collection that satisfies predicate")
- } else {
- message = .expectedTo("find object in collection \(predicateDescription)")
- }
-
- if let sequence = try actualExpression.evaluate() {
- for object in sequence {
- if predicate(object) {
- return PredicateResult(bool: true, message: message)
- }
- }
-
- return PredicateResult(bool: false, message: message)
- }
-
- return PredicateResult(status: .fail, message: message)
- }
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
- extension NMBObjCMatcher {
- @objc public class func containElementSatisfyingMatcher(_ predicate: @escaping ((NSObject) -> Bool)) -> NMBObjCMatcher {
- return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
- let value = try actualExpression.evaluate()
- guard let enumeration = value as? NSFastEnumeration else {
- // swiftlint:disable:next line_length
- failureMessage.postfixMessage = "containElementSatisfying must be provided an NSFastEnumeration object"
- failureMessage.actualValue = nil
- failureMessage.expected = ""
- failureMessage.to = ""
- return false
- }
-
- var iterator = NSFastEnumerationIterator(enumeration)
- while let item = iterator.next() {
- guard let object = item as? NSObject else {
- continue
- }
-
- if predicate(object) {
- return true
- }
- }
-
- failureMessage.actualValue = nil
- failureMessage.postfixMessage = "find object in collection that satisfies predicate"
- return false
- }
- }
- }
-#endif
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/EndWith.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/EndWith.swift
deleted file mode 100644
index 80a06ca..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/EndWith.swift
+++ /dev/null
@@ -1,68 +0,0 @@
-import Foundation
-
-/// A Nimble matcher that succeeds when the actual sequence's last element
-/// is equal to the expected value.
-public func endWith(_ endingElement: T) -> Predicate
- where S.Iterator.Element == T {
- return Predicate.simple("end with <\(endingElement)>") { actualExpression in
- if let actualValue = try actualExpression.evaluate() {
- var actualGenerator = actualValue.makeIterator()
- var lastItem: T?
- var item: T?
- repeat {
- lastItem = item
- item = actualGenerator.next()
- } while(item != nil)
-
- return PredicateStatus(bool: lastItem == endingElement)
- }
- return .fail
- }
-}
-
-/// A Nimble matcher that succeeds when the actual collection's last element
-/// is equal to the expected object.
-public func endWith(_ endingElement: Any) -> Predicate {
- return Predicate.simple("end with <\(endingElement)>") { actualExpression in
- guard let collection = try actualExpression.evaluate() else { return .fail }
- guard collection.count > 0 else { return PredicateStatus(bool: false) }
- #if os(Linux)
- guard let collectionValue = collection.object(at: collection.count - 1) as? NSObject else {
- return .fail
- }
- #else
- let collectionValue = collection.object(at: collection.count - 1) as AnyObject
- #endif
-
- return PredicateStatus(bool: collectionValue.isEqual(endingElement))
- }
-}
-
-/// A Nimble matcher that succeeds when the actual string contains the expected substring
-/// where the expected substring's location is the actual string's length minus the
-/// expected substring's length.
-public func endWith(_ endingSubstring: String) -> Predicate {
- return Predicate.simple("end with <\(endingSubstring)>") { actualExpression in
- if let collection = try actualExpression.evaluate() {
- return PredicateStatus(bool: collection.hasSuffix(endingSubstring))
- }
- return .fail
- }
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-extension NMBObjCMatcher {
- @objc public class func endWithMatcher(_ expected: Any) -> NMBObjCMatcher {
- return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
- let actual = try actualExpression.evaluate()
- if (actual as? String) != nil {
- let expr = actualExpression.cast { $0 as? String }
- return try endWith(expected as! String).matches(expr, failureMessage: failureMessage)
- } else {
- let expr = actualExpression.cast { $0 as? NMBOrderedCollection }
- return try endWith(expected).matches(expr, failureMessage: failureMessage)
- }
- }
- }
-}
-#endif
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/Equal.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/Equal.swift
deleted file mode 100644
index 5f26f49..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/Equal.swift
+++ /dev/null
@@ -1,220 +0,0 @@
-import Foundation
-
-/// A Nimble matcher that succeeds when the actual value is equal to the expected value.
-/// Values can support equal by supporting the Equatable protocol.
-///
-/// @see beCloseTo if you want to match imprecise types (eg - floats, doubles).
-public func equal(_ expectedValue: T?) -> Predicate {
- return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in
- let actualValue = try actualExpression.evaluate()
- let matches = actualValue == expectedValue && expectedValue != nil
- if expectedValue == nil || actualValue == nil {
- if expectedValue == nil && actualValue != nil {
- return PredicateResult(
- status: .fail,
- message: msg.appendedBeNilHint()
- )
- }
- return PredicateResult(status: .fail, message: msg)
- }
- return PredicateResult(status: PredicateStatus(bool: matches), message: msg)
- }
-}
-
-/// A Nimble matcher that succeeds when the actual value is equal to the expected value.
-/// Values can support equal by supporting the Equatable protocol.
-///
-/// @see beCloseTo if you want to match imprecise types (eg - floats, doubles).
-public func equal(_ expectedValue: [T: C]?) -> Predicate<[T: C]> {
- return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in
- let actualValue = try actualExpression.evaluate()
- if expectedValue == nil || actualValue == nil {
- if expectedValue == nil && actualValue != nil {
- return PredicateResult(
- status: .fail,
- message: msg.appendedBeNilHint()
- )
- }
- return PredicateResult(status: .fail, message: msg)
- }
- return PredicateResult(
- status: PredicateStatus(bool: expectedValue! == actualValue!),
- message: msg
- )
- }
-}
-
-/// A Nimble matcher that succeeds when the actual collection is equal to the expected collection.
-/// Items must implement the Equatable protocol.
-public func equal(_ expectedValue: [T]?) -> Predicate<[T]> {
- return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in
- let actualValue = try actualExpression.evaluate()
- if expectedValue == nil || actualValue == nil {
- if expectedValue == nil && actualValue != nil {
- return PredicateResult(
- status: .fail,
- message: msg.appendedBeNilHint()
- )
- }
- return PredicateResult(
- status: .fail,
- message: msg
- )
- }
- return PredicateResult(
- bool: expectedValue! == actualValue!,
- message: msg
- )
- }
-}
-
-/// A Nimble matcher allowing comparison of collection with optional type
-public func equal(_ expectedValue: [T?]) -> Predicate<[T?]> {
- return Predicate.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in
- if let actualValue = try actualExpression.evaluate() {
- let doesNotMatch = PredicateResult(
- status: .doesNotMatch,
- message: msg
- )
-
- if expectedValue.count != actualValue.count {
- return doesNotMatch
- }
-
- for (index, item) in actualValue.enumerated() {
- let otherItem = expectedValue[index]
- if item == nil && otherItem == nil {
- continue
- } else if item == nil && otherItem != nil {
- return doesNotMatch
- } else if item != nil && otherItem == nil {
- return doesNotMatch
- } else if item! != otherItem! {
- return doesNotMatch
- }
- }
-
- return PredicateResult(
- status: .matches,
- message: msg
- )
- } else {
- return PredicateResult(
- status: .fail,
- message: msg.appendedBeNilHint()
- )
- }
- }
-}
-
-/// A Nimble matcher that succeeds when the actual set is equal to the expected set.
-public func equal(_ expectedValue: Set?) -> Predicate> {
- return equal(expectedValue, stringify: { stringify($0) })
-}
-
-/// A Nimble matcher that succeeds when the actual set is equal to the expected set.
-public func equal(_ expectedValue: Set?) -> Predicate> {
- return equal(expectedValue, stringify: {
- if let set = $0 {
- return stringify(Array(set).sorted { $0 < $1 })
- } else {
- return "nil"
- }
- })
-}
-
-private func equal(_ expectedValue: Set?, stringify: @escaping (Set?) -> String) -> Predicate> {
- return Predicate { actualExpression in
- var errorMessage: ExpectationMessage =
- .expectedActualValueTo("equal <\(stringify(expectedValue))>")
-
- if let expectedValue = expectedValue {
- if let actualValue = try actualExpression.evaluate() {
- errorMessage = .expectedCustomValueTo(
- "equal <\(stringify(expectedValue))>",
- "<\(stringify(actualValue))>"
- )
-
- if expectedValue == actualValue {
- return PredicateResult(
- status: .matches,
- message: errorMessage
- )
- }
-
- let missing = expectedValue.subtracting(actualValue)
- if missing.count > 0 {
- errorMessage = errorMessage.appended(message: ", missing <\(stringify(missing))>")
- }
-
- let extra = actualValue.subtracting(expectedValue)
- if extra.count > 0 {
- errorMessage = errorMessage.appended(message: ", extra <\(stringify(extra))>")
- }
- return PredicateResult(
- status: .doesNotMatch,
- message: errorMessage
- )
- }
- return PredicateResult(
- status: .fail,
- message: errorMessage.appendedBeNilHint()
- )
- } else {
- return PredicateResult(
- status: .fail,
- message: errorMessage.appendedBeNilHint()
- )
- }
- }
-}
-
-public func ==(lhs: Expectation, rhs: T?) {
- lhs.to(equal(rhs))
-}
-
-public func !=(lhs: Expectation, rhs: T?) {
- lhs.toNot(equal(rhs))
-}
-
-public func ==(lhs: Expectation<[T]>, rhs: [T]?) {
- lhs.to(equal(rhs))
-}
-
-public func !=(lhs: Expectation<[T]>, rhs: [T]?) {
- lhs.toNot(equal(rhs))
-}
-
-public func == (lhs: Expectation>, rhs: Set?) {
- lhs.to(equal(rhs))
-}
-
-public func != (lhs: Expectation>, rhs: Set?) {
- lhs.toNot(equal(rhs))
-}
-
-public func ==(lhs: Expectation>, rhs: Set?) {
- lhs.to(equal(rhs))
-}
-
-public func !=(lhs: Expectation>, rhs: Set?) {
- lhs.toNot(equal(rhs))
-}
-
-public func ==(lhs: Expectation<[T: C]>, rhs: [T: C]?) {
- lhs.to(equal(rhs))
-}
-
-public func !=(lhs: Expectation<[T: C]>, rhs: [T: C]?) {
- lhs.toNot(equal(rhs))
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-extension NMBObjCMatcher {
- @objc public class func equalMatcher(_ expected: NSObject) -> NMBMatcher {
- return NMBPredicate { actualExpression in
- return try equal(expected).satisfies(actualExpression).toObjectiveC()
- }
- }
-}
-#endif
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/HaveCount.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/HaveCount.swift
deleted file mode 100644
index 3529da8..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/HaveCount.swift
+++ /dev/null
@@ -1,65 +0,0 @@
-import Foundation
-
-// The `haveCount` matchers do not print the full string representation of the collection value,
-// instead they only print the type name and the expected count. This makes it easier to understand
-// the reason for failed expectations. See: https://github.com/Quick/Nimble/issues/308.
-// The representation of the collection content is provided in a new line as an `extendedMessage`.
-
-/// A Nimble matcher that succeeds when the actual Collection's count equals
-/// the expected value
-public func haveCount(_ expectedValue: T.IndexDistance) -> Predicate {
- return Predicate.define { actualExpression in
- if let actualValue = try actualExpression.evaluate() {
- let message = ExpectationMessage
- .expectedCustomValueTo(
- "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))",
- "\(actualValue.count)"
- )
- .appended(details: "Actual Value: \(stringify(actualValue))")
-
- let result = expectedValue == actualValue.count
- return PredicateResult(bool: result, message: message)
- } else {
- return PredicateResult(status: .fail, message: .fail(""))
- }
- }
-}
-
-/// A Nimble matcher that succeeds when the actual collection's count equals
-/// the expected value
-public func haveCount(_ expectedValue: Int) -> Predicate {
- return Predicate { actualExpression in
- if let actualValue = try actualExpression.evaluate() {
- let message = ExpectationMessage
- .expectedCustomValueTo(
- "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))",
- "\(actualValue.count)"
- )
- .appended(details: "Actual Value: \(stringify(actualValue))")
-
- let result = expectedValue == actualValue.count
- return PredicateResult(bool: result, message: message)
- } else {
- return PredicateResult(status: .fail, message: .fail(""))
- }
- }
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-extension NMBObjCMatcher {
- @objc public class func haveCountMatcher(_ expected: NSNumber) -> NMBObjCMatcher {
- return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
- let location = actualExpression.location
- let actualValue = try actualExpression.evaluate()
- if let value = actualValue as? NMBCollection {
- let expr = Expression(expression: ({ value as NMBCollection}), location: location)
- return try haveCount(expected.intValue).matches(expr, failureMessage: failureMessage)
- } else if let actualValue = actualValue {
- failureMessage.postfixMessage = "get type of NSArray, NSSet, NSDictionary, or NSHashTable"
- failureMessage.actualValue = "\(String(describing: type(of: actualValue)))"
- }
- return false
- }
- }
-}
-#endif
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/Match.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/Match.swift
deleted file mode 100644
index f738daf..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/Match.swift
+++ /dev/null
@@ -1,29 +0,0 @@
-import Foundation
-
-/// A Nimble matcher that succeeds when the actual string satisfies the regular expression
-/// described by the expected string.
-public func match(_ expectedValue: String?) -> Predicate {
- return Predicate.simple("match <\(stringify(expectedValue))>") { actualExpression in
- if let actual = try actualExpression.evaluate() {
- if let regexp = expectedValue {
- let bool = actual.range(of: regexp, options: .regularExpression) != nil
- return PredicateStatus(bool: bool)
- }
- }
-
- return .fail
- }
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-
-extension NMBObjCMatcher {
- @objc public class func matchMatcher(_ expected: NSString) -> NMBMatcher {
- return NMBPredicate { actualExpression in
- let actual = actualExpression.cast { $0 as? String }
- return try match(expected.description).satisfies(actual).toObjectiveC()
- }
- }
-}
-
-#endif
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/MatchError.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/MatchError.swift
deleted file mode 100644
index 4ad71d4..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/MatchError.swift
+++ /dev/null
@@ -1,76 +0,0 @@
-import Foundation
-
-/// A Nimble matcher that succeeds when the actual expression evaluates to an
-/// error from the specified case.
-///
-/// Errors are tried to be compared by their implementation of Equatable,
-/// otherwise they fallback to comparison by _domain and _code.
-public func matchError(_ error: T) -> Predicate {
- return Predicate.define { actualExpression in
- let actualError = try actualExpression.evaluate()
-
- let failureMessage = FailureMessage()
- setFailureMessageForError(
- failureMessage,
- postfixMessageVerb: "match",
- actualError: actualError,
- error: error
- )
-
- var matches = false
- if let actualError = actualError, errorMatchesExpectedError(actualError, expectedError: error) {
- matches = true
- }
-
- return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage())
- }
-}
-
-/// A Nimble matcher that succeeds when the actual expression evaluates to an
-/// error from the specified case.
-///
-/// Errors are tried to be compared by their implementation of Equatable,
-/// otherwise they fallback to comparision by _domain and _code.
-public func matchError(_ error: T) -> Predicate {
- return Predicate.define { actualExpression in
- let actualError = try actualExpression.evaluate()
-
- let failureMessage = FailureMessage()
- setFailureMessageForError(
- failureMessage,
- postfixMessageVerb: "match",
- actualError: actualError,
- error: error
- )
-
- var matches = false
- if let actualError = actualError as? T, error == actualError {
- matches = true
- }
-
- return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage())
- }
-}
-
-/// A Nimble matcher that succeeds when the actual expression evaluates to an
-/// error of the specified type
-public func matchError(_ errorType: T.Type) -> Predicate {
- return Predicate.define { actualExpression in
- let actualError = try actualExpression.evaluate()
-
- let failureMessage = FailureMessage()
- setFailureMessageForError(
- failureMessage,
- postfixMessageVerb: "match",
- actualError: actualError,
- errorType: errorType
- )
-
- var matches = false
- if actualError as? T != nil {
- matches = true
- }
-
- return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage())
- }
-}
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/MatcherFunc.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/MatcherFunc.swift
deleted file mode 100644
index abcafa9..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/MatcherFunc.swift
+++ /dev/null
@@ -1,85 +0,0 @@
-/// DEPRECATED: A convenience API to build matchers that don't need special negation
-/// behavior. The toNot() behavior is the negation of to().
-///
-/// @see NonNilMatcherFunc if you prefer to have this matcher fail when nil
-/// values are received in an expectation.
-///
-/// You may use this when implementing your own custom matchers.
-///
-/// Use the Matcher protocol instead of this type to accept custom matchers as
-/// input parameters.
-/// @see allPass for an example that uses accepts other matchers as input.
-@available(*, deprecated, message: "Use to Predicate instead")
-public struct MatcherFunc: Matcher {
- public let matcher: (Expression, FailureMessage) throws -> Bool
-
- public init(_ matcher: @escaping (Expression, FailureMessage) throws -> Bool) {
- self.matcher = matcher
- }
-
- public func matches(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool {
- return try matcher(actualExpression, failureMessage)
- }
-
- public func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool {
- return try !matcher(actualExpression, failureMessage)
- }
-
- /// Compatibility layer to new Matcher API. Converts an old-style matcher to a new one.
- /// Note: You should definitely spend the time to convert to the new api as soon as possible
- /// since this struct type is deprecated.
- public var predicate: Predicate {
- return Predicate.fromDeprecatedMatcher(self)
- }
-}
-
-/// DEPRECATED: A convenience API to build matchers that don't need special negation
-/// behavior. The toNot() behavior is the negation of to().
-///
-/// Unlike MatcherFunc, this will always fail if an expectation contains nil.
-/// This applies regardless of using to() or toNot().
-///
-/// You may use this when implementing your own custom matchers.
-///
-/// Use the Matcher protocol instead of this type to accept custom matchers as
-/// input parameters.
-/// @see allPass for an example that uses accepts other matchers as input.
-@available(*, deprecated, message: "Use to Predicate instead")
-public struct NonNilMatcherFunc: Matcher {
- public let matcher: (Expression, FailureMessage) throws -> Bool
-
- public init(_ matcher: @escaping (Expression, FailureMessage) throws -> Bool) {
- self.matcher = matcher
- }
-
- public func matches(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool {
- let pass = try matcher(actualExpression, failureMessage)
- if try attachNilErrorIfNeeded(actualExpression, failureMessage: failureMessage) {
- return false
- }
- return pass
- }
-
- public func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool {
- let pass = try !matcher(actualExpression, failureMessage)
- if try attachNilErrorIfNeeded(actualExpression, failureMessage: failureMessage) {
- return false
- }
- return pass
- }
-
- internal func attachNilErrorIfNeeded(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool {
- if try actualExpression.evaluate() == nil {
- failureMessage.postfixActual = " (use beNil() to match nils)"
- return true
- }
- return false
- }
-
- /// Compatibility layer to new Matcher API. Converts an old-style matcher to a new one.
- /// Note: You should definitely spend the time to convert to the new api as soon as possible
- /// since this struct type is deprecated.
- public var predicate: Predicate {
- return Predicate.fromDeprecatedMatcher(self)
- }
-}
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift
deleted file mode 100644
index 6f8f103..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift
+++ /dev/null
@@ -1,154 +0,0 @@
-import Foundation
-// `CGFloat` is in Foundation (swift-corelibs-foundation) on Linux.
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
- import CoreGraphics
-#endif
-
-/// Implement this protocol to implement a custom matcher for Swift
-@available(*, deprecated, message: "Use Predicate instead")
-public protocol Matcher {
- associatedtype ValueType
- func matches(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool
- func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool
-}
-
-extension Matcher {
- var predicate: Predicate {
- return Predicate.fromDeprecatedMatcher(self)
- }
-
- var toClosure: (Expression, FailureMessage, Bool) throws -> Bool {
- return ({ expr, msg, expectedResult in
- if expectedResult {
- return try self.matches(expr, failureMessage: msg)
- } else {
- return try self.doesNotMatch(expr, failureMessage: msg)
- }
- })
- }
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-/// Objective-C interface to the Swift variant of Matcher.
-@objc public protocol NMBMatcher {
- func matches(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool
- func doesNotMatch(_ actualBlock: @escaping () -> NSObject?, failureMessage: FailureMessage, location: SourceLocation) -> Bool
-}
-#endif
-
-/// Protocol for types that support contain() matcher.
-public protocol NMBContainer {
- func contains(_ anObject: Any) -> Bool
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-// FIXME: NSHashTable can not conform to NMBContainer since swift-DEVELOPMENT-SNAPSHOT-2016-04-25-a
-//extension NSHashTable : NMBContainer {} // Corelibs Foundation does not include this class yet
-#endif
-
-extension NSArray: NMBContainer {}
-extension NSSet: NMBContainer {}
-
-/// Protocol for types that support only beEmpty(), haveCount() matchers
-public protocol NMBCollection {
- var count: Int { get }
-}
-
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-extension NSHashTable: NMBCollection {} // Corelibs Foundation does not include these classes yet
-extension NSMapTable: NMBCollection {}
-#endif
-
-extension NSSet: NMBCollection {}
-extension NSIndexSet: NMBCollection {}
-extension NSDictionary: NMBCollection {}
-
-/// Protocol for types that support beginWith(), endWith(), beEmpty() matchers
-public protocol NMBOrderedCollection: NMBCollection {
- func object(at index: Int) -> Any
-}
-
-extension NSArray: NMBOrderedCollection {}
-
-public protocol NMBDoubleConvertible {
- var doubleValue: CDouble { get }
-}
-
-extension Double: NMBDoubleConvertible {
- public var doubleValue: CDouble {
- return self
- }
-}
-
-extension Float: NMBDoubleConvertible {
- public var doubleValue: CDouble {
- return CDouble(self)
- }
-}
-
-extension CGFloat: NMBDoubleConvertible {
- public var doubleValue: CDouble {
- return CDouble(self)
- }
-}
-
-extension NSNumber: NMBDoubleConvertible {
-}
-
-private let dateFormatter: DateFormatter = {
- let formatter = DateFormatter()
- formatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSSS"
- formatter.locale = Locale(identifier: "en_US_POSIX")
-
- return formatter
-}()
-
-extension Date: NMBDoubleConvertible {
- public var doubleValue: CDouble {
- return self.timeIntervalSinceReferenceDate
- }
-}
-
-extension NSDate: NMBDoubleConvertible {
- public var doubleValue: CDouble {
- return self.timeIntervalSinceReferenceDate
- }
-}
-
-extension Date: TestOutputStringConvertible {
- public var testDescription: String {
- return dateFormatter.string(from: self)
- }
-}
-
-extension NSDate: TestOutputStringConvertible {
- public var testDescription: String {
- return dateFormatter.string(from: Date(timeIntervalSinceReferenceDate: self.timeIntervalSinceReferenceDate))
- }
-}
-
-/// Protocol for types to support beLessThan(), beLessThanOrEqualTo(),
-/// beGreaterThan(), beGreaterThanOrEqualTo(), and equal() matchers.
-///
-/// Types that conform to Swift's Comparable protocol will work implicitly too
-#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
-@objc public protocol NMBComparable {
- func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult
-}
-#else
-// This should become obsolete once Corelibs Foundation adds Comparable conformance to NSNumber
-public protocol NMBComparable {
- func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult
-}
-#endif
-
-extension NSNumber: NMBComparable {
- public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult {
- return compare(otherObject as! NSNumber)
- }
-}
-extension NSString: NMBComparable {
- public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult {
- return compare(otherObject as! String)
- }
-}
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/PostNotification.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/PostNotification.swift
deleted file mode 100644
index 16af011..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/PostNotification.swift
+++ /dev/null
@@ -1,98 +0,0 @@
-import Foundation
-
-// A workaround to SR-6419.
-extension NotificationCenter {
-#if !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS))
- #if swift(>=4.0)
- #if swift(>=4.0.2)
- #else
- func addObserver(forName name: Notification.Name?, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Void) -> NSObjectProtocol {
- return addObserver(forName: name, object: obj, queue: queue, usingBlock: block)
- }
- #endif
- #elseif swift(>=3.2)
- #if swift(>=3.2.2)
- #else
- // swiftlint:disable:next line_length
- func addObserver(forName name: Notification.Name?, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Void) -> NSObjectProtocol {
- return addObserver(forName: name, object: obj, queue: queue, usingBlock: block)
- }
- #endif
- #else
- // swiftlint:disable:next line_length
- func addObserver(forName name: Notification.Name?, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Void) -> NSObjectProtocol {
- return addObserver(forName: name, object: obj, queue: queue, usingBlock: block)
- }
- #endif
-#endif
-}
-
-internal class NotificationCollector {
- private(set) var observedNotifications: [Notification]
- private let notificationCenter: NotificationCenter
- #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
- private var token: AnyObject?
- #else
- private var token: NSObjectProtocol?
- #endif
-
- required init(notificationCenter: NotificationCenter) {
- self.notificationCenter = notificationCenter
- self.observedNotifications = []
- }
-
- func startObserving() {
- // swiftlint:disable:next line_length
- self.token = self.notificationCenter.addObserver(forName: nil, object: nil, queue: nil, using: { [weak self] n in
- // linux-swift gets confused by .append(n)
- self?.observedNotifications.append(n)
- })
- }
-
- deinit {
- #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
- if let token = self.token {
- self.notificationCenter.removeObserver(token)
- }
- #else
- if let token = self.token as? AnyObject {
- self.notificationCenter.removeObserver(token)
- }
- #endif
- }
-}
-
-private let mainThread = pthread_self()
-
-public func postNotifications(
- _ notificationsMatcher: T,
- fromNotificationCenter center: NotificationCenter = .default)
- -> Predicate
- where T: Matcher, T.ValueType == [Notification]
-{
- _ = mainThread // Force lazy-loading of this value
- let collector = NotificationCollector(notificationCenter: center)
- collector.startObserving()
- var once: Bool = false
-
- return Predicate { actualExpression in
- let collectorNotificationsExpression = Expression(memoizedExpression: { _ in
- return collector.observedNotifications
- }, location: actualExpression.location, withoutCaching: true)
-
- assert(pthread_equal(mainThread, pthread_self()) != 0, "Only expecting closure to be evaluated on main thread.")
- if !once {
- once = true
- _ = try actualExpression.evaluate()
- }
-
- let failureMessage = FailureMessage()
- let match = try notificationsMatcher.matches(collectorNotificationsExpression, failureMessage: failureMessage)
- if collector.observedNotifications.isEmpty {
- failureMessage.actualValue = "no notifications"
- } else {
- failureMessage.actualValue = "<\(stringify(collector.observedNotifications))>"
- }
- return PredicateResult(bool: match, message: failureMessage.toExpectationMessage())
- }
-}
diff --git a/Demo/Pods/Nimble/Sources/Nimble/Matchers/Predicate.swift b/Demo/Pods/Nimble/Sources/Nimble/Matchers/Predicate.swift
deleted file mode 100644
index 19fd322..0000000
--- a/Demo/Pods/Nimble/Sources/Nimble/Matchers/Predicate.swift
+++ /dev/null
@@ -1,352 +0,0 @@
-// New Matcher API
-//
-import Foundation
-
-/// A Predicate is part of the new matcher API that provides assertions to expectations.
-///
-/// Given a code snippet:
-///
-/// expect(1).to(equal(2))
-/// ^^^^^^^^
-/// Called a "matcher"
-///
-/// A matcher consists of two parts a constructor function and the Predicate. The term Predicate
-/// is used as a separate name from Matcher to help transition custom matchers to the new Nimble
-/// matcher API.
-///
-/// The Predicate provide the heavy lifting on how to assert against a given value. Internally,
-/// predicates are simple wrappers around closures to provide static type information and
-/// allow composition and wrapping of existing behaviors.
-public struct Predicate {
- fileprivate var matcher: (Expression) throws -> PredicateResult
-
- /// Constructs a predicate that knows how take a given value
- public init(_ matcher: @escaping (Expression) throws -> PredicateResult) {
- self.matcher = matcher
- }
-
- /// Uses a predicate on a given value to see if it passes the predicate.
- ///
- /// @param expression The value to run the predicate's logic against
- /// @returns A predicate result indicate passing or failing and an associated error message.
- public func satisfies(_ expression: Expression) throws -> PredicateResult {
- return try matcher(expression)
- }
-}
-
-/// Provides convenience helpers to defining predicates
-extension Predicate {
- /// Like Predicate() constructor, but automatically guard against nil (actual) values
- public static func define(matcher: @escaping (Expression) throws -> PredicateResult) -> Predicate {
- return Predicate { actual in
- return try matcher(actual)
- }.requireNonNil
- }
-
- /// Defines a predicate with a default message that can be returned in the closure
- /// Also ensures the predicate's actual value cannot pass with `nil` given.
- public static func define(_ msg: String, matcher: @escaping (Expression, ExpectationMessage) throws -> PredicateResult) -> Predicate {
- return Predicate { actual in
- return try matcher(actual, .expectedActualValueTo(msg))
- }.requireNonNil
- }
-
- /// Defines a predicate with a default message that can be returned in the closure
- /// Unlike `define`, this allows nil values to succeed if the given closure chooses to.
- public static func defineNilable(_ msg: String, matcher: @escaping (Expression, ExpectationMessage) throws -> PredicateResult) -> Predicate {
- return Predicate { actual in
- return try matcher(actual, .expectedActualValueTo(msg))
- }
- }
-}
-
-extension Predicate {
- /// Provides a simple predicate definition that provides no control over the predefined
- /// error message.
- ///
- /// Also ensures the predicate's actual value cannot pass with `nil` given.
- public static func simple(_ msg: String, matcher: @escaping (Expression) throws -> PredicateStatus) -> Predicate {
- return Predicate { actual in
- return PredicateResult(status: try matcher(actual), message: .expectedActualValueTo(msg))
- }.requireNonNil
- }
-
- /// Provides a simple predicate definition that provides no control over the predefined
- /// error message.
- ///
- /// Unlike `simple`, this allows nil values to succeed if the given closure chooses to.
- public static func simpleNilable(_ msg: String, matcher: @escaping (Expression