Skip to content
Merged
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
6 changes: 3 additions & 3 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
#
---
excluded:
- Carthage/
- docs/
- MasKitTests/
- Carthage
- docs
- MasKitTests
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]


- ⬆️ Nimble (7.3.2) #213
- ⬆️ Quick (1.3.2) #213
- ⬆️ Result (4.1.0) #213

## [v1.6.2] 🗑 Trashy - 2019-01-21

Expand Down
6 changes: 3 additions & 3 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github "Carthage/Commandant" "0.15.0"
github "Quick/Nimble" "v7.3.0"
github "Quick/Quick" "v1.3.1"
github "antitypical/Result" "4.0.0"
github "Quick/Nimble" "v7.3.2"
github "Quick/Quick" "v1.3.2"
github "antitypical/Result" "4.1.0"
8 changes: 4 additions & 4 deletions Carthage/Checkouts/Commandant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ struct LogOptions: OptionsProtocol {
return { verbose in { logName in LogOptions(lines: lines, verbose: verbose, logName: logName) } }
}

static func evaluate(_ mode: CommandMode) -> Result<LogOptions, CommandantError<YourErrorType>> {
static func evaluate(_ m: CommandMode) -> Result<LogOptions, CommandantError<YourErrorType>> {
return create
<*> mode <| Option(key: "lines", defaultValue: 0, usage: "the number of lines to read from the logs")
<*> mode <| Option(key: "verbose", defaultValue: false, usage: "show verbose output")
<*> mode <| Argument(usage: "the log to read")
<*> m <| Option(key: "lines", defaultValue: 0, usage: "the number of lines to read from the logs")
<*> m <| Option(key: "verbose", defaultValue: false, usage: "show verbose output")
<*> m <| Argument(usage: "the log to read")
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ public struct HelpOptions<ClientError: Error>: OptionsProtocol {
return self.init(verb: (verb == "" ? nil : verb))
}

public static func evaluate(_ mode: CommandMode) -> Result<HelpOptions, CommandantError<ClientError>> {
public static func evaluate(_ m: CommandMode) -> Result<HelpOptions, CommandantError<ClientError>> {
return create
<*> mode <| Argument(defaultValue: "", usage: "the command to display help for")
<*> m <| Argument(defaultValue: "", usage: "the command to display help for")
}
}
14 changes: 7 additions & 7 deletions Carthage/Checkouts/Commandant/Sources/Commandant/Option.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ import Result
/// return { outputFilename in { shouldDelete in { logName in LogOptions(verbosity: verbosity, outputFilename: outputFilename, shouldDelete: shouldDelete, logName: logName) } } }
/// }
///
/// static func evaluate(_ mode: CommandMode) -> Result<LogOptions, CommandantError<YourErrorType>> {
/// static func evaluate(_ m: CommandMode) -> Result<LogOptions, CommandantError<YourErrorType>> {
/// return create
/// <*> mode <| Option(key: "verbose", defaultValue: 0, usage: "the verbosity level with which to read the logs")
/// <*> mode <| Option(key: "outputFilename", defaultValue: "", usage: "a file to print output to, instead of stdout")
/// <*> mode <| Switch(flag: "d", key: "delete", usage: "delete the logs when finished")
/// <*> mode <| Argument(usage: "the log to read")
/// <*> m <| Option(key: "verbose", defaultValue: 0, usage: "the verbosity level with which to read the logs")
/// <*> m <| Option(key: "outputFilename", defaultValue: "", usage: "a file to print output to, instead of stdout")
/// <*> m <| Switch(flag: "d", key: "delete", usage: "delete the logs when finished")
/// <*> m <| Argument(usage: "the log to read")
/// }
/// }
public protocol OptionsProtocol {
Expand All @@ -41,14 +41,14 @@ public protocol OptionsProtocol {
/// Evaluates this set of options in the given mode.
///
/// Returns the parsed options or a `UsageError`.
static func evaluate(_ mode: CommandMode) -> Result<Self, CommandantError<ClientError>>
static func evaluate(_ m: CommandMode) -> Result<Self, CommandantError<ClientError>>
}

/// An `OptionsProtocol` that has no options.
public struct NoOptions<ClientError: Error>: OptionsProtocol {
public init() {}

public static func evaluate(_ mode: CommandMode) -> Result<NoOptions, CommandantError<ClientError>> {
public static func evaluate(_ m: CommandMode) -> Result<NoOptions, CommandantError<ClientError>> {
return .success(NoOptions())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,19 +157,19 @@ struct TestOptions: OptionsProtocol, Equatable {
} } } } } } } } } }
}

static func evaluate(_ mode: CommandMode) -> Result<TestOptions, CommandantError<NoError>> {
static func evaluate(_ m: CommandMode) -> Result<TestOptions, CommandantError<NoError>> {
return create
<*> mode <| Option(key: "intValue", defaultValue: 42, usage: "Some integer value")
<*> mode <| Option(key: "stringValue", defaultValue: "foobar", usage: "Some string value")
<*> mode <| Option<[String]>(key: "stringsArray", defaultValue: [], usage: "Some array of arguments")
<*> mode <| Option<[String]?>(key: "optionalStringsArray", defaultValue: nil, usage: "Some array of arguments")
<*> mode <| Option<String?>(key: "optionalStringValue", defaultValue: nil, usage: "Some string value")
<*> mode <| Argument(usage: "A name you're required to specify")
<*> mode <| Argument(defaultValue: "filename", usage: "A filename that you can optionally specify")
<*> mode <| Option(key: "enabled", defaultValue: false, usage: "Whether to be enabled")
<*> mode <| Switch(flag: "f", key: "force", usage: "Whether to force")
<*> mode <| Switch(flag: "g", key: "glob", usage: "Whether to glob")
<*> mode <| Argument(defaultValue: [], usage: "An argument list that consumes the rest of positional arguments")
<*> m <| Option(key: "intValue", defaultValue: 42, usage: "Some integer value")
<*> m <| Option(key: "stringValue", defaultValue: "foobar", usage: "Some string value")
<*> m <| Option<[String]>(key: "stringsArray", defaultValue: [], usage: "Some array of arguments")
<*> m <| Option<[String]?>(key: "optionalStringsArray", defaultValue: nil, usage: "Some array of arguments")
<*> m <| Option<String?>(key: "optionalStringValue", defaultValue: nil, usage: "Some string value")
<*> m <| Argument(usage: "A name you're required to specify")
<*> m <| Argument(defaultValue: "filename", usage: "A filename that you can optionally specify")
<*> m <| Option(key: "enabled", defaultValue: false, usage: "Whether to be enabled")
<*> m <| Switch(flag: "f", key: "force", usage: "Whether to force")
<*> m <| Switch(flag: "g", key: "glob", usage: "Whether to glob")
<*> m <| Argument(defaultValue: [], usage: "An argument list that consumes the rest of positional arguments")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,16 @@ struct TestEnumOptions: OptionsProtocol, Equatable {
} } } } } } }
}

static func evaluate(_ mode: CommandMode) -> Result<TestEnumOptions, CommandantError<NoError>> {
static func evaluate(_ m: CommandMode) -> Result<TestEnumOptions, CommandantError<NoError>> {
return create
<*> mode <| Option(key: "strictIntValue", defaultValue: .theAnswerToTheUltimateQuestionOfLifeTheUniverseAndEverything, usage: "`0` - zero, `255` - max, `3` - three, `5` - five or `42` - The Answer")
<*> mode <| Option(key: "strictStringValue", defaultValue: .foobar, usage: "`foobar`, `bazbuzzz`, `a`, `b`, `c`, `one`, `two`, `c`")
<*> mode <| Option<[StrictStringValue]>(key: "strictStringsArray", defaultValue: [], usage: "Some array of arguments")
<*> mode <| Option<[StrictStringValue]?>(key: "optionalStrictStringsArray", defaultValue: nil, usage: "Some array of arguments")
<*> mode <| Option<StrictStringValue?>(key: "optionalStrictStringValue", defaultValue: nil, usage: "Some string value")
<*> mode <| Argument(usage: "A name you're required to specify")
<*> mode <| Argument(defaultValue: .min, usage: "A number that you can optionally specify")
<*> mode <| Argument(defaultValue: [], usage: "An argument list that consumes the rest of positional arguments")
<*> m <| Option(key: "strictIntValue", defaultValue: .theAnswerToTheUltimateQuestionOfLifeTheUniverseAndEverything, usage: "`0` - zero, `255` - max, `3` - three, `5` - five or `42` - The Answer")
<*> m <| Option(key: "strictStringValue", defaultValue: .foobar, usage: "`foobar`, `bazbuzzz`, `a`, `b`, `c`, `one`, `two`, `c`")
<*> m <| Option<[StrictStringValue]>(key: "strictStringsArray", defaultValue: [], usage: "Some array of arguments")
<*> m <| Option<[StrictStringValue]?>(key: "optionalStrictStringsArray", defaultValue: nil, usage: "Some array of arguments")
<*> m <| Option<StrictStringValue?>(key: "optionalStrictStringValue", defaultValue: nil, usage: "Some string value")
<*> m <| Argument(usage: "A name you're required to specify")
<*> m <| Argument(defaultValue: .min, usage: "A number that you can optionally specify")
<*> m <| Argument(defaultValue: [], usage: "An argument list that consumes the rest of positional arguments")
}
}

Expand Down
32 changes: 31 additions & 1 deletion Carthage/Checkouts/Nimble/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,17 @@ matrix:
- os: osx
env: TYPE=macos
osx_image: xcode9.4
- os: osx
env: TYPE=macos
osx_image: xcode10.1
- os: osx
env: TYPE=swiftpm
- os: osx
env: TYPE=swiftpm
osx_image: xcode9
- os: osx
env: TYPE=swiftpm
osx_image: xcode10.1
- os: linux
dist: trusty
sudo: required
Expand All @@ -42,9 +48,33 @@ matrix:
sudo: required
env:
- TYPE=swiftpm
- SWIFT_VERSION=4.0.2
- SWIFT_VERSION=4.0.3
install:
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
- os: linux
dist: trusty
sudo: required
env:
- TYPE=swiftpm
- SWIFT_VERSION=4.1.3
install:
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
- os: linux
dist: trusty
sudo: required
env:
- TYPE=swiftpm
- SWIFT_VERSION=4.2.1
install:
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
# - os: linux
# dist: trusty
# sudo: required
# env:
# - TYPE=swiftpm
# - SWIFT_VERSION=5.0-DEVELOPMENT-SNAPSHOT-2019-01-13-a
# install:
# - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
install:
- if [[ "$TYPE" == "podspec" ]]; then sudo gem install bundler; bundle install; fi
script:
Expand Down
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Nimble/Nimble.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Nimble"
s.version = "7.3.0"
s.version = "7.3.2"
s.summary = "A Matcher Framework for Swift and Objective-C"
s.description = <<-DESC
Use Nimble to express the expected outcomes of Swift or Objective-C expressions. Inspired by Cedar.
Expand Down
6 changes: 3 additions & 3 deletions Carthage/Checkouts/Nimble/Nimble.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1081,9 +1081,9 @@
isa = PBXNativeTarget;
buildConfigurationList = 1F1A743F1940169200FFFC47 /* Build configuration list for PBXNativeTarget "Nimble-iOS" */;
buildPhases = (
1F1A74261940169200FFFC47 /* Headers */,
1F1A74241940169200FFFC47 /* Sources */,
1F1A74251940169200FFFC47 /* Frameworks */,
1F1A74261940169200FFFC47 /* Headers */,
1F1A74271940169200FFFC47 /* Resources */,
);
buildRules = (
Expand Down Expand Up @@ -1120,9 +1120,9 @@
isa = PBXNativeTarget;
buildConfigurationList = 1F5DF16A1BDCA0CE00C3A531 /* Build configuration list for PBXNativeTarget "Nimble-tvOS" */;
buildPhases = (
1F5DF1521BDCA0CE00C3A531 /* Headers */,
1F5DF1501BDCA0CE00C3A531 /* Sources */,
1F5DF1511BDCA0CE00C3A531 /* Frameworks */,
1F5DF1521BDCA0CE00C3A531 /* Headers */,
1F5DF1531BDCA0CE00C3A531 /* Resources */,
);
buildRules = (
Expand Down Expand Up @@ -1156,9 +1156,9 @@
isa = PBXNativeTarget;
buildConfigurationList = 1F925EC0195C0D6300ED456B /* Build configuration list for PBXNativeTarget "Nimble-macOS" */;
buildPhases = (
1F925EAA195C0D6300ED456B /* Headers */,
1F925EA8195C0D6300ED456B /* Sources */,
1F925EA9195C0D6300ED456B /* Frameworks */,
1F925EAA195C0D6300ED456B /* Headers */,
1F925EAB195C0D6300ED456B /* Resources */,
);
buildRules = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Foundation

/// "Global" state of Nimble is stored here. Only DSL functions should access / be aware of this
/// class' existence
internal class NimbleEnvironment {
internal class NimbleEnvironment: NSObject {
static var activeInstance: NimbleEnvironment {
get {
let env = Thread.current.threadDictionary["NimbleEnvironment"]
Expand All @@ -29,7 +29,7 @@ internal class NimbleEnvironment {
var suppressTVOSAssertionWarning: Bool = false
var awaiter: Awaiter

init() {
override init() {
let timeoutQueue: DispatchQueue
if #available(OSX 10.10, *) {
timeoutQueue = DispatchQueue.global(qos: .userInitiated)
Expand All @@ -40,6 +40,9 @@ internal class NimbleEnvironment {
awaiter = Awaiter(
waitLock: AssertionWaitLock(),
asyncQueue: .main,
timeoutQueue: timeoutQueue)
timeoutQueue: timeoutQueue
)

super.init()
}
}
8 changes: 6 additions & 2 deletions Carthage/Checkouts/Nimble/Sources/Nimble/Matchers/Async.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,18 @@ private func async<T>(style: ExpectationStyle, predicate: Predicate<T>, timeout:
}
switch result {
case .completed: return lastPredicateResult!
case .timedOut: return PredicateResult(status: .fail, message: lastPredicateResult!.message)
case .timedOut:
let message = lastPredicateResult?.message ?? .fail("timed out before returning a value")
return PredicateResult(status: .fail, message: message)
case let .errorThrown(error):
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)."))
let message = lastPredicateResult?.message.appended(message: " (timed out, but main run loop was unresponsive).") ??
.fail("main run loop was unresponsive")
return PredicateResult(status: .fail, message: message)
case .incomplete:
internalError("Reached .incomplete state for \(fnName)(...).")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,38 @@ import Foundation
public func beIdenticalTo(_ expected: Any?) -> Predicate<Any> {
return Predicate.define { actualExpression in
#if os(Linux)
let actual = try actualExpression.evaluate() as? AnyObject
#if swift(>=4.0)
#if !swift(>=4.1.50)
let actual = try actualExpression.evaluate() as? AnyObject
#else
let actual = try actualExpression.evaluate() as AnyObject?
#endif
#else
#if !swift(>=3.4)
let actual = try actualExpression.evaluate() as? AnyObject
#else
let actual = try actualExpression.evaluate() as AnyObject?
#endif
#endif
#else
let actual = try actualExpression.evaluate() as AnyObject?
#endif

let bool: Bool
#if os(Linux)
bool = actual === (expected as? AnyObject) && actual !== nil
#if swift(>=4.0)
#if !swift(>=4.1.50)
bool = actual === (expected as? AnyObject) && actual !== nil
#else
bool = actual === (expected as AnyObject?) && actual !== nil
#endif
#else
#if !swift(>=3.4)
bool = actual === (expected as? AnyObject) && actual !== nil
#else
bool = actual === (expected as AnyObject?) && actual !== nil
#endif
#endif
#else
bool = actual === (expected as AnyObject?) && actual !== nil
#endif
Expand Down
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Await.swift
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ internal class AwaitPromiseBuilder<T> {
self.trigger.timeoutSource.resume()
while self.promise.asyncResult.isIncomplete() {
// Stopping the run loop does not work unless we run only 1 mode
#if swift(>=4.2)
#if swift(>=4.2) && (os(macOS) || os(iOS) || os(tvOS))
_ = RunLoop.current.run(mode: .default, before: .distantFuture)
#else
_ = RunLoop.current.run(mode: .defaultRunLoopMode, before: .distantFuture)
Expand Down
14 changes: 13 additions & 1 deletion Carthage/Checkouts/Nimble/Sources/Nimble/Utils/Stringers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@ import Foundation
internal func identityAsString(_ value: Any?) -> String {
let anyObject: AnyObject?
#if os(Linux)
anyObject = value as? AnyObject
#if swift(>=4.0)
#if !swift(>=4.1.50)
anyObject = value as? AnyObject
#else
anyObject = value as AnyObject?
#endif
#else
#if !swift(>=3.4)
anyObject = value as? AnyObject
#else
anyObject = value as AnyObject?
#endif
#endif
#else
anyObject = value as AnyObject?
#endif
Expand Down
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Nimble/test
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function test_podspec {

function test_swiftpm {
if [ -d .build ]; then
run swift build --clean
run swift build --clean || swift package clean
fi
run swift build && swift test
}
Expand Down
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Quick/Quick.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Quick"
s.version = "1.3.1"
s.version = "1.3.2"
s.summary = "The Swift (and Objective-C) testing framework."

s.description = <<-DESC
Expand Down
Loading