Skip to content

Commit

Permalink
Make it easier to see example test output
Browse files Browse the repository at this point in the history
  • Loading branch information
natecook1000 committed Feb 23, 2022
1 parent 723868a commit 31e6061
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Sources/ArgumentParserTestHelpers/TestHelpers.swift
Expand Up @@ -249,10 +249,16 @@ extension XCTest {

let outputData = output.fileHandleForReading.readDataToEndOfFile()
let outputActual = String(data: outputData, encoding: .utf8)!.trimmingCharacters(in: .whitespacesAndNewlines)

let errorData = error.fileHandleForReading.readDataToEndOfFile()
let errorActual = String(data: errorData, encoding: .utf8)!.trimmingCharacters(in: .whitespacesAndNewlines)

print("COMMAND: \(command)")
print("STDOUT:")
print(outputActual)
print("STDERR:")
print(errorActual)

if let expected = expected {
AssertEqualStringsIgnoringTrailingWhitespace(expected, errorActual + outputActual, file: file, line: line)
}
Expand Down

0 comments on commit 31e6061

Please sign in to comment.