11import SwiftFormatRules
22
33final class ValidateDocumentationCommentsTests : LintOrFormatRuleTestCase {
4+ override func setUp( ) {
5+ super. setUp ( )
6+ shouldCheckForUnassertedDiagnostics = true
7+ }
8+
49 func testParameterDocumentation( ) {
510 let input =
611 """
@@ -32,9 +37,9 @@ final class ValidateDocumentationCommentsTests: LintOrFormatRuleTestCase {
3237 func testInvalidParameterDesc(command: String, stdin: String) -> String {}
3338 """
3439 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 )
3843 }
3944
4045 func testParametersName( ) {
@@ -57,8 +62,8 @@ final class ValidateDocumentationCommentsTests: LintOrFormatRuleTestCase {
5762 func foo(p1: Int, p2: Int, p3: Int) -> Int {}
5863 """
5964 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 )
6267 }
6368
6469 func testThrowsDocumentation( ) {
@@ -88,9 +93,9 @@ final class ValidateDocumentationCommentsTests: LintOrFormatRuleTestCase {
8893 func doesRethrow(p1: (() throws -> ())) rethrows {}
8994 """
9095 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 )
9499 }
95100
96101 func testReturnDocumentation( ) {
@@ -114,8 +119,8 @@ final class ValidateDocumentationCommentsTests: LintOrFormatRuleTestCase {
114119 func foo(p1: Int, p2: Int, p3: Int) -> Int {}
115120 """
116121 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 )
119124 }
120125
121126 func testValidDocumentation( ) {
@@ -214,7 +219,7 @@ final class ValidateDocumentationCommentsTests: LintOrFormatRuleTestCase {
214219 XCTAssertNotDiagnosed ( . useSingularParameter)
215220 XCTAssertNotDiagnosed ( . usePluralParameters)
216221
217- XCTAssertDiagnosed ( . parametersDontMatch( funcName: " incorrectParam " ) )
222+ XCTAssertDiagnosed ( . parametersDontMatch( funcName: " incorrectParam " ) , line : 6 , column : 1 )
218223
219224 XCTAssertNotDiagnosed ( . documentReturnValue( funcName: " singularParam " ) )
220225 XCTAssertNotDiagnosed ( . removeReturnComment( funcName: " singularParam " ) )
@@ -268,8 +273,8 @@ final class ValidateDocumentationCommentsTests: LintOrFormatRuleTestCase {
268273 XCTAssertNotDiagnosed ( . useSingularParameter)
269274 XCTAssertNotDiagnosed ( . usePluralParameters)
270275
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 )
273278
274279 XCTAssertNotDiagnosed ( . documentReturnValue( funcName: " init " ) )
275280 XCTAssertNotDiagnosed ( . removeReturnComment( funcName: " init " ) )
0 commit comments