-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for specific configuration
- Loading branch information
Showing
5 changed files
with
40 additions
and
14 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
Source/SwiftLintFramework/Rules/PrefixedTopLevelConstantRule.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
Tests/SwiftLintFrameworkTests/PrefixedTopLevelConstantRuleTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
@testable import SwiftLintFramework | ||
import XCTest | ||
|
||
final class PrefixedTopLevelConstantRuleTests: XCTestCase { | ||
func testDefaultConfiguration() { | ||
verifyRule(PrefixedTopLevelConstantRule.description) | ||
} | ||
|
||
func testPrivateOnly() { | ||
let triggeringExamples = [ | ||
"private let ↓Foo = 20.0", | ||
"fileprivate let ↓foo = 20.0" | ||
] | ||
let nonTriggeringExamples = [ | ||
"let Foo = 20.0", | ||
"internal let Foo = \"Foo\"", | ||
"public let Foo = 20.0" | ||
] | ||
|
||
let alwaysOnSameLineDescription = PrefixedTopLevelConstantRule.description | ||
.with(triggeringExamples: triggeringExamples) | ||
.with(nonTriggeringExamples: nonTriggeringExamples) | ||
|
||
verifyRule(alwaysOnSameLineDescription, | ||
ruleConfiguration: ["only_private": true]) | ||
} | ||
} |