Skip to content

Commit 4ae504b

Browse files
committed
merge receivers and tests
1 parent 55375de commit 4ae504b

File tree

3 files changed

+9
-23
lines changed

3 files changed

+9
-23
lines changed

Tests/IndexStoreDBTests/IndexTests.swift

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -300,31 +300,20 @@ final class IndexTests: XCTestCase {
300300
])
301301
}
302302

303-
func testFilesIncludedByFile() throws {
303+
func testFilesIncludes() throws {
304304
guard let ws = try staticTibsTestWorkspace(name: "MainFiles") else { return }
305305
try ws.buildAndIndex()
306306
let index = ws.index
307307

308308
let main1 = ws.testLoc("main1").url.path
309+
let main2 = ws.testLoc("main2").url.path
309310
let uniq1 = ws.testLoc("uniq1").url.path
310311
let shared = ws.testLoc("shared").url.path
311312

312313
let includedFiles = index.filesIncludedByFile(path: main1)
313-
XCTAssertEqual(includedFiles.count, 2)
314314
XCTAssertEqual(includedFiles, [shared, uniq1])
315-
}
316315

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-
326316
let includingFiles = index.filesIncludingFile(path: shared)
327-
XCTAssertEqual(includingFiles.count, 2)
328317
XCTAssertEqual(includingFiles, [main1, main2])
329318
}
330319

include/CIndexStoreDB/CIndexStoreDB.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,7 @@ typedef void(^indexstoredb_delegate_event_receiver_t)(_Nonnull indexstoredb_dele
139139
typedef bool(^indexstoredb_unit_info_receiver)(_Nonnull indexstoredb_unit_info_t);
140140

141141
/// Returns true to continue.
142-
typedef bool(^indexstoredb_files_included_receiver)(const char *_Nonnull targetPath, size_t line);
143-
144-
/// Returns true to continue.
145-
typedef bool(^indexstoredb_files_including_receiver)(const char *_Nonnull sourcePath, size_t line);
142+
typedef bool(^indexstoredb_file_includes_receiver)(const char *_Nonnull sourcePath, size_t line);
146143

147144
/// Returns true to continue.
148145
typedef bool(^indexstoredb_unit_includes_receiver)(const char *_Nonnull sourcePath, const char *_Nonnull targetPath, size_t line);
@@ -401,7 +398,7 @@ INDEXSTOREDB_PUBLIC bool
401398
indexstoredb_index_files_included_by_file(
402399
_Nonnull indexstoredb_index_t index,
403400
const char *_Nonnull path,
404-
_Nonnull indexstoredb_files_included_receiver receiver);
401+
_Nonnull indexstoredb_file_includes_receiver receiver);
405402

406403
/// Return the file path which including a given header.
407404
///
@@ -413,7 +410,7 @@ INDEXSTOREDB_PUBLIC bool
413410
indexstoredb_index_files_including_file(
414411
_Nonnull indexstoredb_index_t index,
415412
const char *_Nonnull path,
416-
_Nonnull indexstoredb_files_including_receiver receiver);
413+
_Nonnull indexstoredb_file_includes_receiver receiver);
417414

418415
/// Iterates over recorded `#include`s of a unit.
419416
///

lib/CIndexStoreDB/CIndexStoreDB.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,19 +435,19 @@ bool
435435
indexstoredb_index_files_included_by_file(
436436
indexstoredb_index_t index,
437437
const char *path,
438-
indexstoredb_files_included_receiver receiver)
438+
indexstoredb_file_includes_receiver receiver)
439439
{
440440
auto obj = (Object<std::shared_ptr<IndexSystem>> *)index;
441-
return obj->value->foreachFileIncludedByFile(path, [&](const CanonicalFilePathRef &targetPath, unsigned line) -> bool {
442-
return receiver(targetPath.getPath().str().c_str(), line);
441+
return obj->value->foreachFileIncludedByFile(path, [&](const CanonicalFilePathRef &sourcePath, unsigned line) -> bool {
442+
return receiver(sourcePath.getPath().str().c_str(), line);
443443
});
444444
}
445445

446446
bool
447447
indexstoredb_index_files_including_file(
448448
indexstoredb_index_t index,
449449
const char *path,
450-
indexstoredb_files_including_receiver receiver)
450+
indexstoredb_file_includes_receiver receiver)
451451
{
452452
auto obj = (Object<std::shared_ptr<IndexSystem>> *)index;
453453
return obj->value->foreachFileIncludingFile(path, [&](const CanonicalFilePathRef &sourcePath, unsigned line) -> bool {

0 commit comments

Comments
 (0)