@@ -492,7 +492,7 @@ class SymbolTests: XCTestCase {
492
492
XCTAssertEqual ( withRedirectInArticle. redirects, nil )
493
493
494
494
XCTAssertEqual ( problems. first? . diagnostic. identifier, " org.swift.docc.UnsupportedDocCommentDirective " )
495
- XCTAssertEqual ( problems. first? . diagnostic. range? . lowerBound. line, 15 )
495
+ XCTAssertEqual ( problems. first? . diagnostic. range? . lowerBound. line, 3 )
496
496
XCTAssertEqual ( problems. first? . diagnostic. range? . lowerBound. column, 1 )
497
497
}
498
498
@@ -1225,6 +1225,7 @@ class SymbolTests: XCTestCase {
1225
1225
1226
1226
@Metadata
1227
1227
""" ,
1228
+ docCommentLineOffset: 12 ,
1228
1229
articleContent: nil ,
1229
1230
diagnosticEngineFilterLevel: . information
1230
1231
)
@@ -1247,6 +1248,7 @@ class SymbolTests: XCTestCase {
1247
1248
@Available( " Platform from doc comment " , introduced: 1.2.3)
1248
1249
}
1249
1250
""" ,
1251
+ docCommentLineOffset: 12 ,
1250
1252
articleContent: """
1251
1253
# Title
1252
1254
@@ -1354,6 +1356,7 @@ class SymbolTests: XCTestCase {
1354
1356
1355
1357
func makeDocumentationNodeForSymbol(
1356
1358
docComment: String ,
1359
+ docCommentLineOffset: Int = 0 ,
1357
1360
articleContent: String ? ,
1358
1361
diagnosticEngineFilterLevel: DiagnosticSeverity = . warning,
1359
1362
file: StaticString = #file,
@@ -1363,21 +1366,15 @@ class SymbolTests: XCTestCase {
1363
1366
let ( _, bundle, context) = try testBundleAndContext ( copying: " LegacyBundle_DoNotUseInNewTests " ) { url in
1364
1367
var graph = try JSONDecoder ( ) . decode ( SymbolGraph . self, from: Data ( contentsOf: url. appendingPathComponent ( " mykit-iOS.symbols.json " ) ) )
1365
1368
1366
- let newDocComment = SymbolGraph . LineList (
1367
- docComment
1368
- . components ( separatedBy: . newlines)
1369
- . enumerated ( )
1370
- . map { arg -> SymbolGraph . LineList . Line in
1371
- var ( index, line) = arg
1372
- index += 12 // Add an arbitrary offset
1373
- let range = SymbolGraph . LineList. SourceRange (
1374
- start: . init( line: index, character: 0 ) ,
1375
- end: . init( line: index, character: line. utf8. count)
1376
- )
1377
- return . init( text: line, range: range)
1378
- } ,
1379
- uri: " file:///tmp/File.swift "
1369
+ let newDocComment = self . makeLineList (
1370
+ docComment: docComment,
1371
+ startOffset: . init(
1372
+ line: docCommentLineOffset,
1373
+ character: 0
1374
+ ) ,
1375
+ url: URL ( string: " file:///tmp/File.swift " ) !
1380
1376
)
1377
+
1381
1378
// The `guard` statement` below will handle the `nil` case by failing the test and
1382
1379
graph. symbols [ myFunctionUSR] ? . docComment = newDocComment
1383
1380
0 commit comments