mirror of
https://github.com/nicklockwood/SwiftFormat.git
synced 2026-05-17 10:30:35 +00:00
Fix preferFileMacro case-sensitivity bug
This commit is contained in:
committed by
Cal Stephens
parent
be767fc1ce
commit
f5dad6938c
@@ -101,9 +101,9 @@ class OptionDescriptor {
|
||||
type = .binary(true: trueValues, false: falseValues)
|
||||
toOptions = { value, options in
|
||||
switch value.lowercased() {
|
||||
case let value where trueValues.contains(value):
|
||||
case let value where trueValues.contains(where: { value == $0.lowercased() }):
|
||||
options[keyPath: keyPath] = true
|
||||
case let value where falseValues.contains(value):
|
||||
case let value where falseValues.contains(where: { value == $0.lowercased() }):
|
||||
options[keyPath: keyPath] = false
|
||||
default:
|
||||
throw FormatError.options("")
|
||||
|
||||
@@ -349,4 +349,10 @@ class OptionDescriptorTests: XCTestCase {
|
||||
let options2 = FormatOptions(selfRequired: ["baz", "bar", "foo"])
|
||||
XCTAssertEqual(options1.description, options2.description)
|
||||
}
|
||||
|
||||
func testFileMacroCase() {
|
||||
let argument = "#fileID"
|
||||
var options: FormatOptions = .default
|
||||
XCTAssertNoThrow(try Descriptors.preferFileMacro.toOptions(argument, &options))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user