Files
SwiftShell/SwiftShellTests/Command_Tests.swift
T
2014-09-02 15:23:22 +02:00

27 lines
605 B
Swift

//
// Command_Tests.swift
// SwiftShell
//
// Created by Kåre Morstøl on 15/08/14.
// Copyright (c) 2014 NotTooBad Software. All rights reserved.
//
import SwiftShell
import XCTest
class Command_Tests: XCTestCase {
func testSimpleCommand() {
SwiftShell.run("echo")
}
func testSimpleCommandWithOutput() {
XCTAssertEqual(SwiftShell.run("echo this is streamed").read(), "this is streamed\n")
}
func testChainedCommands() {
let result = SwiftShell.run("echo this is streamed") |> SwiftShell.run( "wc -w")
XCTAssertEqual( result.read().trim(), "3", "the number of words should be 3")
}
}