mirror of
https://github.com/realm/SwiftLint.git
synced 2026-05-07 20:12:49 +00:00
15b285527a
* 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`
28 lines
1.1 KiB
Swift
28 lines
1.1 KiB
Swift
@testable import SwiftLintBuiltInRules
|
|
import TestHelpers
|
|
|
|
final class FileLengthRuleTests: SwiftLintTestCase {
|
|
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()),
|
|
Example(repeatElement("print(\"swiftlint\")\n\n", count: 201).joined()),
|
|
]
|
|
|
|
let description = FileLengthRule.description
|
|
.with(nonTriggeringExamples: nonTriggeringExamples)
|
|
.with(triggeringExamples: triggeringExamples)
|
|
|
|
verifyRule(description, ruleConfiguration: ["ignore_comment_only_lines": true],
|
|
testMultiByteOffsets: false, testShebang: false)
|
|
}
|
|
}
|