Skip to content

Commit a28770e

Browse files
committed
correctly override auto
1 parent 676d64b commit a28770e

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

SwiftDraw/Sources/CommandLine/CommandLine.Configuration.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,14 @@ extension CommandLine {
210210

211211
static func parseInsets(from value: String??) throws -> Insets? {
212212
guard let value = value,
213-
let value = value,
214-
value != "auto" else {
213+
let value = value else {
215214
return nil
216215
}
217216

217+
guard value != "auto" else {
218+
return Insets()
219+
}
220+
218221
var scanner = XMLParser.Scanner(text: value)
219222
let top = try scanner.scanInset()
220223
_ = try scanner.scanString(",")

SwiftDraw/Tests/CommandLine/CommandLine.ArgumentsTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ final class CommandLineArgumentsTests: XCTestCase {
4242
XCTAssertEqual(modifiers, [.ultralightInsets: "a", .blackInsets: "b", .hideUnsupportedFilters: nil, .legacy: nil])
4343

4444
modifiers = try CommandLine.parseModifiers(from: ["--ultralight-insets", "a", "--black-insets", "b", "--hide-unsupported-filters", "--legacy"])
45-
XCTAssertEqual(modifiers, [.ultralightInsets: "a", .blackInsets: "b", .hideUnsupportedFilters: nil, .legacy: nil])"
45+
XCTAssertEqual(modifiers, [.ultralightInsets: "a", .blackInsets: "b", .hideUnsupportedFilters: nil, .legacy: nil])
4646

4747
}
4848

SwiftDraw/Tests/CommandLine/CommandLine.ConfigurationTests.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,8 @@ final class CommandLineConfigurationTests: XCTestCase {
9090
}
9191

9292
func testParseInsets() throws {
93-
XCTAssertEqual(
93+
XCTAssertNil(
9494
try CommandLine.parseInsets(from: nil),
95-
.init()
9695
)
9796
XCTAssertEqual(
9897
try CommandLine.parseInsets(from: "auto"),

0 commit comments

Comments
 (0)