mirror of
https://github.com/realm/SwiftLint.git
synced 2026-05-07 20:12:49 +00:00
15b285527a
* Short names for test modules * Lint plugins and `Package.swift` in integration tests * Simplify and merge file groups in Bazel * Move common functions to `TestHelpers`
24 lines
798 B
Swift
24 lines
798 B
Swift
@testable import SwiftLintBuiltInRules
|
|
import TestHelpers
|
|
|
|
final class ExplicitInitRuleTests: SwiftLintTestCase {
|
|
func testIncludeBareInit() {
|
|
let nonTriggeringExamples = [
|
|
Example("let foo = Foo()"),
|
|
Example("let foo = init()"),
|
|
] + ExplicitInitRule.description.nonTriggeringExamples
|
|
|
|
let triggeringExamples = [
|
|
Example("let foo: Foo = ↓.init()"),
|
|
Example("let foo: [Foo] = [↓.init(), ↓.init()]"),
|
|
Example("foo(↓.init())"),
|
|
]
|
|
|
|
let description = ExplicitInitRule.description
|
|
.with(nonTriggeringExamples: nonTriggeringExamples)
|
|
.with(triggeringExamples: triggeringExamples)
|
|
|
|
verifyRule(description, ruleConfiguration: ["include_bare_init": true])
|
|
}
|
|
}
|