Files
SwiftLint/Tests/SwiftLintFrameworkTests/PrivateOverFilePrivateRuleTests.swift
T
JP SimardandGitHub 4bd7da32ea Reduce visibility of rules to be internal (#4533)
There's no reason to expose these publicly and this will make it nicer
to move to a new module outside of the core SwiftLint functionality.
2022-11-09 11:01:26 -05:00

33 lines
1.5 KiB
Swift

@testable import SwiftLintFramework
import XCTest
class PrivateOverFilePrivateRuleTests: XCTestCase {
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])
}
}