Skip to content

Commit 8af9261

Browse files
author
Anthony Eid
committed
Verify relation in testModuleUnderTechnologyRoot
Check that relationship is created between technology root and module in testModuleUnderTechnologyRoot.
1 parent b90a04e commit 8af9261

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Tests/SwiftDocCTests/Infrastructure/DocumentationCuratorTests.swift

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,18 @@ class DocumentationCuratorTests: XCTestCase {
163163
""".write(to: url.appendingPathComponent("Root.md"), atomically: true, encoding: .utf8)
164164
}
165165

166-
var crawler = DocumentationCurator.init(in: context, bundle: bundle)
166+
let crawler = DocumentationCurator.init(in: context, bundle: bundle)
167167
XCTAssert(context.problems.isEmpty, "Expected no problems. Found: \(context.problems.map(\.diagnostic.summary))")
168168

169-
for node in context.rootModules {
170-
XCTAssertNoThrow(try crawler.crawlChildren(of: node, prepareForCuration: { _ in }, relateNodes: { _, _ in }))
169+
guard let moduleNode = context.nodeWithSymbolIdentifier("SourceLocations"),
170+
let pathToRoot = context.pathsTo(moduleNode.reference).first,
171+
let root = pathToRoot.first else {
172+
173+
XCTFail("Module doesn't have technology root as a predecessor in its path")
174+
return
171175
}
172176

177+
XCTAssertEqual(root.path, "/documentation/Root")
173178
XCTAssertEqual(crawler.problems.count, 0)
174179

175180
}
@@ -202,12 +207,9 @@ class DocumentationCuratorTests: XCTestCase {
202207
""".write(to: url.appendingPathComponent("Ancestor.md"), atomically: true, encoding: .utf8)
203208
}
204209

205-
let crawler = DocumentationCurator.init(in: context, bundle: bundle)
210+
let _ = DocumentationCurator.init(in: context, bundle: bundle)
206211
XCTAssert(context.problems.isEmpty, "Expected no problems. Found: \(context.problems.map(\.diagnostic.summary))")
207212

208-
209-
210-
211213
guard let moduleNode = context.nodeWithSymbolIdentifier("SourceLocations"),
212214
let pathToRoot = context.pathsTo(moduleNode.reference).first,
213215
let root = pathToRoot.first else {

0 commit comments

Comments
 (0)