Skip to content

Commit

Permalink
realm#2435 - Add modifier interference tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulowork authored and jpsim committed Nov 28, 2018
1 parent 826caab commit b98d76b
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions Tests/SwiftLintFrameworkTests/ModifierOrderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,63 @@ class ModifierOrderTests: XCTestCase {
verifyRule(descriptionOverride,
ruleConfiguration: ["preferred_modifier_order": ["override", "acl", "owned", "final"]])
}

func testNonSpecifiedModifiersDontInterfier() {
let descriptionOverride = RuleDescription(
identifier: "modifier_order",
name: "Modifier Order",
description: "Modifier order should be consistent.",
kind: .style,
minSwiftVersion: .fourDotOne,
nonTriggeringExamples: [
"""
class Foo {
weak final override private var bar: UIView?
}
""",
"""
class Foo {
final weak override private var bar: UIView?
}
""",
"""
class Foo {
final override weak private var bar: UIView?
}
""",
"""
class Foo {
final override private weak var bar: UIView?
}
"""
],
triggeringExamples: [
"""
class Foo {
weak override final private var bar: UIView?
}
""",
"""
class Foo {
override weak final private var bar: UIView?
}
""",
"""
class Foo {
override final weak private var bar: UIView?
}
""",
"""
class Foo {
override final private weak var bar: UIView?
}
"""
]
)

verifyRule(descriptionOverride,
ruleConfiguration: ["preferred_modifier_order": ["final", "override", "acl"]])
}

func testViolationMessage() {
guard SwiftVersion.current >= ModifierOrderRule.description.minSwiftVersion else {
Expand Down

0 comments on commit b98d76b

Please sign in to comment.