mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
33 lines
943 B
Swift
33 lines
943 B
Swift
@testable import SwiftLintBuiltInRules
|
|
import XCTest
|
|
|
|
class ChildOptionSeverityConfigurationTests: SwiftLintTestCase {
|
|
typealias TesteeType = ChildOptionSeverityConfiguration<RuleMock>
|
|
|
|
func testSeverity() {
|
|
XCTAssertNil(TesteeType.off.severity)
|
|
XCTAssertEqual(TesteeType.warning.severity, .warning)
|
|
XCTAssertEqual(TesteeType.error.severity, .error)
|
|
}
|
|
|
|
func testFromConfig() throws {
|
|
var testee = TesteeType.off
|
|
|
|
try testee.apply(configuration: "warning")
|
|
XCTAssertEqual(testee, .warning)
|
|
|
|
try testee.apply(configuration: "error")
|
|
XCTAssertEqual(testee, .error)
|
|
|
|
try testee.apply(configuration: "off")
|
|
XCTAssertEqual(testee, .off)
|
|
}
|
|
|
|
func testInvalidConfig() {
|
|
var testee = TesteeType.off
|
|
|
|
XCTAssertThrowsError(try testee.apply(configuration: "no"))
|
|
XCTAssertThrowsError(try testee.apply(configuration: 1))
|
|
}
|
|
}
|