Skip to content

Commit d40e0bf

Browse files
committed
Drop .string in favour of .description
1 parent cf5e1ac commit d40e0bf

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

Sources/Argument.swift

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@ public enum Argument: Equatable {
1212
public init(verbatim string: String) {
1313
self = .verbatim(string)
1414
}
15-
16-
public var string: String {
17-
switch self {
18-
case let .quoted(value):
19-
return value.quoted
20-
case let .verbatim(string):
21-
return string
22-
}
23-
}
2415
}
2516

2617

@@ -32,7 +23,14 @@ extension Argument: ExpressibleByStringLiteral {
3223

3324

3425
extension Argument: CustomStringConvertible {
35-
public var description: String { string }
26+
public var description: String {
27+
switch self {
28+
case let .quoted(value):
29+
return value.quoted
30+
case let .verbatim(string):
31+
return string
32+
}
33+
}
3634
}
3735

3836

Tests/ShellOutTests/ShellOutTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,12 @@ class ShellOutTests: XCTestCase {
210210
}
211211

212212
func test_Argument_ExpressibleByStringLiteral() throws {
213-
XCTAssertEqual(("foo" as Argument).string, "foo")
214-
XCTAssertEqual(("foo bar" as Argument).string, "'foo bar'")
213+
XCTAssertEqual(("foo" as Argument).description, "foo")
214+
XCTAssertEqual(("foo bar" as Argument).description, "'foo bar'")
215215
}
216216

217217
func test_Argument_url() throws {
218-
XCTAssertEqual(Argument.url(.init(string: "https://example.com")!).string,
218+
XCTAssertEqual(Argument.url(.init(string: "https://example.com")!).description,
219219
"https://example.com")
220220
}
221221

0 commit comments

Comments
 (0)