From daeb13c2bb58a43ea06c8578a801a3fdf2aa128e Mon Sep 17 00:00:00 2001 From: Manabu Nakazawa Date: Tue, 16 Jan 2018 01:31:09 +0900 Subject: [PATCH] Add testcases to ColonRule.description --- Rules.md | 24 +++++++++++++++++++ .../SwiftLintFramework/Rules/ColonRule.swift | 15 +++++++++--- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/Rules.md b/Rules.md index a94eea78d..481af348d 100644 --- a/Rules.md +++ b/Rules.md @@ -1167,6 +1167,18 @@ object.method(5, y: "string") ``` +```swift +func abc() { def(ghi: jkl) } +``` + +```swift +func abc(def: Void) { ghi(jkl: mno) } +``` + +```swift +class ABC { let def = ghi(jkl: mno) } } +``` +
Triggering Examples @@ -1391,6 +1403,18 @@ object.method(x↓: 5, y: "string") ``` +```swift +func abc() { def(ghi↓:jkl) } +``` + +```swift +func abc(def: Void) { ghi(jkl↓:mno) } +``` + +```swift +class ABC { let def = ghi(jkl↓:mno) } } +``` +
diff --git a/Source/SwiftLintFramework/Rules/ColonRule.swift b/Source/SwiftLintFramework/Rules/ColonRule.swift index 1008f0db1..721c507ac 100644 --- a/Source/SwiftLintFramework/Rules/ColonRule.swift +++ b/Source/SwiftLintFramework/Rules/ColonRule.swift @@ -58,7 +58,10 @@ public struct ColonRule: CorrectableRule, ConfigurationProviderRule { "object.method(x: 5, y: \"string\")\n", "object.method(x: 5, y:\n" + " \"string\")", - "object.method(5, y: \"string\")\n" + "object.method(5, y: \"string\")\n", + "func abc() { def(ghi: jkl) }", + "func abc(def: Void) { ghi(jkl: mno) }", + "class ABC { let def = ghi(jkl: mno) } }" ], triggeringExamples: [ "let ↓abc:Void\n", @@ -104,7 +107,10 @@ public struct ColonRule: CorrectableRule, ConfigurationProviderRule { "class Foo<↓T : Equatable> {}\n", "object.method(x: 5, y↓ : \"string\")\n", "object.method(x↓:5, y: \"string\")\n", - "object.method(x↓: 5, y: \"string\")\n" + "object.method(x↓: 5, y: \"string\")\n", + "func abc() { def(ghi↓:jkl) }", + "func abc(def: Void) { ghi(jkl↓:mno) }", + "class ABC { let def = ghi(jkl↓:mno) } }" ], corrections: [ "let ↓abc:Void\n": "let abc: Void\n", @@ -150,7 +156,10 @@ public struct ColonRule: CorrectableRule, ConfigurationProviderRule { "class Foo<↓T : Equatable> {}\n": "class Foo {}\n", "object.method(x: 5, y↓ : \"string\")\n": "object.method(x: 5, y: \"string\")\n", "object.method(x↓:5, y: \"string\")\n": "object.method(x: 5, y: \"string\")\n", - "object.method(x↓: 5, y: \"string\")\n": "object.method(x: 5, y: \"string\")\n" + "object.method(x↓: 5, y: \"string\")\n": "object.method(x: 5, y: \"string\")\n", + "func abc() { def(ghi↓:jkl) }": "func abc() { def(ghi: jkl) }", + "func abc(def: Void) { ghi(jkl↓:mno) }": "func abc(def: Void) { ghi(jkl: mno) }", + "class ABC { let def = ghi(jkl↓:mno) } }": "class ABC { let def = ghi(jkl: mno) } }" ] )