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`
33 lines
1.5 KiB
Swift
33 lines
1.5 KiB
Swift
@testable import SwiftLintBuiltInRules
|
|
import TestHelpers
|
|
|
|
final class PrivateOverFilePrivateRuleTests: SwiftLintTestCase {
|
|
func testPrivateOverFilePrivateValidatingExtensions() {
|
|
let baseDescription = PrivateOverFilePrivateRule.description
|
|
let triggeringExamples = baseDescription.triggeringExamples + [
|
|
Example("↓fileprivate extension String {}"),
|
|
Example("↓fileprivate \n extension String {}"),
|
|
Example("↓fileprivate extension \n String {}"),
|
|
]
|
|
let corrections = [
|
|
Example("↓fileprivate extension String {}"): Example("private extension String {}"),
|
|
Example("↓fileprivate \n extension String {}"): Example("private \n extension String {}"),
|
|
Example("↓fileprivate extension \n String {}"): Example("private extension \n String {}"),
|
|
]
|
|
|
|
let description = baseDescription.with(nonTriggeringExamples: [])
|
|
.with(triggeringExamples: triggeringExamples).with(corrections: corrections)
|
|
verifyRule(description, ruleConfiguration: ["validate_extensions": true])
|
|
}
|
|
|
|
func testPrivateOverFilePrivateNotValidatingExtensions() {
|
|
let baseDescription = PrivateOverFilePrivateRule.description
|
|
let nonTriggeringExamples = baseDescription.nonTriggeringExamples + [
|
|
Example("fileprivate extension String {}")
|
|
]
|
|
|
|
let description = baseDescription.with(nonTriggeringExamples: nonTriggeringExamples)
|
|
verifyRule(description, ruleConfiguration: ["validate_extensions": false])
|
|
}
|
|
}
|