Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resurrect Dobby #48

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cartfile.private
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "jspahrsummers/xcconfigs" ~> 0.10
github "Quick/Quick" ~> 0.10
github "Quick/Nimble" ~> 5.0
github "Quick/Quick" ~> 2.2
github "Quick/Nimble" ~> 8.0
4 changes: 2 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "Quick/Nimble" "v5.0.0"
github "Quick/Quick" "v0.10.0"
github "Quick/Nimble" "v8.0.7"
github "Quick/Quick" "v2.2.0"
github "jspahrsummers/xcconfigs" "0.10"
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Nimble
Submodule Nimble updated 168 files
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Quick
Submodule Quick updated 139 files
6 changes: 4 additions & 2 deletions Dobby.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ Pod::Spec.new do |spec|
spec.summary = 'Swift helpers for mocking and stubbing'
spec.description = 'Dobby provides a few helpers for mocking and stubbing.'

spec.ios.deployment_target = '8.0'
spec.osx.deployment_target = '10.9'
spec.ios.deployment_target = '11.0'
spec.osx.deployment_target = '10.13'

spec.frameworks = 'Foundation', 'XCTest'

spec.source_files = 'Dobby/**/*.swift'

s.swift_version = '5.0'
end
42 changes: 32 additions & 10 deletions Dobby.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
5C66EBDE244B6F4B0049DC42 /* Package.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C66EBDD244B6F4B0049DC42 /* Package.swift */; };
DC18FB9C1BF0948900768632 /* Dobby.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = DC7F6AF81AD8291800CCBF6D /* Dobby.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
DC3CFE781ADE895E004728C2 /* SwiftExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC3CFE771ADE895E004728C2 /* SwiftExtensions.swift */; };
DC3CFE791ADE895E004728C2 /* SwiftExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC3CFE771ADE895E004728C2 /* SwiftExtensions.swift */; };
Expand Down Expand Up @@ -70,6 +71,7 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
5C66EBDD244B6F4B0049DC42 /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = "<group>"; };
DC3CFE771ADE895E004728C2 /* SwiftExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftExtensions.swift; sourceTree = "<group>"; };
DC457AD81B5552CA00919032 /* Matcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Matcher.swift; sourceTree = "<group>"; };
DC7F6AF81AD8291800CCBF6D /* Dobby.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Dobby.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -163,6 +165,7 @@
DC7F6AEE1AD8291800CCBF6D = {
isa = PBXGroup;
children = (
5C66EBDD244B6F4B0049DC42 /* Package.swift */,
DC7F6AFA1AD8291800CCBF6D /* Dobby */,
DC7F6B071AD8291800CCBF6D /* DobbyTests */,
DCDDA8E81BED4A7600BB5228 /* Configuration */,
Expand Down Expand Up @@ -415,16 +418,16 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 1130;
ORGANIZATIONNAME = "trivago GmbH";
TargetAttributes = {
DC7F6AF71AD8291800CCBF6D = {
CreatedOnToolsVersion = 6.3;
LastSwiftMigration = 0800;
LastSwiftMigration = 1130;
};
DC7F6B021AD8291800CCBF6D = {
CreatedOnToolsVersion = 6.3;
LastSwiftMigration = 0800;
LastSwiftMigration = 1130;
};
DC8452171ADBF5CC006AC5D4 = {
CreatedOnToolsVersion = 6.3;
Expand All @@ -438,10 +441,11 @@
};
buildConfigurationList = DC7F6AF21AD8291800CCBF6D /* Build configuration list for PBXProject "Dobby" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = DC7F6AEE1AD8291800CCBF6D;
productRefGroup = DC7F6AF91AD8291800CCBF6D /* Products */;
Expand Down Expand Up @@ -514,6 +518,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5C66EBDE244B6F4B0049DC42 /* Package.swift in Sources */,
DC457ADA1B5552CA00919032 /* Matcher.swift in Sources */,
DC3CFE791ADE895E004728C2 /* SwiftExtensions.swift in Sources */,
DC83356D1B56661900569709 /* Disposable.swift in Sources */,
Expand Down Expand Up @@ -552,12 +557,18 @@
isa = XCBuildConfiguration;
baseConfigurationReference = DCDDA8ED1BED4A7600BB5228 /* Debug.xcconfig */;
buildSettings = {
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CURRENT_PROJECT_VERSION = 1;
ENABLE_TESTABILITY = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MACOSX_DEPLOYMENT_TARGET = 10.9;
PRODUCT_BUNDLE_IDENTIFIER = "com.trivago.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(PROJECT_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -568,11 +579,18 @@
isa = XCBuildConfiguration;
baseConfigurationReference = DCDDA8EF1BED4A7600BB5228 /* Release.xcconfig */;
buildSettings = {
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CURRENT_PROJECT_VERSION = 1;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MACOSX_DEPLOYMENT_TARGET = 10.9;
PRODUCT_BUNDLE_IDENTIFIER = "com.trivago.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(PROJECT_NAME)";
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -592,7 +610,8 @@
);
INFOPLIST_FILE = Dobby/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -609,7 +628,8 @@
);
INFOPLIST_FILE = Dobby/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -624,7 +644,8 @@
INFOPLIST_FILE = DobbyTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(PROJECT_NAME)Tests";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -639,7 +660,8 @@
INFOPLIST_FILE = DobbyTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(PROJECT_NAME)Tests";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -657,7 +679,7 @@
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = Dobby/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -675,7 +697,7 @@
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = Dobby/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
24 changes: 10 additions & 14 deletions Dobby.xcodeproj/xcshareddata/xcschemes/Dobby-iOS.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
Expand Down Expand Up @@ -70,6 +70,15 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DC7F6AF71AD8291800CCBF6D"
BuildableName = "Dobby.framework"
BlueprintName = "Dobby-iOS"
ReferencedContainer = "container:Dobby.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -82,17 +91,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DC7F6AF71AD8291800CCBF6D"
BuildableName = "Dobby.framework"
BlueprintName = "Dobby-iOS"
ReferencedContainer = "container:Dobby.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -113,8 +111,6 @@
ReferencedContainer = "container:Dobby.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
24 changes: 10 additions & 14 deletions Dobby.xcodeproj/xcshareddata/xcschemes/Dobby-macOS.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
Expand Down Expand Up @@ -70,6 +70,15 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DC8452171ADBF5CC006AC5D4"
BuildableName = "Dobby.framework"
BlueprintName = "Dobby-macOS"
ReferencedContainer = "container:Dobby.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -82,17 +91,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DC8452171ADBF5CC006AC5D4"
BuildableName = "Dobby.framework"
BlueprintName = "Dobby-macOS"
ReferencedContainer = "container:Dobby.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -113,8 +111,6 @@
ReferencedContainer = "container:Dobby.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
8 changes: 8 additions & 0 deletions Dobby.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
11 changes: 9 additions & 2 deletions Dobby/Matcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public func matches<Value>(_ matches: @escaping (Value) -> Bool) -> Matcher<Valu

public extension Matcher {
/// Initializes a new matcher that matches anything.
public init() {
init() {
self.init(description: "_") { _ in true }
}
}
Expand Down Expand Up @@ -65,7 +65,7 @@ public func some<M: MatcherConvertible>(_ matcher: M) -> Matcher<M.ValueType?> {

public extension Matcher where Value: Equatable {
/// Initializes a new matcher that matches the given value.
public init(value: Value) {
init(value: Value) {
self.init(description: "\(value)") { actualValue in
return value == actualValue
}
Expand Down Expand Up @@ -148,6 +148,13 @@ extension Matcher: MatcherConvertible {
}
}

/// Returns a new matcher that matches the given value.
public func matches<Value: MatcherConvertible>(_ value: Value) -> Matcher<Value.ValueType> {
return Matcher(description: "\(value)") { actualValue in
return value.matcher().matches(actualValue)
}
}

/// Returns a new matcher that matches the given 2-tuple of matchers.
public func matches<A: MatcherConvertible, B: MatcherConvertible>(_ values: (A, B)) -> Matcher<(A.ValueType, B.ValueType)> {
return Matcher(description: "\(values)") { actualValues in
Expand Down
2 changes: 1 addition & 1 deletion Dobby/Stub.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public final class Stub<Interaction, ReturnValue> {
behaviors.append((identifier: identifier, behavior: behavior))

return Disposable { [weak self] in
let index = self?.behaviors.index { otherIdentifier, _ in
let index = self?.behaviors.firstIndex { otherIdentifier, _ in
return otherIdentifier == identifier
}

Expand Down
Loading