From 869aa3923ac6dd2e0f4f7a5b352b7f505fb988dc Mon Sep 17 00:00:00 2001 From: jordhan leoture Date: Mon, 7 Oct 2019 13:20:13 +0200 Subject: [PATCH 1/4] add predicates .isTrue and .isFalse --- MockSwift.xcodeproj/project.pbxproj | 8 +++ .../MockSwiftExampleTests/BasicTests.swift | 4 +- .../MockSwift/Predicates/Predicate+Bool.swift | 35 +++++++++++ .../Predicates/PredicateBoolTests.swift | 61 +++++++++++++++++++ Tests/MockSwiftTests/XCTestManifests.swift | 15 +++++ scripts/all-tests.sh | 1 + 6 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 Sources/MockSwift/Predicates/Predicate+Bool.swift create mode 100644 Tests/MockSwiftTests/Predicates/PredicateBoolTests.swift diff --git a/MockSwift.xcodeproj/project.pbxproj b/MockSwift.xcodeproj/project.pbxproj index 0be6b42..7ca2f13 100644 --- a/MockSwift.xcodeproj/project.pbxproj +++ b/MockSwift.xcodeproj/project.pbxproj @@ -46,6 +46,8 @@ 9EA5D1612302FCB7006F0A28 /* FunctionCallRegister.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EA5D1602302FCB7006F0A28 /* FunctionCallRegister.swift */; }; 9EA5D1632303F130006F0A28 /* Predicate+Comparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EA5D1622303F130006F0A28 /* Predicate+Comparable.swift */; }; 9EAC378D234378DD00281F7B /* ParameterType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EAC378C234378DD00281F7B /* ParameterType.swift */; }; + 9EAC3791234A25B000281F7B /* Predicate+Bool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EAC3790234A25B000281F7B /* Predicate+Bool.swift */; }; + 9EAC3792234A25B800281F7B /* PredicateBoolTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EAC378E234A248D00281F7B /* PredicateBoolTests.swift */; }; 9EB5542422FDDDEB00449662 /* MockDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EB5542322FDDDEB00449662 /* MockDefaults.swift */; }; 9EB5542622FDDF2C00449662 /* MockDefaultExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EB5542522FDDF2C00449662 /* MockDefaultExtensionTests.swift */; }; 9EB5542B22FDE44300449662 /* MockDefaultIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EB5542A22FDE44300449662 /* MockDefaultIntegrationTests.swift */; }; @@ -114,6 +116,8 @@ 9EA77EF4230EE7C900DAE694 /* CONTRIBUTING.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CONTRIBUTING.md; sourceTree = ""; }; 9EA77EF5230EE7C900DAE694 /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = ""; }; 9EAC378C234378DD00281F7B /* ParameterType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParameterType.swift; sourceTree = ""; }; + 9EAC378E234A248D00281F7B /* PredicateBoolTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PredicateBoolTests.swift; sourceTree = ""; }; + 9EAC3790234A25B000281F7B /* Predicate+Bool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Predicate+Bool.swift"; sourceTree = ""; }; 9EB5542322FDDDEB00449662 /* MockDefaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockDefaults.swift; sourceTree = ""; }; 9EB5542522FDDF2C00449662 /* MockDefaultExtensionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockDefaultExtensionTests.swift; sourceTree = ""; }; 9EB5542A22FDE44300449662 /* MockDefaultIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockDefaultIntegrationTests.swift; sourceTree = ""; }; @@ -251,6 +255,7 @@ 9EA5D1522301DABB006F0A28 /* PredicateTests.swift */, 9EA5D1562301DE6F006F0A28 /* AnyPredicateEquatableTests.swift */, 9E0071592304007700F040F4 /* PredicateComparableTests.swift */, + 9EAC378E234A248D00281F7B /* PredicateBoolTests.swift */, ); path = Predicates; sourceTree = ""; @@ -262,6 +267,7 @@ 9EA5D14F2301DA6E006F0A28 /* Predicate.swift */, 9EA5D1542301DE3F006F0A28 /* AnyPredicate+Equatable.swift */, 9EA5D1622303F130006F0A28 /* Predicate+Comparable.swift */, + 9EAC3790234A25B000281F7B /* Predicate+Bool.swift */, ); path = Predicates; sourceTree = ""; @@ -505,6 +511,7 @@ 9EA5D15D2302EE7B006F0A28 /* Verifiable.swift in Sources */, 9EB5542422FDDDEB00449662 /* MockDefaults.swift in Sources */, 9E2F052422FB32B200E04F34 /* Behaviour.swift in Sources */, + 9EAC3791234A25B000281F7B /* Predicate+Bool.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -525,6 +532,7 @@ 9E00715F230406B300F040F4 /* FunctionCallRegisterTests.swift in Sources */, OBJ_59 /* MockTests.swift in Sources */, 9EB5542622FDDF2C00449662 /* MockDefaultExtensionTests.swift in Sources */, + 9EAC3792234A25B800281F7B /* PredicateBoolTests.swift in Sources */, 9EA5D1592301E43B006F0A28 /* MockGivenIntegrationTests.swift in Sources */, 9EA5D1532301DABB006F0A28 /* PredicateTests.swift in Sources */, 9EB5542B22FDE44300449662 /* MockDefaultIntegrationTests.swift in Sources */, diff --git a/MockSwiftExample/MockSwiftExampleTests/BasicTests.swift b/MockSwiftExample/MockSwiftExampleTests/BasicTests.swift index c1ecd2d..75be7da 100644 --- a/MockSwiftExample/MockSwiftExampleTests/BasicTests.swift +++ b/MockSwiftExample/MockSwiftExampleTests/BasicTests.swift @@ -40,7 +40,7 @@ class MockSwiftExampleTests: XCTestCase { $0.doSomething(arg: .any).willReturn("2") $0.doSomething(arg1: =="3", arg2: ==nil).willReturn("3") $0.doSomething(with: =="4").willReturn("4") - $0.doSomething(with: =="5", and: ==true).willReturn("5") + $0.doSomething(with: =="5", and: .isTrue).willReturn("5") } // When @@ -67,7 +67,7 @@ class MockSwiftExampleTests: XCTestCase { $0.doSomething(arg: =="2").called(times: 1) $0.doSomething(arg1: =="3", arg2: ==nil).called(times: 1) $0.doSomething(with: =="4").called(times: 1) - $0.doSomething(with: =="5", and: ==true).called(times: 1) + $0.doSomething(with: =="5", and: .isTrue).called(times: 1) } } diff --git a/Sources/MockSwift/Predicates/Predicate+Bool.swift b/Sources/MockSwift/Predicates/Predicate+Bool.swift new file mode 100644 index 0000000..1bb30dc --- /dev/null +++ b/Sources/MockSwift/Predicates/Predicate+Bool.swift @@ -0,0 +1,35 @@ +//Predicate+Bool.swift +/* + MIT License + + Copyright (c) 2019 Jordhan Leoture + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + */ + +import Foundation + +public extension Predicate where Input == Bool { + + /// Creates a `Predicate` that can match any `Bool` equal to `true` + static var isTrue: Predicate { .match(description: "is True") { $0 == true } } + + /// Creates a `Predicate` that can match any `Bool` equal to `false` + static var isFalse: Predicate { .match(description: "is False") { $0 == false } } +} diff --git a/Tests/MockSwiftTests/Predicates/PredicateBoolTests.swift b/Tests/MockSwiftTests/Predicates/PredicateBoolTests.swift new file mode 100644 index 0000000..31ba89f --- /dev/null +++ b/Tests/MockSwiftTests/Predicates/PredicateBoolTests.swift @@ -0,0 +1,61 @@ +//PredicateBoolTests.swift +/* +MIT License + +Copyright (c) 2019 Jordhan Leoture + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +import Foundation +import MockSwift +import XCTest + +class PredicatBoolTests: XCTestCase { + + func test_isTrue_shouldReturnTrue() { + let predicate: Predicate = .isTrue + XCTAssertTrue(predicate.satisfy(by: true)) + } + + func test_isTrue_shouldReturnFalse() { + let predicate: Predicate = .isTrue + XCTAssertFalse(predicate.satisfy(by: false)) + } + + func test_isTrue_description() { + let predicate: Predicate = .isTrue + XCTAssertEqual(predicate.description, "is True") + } + + func test_isFalse_shouldReturnTrue() { + let predicate: Predicate = .isFalse + XCTAssertTrue(predicate.satisfy(by: false)) + } + + func test_isFalse_shouldReturnFalse() { + let predicate: Predicate = .isFalse + XCTAssertFalse(predicate.satisfy(by: true)) + } + + func test_isFalse_description() { + let predicate: Predicate = .isFalse + XCTAssertEqual(predicate.description, "is False") + } +} diff --git a/Tests/MockSwiftTests/XCTestManifests.swift b/Tests/MockSwiftTests/XCTestManifests.swift index 08d36c8..d4f5b3e 100644 --- a/Tests/MockSwiftTests/XCTestManifests.swift +++ b/Tests/MockSwiftTests/XCTestManifests.swift @@ -134,6 +134,20 @@ extension MockableTests { ] } +extension PredicatBoolTests { + // DO NOT MODIFY: This is autogenerated, use: + // `swift test --generate-linuxmain` + // to regenerate. + static let __allTests__PredicatBoolTests = [ + ("test_isFalse_description", test_isFalse_description), + ("test_isFalse_shouldReturnFalse", test_isFalse_shouldReturnFalse), + ("test_isFalse_shouldReturnTrue", test_isFalse_shouldReturnTrue), + ("test_isTrue_description", test_isTrue_description), + ("test_isTrue_shouldReturnFalse", test_isTrue_shouldReturnFalse), + ("test_isTrue_shouldReturnTrue", test_isTrue_shouldReturnTrue), + ] +} + extension PredicateComparableTests { // DO NOT MODIFY: This is autogenerated, use: // `swift test --generate-linuxmain` @@ -205,6 +219,7 @@ public func __allTests() -> [XCTestCaseEntry] { testCase(MockTests.__allTests__MockTests), testCase(MockThenIntegrationTests.__allTests__MockThenIntegrationTests), testCase(MockableTests.__allTests__MockableTests), + testCase(PredicatBoolTests.__allTests__PredicatBoolTests), testCase(PredicateComparableTests.__allTests__PredicateComparableTests), testCase(PredicateTests.__allTests__PredicateTests), testCase(VerifiableTests.__allTests__VerifiableTests), diff --git a/scripts/all-tests.sh b/scripts/all-tests.sh index be989a1..a512bf3 100755 --- a/scripts/all-tests.sh +++ b/scripts/all-tests.sh @@ -3,3 +3,4 @@ swift test --generate-linuxmain swift test docker-compose up +xcodebuild -scheme MockSwiftExample -workspace MockSwift.xcworkspace -destination "name=iPhone 11" test From fa5eb8bd5d0214be217a28401b9e88561afd0166 Mon Sep 17 00:00:00 2001 From: jordhan leoture Date: Mon, 7 Oct 2019 18:41:06 +0200 Subject: [PATCH 2/4] add predicate .not --- .../MockSwiftExampleTests/BasicTests.swift | 2 +- .../Playground.playground/Contents.swift | 4 +- .../MockSwift/Predicates/Predicate+Bool.swift | 4 +- Sources/MockSwift/Predicates/Predicate.swift | 40 ++++++++------ .../Predicates/PredicateBoolTests.swift | 4 +- .../Predicates/PredicateTests.swift | 54 ++++++++++++------- 6 files changed, 67 insertions(+), 41 deletions(-) diff --git a/MockSwiftExample/MockSwiftExampleTests/BasicTests.swift b/MockSwiftExample/MockSwiftExampleTests/BasicTests.swift index 75be7da..ad80225 100644 --- a/MockSwiftExample/MockSwiftExampleTests/BasicTests.swift +++ b/MockSwiftExample/MockSwiftExampleTests/BasicTests.swift @@ -37,7 +37,7 @@ class MockSwiftExampleTests: XCTestCase { $0.doSomething().disambiguate(with: Void.self).will { _ in blockDone = true } $0.doSomething().willReturn(0) $0.doSomething().willReturn(nil) - $0.doSomething(arg: .any).willReturn("2") + $0.doSomething(arg: .any()).willReturn("2") $0.doSomething(arg1: =="3", arg2: ==nil).willReturn("3") $0.doSomething(with: =="4").willReturn("4") $0.doSomething(with: =="5", and: .isTrue).willReturn("5") diff --git a/MockSwiftPlayground/Playground.playground/Contents.swift b/MockSwiftPlayground/Playground.playground/Contents.swift index e60a8eb..76a4c61 100644 --- a/MockSwiftPlayground/Playground.playground/Contents.swift +++ b/MockSwiftPlayground/Playground.playground/Contents.swift @@ -40,7 +40,7 @@ class MyTests: XCTestCase { let expectedUser = User(identifier: "id", name: "John") given(service) - .fetch(identifier: .any) + .fetch(identifier: .any()) .willReturn(expectedUser) // When @@ -48,7 +48,7 @@ class MyTests: XCTestCase { // Then then(service) - .fetch(identifier: .any) + .fetch(identifier: .any()) .disambiguate(with: User.self) .called() XCTAssertEqual(user, expectedUser) diff --git a/Sources/MockSwift/Predicates/Predicate+Bool.swift b/Sources/MockSwift/Predicates/Predicate+Bool.swift index 1bb30dc..a8754fc 100644 --- a/Sources/MockSwift/Predicates/Predicate+Bool.swift +++ b/Sources/MockSwift/Predicates/Predicate+Bool.swift @@ -28,8 +28,8 @@ import Foundation public extension Predicate where Input == Bool { /// Creates a `Predicate` that can match any `Bool` equal to `true` - static var isTrue: Predicate { .match(description: "is True") { $0 == true } } + static var isTrue: Predicate { .match(description: "True") { $0 == true } } /// Creates a `Predicate` that can match any `Bool` equal to `false` - static var isFalse: Predicate { .match(description: "is False") { $0 == false } } + static var isFalse: Predicate { .match(description: "False") { $0 == false } } } diff --git a/Sources/MockSwift/Predicates/Predicate.swift b/Sources/MockSwift/Predicates/Predicate.swift index 0f66f54..cdd045b 100644 --- a/Sources/MockSwift/Predicates/Predicate.swift +++ b/Sources/MockSwift/Predicates/Predicate.swift @@ -28,6 +28,22 @@ import Foundation /// Predicate represents a condition on an `Input`. public class Predicate { + // MARK: - Properties + + /// Description of the Predicate. + public var description: String + + private let predicate: (Input) -> Bool + + // MARK: - Init + + private init(description: String, predicate: @escaping (Input) -> Bool) { + self.description = description + self.predicate = predicate + } + + // MARK: - Public Methods + /// Creates a `Predicate`. /// - Parameter description: The description of the Predicate. /// - Parameter predicate: The block that will be used to verify that the entry statisfies the Predicate. @@ -53,24 +69,18 @@ public class Predicate { } } - /// Predicate matches any value of type `Input`. - public class var any: Predicate { - Self.match(description: "any") { _ in true } + /// Creates a `Predicate` able to match any value of type `Input`. + public class func any() -> Predicate { + .match(description: "any") { _ in true } } - // MARK: - Properties - - /// Description of the Predicate. - public var description: String - - private let predicate: (Input) -> Bool - - // MARK: - Init - - private init(description: String, predicate: @escaping (Input) -> Bool) { - self.description = description - self.predicate = predicate + /// Creates a `Predicate` able to match any value of type `Input` not matched by an other predicate. + /// - Parameter predicate: The predicate to not match. + /// - Returns: A new `Predicate`. + public class func not(_ predicate: Predicate) -> Predicate { + .match(description: "not \(predicate)") { !predicate.satisfy(by: $0) } } + } // MARK: - AnyPredicate diff --git a/Tests/MockSwiftTests/Predicates/PredicateBoolTests.swift b/Tests/MockSwiftTests/Predicates/PredicateBoolTests.swift index 31ba89f..8d45618 100644 --- a/Tests/MockSwiftTests/Predicates/PredicateBoolTests.swift +++ b/Tests/MockSwiftTests/Predicates/PredicateBoolTests.swift @@ -41,7 +41,7 @@ class PredicatBoolTests: XCTestCase { func test_isTrue_description() { let predicate: Predicate = .isTrue - XCTAssertEqual(predicate.description, "is True") + XCTAssertEqual(predicate.description, "True") } func test_isFalse_shouldReturnTrue() { @@ -56,6 +56,6 @@ class PredicatBoolTests: XCTestCase { func test_isFalse_description() { let predicate: Predicate = .isFalse - XCTAssertEqual(predicate.description, "is False") + XCTAssertEqual(predicate.description, "False") } } diff --git a/Tests/MockSwiftTests/Predicates/PredicateTests.swift b/Tests/MockSwiftTests/Predicates/PredicateTests.swift index b911f16..b835f1a 100644 --- a/Tests/MockSwiftTests/Predicates/PredicateTests.swift +++ b/Tests/MockSwiftTests/Predicates/PredicateTests.swift @@ -30,14 +30,14 @@ private class Custom {} class PredicateTests: XCTestCase { - func test_satisfy_withMatchShouldReturnFalseIfInputIsNotTheSameType() { + func test_match_withMatchShouldReturnFalseIfInputIsNotTheSameType() { let predicate: Predicate = .match { _ in true } XCTAssertFalse(predicate.satisfy(by: 1)) } - func test_satisfy_shouldReturnFalseIfInputNotMatched() { + func test_match_shouldReturnFalseIfInputNotMatched() { let predicate: Predicate = .match { value in value.isEmpty } @@ -45,7 +45,7 @@ class PredicateTests: XCTestCase { XCTAssertFalse(predicate.satisfy(by: "not Empty")) } - func test_satisfy_shouldReturnTrueIfInputMatched() { + func test_match_shouldReturnTrueIfInputMatched() { let predicate: Predicate = .match { value in value.isEmpty } @@ -53,7 +53,7 @@ class PredicateTests: XCTestCase { XCTAssertTrue(predicate.satisfy(by: "")) } - func test_satisfy_shouldReturnTrueIfInputMatchedByAnyPredicate() { + func test_match_shouldReturnTrueIfInputMatchedByAnyPredicate() { let anyPredicate: AnyPredicate = Predicate.match { value in value.isEmpty } @@ -62,7 +62,7 @@ class PredicateTests: XCTestCase { XCTAssertTrue(predicate.satisfy(by: "")) } - func test_satisfy_shouldReturnFalseIfInputNotMatchedByAnyPredicate() { + func test_match_shouldReturnFalseIfInputNotMatchedByAnyPredicate() { let anyPredicate: AnyPredicate = Predicate.match { value in value.isEmpty } @@ -71,40 +71,56 @@ class PredicateTests: XCTestCase { XCTAssertFalse(predicate.satisfy(by: "not Empty")) } - func test_satisfy_shouldReturnTrueIfInputMatchedReference() { + func test_match_shouldReturnTrueIfInputSameReference() { let custom = Custom() let predicate: AnyPredicate = Predicate.match(custom) XCTAssertTrue(predicate.satisfy(by: custom)) } - func test_satisfy_shouldReturnFalseIfInputNotMatchedReference() { + func test_match_shouldReturnFalseIfInputNotSameReference() { let custom = Custom() let predicate: AnyPredicate = Predicate.match(custom) XCTAssertFalse(predicate.satisfy(by: Custom())) } - func test_satisfy_withAnyshouldReturnFalseIfInputIsNotTheSameType() { - let predicate: Predicate = .any + func test_match_description() { + let predicate: Predicate = .match(description: "description") { _ in + true + } + XCTAssertEqual("\(predicate)", "description") + } + + func test_any_shouldReturnFalse() { + let predicate: Predicate = .any() XCTAssertFalse(predicate.satisfy(by: 1)) } - func test_satisfy_shouldReturnTrue() { - let predicate: Predicate = .any + func test_any_shouldReturnTrue() { + let predicate: Predicate = .any() XCTAssertTrue(predicate.satisfy(by: "")) } - func test_description_withMatch() { - let predicate: Predicate = .match(description: "description") { _ in - true - } - XCTAssertEqual("\(predicate)", "description") + func test_any_description() { + let predicate: Predicate = .any() + + XCTAssertEqual("\(predicate)", "any") } - func test_description_withAny() { - let predicate: Predicate = .any + func test_not_shouldReturnFalse() { + let predicate: Predicate = .not(.match { _ in true }) + XCTAssertFalse(predicate.satisfy(by: "")) + } - XCTAssertEqual("\(predicate)", "any") + func test_not_shouldReturnTrue() { + let predicate: Predicate = .not(.match { _ in false }) + XCTAssertTrue(predicate.satisfy(by: "")) + } + + func test_not_description() { + let predicate: Predicate = .not(.match(description: "description") { _ in true }) + + XCTAssertEqual("\(predicate)", "not description") } } From 50fb820bd87d6a2a415ad8e7e444383e707bd15b Mon Sep 17 00:00:00 2001 From: jordhan leoture Date: Mon, 7 Oct 2019 19:33:37 +0200 Subject: [PATCH 3/4] ass predicate .isNil() --- CHANGELOG.md | 5 ++ Gemfile.lock | 16 +++---- MockSwift.xcodeproj/project.pbxproj | 8 ++++ .../MockSwiftExampleTests/BasicTests.swift | 8 ++-- .../MockSwift/Predicates/Predicate+Bool.swift | 12 ++--- .../Predicates/Predicate+Optional.swift | 34 ++++++++++++++ Sources/MockSwift/Predicates/Predicate.swift | 14 +++--- .../Predicates/PredicateBoolTests.swift | 12 ++--- .../Predicates/PredicateOptionalTests.swift | 46 +++++++++++++++++++ Tests/MockSwiftTests/XCTestManifests.swift | 37 ++++++++++----- 10 files changed, 150 insertions(+), 42 deletions(-) create mode 100644 Sources/MockSwift/Predicates/Predicate+Optional.swift create mode 100644 Tests/MockSwiftTests/Predicates/PredicateOptionalTests.swift diff --git a/CHANGELOG.md b/CHANGELOG.md index c600776..94db1db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,8 +10,13 @@ ## Unrelease [Compare](https://github.com/leoture/MockSwift/compare/v0.2.0...HEAD) #### Added +- Add Predicates with Comparables [#28](https://github.com/leoture/MockSwift/pull/28) +- Add Predicates .isTrue() & .isFalse() +- Add Predicate .not() +- Add Predicate .isNil() #### Changed +- mocked() with optionals [#32](https://github.com/leoture/MockSwift/pull/32) #### Deprecated diff --git a/Gemfile.lock b/Gemfile.lock index cd873b8..1b20aae 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,15 +7,15 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - algoliasearch (1.27.0) + algoliasearch (1.27.1) httpclient (~> 2.8, >= 2.8.3) json (>= 1.5.1) atomos (0.1.3) claide (1.0.3) - cocoapods (1.8.0) + cocoapods (1.8.3) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.8.0) + cocoapods-core (= 1.8.3) cocoapods-deintegrate (>= 1.0.3, < 2.0) cocoapods-downloader (>= 1.2.2, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) @@ -31,10 +31,10 @@ GEM nap (~> 1.0) ruby-macho (~> 1.4) xcodeproj (>= 1.11.1, < 2.0) - cocoapods-core (1.8.0) + cocoapods-core (1.8.3) activesupport (>= 4.0.2, < 6) algoliasearch (~> 1.0) - concurrent-ruby (~> 1.0) + concurrent-ruby (~> 1.1) fuzzy_match (~> 2.0.4) nap (~> 1.0) cocoapods-deintegrate (1.0.4) @@ -43,7 +43,7 @@ GEM nap cocoapods-search (1.0.0) cocoapods-stats (1.1.0) - cocoapods-trunk (1.4.0) + cocoapods-trunk (1.4.1) nap (>= 0.8, < 2.0) netrc (~> 0.11) cocoapods-try (1.1.0) @@ -68,7 +68,7 @@ GEM xcinvoke (~> 0.3.0) json (2.2.0) liferaft (0.0.6) - minitest (5.12.0) + minitest (5.12.2) molinillo (0.6.6) mustache (1.1.0) nanaimo (0.2.6) @@ -76,7 +76,7 @@ GEM netrc (0.11.0) open4 (1.3.4) redcarpet (3.5.0) - rouge (3.11.0) + rouge (3.11.1) ruby-macho (1.4.0) sassc (2.2.1) ffi (~> 1.9) diff --git a/MockSwift.xcodeproj/project.pbxproj b/MockSwift.xcodeproj/project.pbxproj index 7ca2f13..764344d 100644 --- a/MockSwift.xcodeproj/project.pbxproj +++ b/MockSwift.xcodeproj/project.pbxproj @@ -48,6 +48,8 @@ 9EAC378D234378DD00281F7B /* ParameterType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EAC378C234378DD00281F7B /* ParameterType.swift */; }; 9EAC3791234A25B000281F7B /* Predicate+Bool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EAC3790234A25B000281F7B /* Predicate+Bool.swift */; }; 9EAC3792234A25B800281F7B /* PredicateBoolTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EAC378E234A248D00281F7B /* PredicateBoolTests.swift */; }; + 9EAC3794234BA23F00281F7B /* Predicate+Optional.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EAC3793234BA23F00281F7B /* Predicate+Optional.swift */; }; + 9EAC3796234BA25A00281F7B /* PredicateOptionalTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EAC3795234BA25A00281F7B /* PredicateOptionalTests.swift */; }; 9EB5542422FDDDEB00449662 /* MockDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EB5542322FDDDEB00449662 /* MockDefaults.swift */; }; 9EB5542622FDDF2C00449662 /* MockDefaultExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EB5542522FDDF2C00449662 /* MockDefaultExtensionTests.swift */; }; 9EB5542B22FDE44300449662 /* MockDefaultIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EB5542A22FDE44300449662 /* MockDefaultIntegrationTests.swift */; }; @@ -118,6 +120,8 @@ 9EAC378C234378DD00281F7B /* ParameterType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParameterType.swift; sourceTree = ""; }; 9EAC378E234A248D00281F7B /* PredicateBoolTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PredicateBoolTests.swift; sourceTree = ""; }; 9EAC3790234A25B000281F7B /* Predicate+Bool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Predicate+Bool.swift"; sourceTree = ""; }; + 9EAC3793234BA23F00281F7B /* Predicate+Optional.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Predicate+Optional.swift"; sourceTree = ""; }; + 9EAC3795234BA25A00281F7B /* PredicateOptionalTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PredicateOptionalTests.swift; sourceTree = ""; }; 9EB5542322FDDDEB00449662 /* MockDefaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockDefaults.swift; sourceTree = ""; }; 9EB5542522FDDF2C00449662 /* MockDefaultExtensionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockDefaultExtensionTests.swift; sourceTree = ""; }; 9EB5542A22FDE44300449662 /* MockDefaultIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockDefaultIntegrationTests.swift; sourceTree = ""; }; @@ -256,6 +260,7 @@ 9EA5D1562301DE6F006F0A28 /* AnyPredicateEquatableTests.swift */, 9E0071592304007700F040F4 /* PredicateComparableTests.swift */, 9EAC378E234A248D00281F7B /* PredicateBoolTests.swift */, + 9EAC3795234BA25A00281F7B /* PredicateOptionalTests.swift */, ); path = Predicates; sourceTree = ""; @@ -268,6 +273,7 @@ 9EA5D1542301DE3F006F0A28 /* AnyPredicate+Equatable.swift */, 9EA5D1622303F130006F0A28 /* Predicate+Comparable.swift */, 9EAC3790234A25B000281F7B /* Predicate+Bool.swift */, + 9EAC3793234BA23F00281F7B /* Predicate+Optional.swift */, ); path = Predicates; sourceTree = ""; @@ -510,6 +516,7 @@ OBJ_41 /* Mock.swift in Sources */, 9EA5D15D2302EE7B006F0A28 /* Verifiable.swift in Sources */, 9EB5542422FDDDEB00449662 /* MockDefaults.swift in Sources */, + 9EAC3794234BA23F00281F7B /* Predicate+Optional.swift in Sources */, 9E2F052422FB32B200E04F34 /* Behaviour.swift in Sources */, 9EAC3791234A25B000281F7B /* Predicate+Bool.swift in Sources */, ); @@ -541,6 +548,7 @@ 9E2F052822FB357F00E04F34 /* DefaultFunctionBehaviourTests.swift in Sources */, 9E2F051D22FAF1B900E04F34 /* FunctionBehaviourRegisterTests.swift in Sources */, 9E2F052022FAF54E00E04F34 /* FunctionIdentifierStub.swift in Sources */, + 9EAC3796234BA25A00281F7B /* PredicateOptionalTests.swift in Sources */, 9EA5D1572301DE6F006F0A28 /* AnyPredicateEquatableTests.swift in Sources */, OBJ_60 /* BehaviourRegisterMock.swift in Sources */, 9E2F052622FB354C00E04F34 /* FunctionBehaviourTests.swift in Sources */, diff --git a/MockSwiftExample/MockSwiftExampleTests/BasicTests.swift b/MockSwiftExample/MockSwiftExampleTests/BasicTests.swift index ad80225..47ac799 100644 --- a/MockSwiftExample/MockSwiftExampleTests/BasicTests.swift +++ b/MockSwiftExample/MockSwiftExampleTests/BasicTests.swift @@ -38,9 +38,9 @@ class MockSwiftExampleTests: XCTestCase { $0.doSomething().willReturn(0) $0.doSomething().willReturn(nil) $0.doSomething(arg: .any()).willReturn("2") - $0.doSomething(arg1: =="3", arg2: ==nil).willReturn("3") + $0.doSomething(arg1: =="3", arg2: .isNil()).willReturn("3") $0.doSomething(with: =="4").willReturn("4") - $0.doSomething(with: =="5", and: .isTrue).willReturn("5") + $0.doSomething(with: =="5", and: .isTrue()).willReturn("5") } // When @@ -65,9 +65,9 @@ class MockSwiftExampleTests: XCTestCase { $0.doSomething().disambiguate(with: Int.self).called(times: 1) $0.doSomething().disambiguate(with: String?.self).called(times: 1) $0.doSomething(arg: =="2").called(times: 1) - $0.doSomething(arg1: =="3", arg2: ==nil).called(times: 1) + $0.doSomething(arg1: =="3", arg2: .isNil()).called(times: 1) $0.doSomething(with: =="4").called(times: 1) - $0.doSomething(with: =="5", and: .isTrue).called(times: 1) + $0.doSomething(with: =="5", and: .isTrue()).called(times: 1) } } diff --git a/Sources/MockSwift/Predicates/Predicate+Bool.swift b/Sources/MockSwift/Predicates/Predicate+Bool.swift index a8754fc..06ab3ee 100644 --- a/Sources/MockSwift/Predicates/Predicate+Bool.swift +++ b/Sources/MockSwift/Predicates/Predicate+Bool.swift @@ -1,19 +1,19 @@ //Predicate+Bool.swift /* MIT License - + Copyright (c) 2019 Jordhan Leoture - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -28,8 +28,8 @@ import Foundation public extension Predicate where Input == Bool { /// Creates a `Predicate` that can match any `Bool` equal to `true` - static var isTrue: Predicate { .match(description: "True") { $0 == true } } + static func isTrue() -> Predicate { .match(description: "True") { $0 == true } } /// Creates a `Predicate` that can match any `Bool` equal to `false` - static var isFalse: Predicate { .match(description: "False") { $0 == false } } + static func isFalse() -> Predicate { .match(description: "False") { $0 == false } } } diff --git a/Sources/MockSwift/Predicates/Predicate+Optional.swift b/Sources/MockSwift/Predicates/Predicate+Optional.swift new file mode 100644 index 0000000..ab24915 --- /dev/null +++ b/Sources/MockSwift/Predicates/Predicate+Optional.swift @@ -0,0 +1,34 @@ +//Predicate+Optional.swift +/* + MIT License + + Copyright (c) 2019 Jordhan Leoture + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + */ + +import Foundation + +public extension Predicate { + + /// Creates a `Predicate` able to match `nil`. + static func isNil() -> Predicate { + .match(description: "nil") { $0 == nil } + } +} diff --git a/Sources/MockSwift/Predicates/Predicate.swift b/Sources/MockSwift/Predicates/Predicate.swift index cdd045b..772baad 100644 --- a/Sources/MockSwift/Predicates/Predicate.swift +++ b/Sources/MockSwift/Predicates/Predicate.swift @@ -48,8 +48,8 @@ public class Predicate { /// - Parameter description: The description of the Predicate. /// - Parameter predicate: The block that will be used to verify that the entry statisfies the Predicate. /// - Returns: A new `Predicate`. - public class func match(description: String = "custom matcher", - _ predicate: @escaping (Input) -> Bool) -> Predicate { + public static func match(description: String = "custom matcher", + _ predicate: @escaping (Input) -> Bool) -> Predicate { Predicate(description: description, predicate: predicate) } @@ -59,9 +59,9 @@ public class Predicate { /// - Parameter line: The line where the method is called. /// - Returns: A `AnyPredicate` able to match `value`. /// - Important: If value cannot be cast to `AnyPredicate` or to `AnyObject` a `fatalError` will be raised. - public class func match(_ value: Input, - file: StaticString = #file, - line: UInt = #line) -> AnyPredicate { + public static func match(_ value: Input, + file: StaticString = #file, + line: UInt = #line) -> AnyPredicate { switch value { case let value as AnyPredicate: return value case let value as AnyObject: return Predicate.match(description: "\(value)") { $0 === value } @@ -70,14 +70,14 @@ public class Predicate { } /// Creates a `Predicate` able to match any value of type `Input`. - public class func any() -> Predicate { + public static func any() -> Predicate { .match(description: "any") { _ in true } } /// Creates a `Predicate` able to match any value of type `Input` not matched by an other predicate. /// - Parameter predicate: The predicate to not match. /// - Returns: A new `Predicate`. - public class func not(_ predicate: Predicate) -> Predicate { + public static func not(_ predicate: Predicate) -> Predicate { .match(description: "not \(predicate)") { !predicate.satisfy(by: $0) } } diff --git a/Tests/MockSwiftTests/Predicates/PredicateBoolTests.swift b/Tests/MockSwiftTests/Predicates/PredicateBoolTests.swift index 8d45618..51a600f 100644 --- a/Tests/MockSwiftTests/Predicates/PredicateBoolTests.swift +++ b/Tests/MockSwiftTests/Predicates/PredicateBoolTests.swift @@ -30,32 +30,32 @@ import XCTest class PredicatBoolTests: XCTestCase { func test_isTrue_shouldReturnTrue() { - let predicate: Predicate = .isTrue + let predicate: Predicate = .isTrue() XCTAssertTrue(predicate.satisfy(by: true)) } func test_isTrue_shouldReturnFalse() { - let predicate: Predicate = .isTrue + let predicate: Predicate = .isTrue() XCTAssertFalse(predicate.satisfy(by: false)) } func test_isTrue_description() { - let predicate: Predicate = .isTrue + let predicate: Predicate = .isTrue() XCTAssertEqual(predicate.description, "True") } func test_isFalse_shouldReturnTrue() { - let predicate: Predicate = .isFalse + let predicate: Predicate = .isFalse() XCTAssertTrue(predicate.satisfy(by: false)) } func test_isFalse_shouldReturnFalse() { - let predicate: Predicate = .isFalse + let predicate: Predicate = .isFalse() XCTAssertFalse(predicate.satisfy(by: true)) } func test_isFalse_description() { - let predicate: Predicate = .isFalse + let predicate: Predicate = .isFalse() XCTAssertEqual(predicate.description, "False") } } diff --git a/Tests/MockSwiftTests/Predicates/PredicateOptionalTests.swift b/Tests/MockSwiftTests/Predicates/PredicateOptionalTests.swift new file mode 100644 index 0000000..e8f6e7f --- /dev/null +++ b/Tests/MockSwiftTests/Predicates/PredicateOptionalTests.swift @@ -0,0 +1,46 @@ +//PredicateOptionalTests.swift +/* +MIT License + +Copyright (c) 2019 Jordhan Leoture + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +import Foundation +import MockSwift +import XCTest + +class PredicateOptionalTests: XCTestCase { + + func test_isNil_shouldReturnTrue() { + let predicate: Predicate = .isNil() + XCTAssertTrue(predicate.satisfy(by: nil)) + } + + func test_isNil_shouldReturnFalse() { + let predicate: Predicate = .isNil() + XCTAssertFalse(predicate.satisfy(by: 0)) + } + + func test_isNil_description() { + let predicate: Predicate = .isNil() + XCTAssertEqual(predicate.description, "nil") + } +} diff --git a/Tests/MockSwiftTests/XCTestManifests.swift b/Tests/MockSwiftTests/XCTestManifests.swift index d4f5b3e..c8d89b3 100644 --- a/Tests/MockSwiftTests/XCTestManifests.swift +++ b/Tests/MockSwiftTests/XCTestManifests.swift @@ -171,22 +171,36 @@ extension PredicateComparableTests { ] } +extension PredicateOptionalTests { + // DO NOT MODIFY: This is autogenerated, use: + // `swift test --generate-linuxmain` + // to regenerate. + static let __allTests__PredicateOptionalTests = [ + ("test_isNil_description", test_isNil_description), + ("test_isNil_shouldReturnFalse", test_isNil_shouldReturnFalse), + ("test_isNil_shouldReturnTrue", test_isNil_shouldReturnTrue), + ] +} + extension PredicateTests { // DO NOT MODIFY: This is autogenerated, use: // `swift test --generate-linuxmain` // to regenerate. static let __allTests__PredicateTests = [ - ("test_description_withAny", test_description_withAny), - ("test_description_withMatch", test_description_withMatch), - ("test_satisfy_shouldReturnFalseIfInputNotMatched", test_satisfy_shouldReturnFalseIfInputNotMatched), - ("test_satisfy_shouldReturnFalseIfInputNotMatchedByAnyPredicate", test_satisfy_shouldReturnFalseIfInputNotMatchedByAnyPredicate), - ("test_satisfy_shouldReturnFalseIfInputNotMatchedReference", test_satisfy_shouldReturnFalseIfInputNotMatchedReference), - ("test_satisfy_shouldReturnTrue", test_satisfy_shouldReturnTrue), - ("test_satisfy_shouldReturnTrueIfInputMatched", test_satisfy_shouldReturnTrueIfInputMatched), - ("test_satisfy_shouldReturnTrueIfInputMatchedByAnyPredicate", test_satisfy_shouldReturnTrueIfInputMatchedByAnyPredicate), - ("test_satisfy_shouldReturnTrueIfInputMatchedReference", test_satisfy_shouldReturnTrueIfInputMatchedReference), - ("test_satisfy_withAnyshouldReturnFalseIfInputIsNotTheSameType", test_satisfy_withAnyshouldReturnFalseIfInputIsNotTheSameType), - ("test_satisfy_withMatchShouldReturnFalseIfInputIsNotTheSameType", test_satisfy_withMatchShouldReturnFalseIfInputIsNotTheSameType), + ("test_any_description", test_any_description), + ("test_any_shouldReturnFalse", test_any_shouldReturnFalse), + ("test_any_shouldReturnTrue", test_any_shouldReturnTrue), + ("test_match_description", test_match_description), + ("test_match_shouldReturnFalseIfInputNotMatched", test_match_shouldReturnFalseIfInputNotMatched), + ("test_match_shouldReturnFalseIfInputNotMatchedByAnyPredicate", test_match_shouldReturnFalseIfInputNotMatchedByAnyPredicate), + ("test_match_shouldReturnFalseIfInputNotSameReference", test_match_shouldReturnFalseIfInputNotSameReference), + ("test_match_shouldReturnTrueIfInputMatched", test_match_shouldReturnTrueIfInputMatched), + ("test_match_shouldReturnTrueIfInputMatchedByAnyPredicate", test_match_shouldReturnTrueIfInputMatchedByAnyPredicate), + ("test_match_shouldReturnTrueIfInputSameReference", test_match_shouldReturnTrueIfInputSameReference), + ("test_match_withMatchShouldReturnFalseIfInputIsNotTheSameType", test_match_withMatchShouldReturnFalseIfInputIsNotTheSameType), + ("test_not_description", test_not_description), + ("test_not_shouldReturnFalse", test_not_shouldReturnFalse), + ("test_not_shouldReturnTrue", test_not_shouldReturnTrue), ] } @@ -221,6 +235,7 @@ public func __allTests() -> [XCTestCaseEntry] { testCase(MockableTests.__allTests__MockableTests), testCase(PredicatBoolTests.__allTests__PredicatBoolTests), testCase(PredicateComparableTests.__allTests__PredicateComparableTests), + testCase(PredicateOptionalTests.__allTests__PredicateOptionalTests), testCase(PredicateTests.__allTests__PredicateTests), testCase(VerifiableTests.__allTests__VerifiableTests), ] From 7b306dee24bccf49a35b4e4516d75ef9264d97b4 Mon Sep 17 00:00:00 2001 From: jordhan leoture Date: Tue, 8 Oct 2019 09:41:25 +0200 Subject: [PATCH 4/4] update CHANGELOG --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94db1db..41fb58b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,9 +11,9 @@ [Compare](https://github.com/leoture/MockSwift/compare/v0.2.0...HEAD) #### Added - Add Predicates with Comparables [#28](https://github.com/leoture/MockSwift/pull/28) -- Add Predicates .isTrue() & .isFalse() -- Add Predicate .not() -- Add Predicate .isNil() +- Add Predicates .isTrue() & .isFalse() [#33](https://github.com/leoture/MockSwift/pull/33) +- Add Predicate .not() [#33](https://github.com/leoture/MockSwift/pull/33) +- Add Predicate .isNil() [#33](https://github.com/leoture/MockSwift/pull/33) #### Changed - mocked() with optionals [#32](https://github.com/leoture/MockSwift/pull/32)