mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
058869f446
* Require Swift 5.3 or higher to build * Remove Swift Version Support tables from readmes These weren't exactly accurate because SwiftLint should still work with older Swift versions long after we update the minimum version of Swift needed to _build_ the tool. So I doubt this table was very helpful to anyone.
26 lines
972 B
Swift
26 lines
972 B
Swift
@testable import SwiftLintFramework
|
|
import XCTest
|
|
|
|
class CompilerProtocolInitRuleTests: XCTestCase {
|
|
private let ruleID = CompilerProtocolInitRule.description.identifier
|
|
|
|
func testWithDefaultConfiguration() {
|
|
verifyRule(CompilerProtocolInitRule.description)
|
|
}
|
|
|
|
func testViolationMessageForExpressibleByIntegerLiteral() throws {
|
|
let config = try XCTUnwrap(makeConfig(nil, ruleID))
|
|
let allViolations = violations(Example("let a = NSNumber(integerLiteral: 1)"), config: config)
|
|
|
|
let compilerProtocolInitViolation = allViolations.first { $0.ruleIdentifier == ruleID }
|
|
let violation = try XCTUnwrap(
|
|
compilerProtocolInitViolation,
|
|
"A compiler protocol init violation should have been triggered!"
|
|
)
|
|
XCTAssertEqual(
|
|
violation.reason,
|
|
"The initializers declared in compiler protocol ExpressibleByIntegerLiteral shouldn't be called directly."
|
|
)
|
|
}
|
|
}
|