File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -104,10 +104,6 @@ public struct ShellOutCommand {
104
104
self . arguments = arguments
105
105
}
106
106
107
- public var string : String {
108
- ( [ command] + arguments) . joined ( separator: " " )
109
- }
110
-
111
107
public func appending( arguments newArguments: [ String ] ) -> Self {
112
108
. init( command: command, arguments: arguments + newArguments)
113
109
}
@@ -125,6 +121,12 @@ public struct ShellOutCommand {
125
121
}
126
122
}
127
123
124
+ extension ShellOutCommand : CustomStringConvertible {
125
+ public var description : String {
126
+ ( [ command] + arguments) . joined ( separator: " " )
127
+ }
128
+ }
129
+
128
130
public extension ShellOutCommand {
129
131
static func bash( arguments: [ Argument ] ) -> Self {
130
132
. init( command: " bash " , arguments: [ " -c " , arguments. map ( \. string) . joined ( separator: " " ) ] )
Original file line number Diff line number Diff line change @@ -28,23 +28,23 @@ func XCTAssertEqualAsync<T>(
28
28
class ShellOutTests : XCTestCase {
29
29
func test_appendArguments( ) throws {
30
30
var cmd = ShellOutCommand ( command: " foo " )
31
- XCTAssertEqual ( cmd. string , " foo " )
31
+ XCTAssertEqual ( cmd. description , " foo " )
32
32
cmd. append ( arguments: [ " ; " , " bar " ] )
33
- XCTAssertEqual ( cmd. string , " foo ; bar " )
33
+ XCTAssertEqual ( cmd. description , " foo ; bar " )
34
34
cmd. append ( arguments: [ " > baz " ] )
35
- XCTAssertEqual ( cmd. string , " foo ; bar > baz " )
35
+ XCTAssertEqual ( cmd. description , " foo ; bar > baz " )
36
36
}
37
37
38
38
func test_appendingArguments( ) throws {
39
39
let cmd = ShellOutCommand ( command: " foo " )
40
40
XCTAssertEqual (
41
- cmd. appending ( arguments: [ " ; " , " bar " ] ) . string ,
41
+ cmd. appending ( arguments: [ " ; " , " bar " ] ) . description ,
42
42
" foo ; bar "
43
43
)
44
44
XCTAssertEqual (
45
45
cmd. appending ( arguments: [ " ; " , " bar " ] )
46
46
. appending ( arguments: [ " > baz " ] )
47
- . string ,
47
+ . description ,
48
48
" foo ; bar > baz "
49
49
)
50
50
}
You can’t perform that action at this time.
0 commit comments