27 lines
1.0 KiB
Swift
27 lines
1.0 KiB
Swift
import SwiftLintFramework
|
|
import XCTest
|
|
|
|
class FileLengthRuleTests: XCTestCase {
|
|
func testFileLengthWithDefaultConfiguration() {
|
|
verifyRule(FileLengthRule.description, commentDoesntViolate: false,
|
|
testMultiByteOffsets: false, testShebang: false)
|
|
}
|
|
|
|
func testFileLengthIgnoringLinesWithOnlyComments() {
|
|
let triggeringExamples = [
|
|
Example(repeatElement("print(\"swiftlint\")\n", count: 401).joined())
|
|
]
|
|
let nonTriggeringExamples = [
|
|
Example((repeatElement("print(\"swiftlint\")\n", count: 400) + ["//\n"]).joined()),
|
|
Example(repeatElement("print(\"swiftlint\")\n", count: 400).joined())
|
|
]
|
|
|
|
let description = FileLengthRule.description
|
|
.with(nonTriggeringExamples: nonTriggeringExamples)
|
|
.with(triggeringExamples: triggeringExamples)
|
|
|
|
verifyRule(description, ruleConfiguration: ["ignore_comment_only_lines": true],
|
|
testMultiByteOffsets: false, testShebang: false)
|
|
}
|
|
}
|