Files
SwiftLint/Tests/BuiltInRulesTests/PrefixedTopLevelConstantRuleTests.swift
Danny Mösch 15b285527a Separate built-in rule tests from framework tests (#5924)
* 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`
2024-12-30 12:26:46 +01:00

23 lines
762 B
Swift

@testable import SwiftLintBuiltInRules
import TestHelpers
final class PrefixedTopLevelConstantRuleTests: SwiftLintTestCase {
func testPrivateOnly() {
let triggeringExamples = [
Example("private let ↓Foo = 20.0"),
Example("fileprivate let ↓foo = 20.0"),
]
let nonTriggeringExamples = [
Example("let Foo = 20.0"),
Example("internal let Foo = \"Foo\""),
Example("public let Foo = 20.0"),
]
let description = PrefixedTopLevelConstantRule.description
.with(triggeringExamples: triggeringExamples)
.with(nonTriggeringExamples: nonTriggeringExamples)
verifyRule(description, ruleConfiguration: ["only_private": true])
}
}