1
1
import SwiftFormatRules
2
2
3
3
final class ValidateDocumentationCommentsTests : LintOrFormatRuleTestCase {
4
+ override func setUp( ) {
5
+ super. setUp ( )
6
+ shouldCheckForUnassertedDiagnostics = true
7
+ }
8
+
4
9
func testParameterDocumentation( ) {
5
10
let input =
6
11
"""
@@ -32,9 +37,9 @@ final class ValidateDocumentationCommentsTests: LintOrFormatRuleTestCase {
32
37
func testInvalidParameterDesc(command: String, stdin: String) -> String {}
33
38
"""
34
39
performLint ( ValidateDocumentationComments . self, input: input)
35
- XCTAssertDiagnosed ( . useSingularParameter)
36
- XCTAssertDiagnosed ( . usePluralParameters)
37
- XCTAssertDiagnosed ( . usePluralParameters)
40
+ XCTAssertDiagnosed ( . useSingularParameter, line : 6 , column : 1 )
41
+ XCTAssertDiagnosed ( . usePluralParameters, line : 15 , column : 1 )
42
+ XCTAssertDiagnosed ( . usePluralParameters, line : 26 , column : 1 )
38
43
}
39
44
40
45
func testParametersName( ) {
@@ -57,8 +62,8 @@ final class ValidateDocumentationCommentsTests: LintOrFormatRuleTestCase {
57
62
func foo(p1: Int, p2: Int, p3: Int) -> Int {}
58
63
"""
59
64
performLint ( ValidateDocumentationComments . self, input: input)
60
- XCTAssertDiagnosed ( . parametersDontMatch( funcName: " sum " ) )
61
- XCTAssertDiagnosed ( . parametersDontMatch( funcName: " foo " ) )
65
+ XCTAssertDiagnosed ( . parametersDontMatch( funcName: " sum " ) , line : 7 , column : 1 )
66
+ XCTAssertDiagnosed ( . parametersDontMatch( funcName: " foo " ) , line : 15 , column : 1 )
62
67
}
63
68
64
69
func testThrowsDocumentation( ) {
@@ -88,9 +93,9 @@ final class ValidateDocumentationCommentsTests: LintOrFormatRuleTestCase {
88
93
func doesRethrow(p1: (() throws -> ())) rethrows {}
89
94
"""
90
95
performLint ( ValidateDocumentationComments . self, input: input)
91
- XCTAssertDiagnosed ( . removeThrowsComment( funcName: " doesNotThrow " ) )
92
- XCTAssertDiagnosed ( . documentErrorsThrown( funcName: " doesThrow " ) )
93
- XCTAssertDiagnosed ( . removeThrowsComment( funcName: " doesRethrow " ) )
96
+ XCTAssertDiagnosed ( . removeThrowsComment( funcName: " doesNotThrow " ) , line : 8 , column : 1 )
97
+ XCTAssertDiagnosed ( . documentErrorsThrown( funcName: " doesThrow " ) , line : 16 , column : 43 )
98
+ XCTAssertDiagnosed ( . removeThrowsComment( funcName: " doesRethrow " ) , line : 22 , column : 41 )
94
99
}
95
100
96
101
func testReturnDocumentation( ) {
@@ -114,8 +119,8 @@ final class ValidateDocumentationCommentsTests: LintOrFormatRuleTestCase {
114
119
func foo(p1: Int, p2: Int, p3: Int) -> Int {}
115
120
"""
116
121
performLint ( ValidateDocumentationComments . self, input: input)
117
- XCTAssertDiagnosed ( . removeReturnComment( funcName: " noReturn " ) )
118
- XCTAssertDiagnosed ( . documentReturnValue( funcName: " foo " ) )
122
+ XCTAssertDiagnosed ( . removeReturnComment( funcName: " noReturn " ) , line : 8 , column : 1 )
123
+ XCTAssertDiagnosed ( . documentReturnValue( funcName: " foo " ) , line : 16 , column : 37 )
119
124
}
120
125
121
126
func testValidDocumentation( ) {
@@ -214,7 +219,7 @@ final class ValidateDocumentationCommentsTests: LintOrFormatRuleTestCase {
214
219
XCTAssertNotDiagnosed ( . useSingularParameter)
215
220
XCTAssertNotDiagnosed ( . usePluralParameters)
216
221
217
- XCTAssertDiagnosed ( . parametersDontMatch( funcName: " incorrectParam " ) )
222
+ XCTAssertDiagnosed ( . parametersDontMatch( funcName: " incorrectParam " ) , line : 6 , column : 1 )
218
223
219
224
XCTAssertNotDiagnosed ( . documentReturnValue( funcName: " singularParam " ) )
220
225
XCTAssertNotDiagnosed ( . removeReturnComment( funcName: " singularParam " ) )
@@ -268,8 +273,8 @@ final class ValidateDocumentationCommentsTests: LintOrFormatRuleTestCase {
268
273
XCTAssertNotDiagnosed ( . useSingularParameter)
269
274
XCTAssertNotDiagnosed ( . usePluralParameters)
270
275
271
- XCTAssertDiagnosed ( . parametersDontMatch( funcName: " init " ) )
272
- XCTAssertDiagnosed ( . removeReturnComment( funcName: " init " ) )
276
+ XCTAssertDiagnosed ( . parametersDontMatch( funcName: " init " ) , line : 6 , column : 3 )
277
+ XCTAssertDiagnosed ( . removeReturnComment( funcName: " init " ) , line : 6 , column : 3 )
273
278
274
279
XCTAssertNotDiagnosed ( . documentReturnValue( funcName: " init " ) )
275
280
XCTAssertNotDiagnosed ( . removeReturnComment( funcName: " init " ) )
0 commit comments