Skip to content

Commit

Permalink
Adds #if os(macOS) check to use different error msg (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
KS1019 authored Nov 3, 2023
1 parent b772fb5 commit bb20a3a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Tests/ScriptSwiftTests/ScriptUnitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,41 @@ final class ScriptUnitTests: XCTestCase {
return XCTFail("Expected failure but got success")
}

#if os(macOS)
XCTAssertEqual(result1.localizedDescription, """
ShellOut encountered an error
Status code: 127
Message: "/bin/bash: makes-no-sense: command not found"
Output: ""
""")
#else
XCTAssertEqual(result1.localizedDescription, """
ShellOut encountered an error
Status code: 127
Message: "/bin/bash: line 1: makes-no-sense: command not found"
Output: ""
""")
#endif

guard case .failure(let result2) = Script().exec(command).input else {
return XCTFail("Expected failure but got success")
}

#if os(macOS)
XCTAssertEqual(result2.localizedDescription, """
ShellOut encountered an error
Status code: 127
Message: "/bin/bash: makes-no-sense: command not found"
Output: ""
""")
#else
XCTAssertEqual(result1.localizedDescription, """
ShellOut encountered an error
Status code: 127
Message: "/bin/bash: line 1: makes-no-sense: command not found"
Output: ""
""")
#endif
}

func testMap() {
Expand Down

0 comments on commit bb20a3a

Please sign in to comment.