Skip to content

Commit

Permalink
Added purposefully failing test to show stray characters (ref issue g…
Browse files Browse the repository at this point in the history
  • Loading branch information
finestructure committed Feb 11, 2017
1 parent 09c6716 commit 9e5dedb
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Tests/ProcessTests/ProcessTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,20 @@ class ProcessTests: XCTestCase {
XCTAssertEqual(promptPrinter.printed, "Executed command 'ls -all'\n")
}

func testStrayOutput() {
CommandExecutor.currentTaskExecutor = ActualTaskExecutor()
let msg = [
"Lorem ipsum dolor sit amet,",
"consectetur adipiscing elit,",
].joined(separator: "\n")
let res = Process.exec("echo '\(msg)'") { $0.echo = [.Stdout, .Stderr, .Command] }
XCTAssertEqual(res.exitStatus, 0)
// added an extra '\n' to make test fail on purpose - after which there are stray
// characters in the error log
XCTAssertEqual(res.stdout, "\(msg)\n\n")
XCTAssertEqual(res.stderr, "")
}

static var allTests : [(String, (ProcessTests) -> () throws -> Void)] {
return [
("testItExecutesACommandWithDummyExecutor", testItExecutesACommandWithDummyExecutor),
Expand Down

0 comments on commit 9e5dedb

Please sign in to comment.