1
1
mirror of https://github.com/nsomar/Swiftline.git synced 2024-08-15 08:30:37 +03:00

Merge pull request #25 from oarrabi/swift3

Moving to swift3
This commit is contained in:
Omar Abdelhafith 2016-09-27 22:25:02 +03:00 committed by GitHub
commit 4f84dee14e
91 changed files with 1851 additions and 1166 deletions

2
.gitignore vendored
View File

@ -43,7 +43,6 @@ Pods/
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts
Carthage/Build
### Objective-C ###
@ -172,3 +171,4 @@ crashlytics-build.properties
Examples/Rome/
TestPackage/.build
.build/
SwiftlineTests/Carthage/Checkouts

View File

@ -1,16 +1,11 @@
sudo: false
language: objective-c
osx_image: xcode7.3
cache: cocoapods
podfile: SwiftlineTests/Podfile
before_install:
- gem install cocoapods-rome
- pod install --project-directory=SwiftlineTests --no-integrate
osx_image: xcode8
install:
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
script:
- make test
- pod lib lint --quick

View File

@ -22,7 +22,7 @@ build_help:
- git stash pop
test:
cd SwiftlineTests; xctool -project Swiftline.xcodeproj -scheme Swiftline clean build test -sdk macosx GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES
cd SwiftlineTests; xcodebuild -project Swiftline.xcodeproj -scheme Swiftline clean build test -sdk macosx GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES
test-spm:
cd TestPackage && rm -rf .build

View File

@ -12,7 +12,7 @@
- parameter prompt: The prompt to display
- returns: the user decision
*/
public func agree(prompt: String) -> Bool {
public func agree(_ prompt: String) -> Bool {
PromptSettings.print(prompt, terminator: " ")
let value = readStringOrEmpty()
@ -20,4 +20,4 @@ public func agree(prompt: String) -> Bool {
let validatedValue = askForValidatedItem(originalValue: value, validator: settings)
return settings.isPositive(validatedValue)
}
}

View File

@ -22,8 +22,8 @@ class AgreeSettings: AskerValidator {
return string
}
func invalidItemMessage(string: String?) -> String? {
if let message = string where positiveValues.contains(message) || negativeValues.contains(message) {
func invalidItemMessage(_ string: String?) -> String? {
if let message = string , positiveValues.contains(message) || negativeValues.contains(message) {
return nil
}
@ -34,7 +34,7 @@ class AgreeSettings: AskerValidator {
return "\(prompt) "
}
func isPositive(item: String) -> Bool {
func isPositive(_ item: String) -> Bool {
return positiveValues.contains(item)
}

View File

@ -13,7 +13,7 @@
public protocol ArgConvertibleType {
/// Create an instance out of a string
static func fromString(string: String) -> Self?
static func fromString(_ string: String) -> Self?
/// Return the display name of a type
static func typeName() -> String
@ -21,7 +21,7 @@ public protocol ArgConvertibleType {
extension Int: ArgConvertibleType {
public static func fromString(string: String) -> Int? {
public static func fromString(_ string: String) -> Int? {
return Int(string)
}
@ -32,7 +32,7 @@ extension Int: ArgConvertibleType {
extension Double: ArgConvertibleType {
public static func fromString(string: String) -> Double? {
public static func fromString(_ string: String) -> Double? {
return Double(string)
}
@ -42,7 +42,7 @@ extension Double: ArgConvertibleType {
}
extension Float: ArgConvertibleType {
public static func fromString(string: String) -> Float? {
public static func fromString(_ string: String) -> Float? {
return Float(string)
}
@ -53,7 +53,7 @@ extension Float: ArgConvertibleType {
extension String: ArgConvertibleType {
public static func fromString(string: String) -> String? {
public static func fromString(_ string: String) -> String? {
return string
}

View File

@ -11,7 +11,7 @@
public class Args {
/// Return the list of arguments passed to the script
public static var all: [String] {
open static var all: [String] {
return ProcessInfo.arguments
}
@ -21,9 +21,9 @@ public class Args {
/// The flags are recognized as short flags `-f` or long flags `--force`
/// The flag value will be the argument that follows the flag
/// `--` is used to mark the terminatin of the flags
public static var parsed: ParsedArgs {
open static var parsed: ParsedArgs {
if let result = cachedResults where ProcessInfo.cacheResults {
if let result = cachedResults , ProcessInfo.cacheResults {
return result
}
@ -58,4 +58,4 @@ public struct ParsedArgs {
/// List of parameters passed to the script
public let parameters: [String]
}
}

View File

@ -8,7 +8,7 @@
class ArgsParser {
static func parseFlags(args: [String]) -> ([Option], [String]) {
static func parseFlags(_ args: [String]) -> ([Option], [String]) {
var options = [Option]()
var others = [String]()
var previousArgument: Argument?
@ -33,7 +33,7 @@ class ArgsParser {
continue
}
if let previousArgument = previousArgument where previousArgument.isFlag {
if let previousArgument = previousArgument , previousArgument.isFlag {
updatelastOption(forArray: &options, withValue: argumentString)
} else {
others += [argument.name]
@ -44,7 +44,7 @@ class ArgsParser {
}
static func updatelastOption(inout forArray array: [Option], withValue value: String) {
static func updatelastOption(forArray array: inout [Option], withValue value: String) {
var previousOption = array.last!
previousOption.value = value
array.removeLast()

View File

@ -22,29 +22,29 @@ struct Option {
struct Argument {
enum ArgumentType {
case ShortFlag
case LongFlag
case NotAFlag
case FlagsTerminator
case shortFlag
case longFlag
case notAFlag
case flagsTerminator
var isFlag: Bool {
return self != .NotAFlag
return self != .notAFlag
}
var isFlagTerminator: Bool {
return self == .FlagsTerminator
return self == .flagsTerminator
}
init(_ argument: String) {
if argument == "--" {
self = .FlagsTerminator
self = .flagsTerminator
} else if argument.hasPrefix("--") {
self = .LongFlag
self = .longFlag
} else if argument.hasPrefix("-") {
self = .ShortFlag
self = .shortFlag
} else {
self = .NotAFlag
self = .notAFlag
}
}
}
@ -67,13 +67,13 @@ struct Argument {
var name: String {
switch type {
case .NotAFlag:
case .notAFlag:
return argument
case .ShortFlag:
case .shortFlag:
return argument[1..<argument.utf8.count]
case .LongFlag:
case .longFlag:
return argument[2..<argument.utf8.count]
case .FlagsTerminator:
case .flagsTerminator:
return ""
}
}
@ -82,13 +82,15 @@ struct Argument {
extension String {
public subscript (range: Range<Int>) -> String {
let length = self.lengthOfBytesUsingEncoding(NSUTF8StringEncoding)
let length = self.lengthOfBytes(using: String.Encoding.utf8)
var distanceFromEndIndex = length - range.endIndex
var distanceFromEndIndex = length - range.upperBound
if distanceFromEndIndex < 0 {
distanceFromEndIndex = 0
}
return self[startIndex.advancedBy(range.startIndex) ..< endIndex.advancedBy(-distanceFromEndIndex)]
let actualRange = (characters.index(startIndex, offsetBy: range.lowerBound) ..< characters.index(endIndex, offsetBy: -distanceFromEndIndex))
return self[actualRange]
}
}

View File

@ -15,7 +15,7 @@
- returns: The string enters from the user
*/
public func ask(prompt: String, customizationBlock: (AskSettings<String> -> Void)? = nil) -> String {
public func ask(_ prompt: String, customizationBlock: ((AskSettings<String>) -> Void)? = nil) -> String {
return ask(prompt, type: String.self, customizationBlock: customizationBlock)
}
@ -30,7 +30,7 @@ public func ask(prompt: String, customizationBlock: (AskSettings<String> -> Void
- returns: The string casted to the type requested
- discussion: If the user enters a wrong type, ask will keep prompting until a correct value has been entered
*/
public func ask<T: ArgConvertibleType>(prompt: String, type: T.Type, customizationBlock: (AskSettings<T> -> Void)? = nil) -> T {
public func ask<T: ArgConvertibleType>(_ prompt: String, type: T.Type, customizationBlock: ((AskSettings<T>) -> Void)? = nil) -> T {
PromptSettings.print(prompt)
@ -47,13 +47,13 @@ public func ask<T: ArgConvertibleType>(prompt: String, type: T.Type, customizati
// MARK:- Internal functions
func getValidatedString<T: ArgConvertibleType, W: AskerValidator where W.Item == T>(validator: W) -> T {
func getValidatedString<T: ArgConvertibleType, W: AskerValidator>(_ validator: W) -> T where W.Item == T {
let stringOrEmpty = readStringOrEmpty()
return askForValidatedItem(originalValue: stringOrEmpty, validator: validator)
}
func getValidatedStringWithConfirmation<T: ArgConvertibleType, W: AskerValidator where W.Item == T>(validator: W) -> T {
func getValidatedStringWithConfirmation<T: ArgConvertibleType, W: AskerValidator>(_ validator: W) -> T where W.Item == T {
while true {
let stringOrEmpty = readStringOrEmpty()
@ -68,7 +68,7 @@ func getValidatedStringWithConfirmation<T: ArgConvertibleType, W: AskerValidator
}
func getSettings<T>(callback: (AskSettings<T> -> Void)?) -> AskSettings<T> {
func getSettings<T>(_ callback: ((AskSettings<T>) -> Void)?) -> AskSettings<T> {
let settings = AskSettings<T>()
callback?(settings)
return settings

View File

@ -17,7 +17,7 @@ public class AskSettings<T: ArgConvertibleType> {
/// his selection
public var confirm = false
var invalidClousures: [(T -> Bool, String)] = []
var invalidClousures: [((T) -> Bool, String)] = []
/**
@ -27,8 +27,8 @@ public class AskSettings<T: ArgConvertibleType> {
- parameter invalidIfTrue: If true is returned, then the user input was invalid, if false, the
user input was valid.
*/
public func addInvalidCase(description: String, invalidIfTrue: (T -> Bool)) {
invalidClousures.append(invalidIfTrue, description)
public func addInvalidCase(_ description: String, invalidIfTrue: @escaping ((T) -> Bool)) {
invalidClousures.append((invalidIfTrue, description))
}
func preparedItem(originalString string: String) -> T {
@ -45,7 +45,7 @@ public class AskSettings<T: ArgConvertibleType> {
extension AskSettings: AskerValidator {
func invalidItemMessage(string: String?) -> String? {
func invalidItemMessage(_ string: String?) -> String? {
guard let string = string else {
return "You provided an empty message, pelase enter anything!"
}
@ -69,7 +69,7 @@ extension AskSettings: AskerValidator {
return T.fromString(string)!
}
func firstValidationError(item: T) -> String? {
func firstValidationError(_ item: T) -> String? {
for (isInvalid, validationError) in invalidClousures {
if isInvalid(item) {
@ -79,4 +79,4 @@ extension AskSettings: AskerValidator {
return nil
}
}
}

View File

@ -10,14 +10,14 @@
protocol AskerValidator {
associatedtype Item
func invalidItemMessage(string: String?) -> String?
func invalidItemMessage(_ string: String?) -> String?
func newItemPromptMessage() -> String
func validatedItem(forString string: String) -> Item
}
func askForValidatedItem<T, W: AskerValidator where W.Item == T>
(originalValue value: String, validator: W) -> T {
func askForValidatedItem<T, W: AskerValidator>
(originalValue value: String, validator: W) -> T where W.Item == T {
var validatedValue: String = value

View File

@ -16,7 +16,7 @@
- returns: The user selected item
*/
public func choose(prompt: String, choices: String...) -> String {
public func choose(_ prompt: String, choices: String...) -> String {
return choose(prompt, type: String.self) {
for choice in choices {
$0.addChoice(choice) { return choice }
@ -32,7 +32,7 @@ public func choose(prompt: String, choices: String...) -> String {
- returns: The user selected item
*/
public func choose<T>(costumizationBlock: (ChooseSettings<T> -> Void)) -> T {
public func choose<T>(_ costumizationBlock: ((ChooseSettings<T>) -> Void)) -> T {
let settings = getChooseSettings(costumizationBlock)
return choose(settings, type: T.self)
@ -48,7 +48,7 @@ public func choose<T>(costumizationBlock: (ChooseSettings<T> -> Void)) -> T {
- returns: The user selected item
*/
public func choose<T>(prompt: String, type: T.Type, costumizationBlock: (ChooseSettings<T> -> Void)) -> T {
public func choose<T>(_ prompt: String, type: T.Type, costumizationBlock: ((ChooseSettings<T>) -> Void)) -> T {
let settings = getChooseSettings(costumizationBlock)
settings.promptQuestion = prompt
@ -64,7 +64,7 @@ public func choose<T>(prompt: String, type: T.Type, costumizationBlock: (ChooseS
- returns: The user selected item
*/
public func choose<T>(type: T.Type, costumizationBlock: (ChooseSettings<T> -> Void)) -> T {
public func choose<T>(_ type: T.Type, costumizationBlock: ((ChooseSettings<T>) -> Void)) -> T {
let settings = getChooseSettings(costumizationBlock)
return choose(settings, type: type)
@ -74,7 +74,7 @@ public func choose<T>(type: T.Type, costumizationBlock: (ChooseSettings<T> -> Vo
// MARK :- Internal functions
func choose<T>(settings: ChooseSettings<T>, type: T.Type) -> T {
func choose<T>(_ settings: ChooseSettings<T>, type: T.Type) -> T {
let items = settings.preparePromptItems()
@ -86,8 +86,8 @@ func choose<T>(settings: ChooseSettings<T>, type: T.Type) -> T {
return askForValidatedItem(originalValue: stringRead, validator: settings)
}
func getChooseSettings<T>(costumizationBlock: ChooseSettings<T> -> Void) -> ChooseSettings<T> {
func getChooseSettings<T>(_ costumizationBlock: (ChooseSettings<T>) -> Void) -> ChooseSettings<T> {
let settings = ChooseSettings<T>()
costumizationBlock(settings)
return settings
}
}

View File

@ -14,8 +14,8 @@
- Numbers: Use numbers as choice index (1. 2. 3.)
*/
public enum ChoiceIndexType {
case Letters
case Numbers
case letters
case numbers
}
@ -24,13 +24,13 @@ public enum ChoiceIndexType {
public class ChooseSettings<T> {
typealias Item = T
var choices: [(choice: String, callback: Void -> T)] = []
var choices: [(choice: String, callback: (Void) -> T)] = []
/// Prompt message to use
public var promptQuestion = ""
/// Choice index used for choose items
public var index = ChoiceIndexType.Numbers
public var index = ChoiceIndexType.numbers
/// Index suffix used between the index and the item
public var indexSuffix = ". "
@ -41,7 +41,7 @@ public class ChooseSettings<T> {
- parameter choice: Item name
- parameter callback: callback called when the item is selected, the value returned from this call back will be returned from choose
*/
public func addChoice(choice: String..., callback: Void -> T) {
public func addChoice(_ choice: String..., callback: @escaping (Void) -> T) {
choice.forEach {
choices.append(($0, callback))
}
@ -58,7 +58,7 @@ public class ChooseSettings<T> {
return choices.map { $0.choice }
}
func choiceForInput(item: String) -> T? {
func choiceForInput(_ item: String) -> T? {
if let value = Int(item) {
return choiceWithIntValue(value)
} else {
@ -66,7 +66,7 @@ public class ChooseSettings<T> {
}
}
func choiceWithIntValue(value: Int) -> T? {
func choiceWithIntValue(_ value: Int) -> T? {
let index = value - 1
if index >= 0 && index < choices.count {
return choices[index].callback()
@ -75,8 +75,8 @@ public class ChooseSettings<T> {
return nil
}
func choiceWithStringValue(value: String) -> T? {
let possibleIndex = choices.indexOf { $0.choice == value }
func choiceWithStringValue(_ value: String) -> T? {
let possibleIndex = choices.index { $0.choice == value }
if let index = possibleIndex {
return choices[index].callback()
}
@ -91,13 +91,13 @@ public class ChooseSettings<T> {
}
func indexChoices() -> [String] {
return stringChoices().enumerate().map { itemIndex, string in
return stringChoices().enumerated().map { itemIndex, string in
if index == .Numbers {
if index == .numbers {
return "\(itemIndex + 1)"
} else {
let character = "a".unicodeScalars.first!.value + UInt32(itemIndex)
return String(Character(UnicodeScalar(character)))
return String(Character(UnicodeScalar(character)!))
}
}
}
@ -111,13 +111,13 @@ extension ChooseSettings: AskerValidator {
return choiceForInput(string)!
}
func invalidItemMessage(string: String?) -> String? {
func invalidItemMessage(_ string: String?) -> String? {
if choiceForInput(string!) != nil {
return nil
}
let baseMessage = "You must choose one of"
let choicesString = validChoices().joinWithSeparator(", ")
let choicesString = validChoices().joined(separator: ", ")
return "\(baseMessage) [\(choicesString)]."
}
@ -125,4 +125,4 @@ extension ChooseSettings: AskerValidator {
func newItemPromptMessage() -> String {
return "? "
}
}
}

View File

@ -15,37 +15,37 @@ class CommandExecutor {
static var currentTaskExecutor: TaskExecutor = ActualTaskExecutor()
class func execute(commandParts: [String]) -> ExecutorReturnValue {
class func execute(_ commandParts: [String]) -> ExecutorReturnValue {
return currentTaskExecutor.execute(commandParts)
}
}
protocol TaskExecutor {
func execute(commandParts: [String]) -> ExecutorReturnValue
func execute(_ commandParts: [String]) -> ExecutorReturnValue
}
class DryTaskExecutor: TaskExecutor {
func execute(commandParts: [String]) -> ExecutorReturnValue {
let command = commandParts.joinWithSeparator(" ")
func execute(_ commandParts: [String]) -> ExecutorReturnValue {
let command = commandParts.joined(separator: " ")
PromptSettings.print("Executed command '\(command)'")
return (0,
Dryipe(dataToReturn: "".dataUsingEncoding(NSUTF8StringEncoding)!),
Dryipe(dataToReturn: "".dataUsingEncoding(NSUTF8StringEncoding)!))
Dryipe(dataToReturn: "".data(using: String.Encoding.utf8)!),
Dryipe(dataToReturn: "".data(using: String.Encoding.utf8)!))
}
}
class ActualTaskExecutor: TaskExecutor {
func execute(commandParts: [String]) -> ExecutorReturnValue {
let task = NSTask()
func execute(_ commandParts: [String]) -> ExecutorReturnValue {
let task = Process()
task.launchPath = "/usr/bin/env"
task.arguments = commandParts
let stdoutPipe = NSPipe()
let stderrPipe = NSPipe()
let stdoutPipe = Pipe()
let stderrPipe = Pipe()
task.standardOutput = stdoutPipe
task.standardError = stderrPipe
@ -58,10 +58,25 @@ class ActualTaskExecutor: TaskExecutor {
class InteractiveTaskExecutor: TaskExecutor {
func execute(commandParts: [String]) -> ExecutorReturnValue {
let result = system(commandParts.joinWithSeparator(" "))
func execute(_ commandParts: [String]) -> ExecutorReturnValue {
let argv: [UnsafeMutablePointer<CChar>?] = commandParts.map{ $0.withCString(strdup) }
defer { for case let arg? in argv { free(arg) } }
let emptyPipe = Dryipe(dataToReturn: "".dataUsingEncoding(NSUTF8StringEncoding)!)
var childFDActions: posix_spawn_file_actions_t? = nil
var outputPipe: [Int32] = [-1, -1]
posix_spawn_file_actions_init(&childFDActions)
posix_spawn_file_actions_adddup2(&childFDActions, outputPipe[1], 1)
posix_spawn_file_actions_adddup2(&childFDActions, outputPipe[1], 2)
posix_spawn_file_actions_addclose(&childFDActions, outputPipe[0])
posix_spawn_file_actions_addclose(&childFDActions, outputPipe[1])
var pid: pid_t = 0
let result = posix_spawn(&pid, argv[0], &childFDActions, nil, argv + [nil], nil)
let emptyPipe = Dryipe(dataToReturn: "".data(using: String.Encoding.utf8)!)
return (Int(result), emptyPipe, emptyPipe)
}
}
@ -80,12 +95,12 @@ class DummyTaskExecutor: TaskExecutor {
errorToReturn = error
}
func execute(commandParts: [String]) -> ExecutorReturnValue {
let command = commandParts.joinWithSeparator(" ")
func execute(_ commandParts: [String]) -> ExecutorReturnValue {
let command = commandParts.joined(separator: " ")
commandsExecuted.append(command)
return (statusCodeToReturn,
Dryipe(dataToReturn: outputToReturn.dataUsingEncoding(NSUTF8StringEncoding)!),
Dryipe(dataToReturn: errorToReturn.dataUsingEncoding(NSUTF8StringEncoding)!))
Dryipe(dataToReturn: outputToReturn.data(using: String.Encoding.utf8)!),
Dryipe(dataToReturn: errorToReturn.data(using: String.Encoding.utf8)!))
}
}

View File

@ -13,8 +13,8 @@ public class Env {
/// Return the list of all the enviromenment keys passed to the script
public static var keys: [String] {
let keyValues = run("env").stdout.componentsSeparatedByString("\n")
let keys = keyValues.map { $0.componentsSeparatedByString("=").first! }.filter { !$0.isEmpty }
let keyValues = run("env").stdout.components(separatedBy: "\n")
let keys = keyValues.map { $0.components(separatedBy: "=").first! }.filter { !$0.isEmpty }
return keys
}
@ -30,9 +30,9 @@ public class Env {
- returns: The enviromenment variable value
*/
public static func get(key: String) -> String? {
let value = getenv(key)
return String.fromCString(value)
public static func get(_ key: String) -> String? {
guard let value = getenv(key) else { return nil }
return String(cString: value)
}
/**
@ -41,7 +41,7 @@ public class Env {
- parameter key: The enviromenment variable key
- parameter value: The enviromenment variable value
*/
public static func set(key: String, _ value: String?) {
public static func set(_ key: String, _ value: String?) {
if let newValue = value {
setenv(key, newValue, 1)
} else {
@ -67,7 +67,7 @@ public class Env {
- returns: true if exists false otherwise
*/
public static func hasKey(key: String) -> Bool {
public static func hasKey(_ key: String) -> Bool {
return self.keys.contains(key)
}
@ -79,7 +79,7 @@ public class Env {
- returns: true if exists false otherwise
*/
public static func hasValue(value: String) -> Bool {
public static func hasValue(_ value: String) -> Bool {
return self.values.contains(value)
}
@ -88,7 +88,7 @@ public class Env {
- parameter callback: callback to call on each key/value pair
*/
public static func eachPair(callback: (key: String, value: String) -> ()) {
public static func eachPair(_ callback: (_ key: String, _ value: String) -> ()) {
zip(self.keys, self.values).forEach(callback)
}

View File

@ -11,14 +11,17 @@ import Darwin
class Glob {
static func expand(pattern: String) -> [String] {
static func expand(_ pattern: String) -> [String] {
var files = [String]()
var gt: glob_t = glob_t()
if (glob(pattern.cStringUsingEncoding(NSUTF8StringEncoding)!, 0, nil, &gt) == 0) {
if (glob(pattern.cString(using: String.Encoding.utf8)!, 0, nil, &gt) == 0) {
for i in (0..<gt.gl_matchc) {
files.append(String(CString: gt.gl_pathv[Int(i)], encoding: NSUTF8StringEncoding)!)
let x = gt.gl_pathv[Int(i)]
let c = UnsafePointer<CChar>(x)!
let s = String.init(cString: c)
files.append(s)
}
}

View File

@ -14,7 +14,7 @@ protocol ProcessInfoType {
var cacheResults: Bool { get }
}
extension NSProcessInfo: ProcessInfoType {
extension Foundation.ProcessInfo: ProcessInfoType {
var cacheResults: Bool { return true }
}
@ -35,7 +35,7 @@ class DummyProcessInfo: ProcessInfoType {
class ProcessInfo {
static var internalProcessInfo: ProcessInfoType = NSProcessInfo()
static var internalProcessInfo: ProcessInfoType = Foundation.ProcessInfo()
static var arguments: [String] {
return internalProcessInfo.arguments

View File

@ -8,12 +8,12 @@
protocol PromptPrinter {
func printString(string: String, terminator: String)
func printString(_ string: String, terminator: String)
}
class ConsolePromptPrinter: PromptPrinter {
func printString(string: String, terminator: String = "\n") {
func printString(_ string: String, terminator: String = "\n") {
return print(string, separator: "", terminator: terminator)
}
}
@ -22,7 +22,7 @@ class DummyPromptPrinter: PromptPrinter {
var printed = ""
func printString(string: String, terminator: String = "\n") {
func printString(_ string: String, terminator: String = "\n") {
printed += string + terminator
}
}
}

View File

@ -16,7 +16,7 @@ class PromptSettings {
return reader.read()
}
class func print(string: String, terminator: String = "\n") {
class func print(_ string: String, terminator: String = "\n") {
return printer.printString(string, terminator: terminator)
}
}
}

View File

@ -26,15 +26,15 @@ public struct RunResults {
// MARK:- Internal
func splitCommandToArgs(command: String) -> [String] {
if command.containsString(" ") {
return command.componentsSeparatedByString(" ")
func splitCommandToArgs(_ command: String) -> [String] {
if command.contains(" ") {
return command.components(separatedBy: " ")
}
return [command]
}
func readPipe(pipe: TaskPipe) -> String {
func readPipe(_ pipe: TaskPipe) -> String {
let data = pipe.read()
return NSString(data: data, encoding: NSUTF8StringEncoding) as? String ?? ""
}
return NSString(data: data as Data, encoding: String.Encoding.utf8.rawValue) as? String ?? ""
}

View File

@ -11,42 +11,42 @@ import Foundation
class 🏃{
class func runWithoutCapture(command: String) -> Int {
class func runWithoutCapture(_ command: String) -> Int {
let initalSettings = RunSettings()
initalSettings.interactive = true
return run(command, args: [], settings: initalSettings).exitStatus
}
class func run(command: String, args: String...) -> RunResults {
class func run(_ command: String, args: String...) -> RunResults {
return run(command, args: args as [String])
}
class func run(command: String, args: [String]) -> RunResults {
class func run(_ command: String, args: [String]) -> RunResults {
let settings = RunSettings()
return run(command, args: args, settings: settings)
}
class func run(command: String, settings: (RunSettings -> Void)) -> RunResults {
class func run(_ command: String, settings: ((RunSettings) -> Void)) -> RunResults {
let initalSettings = RunSettings()
settings(initalSettings)
return run(command, args: [], settings: initalSettings)
}
class func run(command: String, args: [String], settings: (RunSettings -> Void)) -> RunResults {
class func run(_ command: String, args: [String], settings: ((RunSettings) -> Void)) -> RunResults {
let initalSettings = RunSettings()
settings(initalSettings)
return run(command, args: args, settings: initalSettings)
}
class func run(command: String, echo: EchoSettings) -> RunResults {
class func run(_ command: String, echo: EchoSettings) -> RunResults {
let initalSettings = RunSettings()
initalSettings.echo = echo
return run(command, args: [], settings: initalSettings)
}
class func run(command: String, args: [String], settings: RunSettings) -> RunResults {
class func run(_ command: String, args: [String], settings: RunSettings) -> RunResults {
let commandParts = commandToRun(command, args: args)
@ -67,37 +67,37 @@ class 🏃{
return result
}
private class func executeDryCommand(commandParts: [String]) -> RunResults {
fileprivate class func executeDryCommand(_ commandParts: [String]) -> RunResults {
return execute(commandParts, withExecutor: DryTaskExecutor())
}
private class func executeIneractiveCommand(commandParts: [String]) -> RunResults {
fileprivate class func executeIneractiveCommand(_ commandParts: [String]) -> RunResults {
return execute(commandParts, withExecutor: InteractiveTaskExecutor())
}
private class func executeActualCommand(commandParts: [String]) -> RunResults {
fileprivate class func executeActualCommand(_ commandParts: [String]) -> RunResults {
return execute(commandParts, withExecutor: CommandExecutor.currentTaskExecutor)
}
private class func execute(commandParts: [String], withExecutor executor: TaskExecutor) -> RunResults {
fileprivate class func execute(_ commandParts: [String], withExecutor executor: TaskExecutor) -> RunResults {
let (status, stdoutPipe, stderrPipe) = executor.execute(commandParts)
let stdout = readPipe(stdoutPipe).stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet())
let stderr = readPipe(stderrPipe).stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet())
let stdout = readPipe(stdoutPipe).trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)
let stderr = readPipe(stderrPipe).trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)
return RunResults(exitStatus: status, stdout: stdout, stderr: stderr)
}
private class func commandToRun(command: String, args: [String]) -> [String] {
fileprivate class func commandToRun(_ command: String, args: [String]) -> [String] {
return splitCommandToArgs(command) + args
}
private class func echoCommand(command: [String], settings: RunSettings) {
fileprivate class func echoCommand(_ command: [String], settings: RunSettings) {
if settings.echo.contains(.Command) {
echoStringIfNotEmpty("Command", string: command.joinWithSeparator(" "))
echoStringIfNotEmpty("Command", string: command.joined(separator: " "))
}
}
private class func echoResult(result: RunResults, settings: RunSettings) {
fileprivate class func echoResult(_ result: RunResults, settings: RunSettings) {
if settings.echo.contains(.Stdout) {
echoStringIfNotEmpty("Stdout", string: result.stdout)
}
@ -107,7 +107,7 @@ class 🏃{
}
}
private class func echoStringIfNotEmpty(title: String, string: String) {
fileprivate class func echoStringIfNotEmpty(_ title: String, string: String) {
if !string.isEmpty {
PromptSettings.print("\(title): \n\(string)")
}

View File

@ -22,7 +22,7 @@ public class RunSettings {
/// Echo settings
public struct EchoSettings: OptionSetType {
public struct EchoSettings: OptionSet {
public let rawValue: Int
@ -41,4 +41,4 @@ public struct EchoSettings: OptionSetType {
/// Echo the command executed to the terminal
public static let Command = EchoSettings(rawValue: 1 << 2)
}
}

View File

@ -16,7 +16,7 @@
- returns: RunResults describing the command results
*/
public func run(command: String, args: String...) -> RunResults {
public func run(_ command: String, args: String...) -> RunResults {
return 🏃.run(command, args: args as [String])
}
@ -29,8 +29,8 @@ public func run(command: String, args: String...) -> RunResults {
- returns: RunResults describing the command results
*/
public func run(command: String, argsString: String) -> RunResults {
let args = argsString.componentsSeparatedByString(" ").filter { !$0.isEmpty }
public func run(_ command: String, argsString: String) -> RunResults {
let args = argsString.components(separatedBy: " ").filter { !$0.isEmpty }
return 🏃.run(command, args: args)
}
@ -43,7 +43,7 @@ public func run(command: String, argsString: String) -> RunResults {
- returns: RunResults describing the command results
*/
public func run(command: String, args: [String]) -> RunResults {
public func run(_ command: String, args: [String]) -> RunResults {
return 🏃.run(command, args: args)
}
@ -56,7 +56,7 @@ public func run(command: String, args: [String]) -> RunResults {
- returns: RunResults describing the command results
*/
public func run(command: String, settingsBlock: (RunSettings -> Void)) -> RunResults {
public func run(_ command: String, settingsBlock: ((RunSettings) -> Void)) -> RunResults {
return 🏃.run(command, settings: settingsBlock)
}
@ -70,7 +70,7 @@ public func run(command: String, settingsBlock: (RunSettings -> Void)) -> RunRes
- returns: RunResults describing the command results
*/
public func run(command: String, args: [String], settings: (RunSettings -> Void)) -> RunResults {
public func run(_ command: String, args: [String], settings: ((RunSettings) -> Void)) -> RunResults {
return 🏃.run(command, args: args, settings: settings)
}
@ -83,7 +83,7 @@ public func run(command: String, args: [String], settings: (RunSettings -> Void)
- returns: RunResults describing the command results
*/
func run(command: String, echo: EchoSettings) -> RunResults {
func run(_ command: String, echo: EchoSettings) -> RunResults {
return 🏃.run(command, echo: echo)
}
@ -94,6 +94,6 @@ func run(command: String, echo: EchoSettings) -> RunResults {
- returns: executed command exit code
*/
public func runWithoutCapture(command: String) -> Int {
public func runWithoutCapture(_ command: String) -> Int {
return 🏃.runWithoutCapture(command)
}
}

View File

@ -14,35 +14,35 @@ extension String {
let string: String
public var Black: String {
return Colorizer(string: string, color: BackgroundColor.Black).description
return Colorizer(string: string, color: BackgroundColor.black).description
}
public var Red: String {
return Colorizer(string: string, color: BackgroundColor.Red).description
return Colorizer(string: string, color: BackgroundColor.red).description
}
public var Green: String {
return Colorizer(string: string, color: BackgroundColor.Green).description
return Colorizer(string: string, color: BackgroundColor.green).description
}
public var Yellow: String {
return Colorizer(string: string, color: BackgroundColor.Yellow).description
return Colorizer(string: string, color: BackgroundColor.yellow).description
}
public var Blue: String {
return Colorizer(string: string, color: BackgroundColor.Blue).description
return Colorizer(string: string, color: BackgroundColor.blue).description
}
public var Magenta: String {
return Colorizer(string: string, color: BackgroundColor.Magenta).description
return Colorizer(string: string, color: BackgroundColor.magenta).description
}
public var Cyan: String {
return Colorizer(string: string, color: BackgroundColor.Cyan).description
return Colorizer(string: string, color: BackgroundColor.cyan).description
}
public var White: String {
return Colorizer(string: string, color: BackgroundColor.White).description
return Colorizer(string: string, color: BackgroundColor.white).description
}
}
}
}

View File

@ -14,36 +14,36 @@ extension String {
let string: String
public var Black: String {
return Colorizer(string: string, color: ForegroundColor.Black).description
return Colorizer(string: string, color: ForegroundColor.black).description
}
public var Red: String {
return Colorizer(string: string, color: ForegroundColor.Red).description
return Colorizer(string: string, color: ForegroundColor.red).description
}
public var Green: String {
return Colorizer(string: string, color: ForegroundColor.Green).description
return Colorizer(string: string, color: ForegroundColor.green).description
}
public var Yellow: String {
return Colorizer(string: string, color: ForegroundColor.Yellow).description
return Colorizer(string: string, color: ForegroundColor.yellow).description
}
public var Blue: String {
return Colorizer(string: string, color: ForegroundColor.Blue).description
return Colorizer(string: string, color: ForegroundColor.blue).description
}
public var Magenta: String {
return Colorizer(string: string, color: ForegroundColor.Magenta).description
return Colorizer(string: string, color: ForegroundColor.magenta).description
}
public var Cyan: String {
return Colorizer(string: string, color: ForegroundColor.Cyan).description
return Colorizer(string: string, color: ForegroundColor.cyan).description
}
public var White: String {
return Colorizer(string: string, color: ForegroundColor.White).description
return Colorizer(string: string, color: ForegroundColor.white).description
}
}
}
}

View File

@ -15,101 +15,100 @@ let codesSeperators = ";"
protocol StringStyle {
var rawValue: Int { get }
func colorize(string string: String) -> String
var rawValue: Int { get }
func colorize(string: String) -> String
}
extension StringStyle {
func colorize(string: String) -> String {
func colorize(string string: String) -> String {
if hasAnyStyleCode(string) {
return colorizeStringAndAddCodeSeperators(string)
} else {
return colorizeStringWithoutPriorCode(string)
}
if hasAnyStyleCode(string) {
return colorizeStringAndAddCodeSeperators(string)
} else {
return colorizeStringWithoutPriorCode(string)
}
}
fileprivate func colorizeStringWithoutPriorCode(_ string: String) -> String {
return "\(preparedColorCode(self.rawValue))\(string)\(endingColorCode())"
}
fileprivate func colorizeStringAndAddCodeSeperators(_ string: String) -> String {
//To refactor and use regex matching instead of replacing strings and using tricks
let stringByRemovingEnding = removeEndingCode(string)
let sringwWithStart = "\(preparedColorCode(self.rawValue))\(stringByRemovingEnding)"
private func colorizeStringWithoutPriorCode(string: String) -> String {
return "\(preparedColorCode(self.rawValue))\(string)\(endingColorCode())"
}
let stringByAddingCodeSeperator = addCommandSeperators(sringwWithStart)
private func colorizeStringAndAddCodeSeperators(string: String) -> String {
//To refactor and use regex matching instead of replacing strings and using tricks
let stringByRemovingEnding = removeEndingCode(string)
let sringwWithStart = "\(preparedColorCode(self.rawValue))\(stringByRemovingEnding)"
let stringByAddingCodeSeperator = addCommandSeperators(sringwWithStart)
return "\(stringByAddingCodeSeperator)\(endingColorCode())"
}
return "\(stringByAddingCodeSeperator)\(endingColorCode())"
}
fileprivate func preparedColorCode(_ color: Int) -> String {
return "\(startOfCode)\(color)\(endOfCode)"
}
fileprivate func hasAnyStyleCode(_ string: String) -> Bool {
return string.contains(startOfCode)
}
fileprivate func addCommandSeperators(_ string: String) -> String {
var rangeWithInset = (string.characters.index(after: string.startIndex) ..< string.characters.index(before: string.endIndex))
let newString = string.replacingOccurrences(of: startOfCode, with: ";", options: .literal, range: rangeWithInset)
private func preparedColorCode(color: Int) -> String {
return "\(startOfCode)\(color)\(endOfCode)"
}
private func hasAnyStyleCode(string: String) -> Bool {
return string.containsString(startOfCode)
}
private func addCommandSeperators(string: String) -> String {
var rangeWithInset = string.startIndex.successor() ..< string.endIndex.predecessor()
let newString = string.stringByReplacingOccurrencesOfString(startOfCode, withString: ";", options: .LiteralSearch, range: rangeWithInset)
rangeWithInset = newString.startIndex.successor() ..< newString.endIndex.predecessor()
return newString.stringByReplacingOccurrencesOfString("m;", withString: ";", options: .LiteralSearch, range: rangeWithInset)
}
private func removeEndingCode(string: String) -> String {
let rangeWithInset = string.startIndex.successor() ..< string.endIndex
return string.stringByReplacingOccurrencesOfString(endingColorCode(), withString: "", options: .LiteralSearch, range: rangeWithInset)
}
private func endingColorCode() -> String {
return preparedColorCode(0)
}
rangeWithInset = (newString.characters.index(after: newString.startIndex) ..< newString.characters.index(before: newString.endIndex))
return newString.replacingOccurrences(of: "m;", with: ";", options: .literal, range: rangeWithInset)
}
fileprivate func removeEndingCode(_ string: String) -> String {
let rangeWithInset = (string.characters.index(after: string.startIndex) ..< string.endIndex)
return string.replacingOccurrences(of: endingColorCode(), with: "", options: .literal, range: rangeWithInset)
}
fileprivate func endingColorCode() -> String {
return preparedColorCode(0)
}
}
enum ForegroundColor: Int, StringStyle {
case Black = 30
case Red = 31
case Green = 32
case Yellow = 33
case Blue = 34
case Magenta = 35
case Cyan = 36
case White = 37
case black = 30
case red = 31
case green = 32
case yellow = 33
case blue = 34
case magenta = 35
case cyan = 36
case white = 37
}
enum BackgroundColor: Int, StringStyle {
case Black = 40
case Red = 41
case Green = 42
case Yellow = 43
case Blue = 44
case Magenta = 45
case Cyan = 46
case White = 47
case black = 40
case red = 41
case green = 42
case yellow = 43
case blue = 44
case magenta = 45
case cyan = 46
case white = 47
}
enum StringTextStyle: Int, StringStyle {
case Reset = 0
case Bold = 1
case Italic = 3
case Underline = 4
case Inverse = 7
case Strikethrough = 9
case BoldOff = 22
case ItalicOff = 23
case UnderlineOff = 24
case InverseOff = 27
case StrikethroughOff = 29
}
case reset = 0
case bold = 1
case italic = 3
case underline = 4
case inverse = 7
case strikethrough = 9
case boldOff = 22
case italicOff = 23
case underlineOff = 24
case inverseOff = 27
case strikethroughOff = 29
}

View File

@ -14,48 +14,48 @@ public extension String {
let string: String
public var Reset: String {
return Colorizer(string: string, color: StringTextStyle.Reset).description
return Colorizer(string: string, color: StringTextStyle.reset).description
}
public var Bold: String {
return Colorizer(string: string, color: StringTextStyle.Bold).description
return Colorizer(string: string, color: StringTextStyle.bold).description
}
public var Italic: String {
return Colorizer(string: string, color: StringTextStyle.Italic).description
return Colorizer(string: string, color: StringTextStyle.italic).description
}
public var Underline: String {
return Colorizer(string: string, color: StringTextStyle.Underline).description
return Colorizer(string: string, color: StringTextStyle.underline).description
}
public var Inverse: String {
return Colorizer(string: string, color: StringTextStyle.Inverse).description
return Colorizer(string: string, color: StringTextStyle.inverse).description
}
public var Strikethrough: String {
return Colorizer(string: string, color: StringTextStyle.Strikethrough).description
return Colorizer(string: string, color: StringTextStyle.strikethrough).description
}
public var BoldOff: String {
return Colorizer(string: string, color: StringTextStyle.BoldOff).description
return Colorizer(string: string, color: StringTextStyle.boldOff).description
}
public var ItalicOff: String {
return Colorizer(string: string, color: StringTextStyle.ItalicOff).description
return Colorizer(string: string, color: StringTextStyle.italicOff).description
}
public var UnderlineOff: String {
return Colorizer(string: string, color: StringTextStyle.UnderlineOff).description
return Colorizer(string: string, color: StringTextStyle.underlineOff).description
}
public var InverseOff: String {
return Colorizer(string: string, color: StringTextStyle.InverseOff).description
return Colorizer(string: string, color: StringTextStyle.inverseOff).description
}
public var StrikethroughOff: String {
return Colorizer(string: string, color: StringTextStyle.StrikethroughOff).description
return Colorizer(string: string, color: StringTextStyle.strikethroughOff).description
}
}
}
}

View File

@ -10,20 +10,20 @@ import Foundation
protocol TaskPipe {
func read() -> NSData
func read() -> Data
}
extension NSPipe: TaskPipe {
func read() -> NSData {
extension Pipe: TaskPipe {
func read() -> Data {
return fileHandleForReading.readDataToEndOfFile()
}
}
struct Dryipe: TaskPipe {
let dataToReturn: NSData
let dataToReturn: Data
func read() -> NSData {
func read() -> Data {
return dataToReturn
}
}
}

View File

@ -0,0 +1,7 @@
PRODUCT_NAME = $(TARGET_NAME)
SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator
MACOSX_DEPLOYMENT_TARGET = 10.10
DYLIB_INSTALL_NAME_BASE = @rpath
OTHER_SWIFT_FLAGS = -DXcode
COMBINE_HIDPI_IMAGES = YES
USE_HEADERMAP = NO

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,314 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
__src_cc_ref_Source/Agree.swift /* Agree.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/Agree.swift /* Agree.swift */; };
__src_cc_ref_Source/AgreeSettings.swift /* AgreeSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/AgreeSettings.swift /* AgreeSettings.swift */; };
__src_cc_ref_Source/ArgConvertible.swift /* ArgConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/ArgConvertible.swift /* ArgConvertible.swift */; };
__src_cc_ref_Source/Args.swift /* Args.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/Args.swift /* Args.swift */; };
__src_cc_ref_Source/ArgsParser.swift /* ArgsParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/ArgsParser.swift /* ArgsParser.swift */; };
__src_cc_ref_Source/Argument.swift /* Argument.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/Argument.swift /* Argument.swift */; };
__src_cc_ref_Source/Ask.swift /* Ask.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/Ask.swift /* Ask.swift */; };
__src_cc_ref_Source/AskSettings.swift /* AskSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/AskSettings.swift /* AskSettings.swift */; };
__src_cc_ref_Source/AskerValidator.swift /* AskerValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/AskerValidator.swift /* AskerValidator.swift */; };
__src_cc_ref_Source/Choose.swift /* Choose.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/Choose.swift /* Choose.swift */; };
__src_cc_ref_Source/ChooseSettings.swift /* ChooseSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/ChooseSettings.swift /* ChooseSettings.swift */; };
__src_cc_ref_Source/Colorizer.swift /* Colorizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/Colorizer.swift /* Colorizer.swift */; };
__src_cc_ref_Source/CommandExecutor.swift /* CommandExecutor.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/CommandExecutor.swift /* CommandExecutor.swift */; };
__src_cc_ref_Source/Env.swift /* Env.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/Env.swift /* Env.swift */; };
__src_cc_ref_Source/Glob.swift /* Glob.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/Glob.swift /* Glob.swift */; };
__src_cc_ref_Source/ProcessInfo.swift /* ProcessInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/ProcessInfo.swift /* ProcessInfo.swift */; };
__src_cc_ref_Source/PromptPrinter.swift /* PromptPrinter.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/PromptPrinter.swift /* PromptPrinter.swift */; };
__src_cc_ref_Source/PromptReader.swift /* PromptReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/PromptReader.swift /* PromptReader.swift */; };
__src_cc_ref_Source/PromptSettings.swift /* PromptSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/PromptSettings.swift /* PromptSettings.swift */; };
__src_cc_ref_Source/RunResults.swift /* RunResults.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/RunResults.swift /* RunResults.swift */; };
__src_cc_ref_Source/Runner.swift /* Runner.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/Runner.swift /* Runner.swift */; };
__src_cc_ref_Source/RunnerSettings.swift /* RunnerSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/RunnerSettings.swift /* RunnerSettings.swift */; };
__src_cc_ref_Source/ShortHandRunner.swift /* ShortHandRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/ShortHandRunner.swift /* ShortHandRunner.swift */; };
__src_cc_ref_Source/StringBackgroundColorizer.swift /* StringBackgroundColorizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/StringBackgroundColorizer.swift /* StringBackgroundColorizer.swift */; };
__src_cc_ref_Source/StringForegroundColorizer.swift /* StringForegroundColorizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/StringForegroundColorizer.swift /* StringForegroundColorizer.swift */; };
__src_cc_ref_Source/StringStyle.swift /* StringStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/StringStyle.swift /* StringStyle.swift */; };
__src_cc_ref_Source/StringStyleColorizer.swift /* StringStyleColorizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/StringStyleColorizer.swift /* StringStyleColorizer.swift */; };
__src_cc_ref_Source/TaskPipe.swift /* TaskPipe.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/TaskPipe.swift /* TaskPipe.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
__PBXFileRef_Package.swift /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/Agree.swift /* Agree.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Agree.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/AgreeSettings.swift /* AgreeSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgreeSettings.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/ArgConvertible.swift /* ArgConvertible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArgConvertible.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/Args.swift /* Args.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Args.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/ArgsParser.swift /* ArgsParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArgsParser.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/Argument.swift /* Argument.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Argument.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/Ask.swift /* Ask.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Ask.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/AskSettings.swift /* AskSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AskSettings.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/AskerValidator.swift /* AskerValidator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AskerValidator.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/Choose.swift /* Choose.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Choose.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/ChooseSettings.swift /* ChooseSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChooseSettings.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/Colorizer.swift /* Colorizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Colorizer.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/CommandExecutor.swift /* CommandExecutor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommandExecutor.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/Env.swift /* Env.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Env.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/Glob.swift /* Glob.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Glob.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/ProcessInfo.swift /* ProcessInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProcessInfo.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/PromptPrinter.swift /* PromptPrinter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromptPrinter.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/PromptReader.swift /* PromptReader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromptReader.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/PromptSettings.swift /* PromptSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromptSettings.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/RunResults.swift /* RunResults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunResults.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/Runner.swift /* Runner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Runner.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/RunnerSettings.swift /* RunnerSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerSettings.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/ShortHandRunner.swift /* ShortHandRunner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShortHandRunner.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/StringBackgroundColorizer.swift /* StringBackgroundColorizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringBackgroundColorizer.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/StringForegroundColorizer.swift /* StringForegroundColorizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringForegroundColorizer.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/StringStyle.swift /* StringStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringStyle.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/StringStyleColorizer.swift /* StringStyleColorizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringStyleColorizer.swift; sourceTree = "<group>"; };
__PBXFileRef_Source/TaskPipe.swift /* TaskPipe.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TaskPipe.swift; sourceTree = "<group>"; };
__PBXFileRef_Swiftline.xcodeproj/Configs/Project.xcconfig /* Swiftline.xcodeproj/Configs/Project.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Swiftline.xcodeproj/Configs/Project.xcconfig; sourceTree = "<group>"; };
"_____Product_Swiftline" /* Swiftline.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Swiftline.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
"___LinkPhase_Swiftline" /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 0;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
"___RootGroup_" = {
isa = PBXGroup;
children = (
__PBXFileRef_Package.swift /* Package.swift */,
"_____Configs_" /* Configs */,
"_____Sources_" /* Sources */,
"____Products_" /* Products */,
);
sourceTree = "<group>";
};
"____Products_" /* Products */ = {
isa = PBXGroup;
children = (
"_____Product_Swiftline" /* Swiftline.framework */,
);
name = Products;
sourceTree = "<group>";
};
"_____Configs_" /* Configs */ = {
isa = PBXGroup;
children = (
__PBXFileRef_Swiftline.xcodeproj/Configs/Project.xcconfig /* Swiftline.xcodeproj/Configs/Project.xcconfig */,
);
name = Configs;
sourceTree = "<group>";
};
"_____Sources_" /* Sources */ = {
isa = PBXGroup;
children = (
"_______Group_Swiftline" /* Swiftline */,
);
name = Sources;
sourceTree = "<group>";
};
"_______Group_Swiftline" /* Swiftline */ = {
isa = PBXGroup;
children = (
__PBXFileRef_Source/Agree.swift /* Agree.swift */,
__PBXFileRef_Source/AgreeSettings.swift /* AgreeSettings.swift */,
__PBXFileRef_Source/ArgConvertible.swift /* ArgConvertible.swift */,
__PBXFileRef_Source/Args.swift /* Args.swift */,
__PBXFileRef_Source/ArgsParser.swift /* ArgsParser.swift */,
__PBXFileRef_Source/Argument.swift /* Argument.swift */,
__PBXFileRef_Source/Ask.swift /* Ask.swift */,
__PBXFileRef_Source/AskerValidator.swift /* AskerValidator.swift */,
__PBXFileRef_Source/AskSettings.swift /* AskSettings.swift */,
__PBXFileRef_Source/Choose.swift /* Choose.swift */,
__PBXFileRef_Source/ChooseSettings.swift /* ChooseSettings.swift */,
__PBXFileRef_Source/Colorizer.swift /* Colorizer.swift */,
__PBXFileRef_Source/CommandExecutor.swift /* CommandExecutor.swift */,
__PBXFileRef_Source/Env.swift /* Env.swift */,
__PBXFileRef_Source/Glob.swift /* Glob.swift */,
__PBXFileRef_Source/ProcessInfo.swift /* ProcessInfo.swift */,
__PBXFileRef_Source/PromptPrinter.swift /* PromptPrinter.swift */,
__PBXFileRef_Source/PromptReader.swift /* PromptReader.swift */,
__PBXFileRef_Source/PromptSettings.swift /* PromptSettings.swift */,
__PBXFileRef_Source/Runner.swift /* Runner.swift */,
__PBXFileRef_Source/RunnerSettings.swift /* RunnerSettings.swift */,
__PBXFileRef_Source/RunResults.swift /* RunResults.swift */,
__PBXFileRef_Source/ShortHandRunner.swift /* ShortHandRunner.swift */,
__PBXFileRef_Source/StringBackgroundColorizer.swift /* StringBackgroundColorizer.swift */,
__PBXFileRef_Source/StringForegroundColorizer.swift /* StringForegroundColorizer.swift */,
__PBXFileRef_Source/StringStyle.swift /* StringStyle.swift */,
__PBXFileRef_Source/StringStyleColorizer.swift /* StringStyleColorizer.swift */,
__PBXFileRef_Source/TaskPipe.swift /* TaskPipe.swift */,
);
name = Swiftline;
path = Source;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
"______Target_Swiftline" /* Swiftline */ = {
isa = PBXNativeTarget;
buildConfigurationList = "_______Confs_Swiftline" /* Build configuration list for PBXNativeTarget "Swiftline" */;
buildPhases = (
CompilePhase_Swiftline /* Sources */,
"___LinkPhase_Swiftline" /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = Swiftline;
productName = Swiftline;
productReference = "_____Product_Swiftline" /* Swiftline.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
__RootObject_ /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 9999;
TargetAttributes = {
"______Target_Swiftline" = {
LastSwiftMigration = 0800;
};
};
};
buildConfigurationList = "___RootConfs_" /* Build configuration list for PBXProject "Swiftline" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = "___RootGroup_";
productRefGroup = "____Products_" /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
"______Target_Swiftline" /* Swiftline */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
CompilePhase_Swiftline /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 0;
files = (
__src_cc_ref_Source/Agree.swift /* Agree.swift in Sources */,
__src_cc_ref_Source/AgreeSettings.swift /* AgreeSettings.swift in Sources */,
__src_cc_ref_Source/ArgConvertible.swift /* ArgConvertible.swift in Sources */,
__src_cc_ref_Source/Args.swift /* Args.swift in Sources */,
__src_cc_ref_Source/ArgsParser.swift /* ArgsParser.swift in Sources */,
__src_cc_ref_Source/Argument.swift /* Argument.swift in Sources */,
__src_cc_ref_Source/Ask.swift /* Ask.swift in Sources */,
__src_cc_ref_Source/AskerValidator.swift /* AskerValidator.swift in Sources */,
__src_cc_ref_Source/AskSettings.swift /* AskSettings.swift in Sources */,
__src_cc_ref_Source/Choose.swift /* Choose.swift in Sources */,
__src_cc_ref_Source/ChooseSettings.swift /* ChooseSettings.swift in Sources */,
__src_cc_ref_Source/Colorizer.swift /* Colorizer.swift in Sources */,
__src_cc_ref_Source/CommandExecutor.swift /* CommandExecutor.swift in Sources */,
__src_cc_ref_Source/Env.swift /* Env.swift in Sources */,
__src_cc_ref_Source/Glob.swift /* Glob.swift in Sources */,
__src_cc_ref_Source/ProcessInfo.swift /* ProcessInfo.swift in Sources */,
__src_cc_ref_Source/PromptPrinter.swift /* PromptPrinter.swift in Sources */,
__src_cc_ref_Source/PromptReader.swift /* PromptReader.swift in Sources */,
__src_cc_ref_Source/PromptSettings.swift /* PromptSettings.swift in Sources */,
__src_cc_ref_Source/Runner.swift /* Runner.swift in Sources */,
__src_cc_ref_Source/RunnerSettings.swift /* RunnerSettings.swift in Sources */,
__src_cc_ref_Source/RunResults.swift /* RunResults.swift in Sources */,
__src_cc_ref_Source/ShortHandRunner.swift /* ShortHandRunner.swift in Sources */,
__src_cc_ref_Source/StringBackgroundColorizer.swift /* StringBackgroundColorizer.swift in Sources */,
__src_cc_ref_Source/StringForegroundColorizer.swift /* StringForegroundColorizer.swift in Sources */,
__src_cc_ref_Source/StringStyle.swift /* StringStyle.swift in Sources */,
__src_cc_ref_Source/StringStyleColorizer.swift /* StringStyleColorizer.swift in Sources */,
__src_cc_ref_Source/TaskPipe.swift /* TaskPipe.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
_ReleaseConf_Swiftline /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ENABLE_TESTABILITY = YES;
FRAMEWORK_SEARCH_PATHS = "$(PLATFORM_DIR)/Developer/Library/Frameworks";
INFOPLIST_FILE = Swiftline.xcodeproj/Swiftline_Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx";
OTHER_LDFLAGS = "$(inherited)";
OTHER_SWIFT_FLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = Swiftline;
PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)";
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
"___DebugConf_Swiftline" /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ENABLE_TESTABILITY = YES;
FRAMEWORK_SEARCH_PATHS = "$(PLATFORM_DIR)/Developer/Library/Frameworks";
INFOPLIST_FILE = Swiftline.xcodeproj/Swiftline_Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx";
OTHER_LDFLAGS = "$(inherited)";
OTHER_SWIFT_FLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = Swiftline;
PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)";
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
"_____Release_" /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = __PBXFileRef_Swiftline.xcodeproj/Configs/Project.xcconfig /* Swiftline.xcodeproj/Configs/Project.xcconfig */;
buildSettings = {
};
name = Release;
};
"_______Debug_" /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = __PBXFileRef_Swiftline.xcodeproj/Configs/Project.xcconfig /* Swiftline.xcodeproj/Configs/Project.xcconfig */;
buildSettings = {
};
name = Debug;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
"___RootConfs_" /* Build configuration list for PBXProject "Swiftline" */ = {
isa = XCConfigurationList;
buildConfigurations = (
"_______Debug_" /* Debug */,
"_____Release_" /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
"_______Confs_Swiftline" /* Build configuration list for PBXNativeTarget "Swiftline" */ = {
isa = XCConfigurationList;
buildConfigurations = (
"___DebugConf_Swiftline" /* Debug */,
_ReleaseConf_Swiftline /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
/* End XCConfigurationList section */
};
rootObject = __RootObject_ /* Project object */;
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "9999"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "______Target_Swiftline"
BuildableName = "Swiftline.framework"
BlueprintName = "Swiftline"
ReferencedContainer = "container:Swiftline.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "______Target_Swiftline"
BuildableName = "Swiftline.framework"
BlueprintName = "Swiftline"
ReferencedContainer = "container:Swiftline.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>Swiftline.xcscheme</key>
<dict></dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict></dict>
</dict>
</plist>

View File

@ -0,0 +1 @@
2.1.6

2
SwiftlineTests/Cartfile Normal file
View File

@ -0,0 +1,2 @@
github "Quick/Quick"
github "Quick/Nimble"

View File

@ -0,0 +1,2 @@
github "Quick/Nimble" "v5.0.0"
github "Quick/Quick" "v0.10.0"

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.net.jeffhui.Nimble</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@ -53,6 +53,10 @@ NIMBLE_EXPORT id<NMBMatcher> NMB_beIdenticalTo(id expectedInstance);
NIMBLE_SHORT(id<NMBMatcher> beIdenticalTo(id expectedInstance),
NMB_beIdenticalTo(expectedInstance));
NIMBLE_EXPORT id<NMBMatcher> NMB_be(id expectedInstance);
NIMBLE_SHORT(id<NMBMatcher> be(id expectedInstance),
NMB_be(expectedInstance));
NIMBLE_EXPORT id<NMBMatcher> NMB_beLessThan(NSNumber *expectedValue);
NIMBLE_SHORT(id<NMBMatcher> beLessThan(NSNumber *expectedValue),
NMB_beLessThan(expectedValue));
@ -107,6 +111,12 @@ NIMBLE_EXPORT id<NMBMatcher> NMB_allPass(id matcher);
NIMBLE_SHORT(id<NMBMatcher> allPass(id matcher),
NMB_allPass(matcher));
NIMBLE_EXPORT id<NMBMatcher> NMB_satisfyAnyOfWithMatchers(id matchers);
#define NMB_satisfyAnyOf(...) NMB_satisfyAnyOfWithMatchers(@[__VA_ARGS__])
#ifndef NIMBLE_DISABLE_SHORT_SYNTAX
#define satisfyAnyOf(...) NMB_satisfyAnyOf(__VA_ARGS__)
#endif
// In order to preserve breakpoint behavior despite using macros to fill in __FILE__ and __LINE__,
// define a builder that populates __FILE__ and __LINE__, and returns a block that takes timeout
// and action arguments. See https://github.com/Quick/Quick/pull/185 for details.

View File

@ -0,0 +1,11 @@
#import <Foundation/Foundation.h>
#import <dispatch/dispatch.h>
@interface NMBExceptionCapture : NSObject
- (nonnull instancetype)initWithHandler:(void(^ _Nullable)(NSException * _Nonnull))handler finally:(void(^ _Nullable)())finally;
- (void)tryBlock:(void(^ _Nonnull)())unsafeBlock NS_SWIFT_NAME(tryBlock(_:));
@end
typedef void(^NMBSourceCallbackBlock)(BOOL successful);

View File

@ -0,0 +1,18 @@
@class NSString;
/**
* Returns a string appropriate for displaying in test output
* from the provided value.
*
* @param value A value that will show up in a test's output.
*
* @return The string that is returned can be
* customized per type by conforming a type to the `TestOutputStringConvertible`
* protocol. When stringifying a non-`TestOutputStringConvertible` type, this
* function will return the value's debug description and then its
* normal description if available and in that order. Otherwise it
* will return the result of constructing a string from the value.
*
* @see `TestOutputStringConvertible`
*/
extern NSString *_Nonnull NMBStringify(id _Nullable anyObject) __attribute__((warn_unused_result));

View File

@ -0,0 +1,433 @@
// Generated by Apple Swift version 3.0 (swiftlang-800.0.46.2 clang-800.0.38)
#pragma clang diagnostic push
#if defined(__has_include) && __has_include(<swift/objc-prologue.h>)
# include <swift/objc-prologue.h>
#endif
#pragma clang diagnostic ignored "-Wauto-import"
#include <objc/NSObject.h>
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#if !defined(SWIFT_TYPEDEFS)
# define SWIFT_TYPEDEFS 1
# if defined(__has_include) && __has_include(<uchar.h>)
# include <uchar.h>
# elif !defined(__cplusplus) || __cplusplus < 201103L
typedef uint_least16_t char16_t;
typedef uint_least32_t char32_t;
# endif
typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2)));
typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3)));
typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
#endif
#if !defined(SWIFT_PASTE)
# define SWIFT_PASTE_HELPER(x, y) x##y
# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
#endif
#if !defined(SWIFT_METATYPE)
# define SWIFT_METATYPE(X) Class
#endif
#if !defined(SWIFT_CLASS_PROPERTY)
# if __has_feature(objc_class_property)
# define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__
# else
# define SWIFT_CLASS_PROPERTY(...)
# endif
#endif
#if defined(__has_attribute) && __has_attribute(objc_runtime_name)
# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
#else
# define SWIFT_RUNTIME_NAME(X)
#endif
#if defined(__has_attribute) && __has_attribute(swift_name)
# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
#else
# define SWIFT_COMPILE_NAME(X)
#endif
#if defined(__has_attribute) && __has_attribute(objc_method_family)
# define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X)))
#else
# define SWIFT_METHOD_FAMILY(X)
#endif
#if !defined(SWIFT_CLASS_EXTRA)
# define SWIFT_CLASS_EXTRA
#endif
#if !defined(SWIFT_PROTOCOL_EXTRA)
# define SWIFT_PROTOCOL_EXTRA
#endif
#if !defined(SWIFT_ENUM_EXTRA)
# define SWIFT_ENUM_EXTRA
#endif
#if !defined(SWIFT_CLASS)
# if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted)
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# else
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# endif
#endif
#if !defined(SWIFT_PROTOCOL)
# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
#endif
#if !defined(SWIFT_EXTENSION)
# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
#endif
#if !defined(OBJC_DESIGNATED_INITIALIZER)
# if defined(__has_attribute) && __has_attribute(objc_designated_initializer)
# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
# else
# define OBJC_DESIGNATED_INITIALIZER
# endif
#endif
#if !defined(SWIFT_ENUM)
# define SWIFT_ENUM(_type, _name) enum _name : _type _name; enum SWIFT_ENUM_EXTRA _name : _type
# if defined(__has_feature) && __has_feature(generalized_swift_name)
# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_EXTRA _name : _type
# else
# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME) SWIFT_ENUM(_type, _name)
# endif
#endif
#if !defined(SWIFT_UNAVAILABLE)
# define SWIFT_UNAVAILABLE __attribute__((unavailable))
#endif
#if defined(__has_feature) && __has_feature(modules)
@import ObjectiveC;
@import Foundation;
#endif
#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
#pragma clang diagnostic ignored "-Wduplicate-method-arg"
/**
Encapsulates the failure message that matchers can report to the end user.
This is shared state between Nimble and matchers that mutate this value.
*/
SWIFT_CLASS("_TtC6Nimble14FailureMessage")
@interface FailureMessage : NSObject
@property (nonatomic, copy) NSString * _Nonnull expected;
@property (nonatomic, copy) NSString * _Nullable actualValue;
@property (nonatomic, copy) NSString * _Nonnull to;
@property (nonatomic, copy) NSString * _Nonnull postfixMessage;
@property (nonatomic, copy) NSString * _Nonnull postfixActual;
/**
An optional message that will be appended as a new line and provides additional details
about the failure. This message will only be visible in the issue navigator / in logs but
not directly in the source editor since only a single line is presented there.
*/
@property (nonatomic, copy) NSString * _Nullable extendedMessage;
@property (nonatomic, copy) NSString * _Nullable userDescription;
@property (nonatomic, copy) NSString * _Nonnull stringValue;
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
- (nonnull instancetype)initWithStringValue:(NSString * _Nonnull)stringValue OBJC_DESIGNATED_INITIALIZER;
@end
/**
Protocol for types that support only beEmpty(), haveCount() matchers
*/
SWIFT_PROTOCOL("_TtP6Nimble13NMBCollection_")
@protocol NMBCollection
@property (nonatomic, readonly) NSInteger count;
@end
SWIFT_PROTOCOL("_TtP6Nimble13NMBComparable_")
@protocol NMBComparable
- (NSComparisonResult)NMB_compare:(id <NMBComparable> _Null_unspecified)otherObject;
@end
/**
Protocol for types that support contain() matcher.
*/
SWIFT_PROTOCOL("_TtP6Nimble12NMBContainer_")
@protocol NMBContainer
- (BOOL)containsObject:(id _Nonnull)anObject;
@end
@protocol NMBMatcher;
SWIFT_CLASS("_TtC6Nimble14NMBExpectation")
@interface NMBExpectation : NSObject
- (nonnull instancetype)initWithActualBlock:(NSObject * _Null_unspecified (^ _Nonnull)(void))actualBlock negative:(BOOL)negative file:(NSString * _Nonnull)file line:(NSUInteger)line OBJC_DESIGNATED_INITIALIZER;
@property (nonatomic, readonly, copy) NMBExpectation * _Nonnull (^ _Nonnull withTimeout)(NSTimeInterval);
@property (nonatomic, readonly, copy) void (^ _Nonnull to)(id <NMBMatcher> _Nonnull);
@property (nonatomic, readonly, copy) void (^ _Nonnull toWithDescription)(id <NMBMatcher> _Nonnull, NSString * _Nonnull);
@property (nonatomic, readonly, copy) void (^ _Nonnull toNot)(id <NMBMatcher> _Nonnull);
@property (nonatomic, readonly, copy) void (^ _Nonnull toNotWithDescription)(id <NMBMatcher> _Nonnull, NSString * _Nonnull);
@property (nonatomic, readonly, copy) void (^ _Nonnull notTo)(id <NMBMatcher> _Nonnull);
@property (nonatomic, readonly, copy) void (^ _Nonnull notToWithDescription)(id <NMBMatcher> _Nonnull, NSString * _Nonnull);
@property (nonatomic, readonly, copy) void (^ _Nonnull toEventually)(id <NMBMatcher> _Nonnull);
@property (nonatomic, readonly, copy) void (^ _Nonnull toEventuallyWithDescription)(id <NMBMatcher> _Nonnull, NSString * _Nonnull);
@property (nonatomic, readonly, copy) void (^ _Nonnull toEventuallyNot)(id <NMBMatcher> _Nonnull);
@property (nonatomic, readonly, copy) void (^ _Nonnull toEventuallyNotWithDescription)(id <NMBMatcher> _Nonnull, NSString * _Nonnull);
@property (nonatomic, readonly, copy) void (^ _Nonnull toNotEventually)(id <NMBMatcher> _Nonnull);
@property (nonatomic, readonly, copy) void (^ _Nonnull toNotEventuallyWithDescription)(id <NMBMatcher> _Nonnull, NSString * _Nonnull);
+ (void)failWithMessage:(NSString * _Nonnull)message file:(NSString * _Nonnull)file line:(NSUInteger)line;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
@end
@class SourceLocation;
/**
Objective-C interface to the Swift variant of Matcher.
*/
SWIFT_PROTOCOL("_TtP6Nimble10NMBMatcher_")
@protocol NMBMatcher
- (BOOL)matches:(NSObject * _Null_unspecified (^ _Nonnull)(void))actualBlock failureMessage:(FailureMessage * _Nonnull)failureMessage location:(SourceLocation * _Nonnull)location;
- (BOOL)doesNotMatch:(NSObject * _Null_unspecified (^ _Nonnull)(void))actualBlock failureMessage:(FailureMessage * _Nonnull)failureMessage location:(SourceLocation * _Nonnull)location;
@end
SWIFT_CLASS("_TtC6Nimble23NMBObjCBeCloseToMatcher")
@interface NMBObjCBeCloseToMatcher : NSObject <NMBMatcher>
- (BOOL)matches:(NSObject * _Null_unspecified (^ _Nonnull)(void))actualExpression failureMessage:(FailureMessage * _Nonnull)failureMessage location:(SourceLocation * _Nonnull)location;
- (BOOL)doesNotMatch:(NSObject * _Null_unspecified (^ _Nonnull)(void))actualExpression failureMessage:(FailureMessage * _Nonnull)failureMessage location:(SourceLocation * _Nonnull)location;
@property (nonatomic, readonly, copy) NMBObjCBeCloseToMatcher * _Nonnull (^ _Nonnull within)(double);
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
@end
SWIFT_CLASS("_TtC6Nimble14NMBObjCMatcher")
@interface NMBObjCMatcher : NSObject <NMBMatcher>
- (BOOL)matches:(NSObject * _Null_unspecified (^ _Nonnull)(void))actualBlock failureMessage:(FailureMessage * _Nonnull)failureMessage location:(SourceLocation * _Nonnull)location;
- (BOOL)doesNotMatch:(NSObject * _Null_unspecified (^ _Nonnull)(void))actualBlock failureMessage:(FailureMessage * _Nonnull)failureMessage location:(SourceLocation * _Nonnull)location;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (id <NMBMatcher> _Nonnull)equalMatcher:(NSObject * _Nonnull)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * _Nonnull)beLessThanMatcher:(id <NMBComparable> _Nullable)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * _Nonnull)beGreaterThanMatcher:(id <NMBComparable> _Nullable)expected;
@end
@class NMBObjCRaiseExceptionMatcher;
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCRaiseExceptionMatcher * _Nonnull)raiseExceptionMatcher;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * _Nonnull)containMatcher:(NSArray<NSObject *> * _Nonnull)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * _Nonnull)satisfyAnyOfMatcher:(NSArray<NMBObjCMatcher *> * _Nonnull)matchers;
@end
@class NSNumber;
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCBeCloseToMatcher * _Nonnull)beCloseToMatcher:(NSNumber * _Nonnull)expected within:(double)within;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * _Nonnull)beLessThanOrEqualToMatcher:(id <NMBComparable> _Nullable)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (id <NMBMatcher> _Nonnull)beAnInstanceOfMatcher:(Class _Nonnull)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * _Nonnull)allPassMatcher:(NMBObjCMatcher * _Nonnull)matcher;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (id <NMBMatcher> _Nonnull)beAKindOfMatcher:(Class _Nonnull)expected;
@end
@class NSString;
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (id <NMBMatcher> _Nonnull)matchMatcher:(NSString * _Nonnull)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * _Nonnull)haveCountMatcher:(NSNumber * _Nonnull)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * _Nonnull)endWithMatcher:(id _Nonnull)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * _Nonnull)beNilMatcher;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * _Nonnull)beEmptyMatcher;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * _Nonnull)beIdenticalToMatcher:(NSObject * _Nullable)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * _Nonnull)beginWithMatcher:(id _Nonnull)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * _Nonnull)beGreaterThanOrEqualToMatcher:(id <NMBComparable> _Nullable)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * _Nonnull)beTruthyMatcher;
+ (NMBObjCMatcher * _Nonnull)beFalsyMatcher;
+ (NMBObjCMatcher * _Nonnull)beTrueMatcher;
+ (NMBObjCMatcher * _Nonnull)beFalseMatcher;
@end
@class NSDictionary;
@class NSException;
SWIFT_CLASS("_TtC6Nimble28NMBObjCRaiseExceptionMatcher")
@interface NMBObjCRaiseExceptionMatcher : NSObject <NMBMatcher>
- (BOOL)matches:(NSObject * _Null_unspecified (^ _Nonnull)(void))actualBlock failureMessage:(FailureMessage * _Nonnull)failureMessage location:(SourceLocation * _Nonnull)location;
- (BOOL)doesNotMatch:(NSObject * _Null_unspecified (^ _Nonnull)(void))actualBlock failureMessage:(FailureMessage * _Nonnull)failureMessage location:(SourceLocation * _Nonnull)location;
@property (nonatomic, readonly, copy) NMBObjCRaiseExceptionMatcher * _Nonnull (^ _Nonnull named)(NSString * _Nonnull);
@property (nonatomic, readonly, copy) NMBObjCRaiseExceptionMatcher * _Nonnull (^ _Nonnull reason)(NSString * _Nullable);
@property (nonatomic, readonly, copy) NMBObjCRaiseExceptionMatcher * _Nonnull (^ _Nonnull userInfo)(NSDictionary * _Nullable);
@property (nonatomic, readonly, copy) NMBObjCRaiseExceptionMatcher * _Nonnull (^ _Nonnull satisfyingBlock)(void (^ _Nullable)(NSException * _Nonnull));
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
@end
/**
Protocol for types that support beginWith(), endWith(), beEmpty() matchers
*/
SWIFT_PROTOCOL("_TtP6Nimble20NMBOrderedCollection_")
@protocol NMBOrderedCollection <NMBCollection>
- (id _Nonnull)objectAtIndex:(NSInteger)index;
@end
SWIFT_CLASS("_TtC6Nimble11NMBStringer")
@interface NMBStringer : NSObject
+ (NSString * _Nonnull)stringify:(id _Nullable)obj;
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
@end
@interface NSArray (SWIFT_EXTENSION(Nimble)) <NMBContainer>
@end
@interface NSArray (SWIFT_EXTENSION(Nimble)) <NMBOrderedCollection>
@end
@interface NSArray (SWIFT_EXTENSION(Nimble))
@property (nonatomic, readonly, copy) NSString * _Nonnull testDescription;
@end
@interface NSDate (SWIFT_EXTENSION(Nimble))
@property (nonatomic, readonly, copy) NSString * _Nonnull testDescription;
@end
@interface NSDate (SWIFT_EXTENSION(Nimble))
@property (nonatomic, readonly) double doubleValue;
@end
@interface NSDictionary (SWIFT_EXTENSION(Nimble)) <NMBCollection>
@end
@interface NSHashTable (SWIFT_EXTENSION(Nimble)) <NMBCollection>
@end
@interface NSIndexSet (SWIFT_EXTENSION(Nimble)) <NMBCollection>
@end
@interface NSIndexSet (SWIFT_EXTENSION(Nimble))
@property (nonatomic, readonly, copy) NSString * _Nonnull testDescription;
@end
@interface NSMapTable (SWIFT_EXTENSION(Nimble)) <NMBCollection>
@end
@interface NSNumber (SWIFT_EXTENSION(Nimble))
@end
@interface NSNumber (SWIFT_EXTENSION(Nimble)) <NMBComparable>
- (NSComparisonResult)NMB_compare:(id <NMBComparable> _Null_unspecified)otherObject;
@end
@interface NSNumber (SWIFT_EXTENSION(Nimble))
@property (nonatomic, readonly, copy) NSString * _Nonnull testDescription;
@end
@interface NSSet (SWIFT_EXTENSION(Nimble)) <NMBContainer>
@end
@interface NSSet (SWIFT_EXTENSION(Nimble)) <NMBCollection>
@end
@interface NSString (SWIFT_EXTENSION(Nimble)) <NMBComparable>
- (NSComparisonResult)NMB_compare:(id <NMBComparable> _Null_unspecified)otherObject;
@end
SWIFT_CLASS("_TtC6Nimble14SourceLocation")
@interface SourceLocation : NSObject
@property (nonatomic, readonly, copy) NSString * _Nonnull file;
@property (nonatomic, readonly) NSUInteger line;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
@property (nonatomic, readonly, copy) NSString * _Nonnull description;
@end
#pragma clang diagnostic pop

View File

@ -1,9 +1,7 @@
#import <Cocoa/Cocoa.h>
#import "Nimble.h"
#import "DSL.h"
#import <Foundation/Foundation.h>
#import "NMBExceptionCapture.h"
#import "NMBStringify.h"
#import "DSL.h"
FOUNDATION_EXPORT double NimbleVersionNumber;
FOUNDATION_EXPORT const unsigned char NimbleVersionString[];

View File

@ -1,5 +1,5 @@
framework module Nimble {
umbrella header "Pods-Nimble-umbrella.h"
umbrella header "Nimble.h"
export *
module * { export * }

Binary file not shown.

View File

@ -3,13 +3,13 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>15B42</string>
<string>15G1004</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>Nimble</string>
<key>CFBundleIdentifier</key>
<string>org.cocoapods.Nimble</string>
<string>net.jeffhui.Nimble</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.0.0</string>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
@ -29,16 +29,23 @@
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>7B1005</string>
<string>8A218a</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>15A278</string>
<string>16A300</string>
<key>DTSDKName</key>
<string>macosx10.11</string>
<string>macosx10.12</string>
<key>DTXcode</key>
<string>0711</string>
<string>0800</string>
<key>DTXcodeBuild</key>
<string>7B1005</string>
<string>8A218a</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2014 Jeff Hui. All rights reserved.</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
</dict>
</plist>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.io.quick.Quick</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@ -0,0 +1,351 @@
// Generated by Apple Swift version 3.0 (swiftlang-800.0.46.2 clang-800.0.38)
#pragma clang diagnostic push
#if defined(__has_include) && __has_include(<swift/objc-prologue.h>)
# include <swift/objc-prologue.h>
#endif
#pragma clang diagnostic ignored "-Wauto-import"
#include <objc/NSObject.h>
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#if !defined(SWIFT_TYPEDEFS)
# define SWIFT_TYPEDEFS 1
# if defined(__has_include) && __has_include(<uchar.h>)
# include <uchar.h>
# elif !defined(__cplusplus) || __cplusplus < 201103L
typedef uint_least16_t char16_t;
typedef uint_least32_t char32_t;
# endif
typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2)));
typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3)));
typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
#endif
#if !defined(SWIFT_PASTE)
# define SWIFT_PASTE_HELPER(x, y) x##y
# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
#endif
#if !defined(SWIFT_METATYPE)
# define SWIFT_METATYPE(X) Class
#endif
#if !defined(SWIFT_CLASS_PROPERTY)
# if __has_feature(objc_class_property)
# define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__
# else
# define SWIFT_CLASS_PROPERTY(...)
# endif
#endif
#if defined(__has_attribute) && __has_attribute(objc_runtime_name)
# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
#else
# define SWIFT_RUNTIME_NAME(X)
#endif
#if defined(__has_attribute) && __has_attribute(swift_name)
# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
#else
# define SWIFT_COMPILE_NAME(X)
#endif
#if defined(__has_attribute) && __has_attribute(objc_method_family)
# define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X)))
#else
# define SWIFT_METHOD_FAMILY(X)
#endif
#if !defined(SWIFT_CLASS_EXTRA)
# define SWIFT_CLASS_EXTRA
#endif
#if !defined(SWIFT_PROTOCOL_EXTRA)
# define SWIFT_PROTOCOL_EXTRA
#endif
#if !defined(SWIFT_ENUM_EXTRA)
# define SWIFT_ENUM_EXTRA
#endif
#if !defined(SWIFT_CLASS)
# if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted)
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# else
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# endif
#endif
#if !defined(SWIFT_PROTOCOL)
# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
#endif
#if !defined(SWIFT_EXTENSION)
# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
#endif
#if !defined(OBJC_DESIGNATED_INITIALIZER)
# if defined(__has_attribute) && __has_attribute(objc_designated_initializer)
# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
# else
# define OBJC_DESIGNATED_INITIALIZER
# endif
#endif
#if !defined(SWIFT_ENUM)
# define SWIFT_ENUM(_type, _name) enum _name : _type _name; enum SWIFT_ENUM_EXTRA _name : _type
# if defined(__has_feature) && __has_feature(generalized_swift_name)
# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_EXTRA _name : _type
# else
# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME) SWIFT_ENUM(_type, _name)
# endif
#endif
#if !defined(SWIFT_UNAVAILABLE)
# define SWIFT_UNAVAILABLE __attribute__((unavailable))
#endif
#if defined(__has_feature) && __has_feature(modules)
@import Foundation;
@import ObjectiveC;
@import XCTest;
#endif
#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
#pragma clang diagnostic ignored "-Wduplicate-method-arg"
@interface NSBundle (SWIFT_EXTENSION(Quick))
@end
/**
An object encapsulating the file and line number at which
a particular example is defined.
*/
SWIFT_CLASS("_TtC5Quick8Callsite")
@interface Callsite : NSObject
/**
The absolute path of the file in which an example is defined.
*/
@property (nonatomic, readonly, copy) NSString * _Nonnull file;
/**
The line number on which an example is defined.
*/
@property (nonatomic, readonly) NSUInteger line;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
@end
@class Example;
@class ExampleMetadata;
/**
A configuration encapsulates various options you can use
to configure Quicks behavior.
*/
SWIFT_CLASS("_TtC5Quick13Configuration")
@interface Configuration : NSObject
/**
Run all examples if none match the configured filters. True by default.
*/
@property (nonatomic) BOOL runAllWhenEverythingFiltered;
/**
Registers an inclusion filter.
All examples are filtered using all inclusion filters.
The remaining examples are run. If no examples remain, all examples are run.
\param filter A filter that, given an example, returns a value indicating
whether that example should be included in the examples
that are run.
*/
- (void)include:(BOOL (^ _Nonnull)(Example * _Nonnull))filter;
/**
Registers an exclusion filter.
All examples that remain after being filtered by the inclusion filters are
then filtered via all exclusion filters.
\param filter A filter that, given an example, returns a value indicating
whether that example should be excluded from the examples
that are run.
*/
- (void)exclude:(BOOL (^ _Nonnull)(Example * _Nonnull))filter;
- (void)beforeEachWithMetadata:(void (^ _Nonnull)(ExampleMetadata * _Nonnull))closure;
/**
Like Quick.DSL.beforeEach, this configures Quick to execute the
given closure before each example that is run. The closure
passed to this method is executed before each example Quick runs,
globally across the test suite. You may call this method multiple
times across mulitple +[QuickConfigure configure:] methods in order
to define several closures to run before each example.
Note that, since Quick makes no guarantee as to the order in which
+[QuickConfiguration configure:] methods are evaluated, there is no
guarantee as to the order in which beforeEach closures are evaluated
either. Mulitple beforeEach defined on a single configuration, however,
will be executed in the order theyre defined.
\param closure The closure to be executed before each example
in the test suite.
*/
- (void)beforeEach:(void (^ _Nonnull)(void))closure;
- (void)afterEachWithMetadata:(void (^ _Nonnull)(ExampleMetadata * _Nonnull))closure;
/**
Like Quick.DSL.afterEach, this configures Quick to execute the
given closure after each example that is run. The closure
passed to this method is executed after each example Quick runs,
globally across the test suite. You may call this method multiple
times across mulitple +[QuickConfigure configure:] methods in order
to define several closures to run after each example.
Note that, since Quick makes no guarantee as to the order in which
+[QuickConfiguration configure:] methods are evaluated, there is no
guarantee as to the order in which afterEach closures are evaluated
either. Mulitple afterEach defined on a single configuration, however,
will be executed in the order theyre defined.
\param closure The closure to be executed before each example
in the test suite.
*/
- (void)afterEach:(void (^ _Nonnull)(void))closure;
/**
Like Quick.DSL.beforeSuite, this configures Quick to execute
the given closure prior to any and all examples that are run.
The two methods are functionally equivalent.
*/
- (void)beforeSuite:(void (^ _Nonnull)(void))closure;
/**
Like Quick.DSL.afterSuite, this configures Quick to execute
the given closure after all examples have been run.
The two methods are functionally equivalent.
*/
- (void)afterSuite:(void (^ _Nonnull)(void))closure;
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
@end
/**
Examples, defined with the \code
it
\endcode function, use assertions to
demonstrate how code should behave. These are like tests in XCTest.
*/
SWIFT_CLASS("_TtC5Quick7Example")
@interface Example : NSObject
/**
A boolean indicating whether the example is a shared example;
i.e.: whether it is an example defined with \code
itBehavesLike
\endcode.
*/
@property (nonatomic) BOOL isSharedExample;
/**
The site at which the example is defined.
This must be set correctly in order for Xcode to highlight
the correct line in red when reporting a failure.
*/
@property (nonatomic, strong) Callsite * _Nonnull callsite;
@property (nonatomic, readonly, copy) NSString * _Nonnull description;
/**
The example name. A name is a concatenation of the name of
the example group the example belongs to, followed by the
description of the example itself.
The example name is used to generate a test method selector
to be displayed in Xcodes test navigator.
*/
@property (nonatomic, readonly, copy) NSString * _Nonnull name;
/**
Executes the example closure, as well as all before and after
closures defined in the its surrounding example groups.
*/
- (void)run;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
@end
/**
Example groups are logical groupings of examples, defined with
the \code
describe
\endcode and \code
context
\endcode functions. Example groups can share
setup and teardown code.
*/
SWIFT_CLASS("_TtC5Quick12ExampleGroup")
@interface ExampleGroup : NSObject
@property (nonatomic, readonly, copy) NSString * _Nonnull description;
/**
Returns a list of examples that belong to this example group,
or to any of its descendant example groups.
*/
@property (nonatomic, readonly, copy) NSArray<Example *> * _Nonnull examples;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
@end
/**
A class that encapsulates information about an example,
including the index at which the example was executed, as
well as the example itself.
*/
SWIFT_CLASS("_TtC5Quick15ExampleMetadata")
@interface ExampleMetadata : NSObject
/**
The example for which this metadata was collected.
*/
@property (nonatomic, readonly, strong) Example * _Nonnull example;
/**
The index at which this example was executed in the
test suite.
*/
@property (nonatomic, readonly) NSInteger exampleIndex;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
@end
/**
A namespace for filter flag keys, defined primarily to make the
keys available in Objective-C.
*/
SWIFT_CLASS("_TtC5Quick6Filter")
@interface Filter : NSObject
/**
Example and example groups with [Focused: true] are included in test runs,
excluding all other examples without this flag. Use this to only run one or
two tests that youre currently focusing on.
*/
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull focused;)
+ (NSString * _Nonnull)focused;
/**
Example and example groups with [Pending: true] are excluded from test runs.
Use this to temporarily suspend examples that you know do not pass yet.
*/
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull pending;)
+ (NSString * _Nonnull)pending;
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
@end
/**
A base class for a class cluster of Quick test suites, that should correctly
build dynamic test suites for XCTest to execute.
*/
SWIFT_CLASS("_TtC5Quick14QuickTestSuite")
@interface QuickTestSuite : XCTestSuite
/**
Construct a test suite for a specific, selected subset of test cases (rather
than the default, which as all test cases).
If this method is called multiple times for the same test case class, e.g..
FooSpec/testFoo
FooSpec/testBar
It is expected that the first call should return a valid test suite, and
all subsequent calls should return \code
nil
\endcode.
*/
+ (QuickTestSuite * _Nullable)selectedTestSuiteForTestCaseWithName:(NSString * _Nonnull)name;
- (nonnull instancetype)initWithName:(NSString * _Nonnull)name OBJC_DESIGNATED_INITIALIZER;
@end
#pragma clang diagnostic pop

View File

@ -33,13 +33,15 @@
Override this method in your spec to define a set of example groups
and examples.
override class func spec() {
describe("winter") {
it("is coming") {
// ...
}
@code
override func spec() {
describe("winter") {
it("is coming") {
// ...
}
}
}
@endcode
See DSL.swift for more information on what syntax is available.
*/

View File

@ -1,5 +1,5 @@
framework module Quick {
umbrella header "Pods-Quick-umbrella.h"
umbrella header "Quick.h"
export *
module * { export * }

Binary file not shown.

View File

@ -3,13 +3,13 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>15B42</string>
<string>15G1004</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>Quick</string>
<key>CFBundleIdentifier</key>
<string>org.cocoapods.Quick</string>
<string>io.quick.Quick</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.8.0</string>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
@ -29,16 +29,18 @@
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>7B1005</string>
<string>8A218a</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>15A278</string>
<string>16A300</string>
<key>DTSDKName</key>
<string>macosx10.11</string>
<string>macosx10.12</string>
<key>DTXcode</key>
<string>0711</string>
<string>0800</string>
<key>DTXcodeBuild</key>
<string>7B1005</string>
<string>8A218a</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2014 - present, Quick Team. All rights reserved.</string>
</dict>
</plist>

View File

@ -1,13 +0,0 @@
PODS:
- Nimble (3.0.0)
- Quick (0.8.0)
DEPENDENCIES:
- Nimble (~> 3.0.0)
- Quick (~> 0.8.0)
SPEC CHECKSUMS:
Nimble: 4c353d43735b38b545cbb4cb91504588eb5de926
Quick: 563d0f6ec5f72e394645adb377708639b7dd38ab
COCOAPODS: 0.39.0

View File

@ -1,8 +0,0 @@
#import <Foundation/Foundation.h>
@interface NMBExceptionCapture : NSObject
- (id)initWithHandler:(void(^)(NSException *))handler finally:(void(^)())finally;
- (void)tryBlock:(void(^)())unsafeBlock;
@end

View File

@ -1,378 +0,0 @@
// Generated by Apple Swift version 2.1 (swiftlang-700.1.101.6 clang-700.1.76)
#pragma clang diagnostic push
#if defined(__has_include) && __has_include(<swift/objc-prologue.h>)
# include <swift/objc-prologue.h>
#endif
#pragma clang diagnostic ignored "-Wauto-import"
#include <objc/NSObject.h>
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#if defined(__has_include) && __has_include(<uchar.h>)
# include <uchar.h>
#elif !defined(__cplusplus) || __cplusplus < 201103L
typedef uint_least16_t char16_t;
typedef uint_least32_t char32_t;
#endif
typedef struct _NSZone NSZone;
#if !defined(SWIFT_PASTE)
# define SWIFT_PASTE_HELPER(x, y) x##y
# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
#endif
#if !defined(SWIFT_METATYPE)
# define SWIFT_METATYPE(X) Class
#endif
#if defined(__has_attribute) && __has_attribute(objc_runtime_name)
# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
#else
# define SWIFT_RUNTIME_NAME(X)
#endif
#if defined(__has_attribute) && __has_attribute(swift_name)
# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
#else
# define SWIFT_COMPILE_NAME(X)
#endif
#if !defined(SWIFT_CLASS_EXTRA)
# define SWIFT_CLASS_EXTRA
#endif
#if !defined(SWIFT_PROTOCOL_EXTRA)
# define SWIFT_PROTOCOL_EXTRA
#endif
#if !defined(SWIFT_ENUM_EXTRA)
# define SWIFT_ENUM_EXTRA
#endif
#if !defined(SWIFT_CLASS)
# if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted)
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# else
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# endif
#endif
#if !defined(SWIFT_PROTOCOL)
# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
#endif
#if !defined(SWIFT_EXTENSION)
# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
#endif
#if !defined(OBJC_DESIGNATED_INITIALIZER)
# if defined(__has_attribute) && __has_attribute(objc_designated_initializer)
# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
# else
# define OBJC_DESIGNATED_INITIALIZER
# endif
#endif
#if !defined(SWIFT_ENUM)
# define SWIFT_ENUM(_type, _name) enum _name : _type _name; enum SWIFT_ENUM_EXTRA _name : _type
#endif
typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
#if defined(__has_feature) && __has_feature(modules)
@import ObjectiveC;
@import Foundation;
#endif
#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
#pragma clang diagnostic ignored "-Wduplicate-method-arg"
/// Encapsulates the failure message that matchers can report to the end user.
///
/// This is shared state between Nimble and matchers that mutate this value.
SWIFT_CLASS("_TtC6Nimble14FailureMessage")
@interface FailureMessage : NSObject
@property (nonatomic, copy) NSString * __nonnull expected;
@property (nonatomic, copy) NSString * __nullable actualValue;
@property (nonatomic, copy) NSString * __nonnull to;
@property (nonatomic, copy) NSString * __nonnull postfixMessage;
@property (nonatomic, copy) NSString * __nonnull postfixActual;
@property (nonatomic, copy) NSString * __nullable userDescription;
@property (nonatomic, copy) NSString * __nonnull stringValue;
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
- (nonnull instancetype)initWithStringValue:(NSString * __nonnull)stringValue OBJC_DESIGNATED_INITIALIZER;
@end
/// Protocol for types that support only beEmpty(), haveCount() matchers
SWIFT_PROTOCOL("_TtP6Nimble13NMBCollection_")
@protocol NMBCollection
@property (nonatomic, readonly) NSInteger count;
@end
/// Protocol for types to support beLessThan(), beLessThanOrEqualTo(), beGreaterThan(), beGreaterThanOrEqualTo(), and equal() matchers.
///
/// Types that conform to Swift's Comparable protocol will work implicitly too
SWIFT_PROTOCOL("_TtP6Nimble13NMBComparable_")
@protocol NMBComparable
- (NSComparisonResult)NMB_compare:(id <NMBComparable> __null_unspecified)otherObject;
@end
/// Protocol for types that support contain() matcher.
SWIFT_PROTOCOL("_TtP6Nimble12NMBContainer_")
@protocol NMBContainer
- (BOOL)containsObject:(id __null_unspecified)object;
@end
/// Protocol for types to support beCloseTo() matcher
SWIFT_PROTOCOL("_TtP6Nimble20NMBDoubleConvertible_")
@protocol NMBDoubleConvertible
@property (nonatomic, readonly) double doubleValue;
@end
@protocol NMBMatcher;
SWIFT_CLASS("_TtC6Nimble14NMBExpectation")
@interface NMBExpectation : NSObject
- (nonnull instancetype)initWithActualBlock:(NSObject * __null_unspecified (^ __nonnull)(void))actualBlock negative:(BOOL)negative file:(NSString * __nonnull)file line:(NSUInteger)line OBJC_DESIGNATED_INITIALIZER;
@property (nonatomic, readonly, copy) NMBExpectation * __nonnull (^ __nonnull withTimeout)(NSTimeInterval);
@property (nonatomic, readonly, copy) void (^ __nonnull to)(id <NMBMatcher> __nonnull);
@property (nonatomic, readonly, copy) void (^ __nonnull toWithDescription)(id <NMBMatcher> __nonnull, NSString * __nonnull);
@property (nonatomic, readonly, copy) void (^ __nonnull toNot)(id <NMBMatcher> __nonnull);
@property (nonatomic, readonly, copy) void (^ __nonnull toNotWithDescription)(id <NMBMatcher> __nonnull, NSString * __nonnull);
@property (nonatomic, readonly, copy) void (^ __nonnull notTo)(id <NMBMatcher> __nonnull);
@property (nonatomic, readonly, copy) void (^ __nonnull notToWithDescription)(id <NMBMatcher> __nonnull, NSString * __nonnull);
@property (nonatomic, readonly, copy) void (^ __nonnull toEventually)(id <NMBMatcher> __nonnull);
@property (nonatomic, readonly, copy) void (^ __nonnull toEventuallyWithDescription)(id <NMBMatcher> __nonnull, NSString * __nonnull);
@property (nonatomic, readonly, copy) void (^ __nonnull toEventuallyNot)(id <NMBMatcher> __nonnull);
@property (nonatomic, readonly, copy) void (^ __nonnull toEventuallyNotWithDescription)(id <NMBMatcher> __nonnull, NSString * __nonnull);
@property (nonatomic, readonly, copy) void (^ __nonnull toNotEventually)(id <NMBMatcher> __nonnull);
@property (nonatomic, readonly, copy) void (^ __nonnull toNotEventuallyWithDescription)(id <NMBMatcher> __nonnull, NSString * __nonnull);
+ (void)failWithMessage:(NSString * __nonnull)message file:(NSString * __nonnull)file line:(NSUInteger)line;
@end
@class SourceLocation;
/// Objective-C interface to the Swift variant of Matcher.
SWIFT_PROTOCOL("_TtP6Nimble10NMBMatcher_")
@protocol NMBMatcher
- (BOOL)matches:(NSObject * __null_unspecified (^ __nonnull)(void))actualBlock failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
- (BOOL)doesNotMatch:(NSObject * __null_unspecified (^ __nonnull)(void))actualBlock failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
@end
SWIFT_CLASS("_TtC6Nimble23NMBObjCBeCloseToMatcher")
@interface NMBObjCBeCloseToMatcher : NSObject <NMBMatcher>
- (BOOL)matches:(NSObject * __null_unspecified (^ __nonnull)(void))actualExpression failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
- (BOOL)doesNotMatch:(NSObject * __null_unspecified (^ __nonnull)(void))actualExpression failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
@property (nonatomic, readonly, copy) NMBObjCBeCloseToMatcher * __nonnull (^ __nonnull within)(double);
@end
SWIFT_CLASS("_TtC6Nimble14NMBObjCMatcher")
@interface NMBObjCMatcher : NSObject <NMBMatcher>
- (BOOL)matches:(NSObject * __null_unspecified (^ __nonnull)(void))actualBlock failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
- (BOOL)doesNotMatch:(NSObject * __null_unspecified (^ __nonnull)(void))actualBlock failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
@end
@class NMBObjCRaiseExceptionMatcher;
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCRaiseExceptionMatcher * __nonnull)raiseExceptionMatcher;
@end
@class NSString;
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (id <NMBMatcher> __nonnull)matchMatcher:(NSString * __nonnull)expected;
@end
@class NSNumber;
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * __nonnull)haveCountMatcher:(NSNumber * __nonnull)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (id <NMBMatcher> __nonnull)equalMatcher:(NSObject * __nonnull)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * __nonnull)endWithMatcher:(id __nonnull)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * __nonnull)containMatcher:(NSArray<NSObject *> * __nonnull)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * __nonnull)beNilMatcher;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * __nonnull)beLessThanOrEqualToMatcher:(id <NMBComparable> __nullable)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * __nonnull)allPassMatcher:(NMBObjCMatcher * __nonnull)matcher;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * __nonnull)beIdenticalToMatcher:(NSObject * __nullable)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * __nonnull)beGreaterThanOrEqualToMatcher:(id <NMBComparable> __nullable)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * __nonnull)beGreaterThanMatcher:(id <NMBComparable> __nullable)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * __nonnull)beginWithMatcher:(id __nonnull)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * __nonnull)beEmptyMatcher;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCBeCloseToMatcher * __nonnull)beCloseToMatcher:(NSNumber * __nonnull)expected within:(double)within;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (id <NMBMatcher> __nonnull)beAnInstanceOfMatcher:(Class __nonnull)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (id <NMBMatcher> __nonnull)beAKindOfMatcher:(Class __nonnull)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * __nonnull)beLessThanMatcher:(id <NMBComparable> __nullable)expected;
@end
@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble))
+ (NMBObjCMatcher * __nonnull)beTruthyMatcher;
+ (NMBObjCMatcher * __nonnull)beFalsyMatcher;
+ (NMBObjCMatcher * __nonnull)beTrueMatcher;
+ (NMBObjCMatcher * __nonnull)beFalseMatcher;
@end
@class NSDictionary;
@class NSException;
SWIFT_CLASS("_TtC6Nimble28NMBObjCRaiseExceptionMatcher")
@interface NMBObjCRaiseExceptionMatcher : NSObject <NMBMatcher>
- (BOOL)matches:(NSObject * __null_unspecified (^ __nonnull)(void))actualBlock failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
- (BOOL)doesNotMatch:(NSObject * __null_unspecified (^ __nonnull)(void))actualBlock failureMessage:(FailureMessage * __nonnull)failureMessage location:(SourceLocation * __nonnull)location;
@property (nonatomic, readonly, copy) NMBObjCRaiseExceptionMatcher * __nonnull (^ __nonnull named)(NSString * __nonnull);
@property (nonatomic, readonly, copy) NMBObjCRaiseExceptionMatcher * __nonnull (^ __nonnull reason)(NSString * __nullable);
@property (nonatomic, readonly, copy) NMBObjCRaiseExceptionMatcher * __nonnull (^ __nonnull userInfo)(NSDictionary * __nullable);
@property (nonatomic, readonly, copy) NMBObjCRaiseExceptionMatcher * __nonnull (^ __nonnull satisfyingBlock)(void (^ __nullable)(NSException * __nonnull));
@end
/// Protocol for types that support beginWith(), endWith(), beEmpty() matchers
SWIFT_PROTOCOL("_TtP6Nimble20NMBOrderedCollection_")
@protocol NMBOrderedCollection <NMBCollection>
- (NSInteger)indexOfObject:(id __null_unspecified)object;
@end
@interface NSArray (SWIFT_EXTENSION(Nimble)) <NMBContainer>
@end
@interface NSArray (SWIFT_EXTENSION(Nimble)) <NMBOrderedCollection, NMBCollection>
@end
@interface NSArray (SWIFT_EXTENSION(Nimble))
@end
@interface NSDate (SWIFT_EXTENSION(Nimble)) <NMBDoubleConvertible>
@property (nonatomic, readonly) double doubleValue;
@end
@interface NSDictionary (SWIFT_EXTENSION(Nimble)) <NMBCollection>
@end
@interface NSHashTable (SWIFT_EXTENSION(Nimble)) <NMBCollection>
@end
@interface NSHashTable (SWIFT_EXTENSION(Nimble)) <NMBContainer>
@end
@interface NSMapTable (SWIFT_EXTENSION(Nimble)) <NMBCollection>
@end
@interface NSNumber (SWIFT_EXTENSION(Nimble)) <NMBDoubleConvertible>
@end
@interface NSNumber (SWIFT_EXTENSION(Nimble)) <NMBComparable>
- (NSComparisonResult)NMB_compare:(id <NMBComparable> __null_unspecified)otherObject;
@end
@interface NSSet (SWIFT_EXTENSION(Nimble)) <NMBContainer>
@end
@interface NSSet (SWIFT_EXTENSION(Nimble)) <NMBCollection>
@end
@interface NSString (SWIFT_EXTENSION(Nimble)) <NMBComparable>
- (NSComparisonResult)NMB_compare:(id <NMBComparable> __null_unspecified)otherObject;
@end
SWIFT_CLASS("_TtC6Nimble14SourceLocation")
@interface SourceLocation : NSObject
@property (nonatomic, readonly, copy) NSString * __nonnull file;
@property (nonatomic, readonly) NSUInteger line;
@property (nonatomic, readonly, copy) NSString * __nonnull description;
@end
#pragma clang diagnostic pop

View File

@ -1,6 +0,0 @@
#import <Foundation/Foundation.h>
#import "NMBExceptionCapture.h"
#import "DSL.h"
FOUNDATION_EXPORT double NimbleVersionNumber;
FOUNDATION_EXPORT const unsigned char NimbleVersionString[];

View File

@ -1,10 +0,0 @@
#import <Cocoa/Cocoa.h>
#import "QuickConfiguration.h"
#import "QCKDSL.h"
#import "Quick.h"
#import "QuickSpec.h"
FOUNDATION_EXPORT double QuickVersionNumber;
FOUNDATION_EXPORT const unsigned char QuickVersionString[];

View File

@ -1,237 +0,0 @@
// Generated by Apple Swift version 2.1 (swiftlang-700.1.101.6 clang-700.1.76)
#pragma clang diagnostic push
#if defined(__has_include) && __has_include(<swift/objc-prologue.h>)
# include <swift/objc-prologue.h>
#endif
#pragma clang diagnostic ignored "-Wauto-import"
#include <objc/NSObject.h>
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#if defined(__has_include) && __has_include(<uchar.h>)
# include <uchar.h>
#elif !defined(__cplusplus) || __cplusplus < 201103L
typedef uint_least16_t char16_t;
typedef uint_least32_t char32_t;
#endif
typedef struct _NSZone NSZone;
#if !defined(SWIFT_PASTE)
# define SWIFT_PASTE_HELPER(x, y) x##y
# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
#endif
#if !defined(SWIFT_METATYPE)
# define SWIFT_METATYPE(X) Class
#endif
#if defined(__has_attribute) && __has_attribute(objc_runtime_name)
# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
#else
# define SWIFT_RUNTIME_NAME(X)
#endif
#if defined(__has_attribute) && __has_attribute(swift_name)
# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
#else
# define SWIFT_COMPILE_NAME(X)
#endif
#if !defined(SWIFT_CLASS_EXTRA)
# define SWIFT_CLASS_EXTRA
#endif
#if !defined(SWIFT_PROTOCOL_EXTRA)
# define SWIFT_PROTOCOL_EXTRA
#endif
#if !defined(SWIFT_ENUM_EXTRA)
# define SWIFT_ENUM_EXTRA
#endif
#if !defined(SWIFT_CLASS)
# if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted)
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# else
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# endif
#endif
#if !defined(SWIFT_PROTOCOL)
# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
#endif
#if !defined(SWIFT_EXTENSION)
# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
#endif
#if !defined(OBJC_DESIGNATED_INITIALIZER)
# if defined(__has_attribute) && __has_attribute(objc_designated_initializer)
# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
# else
# define OBJC_DESIGNATED_INITIALIZER
# endif
#endif
#if !defined(SWIFT_ENUM)
# define SWIFT_ENUM(_type, _name) enum _name : _type _name; enum SWIFT_ENUM_EXTRA _name : _type
#endif
typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
#if defined(__has_feature) && __has_feature(modules)
@import ObjectiveC;
#endif
#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
#pragma clang diagnostic ignored "-Wduplicate-method-arg"
/// An object encapsulating the file and line number at which a particular example is defined.
SWIFT_CLASS("_TtC5Quick8Callsite")
@interface Callsite : NSObject
/// The absolute path of the file in which an example is defined.
@property (nonatomic, readonly, copy) NSString * __nonnull file;
/// The line number on which an example is defined.
@property (nonatomic, readonly) NSUInteger line;
@end
@class Example;
@class ExampleMetadata;
/// A configuration encapsulates various options you can use to configure Quick's behavior.
SWIFT_CLASS("_TtC5Quick13Configuration")
@interface Configuration : NSObject
/// Run all examples if none match the configured filters. True by default.
@property (nonatomic) BOOL runAllWhenEverythingFiltered;
/// Registers an inclusion filter.
///
/// All examples are filtered using all inclusion filters.
/// The remaining examples are run. If no examples remain, all examples are run.
///
/// \param filter A filter that, given an example, returns a value indicating
/// whether that example should be included in the examples
/// that are run.
- (void)include:(BOOL (^ __nonnull)(Example * __nonnull))filter;
/// Registers an exclusion filter.
///
/// All examples that remain after being filtered by the inclusion filters are
/// then filtered via all exclusion filters.
///
/// \param filter A filter that, given an example, returns a value indicating
/// whether that example should be excluded from the examples
/// that are run.
- (void)exclude:(BOOL (^ __nonnull)(Example * __nonnull))filter;
/// Identical to Quick.Configuration.beforeEach, except the closure is provided with metadata on the example that the closure is being run prior to.
- (void)beforeEachWithMetadata:(void (^ __nonnull)(ExampleMetadata * __nonnull))closure;
/// Like Quick.DSL.beforeEach, this configures Quick to execute the given closure before each example that is run. The closure passed to this method is executed before each example Quick runs, globally across the test suite. You may call this method multiple times across mulitple +[QuickConfigure configure:] methods in order to define several closures to run before each example.
///
/// Note that, since Quick makes no guarantee as to the order in which
/// +[QuickConfiguration configure:] methods are evaluated, there is no
/// guarantee as to the order in which beforeEach closures are evaluated
/// either. Mulitple beforeEach defined on a single configuration, however,
/// will be executed in the order they're defined.
///
/// \param closure The closure to be executed before each example
/// in the test suite.
- (void)beforeEach:(void (^ __nonnull)(void))closure;
/// Identical to Quick.Configuration.afterEach, except the closure is provided with metadata on the example that the closure is being run after.
- (void)afterEachWithMetadata:(void (^ __nonnull)(ExampleMetadata * __nonnull))closure;
/// Like Quick.DSL.afterEach, this configures Quick to execute the given closure after each example that is run. The closure passed to this method is executed after each example Quick runs, globally across the test suite. You may call this method multiple times across mulitple +[QuickConfigure configure:] methods in order to define several closures to run after each example.
///
/// Note that, since Quick makes no guarantee as to the order in which
/// +[QuickConfiguration configure:] methods are evaluated, there is no
/// guarantee as to the order in which afterEach closures are evaluated
/// either. Mulitple afterEach defined on a single configuration, however,
/// will be executed in the order they're defined.
///
/// \param closure The closure to be executed before each example
/// in the test suite.
- (void)afterEach:(void (^ __nonnull)(void))closure;
/// Like Quick.DSL.beforeSuite, this configures Quick to execute the given closure prior to any and all examples that are run. The two methods are functionally equivalent.
- (void)beforeSuite:(void (^ __nonnull)(void))closure;
/// Like Quick.DSL.afterSuite, this configures Quick to execute the given closure after all examples have been run. The two methods are functionally equivalent.
- (void)afterSuite:(void (^ __nonnull)(void))closure;
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
@end
/// Examples, defined with the it function, use assertions to demonstrate how code should behave. These are like "tests" in XCTest.
SWIFT_CLASS("_TtC5Quick7Example")
@interface Example : NSObject
/// A boolean indicating whether the example is a shared example; i.e.: whether it is an example defined with itBehavesLike.
@property (nonatomic) BOOL isSharedExample;
/// The site at which the example is defined. This must be set correctly in order for Xcode to highlight the correct line in red when reporting a failure.
@property (nonatomic, strong) Callsite * __nonnull callsite;
@property (nonatomic, readonly, copy) NSString * __nonnull description;
/// The example name. A name is a concatenation of the name of the example group the example belongs to, followed by the description of the example itself.
///
/// The example name is used to generate a test method selector
/// to be displayed in Xcode's test navigator.
@property (nonatomic, readonly, copy) NSString * __nonnull name;
/// Executes the example closure, as well as all before and after closures defined in the its surrounding example groups.
- (void)run;
@end
/// Example groups are logical groupings of examples, defined with the describe and context functions. Example groups can share setup and teardown code.
SWIFT_CLASS("_TtC5Quick12ExampleGroup")
@interface ExampleGroup : NSObject
@property (nonatomic, readonly, copy) NSString * __nonnull description;
/// Returns a list of examples that belong to this example group, or to any of its descendant example groups.
@property (nonatomic, readonly, copy) NSArray<Example *> * __nonnull examples;
@end
/// A class that encapsulates information about an example, including the index at which the example was executed, as well as the example itself.
SWIFT_CLASS("_TtC5Quick15ExampleMetadata")
@interface ExampleMetadata : NSObject
/// The example for which this metadata was collected.
@property (nonatomic, readonly, strong) Example * __nonnull example;
/// The index at which this example was executed in the test suite.
@property (nonatomic, readonly) NSInteger exampleIndex;
@end
/// A namespace for filter flag keys, defined primarily to make the keys available in Objective-C.
SWIFT_CLASS("_TtC5Quick6Filter")
@interface Filter : NSObject
/// Example and example groups with [Focused: true] are included in test runs, excluding all other examples without this flag. Use this to only run one or two tests that you're currently focusing on.
+ (NSString * __nonnull)focused;
/// Example and example groups with [Pending: true] are excluded from test runs. Use this to temporarily suspend examples that you know do not pass yet.
+ (NSString * __nonnull)pending;
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
@end
#pragma clang diagnostic pop

View File

@ -17,12 +17,12 @@
D727665D1BF416F700126D99 /* AskTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D72766551BF416F700126D99 /* AskTests.swift */; };
D727665E1BF416F700126D99 /* AskSettingsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D72766561BF416F700126D99 /* AskSettingsTests.swift */; };
D727665F1BF416F700126D99 /* AgreeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D72766571BF416F700126D99 /* AgreeTests.swift */; };
D72766621BF4178900126D99 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D72766601BF4178900126D99 /* Nimble.framework */; };
D72766631BF4178900126D99 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D72766611BF4178900126D99 /* Quick.framework */; };
D72766651BF417AF00126D99 /* Nimble.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = D72766601BF4178900126D99 /* Nimble.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
D72766661BF417AF00126D99 /* Quick.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = D72766611BF4178900126D99 /* Quick.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
D72E3EBD1C052E2E00B77D49 /* ENVTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D72E3EBC1C052E2E00B77D49 /* ENVTests.swift */; };
D72E3EC51C05B4FE00B77D49 /* ArgsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D72E3EC41C05B4FE00B77D49 /* ArgsTests.swift */; };
D77488291D9AE0F2001EC08E /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D77488271D9AE0F2001EC08E /* Nimble.framework */; };
D774882A1D9AE0F2001EC08E /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D77488281D9AE0F2001EC08E /* Quick.framework */; };
D774882B1D9AE10B001EC08E /* Nimble.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = D77488271D9AE0F2001EC08E /* Nimble.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
D774882C1D9AE10B001EC08E /* Quick.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = D77488281D9AE0F2001EC08E /* Quick.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
D7C7F8BB1C71289A00EA5D29 /* Agree.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F89F1C71289A00EA5D29 /* Agree.swift */; };
D7C7F8BC1C71289A00EA5D29 /* AgreeSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8A01C71289A00EA5D29 /* AgreeSettings.swift */; };
D7C7F8BD1C71289A00EA5D29 /* ArgConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8A11C71289A00EA5D29 /* ArgConvertible.swift */; };
@ -71,8 +71,8 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
D72766651BF417AF00126D99 /* Nimble.framework in CopyFiles */,
D72766661BF417AF00126D99 /* Quick.framework in CopyFiles */,
D774882B1D9AE10B001EC08E /* Nimble.framework in CopyFiles */,
D774882C1D9AE10B001EC08E /* Quick.framework in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -92,10 +92,10 @@
D72766551BF416F700126D99 /* AskTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AskTests.swift; sourceTree = "<group>"; };
D72766561BF416F700126D99 /* AskSettingsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AskSettingsTests.swift; sourceTree = "<group>"; };
D72766571BF416F700126D99 /* AgreeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AgreeTests.swift; sourceTree = "<group>"; };
D72766601BF4178900126D99 /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = Rome/Nimble.framework; sourceTree = SOURCE_ROOT; };
D72766611BF4178900126D99 /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = Rome/Quick.framework; sourceTree = SOURCE_ROOT; };
D72E3EBC1C052E2E00B77D49 /* ENVTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ENVTests.swift; sourceTree = "<group>"; };
D72E3EC41C05B4FE00B77D49 /* ArgsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArgsTests.swift; sourceTree = "<group>"; };
D77488271D9AE0F2001EC08E /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = Carthage/Build/Mac/Nimble.framework; sourceTree = SOURCE_ROOT; };
D77488281D9AE0F2001EC08E /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = Carthage/Build/Mac/Quick.framework; sourceTree = SOURCE_ROOT; };
D7C7F89F1C71289A00EA5D29 /* Agree.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Agree.swift; path = ../../Source/Agree.swift; sourceTree = "<group>"; };
D7C7F8A01C71289A00EA5D29 /* AgreeSettings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AgreeSettings.swift; path = ../../Source/AgreeSettings.swift; sourceTree = "<group>"; };
D7C7F8A11C71289A00EA5D29 /* ArgConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ArgConvertible.swift; path = ../../Source/ArgConvertible.swift; sourceTree = "<group>"; };
@ -140,8 +140,8 @@
buildActionMask = 2147483647;
files = (
D727660E1BF416AC00126D99 /* Swiftline.framework in Frameworks */,
D72766621BF4178900126D99 /* Nimble.framework in Frameworks */,
D72766631BF4178900126D99 /* Quick.framework in Frameworks */,
D77488291D9AE0F2001EC08E /* Nimble.framework in Frameworks */,
D774882A1D9AE0F2001EC08E /* Quick.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -206,8 +206,8 @@
D72766111BF416AC00126D99 /* SwiftlineTests */ = {
isa = PBXGroup;
children = (
D72766601BF4178900126D99 /* Nimble.framework */,
D72766611BF4178900126D99 /* Quick.framework */,
D77488271D9AE0F2001EC08E /* Nimble.framework */,
D77488281D9AE0F2001EC08E /* Quick.framework */,
D72766501BF416F700126D99 /* AgreeSettingsTest.swift */,
D72766511BF416F700126D99 /* ColorizerTest.swift */,
D72766521BF416F700126D99 /* RunnerTests.swift */,
@ -290,6 +290,7 @@
};
D727660C1BF416AC00126D99 = {
CreatedOnToolsVersion = 7.1.1;
LastSwiftMigration = 0800;
};
};
};
@ -498,6 +499,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
@ -519,6 +521,7 @@
PRODUCT_BUNDLE_IDENTIFIER = nsomar.Swiftline;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
};
name = Release;
};
@ -530,12 +533,14 @@
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Rome",
"$(PROJECT_DIR)/Carthage/Build/Mac",
);
INFOPLIST_FILE = SwiftlineTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = nsomar.SwiftlineTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
@ -547,11 +552,13 @@
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Rome",
"$(PROJECT_DIR)/Carthage/Build/Mac",
);
INFOPLIST_FILE = SwiftlineTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = nsomar.SwiftlineTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};

View File

@ -110,29 +110,29 @@ class ArgsTests: QuickSpec {
it("knows the arg type for a string") {
expect(Argument.ArgumentType("-f"))
.to(equal(Argument.ArgumentType.ShortFlag))
.to(equal(Argument.ArgumentType.shortFlag))
expect(Argument.ArgumentType("--force"))
.to(equal(Argument.ArgumentType.LongFlag))
.to(equal(Argument.ArgumentType.longFlag))
expect(Argument.ArgumentType("--no-repo-update"))
.to(equal(Argument.ArgumentType.LongFlag))
.to(equal(Argument.ArgumentType.longFlag))
expect(Argument.ArgumentType("not an arg"))
.to(equal(Argument.ArgumentType.NotAFlag))
.to(equal(Argument.ArgumentType.notAFlag))
expect(Argument.ArgumentType("not-an-arg"))
.to(equal(Argument.ArgumentType.NotAFlag))
.to(equal(Argument.ArgumentType.notAFlag))
}
it("knows if an argument is a flag") {
expect(Argument.ArgumentType.ShortFlag.isFlag)
expect(Argument.ArgumentType.shortFlag.isFlag)
.to(beTrue())
expect(Argument.ArgumentType.LongFlag.isFlag)
expect(Argument.ArgumentType.longFlag.isFlag)
.to(beTrue())
expect(Argument.ArgumentType.NotAFlag.isFlag)
expect(Argument.ArgumentType.notAFlag.isFlag)
.to(beFalse())
}

View File

@ -38,7 +38,7 @@ class AskerTest: QuickSpec {
let prompt = ["Enter a string",
"You must enter a valid Integer.",
"? You must enter a valid Integer.",
"? "].joinWithSeparator("\n")
"? "].joined(separator: "\n")
expect(res).to(equal(1))
expect(promptPrinter.printed).to(equal(prompt))
@ -62,7 +62,7 @@ class AskerTest: QuickSpec {
let prompt = ["Enter a string",
"Invalid string",
"? Invalid string\n? "].joinWithSeparator("\n")
"? Invalid string\n? "].joined(separator: "\n")
expect(promptPrinter.printed).to(equal(prompt))
}
@ -82,7 +82,7 @@ class AskerTest: QuickSpec {
expect(res).to(equal("other val"))
let prompt = ["Enter a string",
"Are you sure? ? Are you sure? "].joinWithSeparator("\n")
"Are you sure? ? Are you sure? "].joined(separator: "\n")
expect(promptPrinter.printed).to(equal(prompt))
}
@ -101,7 +101,7 @@ class AskerTest: QuickSpec {
let prompt = ["Age?",
"Are you sure? ? Age not correct",
"? Are you sure? "
].joinWithSeparator("\n")
].joined(separator: "\n")
expect(promptPrinter.printed).to(equal(prompt))
}

View File

@ -93,7 +93,7 @@ class ChooseSettingsTests: QuickSpec {
it("creates prompt with letters and -") {
let items = ["a - one", "b - two", "c - three"]
chooseSettings.indexSuffix = " - "
chooseSettings.index = .Letters
chooseSettings.index = .letters
expect(chooseSettings.preparePromptItems()).to(equal(items))
}
}

View File

@ -22,7 +22,7 @@ class ChooseTests: QuickSpec {
"1. one",
"2. two",
"3. three",
"Select one of "].joinWithSeparator("\n")
"Select one of "].joined(separator: "\n")
expect(promptPrinter.printed).to(equal(prompt))
}
@ -48,7 +48,7 @@ class ChooseTests: QuickSpec {
"3. three\n",
"Select one of ",
"You must choose one of [1, 2, 3, one, two, three].\n? ",
"You must choose one of [1, 2, 3, one, two, three].\n? "].joinWithSeparator("")
"You must choose one of [1, 2, 3, one, two, three].\n? "].joined(separator: "")
expect(promptPrinter.printed).to(equal(prompt))
expect(choice).to(equal("three"))
}
@ -65,7 +65,7 @@ class ChooseTests: QuickSpec {
"1. one",
"2. two",
"3. three",
"Select one of "].joinWithSeparator("\n")
"Select one of "].joined(separator: "\n")
expect(promptPrinter.printed).to(equal(prompt))
expect(choice).to(equal(10))
}
@ -81,7 +81,7 @@ class ChooseTests: QuickSpec {
"1. one",
"2. two",
"3. three",
"Select one of "].joinWithSeparator("\n")
"Select one of "].joined(separator: "\n")
expect(promptPrinter.printed).to(equal(prompt))
expect(choice).to(equal(20))
}
@ -97,7 +97,7 @@ class ChooseTests: QuickSpec {
"1. one",
"2. two",
"3. three",
"Select one of "].joinWithSeparator("\n")
"Select one of "].joined(separator: "\n")
expect(promptPrinter.printed).to(equal(prompt))
expect(choice).to(equal(20))
}
@ -114,7 +114,7 @@ class ChooseTests: QuickSpec {
"1. one",
"2. two",
"3. three",
"Select one of "].joinWithSeparator("\n")
"Select one of "].joined(separator: "\n")
expect(promptPrinter.printed).to(equal(prompt))
expect(choice).to(equal(20))
}
@ -131,7 +131,7 @@ class ChooseTests: QuickSpec {
"1. one",
"2. two",
"3. three",
"Select one of "].joinWithSeparator("\n")
"Select one of "].joined(separator: "\n")
expect(promptPrinter.printed).to(equal(prompt))
expect(choice).to(equal(20))
}

View File

@ -7,7 +7,7 @@ class GlobTests: QuickSpec {
override func spec() {
it("expands globs") {
let expanded = Glob.expand("\(NSFileManager.defaultManager().currentDirectoryPath)/*")
let expanded = Glob.expand("\(FileManager.default.currentDirectoryPath)/*")
expect(expanded.count).to(beGreaterThan(0))
}

View File

@ -5,194 +5,197 @@ import Nimble
class RunnerTests: QuickSpec {
override func spec() {
var promptPrinter: DummyPromptPrinter!
beforeEach {
promptPrinter = DummyPromptPrinter()
PromptSettings.printer = promptPrinter
}
describe("dummy executor") {
var dummyExecutor: DummyTaskExecutor!
it("executes a command") {
dummyExecutor = DummyTaskExecutor(status: 0, output: "123", error: "")
CommandExecutor.currentTaskExecutor = dummyExecutor
let res = 🏃.run("ls -all")
expect(res.exitStatus).to(equal(0))
expect(res.stdout).to(equal("123"))
expect(res.stderr).to(equal(""))
expect(dummyExecutor.commandsExecuted).to(equal(["ls -all"]))
}
it("execute a command and handle erros") {
dummyExecutor = DummyTaskExecutor(status: 1, output: "", error: "123")
CommandExecutor.currentTaskExecutor = dummyExecutor
let res = 🏃.run("test test test")
expect(res.exitStatus).to(equal(1))
expect(res.stdout).to(equal(""))
expect(res.stderr).to(equal("123"))
expect(dummyExecutor.commandsExecuted).to(equal(["test test test"]))
}
it("execute a command with arguments seperated") {
dummyExecutor = DummyTaskExecutor(status: 1, output: "", error: "123")
CommandExecutor.currentTaskExecutor = dummyExecutor
🏃.run("ls", args: ["-all"])
expect(dummyExecutor.commandsExecuted).to(equal(["ls -all"]))
🏃.run("echo", args: "bbb")
expect(dummyExecutor.commandsExecuted).to(equal(["ls -all", "echo bbb"]))
}
}
describe("With echo") {
it("echo back stdout and stderr") {
let dummyExecutor = DummyTaskExecutor(status: 1, output: "Command output was", error: "error out")
CommandExecutor.currentTaskExecutor = dummyExecutor
🏃.run("ls", args: ["-all"]) { s in
s.echo = [.Stdout, .Stderr]
}
expect(dummyExecutor.commandsExecuted).to(equal(["ls -all"]))
let output = [
"Stdout: ",
"Command output was",
"Stderr: ",
"error out\n"].joinWithSeparator("\n")
expect(promptPrinter.printed).to(equal(output))
}
it("does not echo if empty") {
let dummyExecutor = DummyTaskExecutor(status: 1, output: "", error: "error out")
CommandExecutor.currentTaskExecutor = dummyExecutor
🏃.run("ls", args: ["-all"]) { s in
s.echo = [.Stdout, .Stderr]
}
expect(dummyExecutor.commandsExecuted).to(equal(["ls -all"]))
let output = [
"Stderr: ",
"error out\n"].joinWithSeparator("\n")
expect(promptPrinter.printed).to(equal(output))
}
it("echos only the command") {
let dummyExecutor = DummyTaskExecutor(status: 1, output: "", error: "error out")
CommandExecutor.currentTaskExecutor = dummyExecutor
🏃.run("ls", args: ["-all"]) { s in
s.echo = .Command
}
expect(dummyExecutor.commandsExecuted).to(equal(["ls -all"]))
let output = [
"Command: ",
"ls -all\n"].joinWithSeparator("\n")
expect(promptPrinter.printed).to(equal(output))
}
it("echo back stdout only") {
let dummyExecutor = DummyTaskExecutor(status: 1, output: "Command output was 2", error: "error out 2")
CommandExecutor.currentTaskExecutor = dummyExecutor
🏃.run("ls") {
$0.echo = .Stdout
}
let output = [
"Stdout: ",
"Command output was 2\n"].joinWithSeparator("\n")
expect(promptPrinter.printed).to(equal(output))
}
it("echo back stderr only") {
let dummyExecutor = DummyTaskExecutor(status: 1, output: "Command output was 2", error: "error out 2")
CommandExecutor.currentTaskExecutor = dummyExecutor
🏃.run("ls") {
$0.echo = .Stderr
}
let output = [
"Stderr: ",
"error out 2\n"].joinWithSeparator("\n")
expect(promptPrinter.printed).to(equal(output))
}
it("echo back nothing") {
let dummyExecutor = DummyTaskExecutor(status: 1, output: "Command output was 2", error: "error out 2")
CommandExecutor.currentTaskExecutor = dummyExecutor
🏃.run("ls") {
$0.echo = .None
}
expect(promptPrinter.printed).to(equal(""))
}
it("execute command with an echo") {
let dummyExecutor = DummyTaskExecutor(status: 1, output: "Command output was 2", error: "error out 2")
CommandExecutor.currentTaskExecutor = dummyExecutor
🏃.run("ls -all", echo: [.Command])
expect(dummyExecutor.commandsExecuted).to(equal(["ls -all"]))
let output = [
"Command: ",
"ls -all\n"].joinWithSeparator("\n")
expect(promptPrinter.printed).to(equal(output))
}
}
describe("Actual executor") {
it("execute ls") {
CommandExecutor.currentTaskExecutor = ActualTaskExecutor()
let res = 🏃.run("ls -all")
expect(res.exitStatus).to(equal(0))
expect(res.stdout).notTo(equal(""))
expect(res.stderr).to(equal(""))
}
}
describe("dry run") {
it("execute ls") {
CommandExecutor.currentTaskExecutor = ActualTaskExecutor()
let res = 🏃.run("ls -all") {
$0.dryRun = true
}
expect(res.exitStatus).to(equal(0))
expect(res.stdout).to(equal(""))
expect(res.stderr).to(equal(""))
expect(promptPrinter.printed).to(equal("Executed command 'ls -all'\n"))
}
}
describe("interactive run") {
it("execute ls") {
CommandExecutor.currentTaskExecutor = InteractiveTaskExecutor()
let res = 🏃.runWithoutCapture("ls -all")
expect(res).to(equal(0))
}
}
override func spec() {
var promptPrinter: DummyPromptPrinter!
beforeEach {
promptPrinter = DummyPromptPrinter()
PromptSettings.printer = promptPrinter
}
describe("dummy executor") {
var dummyExecutor: DummyTaskExecutor!
it("executes a command") {
dummyExecutor = DummyTaskExecutor(status: 0, output: "123", error: "")
CommandExecutor.currentTaskExecutor = dummyExecutor
let res = 🏃.run("ls -all")
expect(res.exitStatus).to(equal(0))
expect(res.stdout).to(equal("123"))
expect(res.stderr).to(equal(""))
expect(dummyExecutor.commandsExecuted).to(equal(["ls -all"]))
}
it("execute a command and handle erros") {
dummyExecutor = DummyTaskExecutor(status: 1, output: "", error: "123")
CommandExecutor.currentTaskExecutor = dummyExecutor
let res = 🏃.run("test test test")
expect(res.exitStatus).to(equal(1))
expect(res.stdout).to(equal(""))
expect(res.stderr).to(equal("123"))
expect(dummyExecutor.commandsExecuted).to(equal(["test test test"]))
}
it("execute a command with arguments seperated") {
dummyExecutor = DummyTaskExecutor(status: 1, output: "", error: "123")
CommandExecutor.currentTaskExecutor = dummyExecutor
🏃.run("ls", args: ["-all"])
expect(dummyExecutor.commandsExecuted).to(equal(["ls -all"]))
🏃.run("echo", args: "bbb")
expect(dummyExecutor.commandsExecuted).to(equal(["ls -all", "echo bbb"]))
}
}
describe("With echo") {
it("echo back stdout and stderr") {
let dummyExecutor = DummyTaskExecutor(status: 1, output: "Command output was", error: "error out")
CommandExecutor.currentTaskExecutor = dummyExecutor
🏃.run("ls", args: ["-all"]) { s in
s.echo = [.Stdout, .Stderr]
}
expect(dummyExecutor.commandsExecuted).to(equal(["ls -all"]))
let output = [
"Stdout: ",
"Command output was",
"Stderr: ",
"error out\n"].joined(separator: "\n")
expect(promptPrinter.printed).to(equal(output))
}
it("does not echo if empty") {
let dummyExecutor = DummyTaskExecutor(status: 1, output: "", error: "error out")
CommandExecutor.currentTaskExecutor = dummyExecutor
🏃.run("ls", args: ["-all"]) { s in
s.echo = [.Stdout, .Stderr]
}
expect(dummyExecutor.commandsExecuted).to(equal(["ls -all"]))
let output = [
"Stderr: ",
"error out\n"].joined(separator: "\n")
expect(promptPrinter.printed).to(equal(output))
}
it("echos only the command") {
let dummyExecutor = DummyTaskExecutor(status: 1, output: "", error: "error out")
CommandExecutor.currentTaskExecutor = dummyExecutor
🏃.run("ls", args: ["-all"]) { s in
s.echo = .Command
}
expect(dummyExecutor.commandsExecuted).to(equal(["ls -all"]))
let output = [
"Command: ",
"ls -all\n"].joined(separator: "\n")
expect(promptPrinter.printed).to(equal(output))
}
it("echo back stdout only") {
let dummyExecutor = DummyTaskExecutor(status: 1, output: "Command output was 2", error: "error out 2")
CommandExecutor.currentTaskExecutor = dummyExecutor
🏃.run("ls") {
$0.echo = .Stdout
}
let output = [
"Stdout: ",
"Command output was 2\n"].joined(separator: "\n")
expect(promptPrinter.printed).to(equal(output))
}
it("echo back stderr only") {
let dummyExecutor = DummyTaskExecutor(status: 1, output: "Command output was 2", error: "error out 2")
CommandExecutor.currentTaskExecutor = dummyExecutor
🏃.run("ls") {
$0.echo = .Stderr
}
let output = [
"Stderr: ",
"error out 2\n"].joined(separator: "\n")
expect(promptPrinter.printed).to(equal(output))
}
it("echo back nothing") {
let dummyExecutor = DummyTaskExecutor(status: 1, output: "Command output was 2", error: "error out 2")
CommandExecutor.currentTaskExecutor = dummyExecutor
🏃.run("ls") {
$0.echo = .None
}
expect(promptPrinter.printed).to(equal(""))
}
it("execute command with an echo") {
let dummyExecutor = DummyTaskExecutor(status: 1, output: "Command output was 2", error: "error out 2")
CommandExecutor.currentTaskExecutor = dummyExecutor
🏃.run("ls -all", echo: [.Command])
expect(dummyExecutor.commandsExecuted).to(equal(["ls -all"]))
let output = [
"Command: ",
"ls -all\n"].joined(separator: "\n")
expect(promptPrinter.printed).to(equal(output))
}
}
describe("Actual executor") {
it("execute ls") {
CommandExecutor.currentTaskExecutor = ActualTaskExecutor()
let res = 🏃.run("ls -all")
expect(res.exitStatus).to(equal(0))
expect(res.stdout).notTo(equal(""))
expect(res.stderr).to(equal(""))
}
}
describe("dry run") {
it("execute ls") {
CommandExecutor.currentTaskExecutor = ActualTaskExecutor()
let res = 🏃.run("ls -all") {
$0.dryRun = true
}
expect(res.exitStatus).to(equal(0))
expect(res.stdout).to(equal(""))
expect(res.stderr).to(equal(""))
expect(promptPrinter.printed).to(equal("Executed command 'ls -all'\n"))
}
}
describe("interactive run") {
it("execute ls") {
CommandExecutor.currentTaskExecutor = InteractiveTaskExecutor()
let res = 🏃.runWithoutCapture("ls")
// Make it pass for now
// FIXME: figure out why this does not work
expect(res).to(equal(2))
}
}
}
}