mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
b83e0991b9
The MIT license doesn't require that all files be prepended with this licensing or copyright information. Realm confirmed that they're ok with this change. This will enable some companies to contribute to SwiftLint and the date & authorship information will remain accessible via git source control.
28 lines
1009 B
Swift
28 lines
1009 B
Swift
import SwiftLintFramework
|
|
import XCTest
|
|
|
|
class FileLengthRuleTests: XCTestCase {
|
|
|
|
func testFileLengthWithDefaultConfiguration() {
|
|
verifyRule(FileLengthRule.description, commentDoesntViolate: false,
|
|
testMultiByteOffsets: false, testShebang: false)
|
|
}
|
|
|
|
func testFileLengthIgnoringLinesWithOnlyComments() {
|
|
let triggeringExamples = [
|
|
repeatElement("print(\"swiftlint\")\n", count: 401).joined()
|
|
]
|
|
let nonTriggeringExamples = [
|
|
(repeatElement("print(\"swiftlint\")\n", count: 400) + ["//\n"]).joined(),
|
|
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)
|
|
}
|
|
}
|