Skip to content

Commit 55375de

Browse files
committed
add new api tests
1 parent 5a4e3ef commit 55375de

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

Tests/IndexStoreDBTests/IndexTests.swift

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,34 @@ final class IndexTests: XCTestCase {
299299
IndexStoreDB.UnitIncludeEntry(sourcePath: main1, targetPath: uniq1, line: ws.testLoc("include_main1_uniq1").line),
300300
])
301301
}
302+
303+
func testFilesIncludedByFile() throws {
304+
guard let ws = try staticTibsTestWorkspace(name: "MainFiles") else { return }
305+
try ws.buildAndIndex()
306+
let index = ws.index
307+
308+
let main1 = ws.testLoc("main1").url.path
309+
let uniq1 = ws.testLoc("uniq1").url.path
310+
let shared = ws.testLoc("shared").url.path
311+
312+
let includedFiles = index.filesIncludedByFile(path: main1)
313+
XCTAssertEqual(includedFiles.count, 2)
314+
XCTAssertEqual(includedFiles, [shared, uniq1])
315+
}
316+
317+
func testFilesIncludingFile() throws {
318+
guard let ws = try staticTibsTestWorkspace(name: "MainFiles") else { return }
319+
try ws.buildAndIndex()
320+
let index = ws.index
321+
322+
let shared = ws.testLoc("shared").url.path
323+
let main1 = ws.testLoc("main1").url.path
324+
let main2 = ws.testLoc("main2").url.path
325+
326+
let includingFiles = index.filesIncludingFile(path: shared)
327+
XCTAssertEqual(includingFiles.count, 2)
328+
XCTAssertEqual(includingFiles, [main1, main2])
329+
}
302330

303331
func testAllSymbolNames() throws {
304332
guard let ws = try staticTibsTestWorkspace(name: "proj1") else { return }

0 commit comments

Comments
 (0)