From 3ed67ef010dbcec9f1b53bd72a4186c7183b3148 Mon Sep 17 00:00:00 2001 From: KOTARO SUTO Date: Fri, 3 Nov 2023 16:35:32 -0700 Subject: [PATCH] Adds #if os(macOS) check to use different error msg --- Tests/ScriptSwiftTests/ScriptUnitTests.swift | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Tests/ScriptSwiftTests/ScriptUnitTests.swift b/Tests/ScriptSwiftTests/ScriptUnitTests.swift index 71031a3..2916805 100644 --- a/Tests/ScriptSwiftTests/ScriptUnitTests.swift +++ b/Tests/ScriptSwiftTests/ScriptUnitTests.swift @@ -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() {