File tree Expand file tree Collapse file tree
Tests/SwiftShellUtilitiesTests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,10 +2,29 @@ import XCTest
22@testable import SwiftShellUtilities
33
44final class SystemActionTests : XCTestCase {
5- func testExample( ) throws {
6- // This is an example of a functional test case.
7- // Use XCTAssert and related functions to verify your tests produce the correct
8- // results.
9- // XCTAssertEqual(SystemAction().text, "Hello, World!")
5+
6+ func testThat_Real_CanExecuteCommand( ) throws {
7+ let action = SystemActionReal ( )
8+
9+ try action. runAndPrint ( command: " date " )
10+ }
11+
12+ func testThat_Real_WillThrow_GivenInvalidCommand( ) throws {
13+ let action = SystemActionReal ( )
14+
15+ XCTAssertThrowsError ( try action. runAndPrint ( command: " _this_command-does_not_exist " ) )
16+ }
17+
18+ func testThat_Composite_CanExecuteCommand( ) throws {
19+ let action = SystemActionComposite ( [ SystemActionPrint ( ) , SystemActionReal ( ) ] )
20+
21+ try action. runAndPrint ( command: " date " )
22+ }
23+
24+ func testThat_Composite_WillThrow_GivenInvalidCommand( ) throws {
25+ let action = SystemActionComposite ( [ SystemActionPrint ( ) , SystemActionReal ( ) ] )
26+
27+ XCTAssertThrowsError ( try action. runAndPrint ( command: " _this_command-does_not_exist " ) )
1028 }
29+
1130}
You can’t perform that action at this time.
0 commit comments