Files
SwiftLint/Tests/SwiftLintFrameworkTests/InclusiveLanguageRuleTests.swift
T
Dalton Claybrook d305e03905 Add inclusive_language rule (#3243)
Current events have renewed the conversation in our community about the roles of terminology with racist connotations in our software. Many companies and developers are now taking appropriate steps to remove this terminology from their codebases and products. (e.g. [GitHub](https://twitter.com/natfriedman/status/1271253144442253312)) This small rule prevents the use of declarations that contain any of the terms: whitelist, blacklist, master, and slave. It may be appropriate to add more terms to this list now or in the future.
2020-11-07 22:03:08 -05:00

27 lines
1018 B
Swift

@testable import SwiftLintFramework
import XCTest
class InclusiveLanguageRuleTests: XCTestCase {
func testWithDefaultConfiguration() {
verifyRule(InclusiveLanguageRule.description)
}
func testNonTriggeringExamplesWithNonDefaultConfig() {
InclusiveLanguageRuleExamples.nonTriggeringExamplesWithConfig.forEach { example in
let description = InclusiveLanguageRule.description
.with(nonTriggeringExamples: [example])
.with(triggeringExamples: [])
verifyRule(description, ruleConfiguration: example.configuration)
}
}
func testTriggeringExamplesWithNonDefaultConfig() {
InclusiveLanguageRuleExamples.triggeringExamplesWithConfig.forEach { example in
let description = InclusiveLanguageRule.description
.with(nonTriggeringExamples: [])
.with(triggeringExamples: [example])
verifyRule(description, ruleConfiguration: example.configuration)
}
}
}