From d99fab4c1b508cd2ded88c370efc4c1b82bc1efd Mon Sep 17 00:00:00 2001
From: Jordhan
Date: Wed, 14 Apr 2021 19:19:27 +0200
Subject: [PATCH 1/4] update README.md
---
README.md | 98 ++++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 75 insertions(+), 23 deletions(-)
diff --git a/README.md b/README.md
index 87de7d8..8fa29f9 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,9 @@
-Welcome to MockSwift!
+Welcome to MockSwift
=======
+
[![Release](https://img.shields.io/github/v/release/leoture/MockSwift?color=red)](https://github.com/leoture/MockSwift/releases)
[![Build Status](https://github.com/leoture/MockSwift/workflows/Master/badge.svg?branch=master)](https://github.com/leoture/MockSwift/actions)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/d857788324854dc989d76a18a9d48f7e)](https://www.codacy.com/gh/leoture/MockSwift/dashboard?utm_source=github.com&utm_medium=referral&utm_content=leoture/MockSwift&utm_campaign=Badge_Grade)
@@ -13,36 +14,43 @@ Welcome to MockSwift!
[![Swift](https://img.shields.io/badge/Swift-5.3-important)](https://swift.org)
[![license MIT](https://img.shields.io/badge/license-MIT-informational)](https://github.com/leoture/MockSwift/blob/master/LICENSE)
-**MockSwift** allows you to [**write mocks**](#write-mocks) and [**make better tests**](#make-better-tests). Because **MockSwift** is an **open source** library **100%** written in **Swift**, it is **AVAILABLE ON ALL PLATFORMS**.
+**MockSwift** allows you to [**write mocks**](#write-mocks) and [**make better tests**](#make-better-tests). Because **MockSwift** is an **open source** library **100%** written in **Swift**, it is **AVAILABLE ON ALL PLATFORMS**.
Initially MockSwift is inspired by [Mockito](https://site.mockito.org).
-
###### Table of Contents
+
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [Documentation](#documentation)
-- [Playgrounds](#playgrounds)
- [Contribution](#contribution)
- [License](#license)
# Features
+
Actually MockSwift supports:
-- **Mocking**
- - [x] **protocol** (methods, properties, subscripts)
- - [ ] class ([v2](https://github.com/leoture/MockSwift/projects/2))
- - [ ] struct ([v2](https://github.com/leoture/MockSwift/projects/2))
- - [ ] enum ([v2](https://github.com/leoture/MockSwift/projects/2))
-- **Call verification**
- - [x] **protocol** (methods, properties, subscripts)
- - [ ] class ([v2](https://github.com/leoture/MockSwift/projects/2))
- - [ ] struct ([v2](https://github.com/leoture/MockSwift/projects/2))
- - [ ] enum ([v2](https://github.com/leoture/MockSwift/projects/2))
-- [x] **Generics**
-- [x] **Parameters matching**
-- [x] **Default values for Types**
+
+- **Stub**
+ - [x] Protocol methods
+ - [x] Protocol properties
+ - [x] Protocol subscripts
+ - [ ] Class
+ - [ ] Struct
+ - [ ] Enum
+ - [x] Default values for types
+- **Verify interactions**
+ - [x] Protocol methods
+ - [x] Protocol properties
+ - [x] Protocol subscripts
+ - [ ] Class
+ - [ ] Struct
+ - [ ] Enum
+_ **Parameter matching**
+ - [x] Predicates
+ - [x] Generics
#### CHANGELOG
+
You can see all changes and new features [here](https://github.com/leoture/MockSwift/blob/master/CHANGELOG.md).
# Installation
@@ -65,6 +73,37 @@ let package = Package(
```
# Usage
+## Quick Look
+```swift
+class AwesomeTests: XCTestCase {
+
+ private var printer: Printer!
+ @Mock private var userService: UserService
+
+ override func setUp() {
+ printer = Printer(userService)
+ }
+
+ func test_sayHello() {
+ // Given
+ given(userService).fetchUserName(of: "you").willReturn("my friend")
+ given(userService).isConnected.get.willReturn(true)
+ given(userService)[cache: .any()].set(.any()).willDoNothing()
+
+ // When
+ let message = printer.sayHello(to: "you", from: "me")
+
+ // Then
+ then(userService).fetchUserName(of: .any()).called()
+ then(userService).isConnected.get.called(times: 1)
+ then(userService)[cache: "you"].set("my friend").calledOnce()
+
+ XCTAssertEqual(message, "me: Hello my friend")
+ }
+}
+```
+
+## Details
Suppose that you have a `UserService` protocol.
```swift
struct User: Equatable {
@@ -95,6 +134,7 @@ class UserCore {
## Make better tests
Now, with MockSwift, you can use a mocked `UserService` in your tests with the `@Mock` annotation.
+
```swift
@Mock private var service: UserService
@@ -104,6 +144,7 @@ private var service: UserService = Mock()
```
And easly configure it to fully test `UseCore`.
+
```swift
class UserCoreTests: XCTestCase {
@@ -164,9 +205,11 @@ you can also define behaviours when you instantiate the mock.
})
private var service: UserService
```
+
### Then
`then()` enables you to verify calls.
example:
+
```swift
then(service).fetch(identifier: .any()).called()
@@ -176,18 +219,30 @@ then(service) {
$0.fetch(identifier: .any()).called()
}
```
+
```swift
then(service) {
$0.fetch(identifier: "current").called(times: >=2)
- $0.fetch(identifier: =="").called(times: 0)
+ $0.fetch(identifier: == "").called(times: 0)
}
```
+
+You can go further and verify order of calls
+```swift
+let assertion = then(service).fetch(identifier: "current").called(times: >=2)
+then(service).fetch(identifier: == "").called(times: 1, after: assertion)
+```
+
### Stubs
+
In MockSwift, stubs are default values that are returned when no behaviours has been found.
+
#### Global Stubs
+
You can define a **global stub** for any type.
It will concern **all mocks** you will use in **every tests**.
+
```swift
extension User: GlobalStub {
static func stub() -> User {
@@ -195,6 +250,7 @@ extension User: GlobalStub {
}
}
```
+
#### Local Stubs
You can also define a **stub localy** for any type.
It will concern only the **current mock**.
@@ -276,13 +332,9 @@ extension Then where WrappedType == UserService {
}
}
```
+
# Documentation
If you need more details about the API, you can check out our [API documentation](https://leoture.github.io/MockSwift/) or our [GitBook](https://mockswift.gitbook.io/mockswift/).
-# Playgrounds
-This project contains playgrounds that can help you experiment **MockSwift** .
-To use playgrounds:
-- open **MockSwift.xcworkspace**
-- build the **MockSwiftPlayground scheme**.
# Contribution
Would you like to contribute to MockSwift? Please read our [contributing guidelines](https://github.com/leoture/MockSwift/blob/master/CONTRIBUTING.md) and [code of conduct](https://github.com/leoture/MockSwift/blob/master/CODE_OF_CONDUCT.md).
From 0f8531c4bd07701e19954d1ee926a6e7f70ba187 Mon Sep 17 00:00:00 2001
From: Jordhan
Date: Wed, 14 Apr 2021 19:26:15 +0200
Subject: [PATCH 2/4] update CONTRIBUTING.md
---
CONTRIBUTING.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 13cf92b..0b8993b 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -13,7 +13,7 @@ Before you start contributing, please read this file and do your best to comply
## 🤔 Asking Questions
If you have a question, check that nobody asked this question before.
-Otherwise, please open an issue as a [**Bug Report**](https://github.com/leoture/MockSwift/issues/new?assignees=&labels=bug&template=bug_report.md&title=) and add `question` label.
+Otherwise, please open an issue as a [**Question**](https://github.com/leoture/MockSwift/issues/new?assignees=&labels=question&template=question.md&title=).
We will make our best to answer you as quickly as possible!
>If you find that this question has already been asked in an issue, add 👍 as *reaction* on the issue.
From 6d2aee45f579db50b6f392707baec07d77d16ab0 Mon Sep 17 00:00:00 2001
From: Jordhan
Date: Wed, 14 Apr 2021 19:34:43 +0200
Subject: [PATCH 3/4] remove playground
---
CONTRIBUTING.md | 1 -
.../contents.xcworkspacedata | 3 -
.../project.pbxproj | 366 ------------------
.../xcschemes/MockSwiftPlayground.xcscheme | 67 ----
.../MockSwiftPlayground/Info.plist | 22 --
.../MockSwiftPlayground/MockSwiftPlayground.h | 19 -
.../Playground.playground/Contents.swift | 92 -----
.../contents.xcplayground | 4 -
.../contents.xcworkspacedata | 7 -
.../xcshareddata/IDEWorkspaceChecks.plist | 8 -
10 files changed, 589 deletions(-)
delete mode 100644 MockSwiftPlayground/MockSwiftPlayground.xcodeproj/project.pbxproj
delete mode 100644 MockSwiftPlayground/MockSwiftPlayground.xcodeproj/xcshareddata/xcschemes/MockSwiftPlayground.xcscheme
delete mode 100644 MockSwiftPlayground/MockSwiftPlayground/Info.plist
delete mode 100644 MockSwiftPlayground/MockSwiftPlayground/MockSwiftPlayground.h
delete mode 100644 MockSwiftPlayground/Playground.playground/Contents.swift
delete mode 100644 MockSwiftPlayground/Playground.playground/contents.xcplayground
delete mode 100644 MockSwiftPlayground/Playground.playground/playground.xcworkspace/contents.xcworkspacedata
delete mode 100644 MockSwiftPlayground/Playground.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 0b8993b..977d166 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -22,7 +22,6 @@ We will make our best to answer you as quickly as possible!
#### With Xcode
- Open `MockSwift.xcworkspace`.
- To build or test the project: choose `MockSwift-Package` scheme on `My Mac`.
-- Before using playgrounds build the `MockSwiftPlayground` scheme.
#### With Swift Package Manager
- To build or test the project: use the respective commands `swift build` and `swift test`.
diff --git a/MockSwift.xcworkspace/contents.xcworkspacedata b/MockSwift.xcworkspace/contents.xcworkspacedata
index d1328dd..bc9731f 100644
--- a/MockSwift.xcworkspace/contents.xcworkspacedata
+++ b/MockSwift.xcworkspace/contents.xcworkspacedata
@@ -4,9 +4,6 @@
-
-
diff --git a/MockSwiftPlayground/MockSwiftPlayground.xcodeproj/project.pbxproj b/MockSwiftPlayground/MockSwiftPlayground.xcodeproj/project.pbxproj
deleted file mode 100644
index 19bcb29..0000000
--- a/MockSwiftPlayground/MockSwiftPlayground.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,366 +0,0 @@
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 50;
- objects = {
-
-/* Begin PBXBuildFile section */
- 9EB7257F22F5E6C900F285FD /* MockSwiftPlayground.h in Headers */ = {isa = PBXBuildFile; fileRef = 9EB7257D22F5E6C900F285FD /* MockSwiftPlayground.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 9EB7258822F5E74900F285FD /* MockSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9EB7258722F5E74900F285FD /* MockSwift.framework */; };
- 9EB7258922F5E74900F285FD /* MockSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9EB7258722F5E74900F285FD /* MockSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
-/* End PBXBuildFile section */
-
-/* Begin PBXCopyFilesBuildPhase section */
- 9EB7258A22F5E74900F285FD /* Embed Frameworks */ = {
- isa = PBXCopyFilesBuildPhase;
- buildActionMask = 2147483647;
- dstPath = "";
- dstSubfolderSpec = 10;
- files = (
- 9EB7258922F5E74900F285FD /* MockSwift.framework in Embed Frameworks */,
- );
- name = "Embed Frameworks";
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXCopyFilesBuildPhase section */
-
-/* Begin PBXFileReference section */
- 9EB7257A22F5E6C900F285FD /* MockSwiftPlayground.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MockSwiftPlayground.framework; sourceTree = BUILT_PRODUCTS_DIR; };
- 9EB7257D22F5E6C900F285FD /* MockSwiftPlayground.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockSwiftPlayground.h; sourceTree = ""; };
- 9EB7257E22F5E6C900F285FD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
- 9EB7258522F5E70700F285FD /* Playground.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = Playground.playground; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
- 9EB7258722F5E74900F285FD /* MockSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = MockSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
- 9EB7257722F5E6C900F285FD /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 9EB7258822F5E74900F285FD /* MockSwift.framework in Frameworks */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
- 9EB7257022F5E6C900F285FD = {
- isa = PBXGroup;
- children = (
- 9EB7258522F5E70700F285FD /* Playground.playground */,
- 9EB7257C22F5E6C900F285FD /* MockSwiftPlayground */,
- 9EB7257B22F5E6C900F285FD /* Products */,
- 9EB7258622F5E74900F285FD /* Frameworks */,
- );
- sourceTree = "";
- };
- 9EB7257B22F5E6C900F285FD /* Products */ = {
- isa = PBXGroup;
- children = (
- 9EB7257A22F5E6C900F285FD /* MockSwiftPlayground.framework */,
- );
- name = Products;
- sourceTree = "";
- };
- 9EB7257C22F5E6C900F285FD /* MockSwiftPlayground */ = {
- isa = PBXGroup;
- children = (
- 9EB7257D22F5E6C900F285FD /* MockSwiftPlayground.h */,
- 9EB7257E22F5E6C900F285FD /* Info.plist */,
- );
- path = MockSwiftPlayground;
- sourceTree = "";
- };
- 9EB7258622F5E74900F285FD /* Frameworks */ = {
- isa = PBXGroup;
- children = (
- 9EB7258722F5E74900F285FD /* MockSwift.framework */,
- );
- name = Frameworks;
- sourceTree = "";
- };
-/* End PBXGroup section */
-
-/* Begin PBXHeadersBuildPhase section */
- 9EB7257522F5E6C900F285FD /* Headers */ = {
- isa = PBXHeadersBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 9EB7257F22F5E6C900F285FD /* MockSwiftPlayground.h in Headers */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXHeadersBuildPhase section */
-
-/* Begin PBXNativeTarget section */
- 9EB7257922F5E6C900F285FD /* MockSwiftPlayground */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = 9EB7258222F5E6C900F285FD /* Build configuration list for PBXNativeTarget "MockSwiftPlayground" */;
- buildPhases = (
- 9EB7257522F5E6C900F285FD /* Headers */,
- 9EB7257622F5E6C900F285FD /* Sources */,
- 9EB7257722F5E6C900F285FD /* Frameworks */,
- 9EB7257822F5E6C900F285FD /* Resources */,
- 9EB7258A22F5E74900F285FD /* Embed Frameworks */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = MockSwiftPlayground;
- productName = MockSwiftPlayground;
- productReference = 9EB7257A22F5E6C900F285FD /* MockSwiftPlayground.framework */;
- productType = "com.apple.product-type.framework";
- };
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
- 9EB7257122F5E6C900F285FD /* Project object */ = {
- isa = PBXProject;
- attributes = {
- LastUpgradeCheck = 1200;
- ORGANIZATIONNAME = "jordhan leoture";
- TargetAttributes = {
- 9EB7257922F5E6C900F285FD = {
- CreatedOnToolsVersion = 11.0;
- };
- };
- };
- buildConfigurationList = 9EB7257422F5E6C900F285FD /* Build configuration list for PBXProject "MockSwiftPlayground" */;
- compatibilityVersion = "Xcode 9.3";
- developmentRegion = en;
- hasScannedForEncodings = 0;
- knownRegions = (
- en,
- Base,
- );
- mainGroup = 9EB7257022F5E6C900F285FD;
- productRefGroup = 9EB7257B22F5E6C900F285FD /* Products */;
- projectDirPath = "";
- projectRoot = "";
- targets = (
- 9EB7257922F5E6C900F285FD /* MockSwiftPlayground */,
- );
- };
-/* End PBXProject section */
-
-/* Begin PBXResourcesBuildPhase section */
- 9EB7257822F5E6C900F285FD /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXResourcesBuildPhase section */
-
-/* Begin PBXSourcesBuildPhase section */
- 9EB7257622F5E6C900F285FD /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXSourcesBuildPhase section */
-
-/* Begin XCBuildConfiguration section */
- 9EB7258022F5E6C900F285FD /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_ANALYZER_NONNULL = YES;
- CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_ARC = YES;
- CLANG_ENABLE_OBJC_WEAK = YES;
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
- CLANG_WARN_BOOL_CONVERSION = YES;
- CLANG_WARN_COMMA = YES;
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
- CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INFINITE_RECURSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
- CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
- CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
- CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
- CLANG_WARN_STRICT_PROTOTYPES = YES;
- CLANG_WARN_SUSPICIOUS_MOVE = YES;
- CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
- CLANG_WARN_UNREACHABLE_CODE = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 1;
- DEBUG_INFORMATION_FORMAT = dwarf;
- ENABLE_STRICT_OBJC_MSGSEND = YES;
- ENABLE_TESTABILITY = YES;
- GCC_C_LANGUAGE_STANDARD = gnu11;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_NO_COMMON_BLOCKS = YES;
- GCC_OPTIMIZATION_LEVEL = 0;
- GCC_PREPROCESSOR_DEFINITIONS = (
- "DEBUG=1",
- "$(inherited)",
- );
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
- GCC_WARN_UNDECLARED_SELECTOR = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 13.0;
- MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
- MTL_FAST_MATH = YES;
- ONLY_ACTIVE_ARCH = YES;
- SDKROOT = iphoneos;
- SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
- SWIFT_OPTIMIZATION_LEVEL = "-Onone";
- VERSIONING_SYSTEM = "apple-generic";
- VERSION_INFO_PREFIX = "";
- };
- name = Debug;
- };
- 9EB7258122F5E6C900F285FD /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_ANALYZER_NONNULL = YES;
- CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_ARC = YES;
- CLANG_ENABLE_OBJC_WEAK = YES;
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
- CLANG_WARN_BOOL_CONVERSION = YES;
- CLANG_WARN_COMMA = YES;
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
- CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INFINITE_RECURSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
- CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
- CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
- CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
- CLANG_WARN_STRICT_PROTOTYPES = YES;
- CLANG_WARN_SUSPICIOUS_MOVE = YES;
- CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
- CLANG_WARN_UNREACHABLE_CODE = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 1;
- DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- ENABLE_NS_ASSERTIONS = NO;
- ENABLE_STRICT_OBJC_MSGSEND = YES;
- GCC_C_LANGUAGE_STANDARD = gnu11;
- GCC_NO_COMMON_BLOCKS = YES;
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
- GCC_WARN_UNDECLARED_SELECTOR = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 13.0;
- MTL_ENABLE_DEBUG_INFO = NO;
- MTL_FAST_MATH = YES;
- SDKROOT = iphoneos;
- SWIFT_COMPILATION_MODE = wholemodule;
- SWIFT_OPTIMIZATION_LEVEL = "-O";
- VALIDATE_PRODUCT = YES;
- VERSIONING_SYSTEM = "apple-generic";
- VERSION_INFO_PREFIX = "";
- };
- name = Release;
- };
- 9EB7258322F5E6C900F285FD /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- CODE_SIGN_STYLE = Automatic;
- DEFINES_MODULE = YES;
- DEVELOPMENT_TEAM = VFBUQ866W5;
- DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 1;
- DYLIB_INSTALL_NAME_BASE = "@rpath";
- INFOPLIST_FILE = MockSwiftPlayground/Info.plist;
- INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
- LD_RUNPATH_SEARCH_PATHS = (
- "$(inherited)",
- "@executable_path/Frameworks",
- "@loader_path/Frameworks",
- );
- PRODUCT_BUNDLE_IDENTIFIER = "com.jordhan-leoture.MockSwiftPlayground";
- PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
- SKIP_INSTALL = YES;
- SUPPORTS_MACCATALYST = NO;
- SWIFT_VERSION = 5.0;
- TARGETED_DEVICE_FAMILY = "1,2";
- };
- name = Debug;
- };
- 9EB7258422F5E6C900F285FD /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- CODE_SIGN_STYLE = Automatic;
- DEFINES_MODULE = YES;
- DEVELOPMENT_TEAM = VFBUQ866W5;
- DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 1;
- DYLIB_INSTALL_NAME_BASE = "@rpath";
- INFOPLIST_FILE = MockSwiftPlayground/Info.plist;
- INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
- LD_RUNPATH_SEARCH_PATHS = (
- "$(inherited)",
- "@executable_path/Frameworks",
- "@loader_path/Frameworks",
- );
- PRODUCT_BUNDLE_IDENTIFIER = "com.jordhan-leoture.MockSwiftPlayground";
- PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
- SKIP_INSTALL = YES;
- SUPPORTS_MACCATALYST = NO;
- SWIFT_VERSION = 5.0;
- TARGETED_DEVICE_FAMILY = "1,2";
- };
- name = Release;
- };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
- 9EB7257422F5E6C900F285FD /* Build configuration list for PBXProject "MockSwiftPlayground" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 9EB7258022F5E6C900F285FD /* Debug */,
- 9EB7258122F5E6C900F285FD /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- 9EB7258222F5E6C900F285FD /* Build configuration list for PBXNativeTarget "MockSwiftPlayground" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 9EB7258322F5E6C900F285FD /* Debug */,
- 9EB7258422F5E6C900F285FD /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
-/* End XCConfigurationList section */
- };
- rootObject = 9EB7257122F5E6C900F285FD /* Project object */;
-}
diff --git a/MockSwiftPlayground/MockSwiftPlayground.xcodeproj/xcshareddata/xcschemes/MockSwiftPlayground.xcscheme b/MockSwiftPlayground/MockSwiftPlayground.xcodeproj/xcshareddata/xcschemes/MockSwiftPlayground.xcscheme
deleted file mode 100644
index 83c6877..0000000
--- a/MockSwiftPlayground/MockSwiftPlayground.xcodeproj/xcshareddata/xcschemes/MockSwiftPlayground.xcscheme
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/MockSwiftPlayground/MockSwiftPlayground/Info.plist b/MockSwiftPlayground/MockSwiftPlayground/Info.plist
deleted file mode 100644
index 9bcb244..0000000
--- a/MockSwiftPlayground/MockSwiftPlayground/Info.plist
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
- CFBundleDevelopmentRegion
- $(DEVELOPMENT_LANGUAGE)
- CFBundleExecutable
- $(EXECUTABLE_NAME)
- CFBundleIdentifier
- $(PRODUCT_BUNDLE_IDENTIFIER)
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleName
- $(PRODUCT_NAME)
- CFBundlePackageType
- $(PRODUCT_BUNDLE_PACKAGE_TYPE)
- CFBundleShortVersionString
- 1.0
- CFBundleVersion
- $(CURRENT_PROJECT_VERSION)
-
-
diff --git a/MockSwiftPlayground/MockSwiftPlayground/MockSwiftPlayground.h b/MockSwiftPlayground/MockSwiftPlayground/MockSwiftPlayground.h
deleted file mode 100644
index 11584f6..0000000
--- a/MockSwiftPlayground/MockSwiftPlayground/MockSwiftPlayground.h
+++ /dev/null
@@ -1,19 +0,0 @@
-//
-// MockSwiftPlayground.h
-// MockSwiftPlayground
-//
-// Created by jordhan leoture on 03/08/2019.
-// Copyright © 2019 jordhan leoture. All rights reserved.
-//
-
-#import
-
-//! Project version number for MockSwiftPlayground.
-FOUNDATION_EXPORT double MockSwiftPlaygroundVersionNumber;
-
-//! Project version string for MockSwiftPlayground.
-FOUNDATION_EXPORT const unsigned char MockSwiftPlaygroundVersionString[];
-
-// In this header, you should import all the public headers of your framework using statements like #import
-
-
diff --git a/MockSwiftPlayground/Playground.playground/Contents.swift b/MockSwiftPlayground/Playground.playground/Contents.swift
deleted file mode 100644
index 84c4c43..0000000
--- a/MockSwiftPlayground/Playground.playground/Contents.swift
+++ /dev/null
@@ -1,92 +0,0 @@
-import XCTest
-import MockSwift
-
-struct User: Equatable {
- let identifier: String
- let name: String
-}
-
-protocol UserService {
- func fetch(identifier: String) -> User
- func fetch(identifier: String) -> String
-}
-
-extension Mock: UserService where WrappedType == UserService {
- func fetch(identifier: String) -> User { mocked(identifier) }
- func fetch(identifier: String) -> String { mocked(identifier) }
-}
-
-extension Given where WrappedType == UserService {
- func fetch(identifier: Predicate) -> Mockable { mockable(identifier) }
- func fetch(identifier: Predicate) -> Mockable { mockable(identifier) }
-}
-
-extension Then where WrappedType == UserService {
- func fetch(identifier: Predicate) -> Verifiable { verifiable(identifier) }
- func fetch(identifier: Predicate) -> Verifiable { verifiable(identifier) }
-}
-
-extension User: GlobalStub {
- static func stub() -> User {
- User(identifier: "id", name: "John")
- }
-}
-
-class MyTests: XCTestCase {
- @Mock private var service: UserService
-
- func test_fetch() {
- // Given
- let expectedUser = User(identifier: "id", name: "John")
-
- given(service)
- .fetch(identifier: .any())
- .willReturn(expectedUser)
-
- // When
- let user: User = service.fetch(identifier: "id")
-
- // Then
- then(service)
- .fetch(identifier: .any())
- .disambiguate(with: User.self)
- .called()
- XCTAssertEqual(user, expectedUser)
- }
-
- func test_fetch_withDefault() {
- // Given
- let expectedUser = User(identifier: "id", name: "John")
-
- // When
- let user: User = service.fetch(identifier: "id")
-
- // Then
- XCTAssertEqual(user, expectedUser)
- }
-}
-
-MyTests.defaultTestSuite.run()
-
-let myPredicate = Predicate.match(description: "User.identifer == id") { user in
- user.identifier == "id"
-}
-
-myPredicate.satisfy(by: User(identifier: "id", name: "John"))
-myPredicate.satisfy(by: User(identifier: "identifier", name: "John"))
-
-extension User: AnyPredicate {
- var description: String {
- "User.identifer == \(identifier)"
- }
-
- func satisfy(by element: Any) -> Bool {
- guard let element = element as? User else {
- return false
- }
- return identifier == element.identifier
- }
-}
-
-User(identifier: "id", name: "").satisfy(by: User(identifier: "id", name: "John"))
-User(identifier: "id", name: "").satisfy(by: User(identifier: "identifier", name: "John"))
diff --git a/MockSwiftPlayground/Playground.playground/contents.xcplayground b/MockSwiftPlayground/Playground.playground/contents.xcplayground
deleted file mode 100644
index 5da2641..0000000
--- a/MockSwiftPlayground/Playground.playground/contents.xcplayground
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/MockSwiftPlayground/Playground.playground/playground.xcworkspace/contents.xcworkspacedata b/MockSwiftPlayground/Playground.playground/playground.xcworkspace/contents.xcworkspacedata
deleted file mode 100644
index 919434a..0000000
--- a/MockSwiftPlayground/Playground.playground/playground.xcworkspace/contents.xcworkspacedata
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
diff --git a/MockSwiftPlayground/Playground.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/MockSwiftPlayground/Playground.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
deleted file mode 100644
index 18d9810..0000000
--- a/MockSwiftPlayground/Playground.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
- IDEDidComputeMac32BitWarning
-
-
-
From dc1cdbe6bdfe6dbcf6e7e474b13da16ed5ebfdb8 Mon Sep 17 00:00:00 2001
From: Jordhan
Date: Wed, 14 Apr 2021 19:55:53 +0200
Subject: [PATCH 4/4] documentation for release
---
CHANGELOG.md | 26 +-
README.md | 2 +-
docs/Classes.html | 54 +-
docs/Classes/Given.html | 54 +-
docs/Classes/Interaction.html | 54 +-
docs/Classes/Mock.html | 54 +-
docs/Classes/Mockable.html | 99 +++-
docs/Classes/MockableProperty.html | 54 +-
docs/Classes/MockableProperty/Readable.html | 54 +-
docs/Classes/MockableProperty/Writable.html | 54 +-
docs/Classes/MockableSubscript.html | 54 +-
docs/Classes/MockableSubscript/Readable.html | 54 +-
docs/Classes/MockableSubscript/Writable.html | 54 +-
docs/Classes/Predicate.html | 130 ++---
docs/Classes/Stub.html | 54 +-
docs/Classes/Then.html | 54 +-
docs/Classes/Verifiable.html | 220 +++++++-
docs/Classes/VerifiableProperty.html | 54 +-
docs/Classes/VerifiableProperty/Readable.html | 54 +-
docs/Classes/VerifiableProperty/Writable.html | 54 +-
docs/Classes/VerifiableSubscript.html | 54 +-
.../Classes/VerifiableSubscript/Readable.html | 54 +-
.../Classes/VerifiableSubscript/Writable.html | 54 +-
docs/Enums.html | 54 +-
docs/Enums/StrategyIdentifier.html | 54 +-
docs/Extensions.html | 532 +++++++++++++++++-
docs/Extensions/Array.html | 57 +-
docs/Extensions/Decimal.html | 324 +++++++++++
docs/Extensions/Double.html | 324 +++++++++++
docs/Extensions/Float.html | 324 +++++++++++
docs/Extensions/Float80.html | 324 +++++++++++
docs/Extensions/NSNumber.html | 324 +++++++++++
docs/Functions.html | 54 +-
docs/Protocols.html | 54 +-
docs/Protocols/AnyPredicate.html | 54 +-
docs/Protocols/Assertion.html | 54 +-
docs/Protocols/GlobalStub.html | 54 +-
docs/Typealiases.html | 54 +-
docs/badge.svg | 4 +-
.../Contents/Resources/Documents/Classes.html | 54 +-
.../Resources/Documents/Classes/Given.html | 54 +-
.../Documents/Classes/Interaction.html | 54 +-
.../Resources/Documents/Classes/Mock.html | 54 +-
.../Resources/Documents/Classes/Mockable.html | 99 +++-
.../Documents/Classes/MockableProperty.html | 54 +-
.../Classes/MockableProperty/Readable.html | 54 +-
.../Classes/MockableProperty/Writable.html | 54 +-
.../Documents/Classes/MockableSubscript.html | 54 +-
.../Classes/MockableSubscript/Readable.html | 54 +-
.../Classes/MockableSubscript/Writable.html | 54 +-
.../Documents/Classes/Predicate.html | 130 ++---
.../Resources/Documents/Classes/Stub.html | 54 +-
.../Resources/Documents/Classes/Then.html | 54 +-
.../Documents/Classes/Verifiable.html | 220 +++++++-
.../Documents/Classes/VerifiableProperty.html | 54 +-
.../Classes/VerifiableProperty/Readable.html | 54 +-
.../Classes/VerifiableProperty/Writable.html | 54 +-
.../Classes/VerifiableSubscript.html | 54 +-
.../Classes/VerifiableSubscript/Readable.html | 54 +-
.../Classes/VerifiableSubscript/Writable.html | 54 +-
.../Contents/Resources/Documents/Enums.html | 54 +-
.../Documents/Enums/StrategyIdentifier.html | 54 +-
.../Resources/Documents/Extensions.html | 532 +++++++++++++++++-
.../Resources/Documents/Extensions/Array.html | 57 +-
.../Documents/Extensions/Decimal.html | 324 +++++++++++
.../Documents/Extensions/Double.html | 324 +++++++++++
.../Resources/Documents/Extensions/Float.html | 324 +++++++++++
.../Documents/Extensions/Float80.html | 324 +++++++++++
.../Documents/Extensions/NSNumber.html | 324 +++++++++++
.../Resources/Documents/Functions.html | 54 +-
.../Resources/Documents/Protocols.html | 54 +-
.../Documents/Protocols/AnyPredicate.html | 54 +-
.../Documents/Protocols/Assertion.html | 54 +-
.../Documents/Protocols/GlobalStub.html | 54 +-
.../Resources/Documents/Typealiases.html | 54 +-
.../Contents/Resources/Documents/badge.svg | 4 +-
.../Contents/Resources/Documents/index.html | 135 +++--
.../Contents/Resources/Documents/search.json | 2 +-
.../Resources/Documents/undocumented.json | 28 +
.../Contents/Resources/docSet.dsidx | Bin 40960 -> 45056 bytes
docs/docsets/MockSwift.tgz | Bin 119005 -> 129861 bytes
docs/index.html | 135 +++--
docs/search.json | 2 +-
83 files changed, 7834 insertions(+), 628 deletions(-)
create mode 100644 docs/Extensions/Decimal.html
create mode 100644 docs/Extensions/Double.html
create mode 100644 docs/Extensions/Float.html
create mode 100644 docs/Extensions/Float80.html
create mode 100644 docs/Extensions/NSNumber.html
create mode 100644 docs/docsets/MockSwift.docset/Contents/Resources/Documents/Extensions/Decimal.html
create mode 100644 docs/docsets/MockSwift.docset/Contents/Resources/Documents/Extensions/Double.html
create mode 100644 docs/docsets/MockSwift.docset/Contents/Resources/Documents/Extensions/Float.html
create mode 100644 docs/docsets/MockSwift.docset/Contents/Resources/Documents/Extensions/Float80.html
create mode 100644 docs/docsets/MockSwift.docset/Contents/Resources/Documents/Extensions/NSNumber.html
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7c081a0..257575b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,9 @@
[Unrelease](#Unrelease)
+##### 1.x Releases
+- [1.0.0](#1.0.0)
+
##### 0.x Releases
- [0.7.0](#0.7.0)
- [0.6.0](#0.6.0)
@@ -13,7 +16,22 @@
---
## Unrelease
-[Compare](https://github.com/leoture/MockSwift/compare/v0.7.0...HEAD)
+[Compare](https://github.com/leoture/MockSwift/compare/v1.0.0...HEAD)
+#### Added
+
+#### Changed
+
+#### Deprecated
+
+#### Removed
+
+#### Fixed
+
+#### Security
+
+---
+## [1.0.0](https://github.com/leoture/MockSwift/releases/tag/v1.0.0) - 2021-04-14
+[Compare](https://github.com/leoture/MockSwift/compare/v0.7.0...v1.0.0)
#### Added
- Add willDoNothing [#107](https://github.com/leoture/MockSwift/pull/107) by [Jordhan Leoture](https://github.com/leoture)
- Add neverCalled [#106](https://github.com/leoture/MockSwift/pull/106) by [Jordhan Leoture](https://github.com/leoture)
@@ -27,18 +45,12 @@
- Add GlobalStub for ExpressibleByArrayLiteral [#109](https://github.com/leoture/MockSwift/pull/109) by [Jordhan Leoture](https://github.com/leoture)
- Add GlobalStub for ExpressibleByDictionaryLiteral [#109](https://github.com/leoture/MockSwift/pull/109) by [Jordhan Leoture](https://github.com/leoture)
-#### Changed
-
-#### Deprecated
-
#### Removed
- Remove Predicate.match(description:keyPath:) [#108](https://github.com/leoture/MockSwift/pull/108) by [Jordhan Leoture](https://github.com/leoture)
#### Fixed
- Make called(after:) fail when previsous Assertion is not valid [#110](https://github.com/leoture/MockSwift/pull/110) by [Jordhan Leoture](https://github.com/leoture)
-#### Security
-
---
## [0.7.0](https://github.com/leoture/MockSwift/releases/tag/v0.7.0) - 2020-10-21
[Compare](https://github.com/leoture/MockSwift/compare/v0.6.0...v0.7.0)
diff --git a/README.md b/README.md
index 8fa29f9..9266b08 100644
--- a/README.md
+++ b/README.md
@@ -64,7 +64,7 @@ import PackageDescription
let package = Package(
name: "MyProject",
dependencies: [
- .package(url: "https://github.com/leoture/MockSwift.git", from: "0.7.0")
+ .package(url: "https://github.com/leoture/MockSwift.git", from: "1.0.0")
],
targets: [
.testTarget(name: "MyProjectTests", dependencies: ["MockSwift"])
diff --git a/docs/Classes.html b/docs/Classes.html
index e6290ed..33a0388 100644
--- a/docs/Classes.html
+++ b/docs/Classes.html
@@ -23,7 +23,7 @@
- (94% documented)
+ (95% documented)
- Bool
+ ArraySlice
+
+
+ Bool
BooleanLiteralType
+
+ ContiguousArray
+
+
+ Decimal
+
+
+ Dictionary
+
+
+ Double
+
+
+ Float
+
+
+ Float80
+
FloatLiteralType
- Int
+ IndexPath
+
+
+ Int
IntegerLiteralType
+
+ KeyValuePairs
+
+
+ NSNumber
+
NSObject
- String
+ Optional
+
+
+ Set
+
+
+ StaticString
+
+
+ String
StringLiteralType
+
+ Substring
+
@@ -607,8 +649,8 @@ Declaration