Skip to content

Commit d6ed229

Browse files
committed
update error message
1 parent 7838fe1 commit d6ed229

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

Sources/ArgumentParserTestHelpers/TestHelpers.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,12 @@ public func AssertEqualStrings(
162162
line: UInt = #line
163163
) {
164164
// Normalize line endings to '\n'.
165-
let actual = actual
165+
let actual =
166+
actual
166167
.replacingOccurrences(of: "\r\n", with: "\n")
167168
.replacingOccurrences(of: "\r", with: "\n")
168-
let expected = expected
169+
let expected =
170+
expected
169171
.replacingOccurrences(of: "\r\n", with: "\n")
170172
.replacingOccurrences(of: "\r", with: "\n")
171173

Tests/ArgumentParserPackageManagerTests/HelpTests.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ extension HelpTests {
100100

101101
func testConfigHelp() throws {
102102
XCTAssertEqual(
103-
getErrorText(Package.self, ["help", "config"], screenWidth: 80)
104-
,
103+
getErrorText(Package.self, ["help", "config"], screenWidth: 80),
105104
"""
106105
USAGE: package config <subcommand>
107106

Tests/ArgumentParserUnitTests/ExitCodeTests.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,14 @@ extension ExitCodeTests {
8484

8585
extension ExitCodeTests {
8686
func testNSErrorIsHandled() {
87-
let message = "The file “foo/bar” couldn’t be opened because there is no such file"
8887
struct NSErrorCommand: ParsableCommand {
88+
static let message =
89+
"The file “foo/bar” couldn’t be opened because there is no such file"
90+
8991
static let fileNotFoundNSError = NSError(
9092
domain: "TestError",
9193
code: 1,
92-
userInfo: [NSLocalizedDescriptionKey: message])
94+
userInfo: [NSLocalizedDescriptionKey: Self.message])
9395
}
9496
XCTAssertEqual(
9597
NSErrorCommand.exitCode(for: NSErrorCommand.fileNotFoundNSError),
@@ -103,12 +105,12 @@ extension ExitCodeTests {
103105
#else
104106
XCTAssertEqual(
105107
NSErrorCommand.message(for: NSErrorCommand.fileNotFoundNSError),
106-
"Error Domain=TestError Code=1 \"(null)\"\(message)")
108+
"Error Domain=TestError Code=1 \"(null)\"\(NSErrorCommand.message)")
107109
#endif
108110
#else
109111
XCTAssertEqual(
110112
NSErrorCommand.message(for: NSErrorCommand.fileNotFoundNSError),
111-
message)
113+
NSErrorCommand.message)
112114
#endif
113115
}
114116
}

0 commit comments

Comments
 (0)