@@ -19,6 +19,21 @@ final class NoEmptyTrailingClosureParenthesesTests: LintOrFormatRuleTestCase {
19
19
func myfunc(cls: MyClass) {
20
20
cls.myBadClosure() { $0 }
21
21
}
22
+ DispatchQueue.main.async() {
23
+ greetEnthusiastically() { " John " }
24
+ DispatchQueue.main.async() {
25
+ greetEnthusiastically() { " Willis " }
26
+ }
27
+ }
28
+ DispatchQueue.global.async(inGroup: blah) {
29
+ DispatchQueue.main.async() {
30
+ greetEnthusiastically() { " Willis " }
31
+ }
32
+ DispatchQueue.main.async {
33
+ greetEnthusiastically() { " Willis " }
34
+ }
35
+ }
36
+ foo(bar() { baz })() { blah }
22
37
""" ,
23
38
expected: """
24
39
func greetEnthusiastically(_ nameProvider: () -> String) {
@@ -35,9 +50,39 @@ final class NoEmptyTrailingClosureParenthesesTests: LintOrFormatRuleTestCase {
35
50
func myfunc(cls: MyClass) {
36
51
cls.myBadClosure { $0 }
37
52
}
38
- """ )
39
- XCTAssertDiagnosed ( . removeEmptyTrailingParentheses( name: " greetEnthusiastically " ) )
40
- XCTAssertDiagnosed ( . removeEmptyTrailingParentheses( name: " myBadClosure " ) )
53
+ DispatchQueue.main.async {
54
+ greetEnthusiastically { " John " }
55
+ DispatchQueue.main.async {
56
+ greetEnthusiastically { " Willis " }
57
+ }
58
+ }
59
+ DispatchQueue.global.async(inGroup: blah) {
60
+ DispatchQueue.main.async {
61
+ greetEnthusiastically { " Willis " }
62
+ }
63
+ DispatchQueue.main.async {
64
+ greetEnthusiastically { " Willis " }
65
+ }
66
+ }
67
+ foo(bar { baz }) { blah }
68
+ """ ,
69
+ checkForUnassertedDiagnostics: true )
70
+ XCTAssertDiagnosed (
71
+ . removeEmptyTrailingParentheses( name: " greetEnthusiastically " ) , line: 7 , column: 1 )
72
+ XCTAssertDiagnosed ( . removeEmptyTrailingParentheses( name: " myBadClosure " ) , line: 13 , column: 3 )
41
73
XCTAssertNotDiagnosed ( . removeEmptyTrailingParentheses( name: " myClosure " ) )
74
+ XCTAssertDiagnosed ( . removeEmptyTrailingParentheses( name: " async " ) , line: 15 , column: 1 )
75
+ XCTAssertDiagnosed (
76
+ . removeEmptyTrailingParentheses( name: " greetEnthusiastically " ) , line: 16 , column: 3 )
77
+ XCTAssertDiagnosed ( . removeEmptyTrailingParentheses( name: " async " ) , line: 17 , column: 3 )
78
+ XCTAssertDiagnosed (
79
+ . removeEmptyTrailingParentheses( name: " greetEnthusiastically " ) , line: 18 , column: 5 )
80
+ XCTAssertDiagnosed ( . removeEmptyTrailingParentheses( name: " async " ) , line: 22 , column: 3 )
81
+ XCTAssertDiagnosed (
82
+ . removeEmptyTrailingParentheses( name: " greetEnthusiastically " ) , line: 23 , column: 5 )
83
+ XCTAssertDiagnosed (
84
+ . removeEmptyTrailingParentheses( name: " greetEnthusiastically " ) , line: 26 , column: 5 )
85
+ XCTAssertDiagnosed ( . removeEmptyTrailingParentheses( name: " ) " ) , line: 29 , column: 1 )
86
+ XCTAssertDiagnosed ( . removeEmptyTrailingParentheses( name: " bar " ) , line: 29 , column: 5 )
42
87
}
43
88
}
0 commit comments