diff --git a/src/iindexer.cc b/src/iindexer.cc index d18a55d8..ba86ecd3 100644 --- a/src/iindexer.cc +++ b/src/iindexer.cc @@ -71,6 +71,9 @@ struct TestIndexer : IIndexer { } // namespace +IIndexer::TestEntry::TestEntry(const std::string& path, int num_indexes) + : path(path), num_indexes(num_indexes) {} + // static std::unique_ptr IIndexer::MakeClangIndexer() { return MakeUnique(); @@ -78,6 +81,6 @@ std::unique_ptr IIndexer::MakeClangIndexer() { // static std::unique_ptr IIndexer::MakeTestIndexer( - const std::vector& entries) { + std::initializer_list entries) { return TestIndexer::FromEntries(entries); } diff --git a/src/iindexer.h b/src/iindexer.h index 466323c0..3604f47e 100644 --- a/src/iindexer.h +++ b/src/iindexer.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -22,11 +23,13 @@ struct IIndexer { struct TestEntry { std::string path; int num_indexes = 0; + + TestEntry(const std::string& path, int num_indexes); }; static std::unique_ptr MakeClangIndexer(); static std::unique_ptr MakeTestIndexer( - const std::vector& entries); + std::initializer_list entries); virtual ~IIndexer() = default; virtual std::vector> Index( diff --git a/src/import_pipeline.cc b/src/import_pipeline.cc index 4e867639..18351c34 100644 --- a/src/import_pipeline.cc +++ b/src/import_pipeline.cc @@ -627,7 +627,7 @@ TEST_SUITE("ImportPipeline") { }; TEST_CASE_FIXTURE(Fixture, "index request with zero results") { - indexer = IIndexer::MakeTestIndexer({{"foo.cc", 0}}); + indexer = IIndexer::MakeTestIndexer({IIndexer::TestEntry{"foo.cc", 0}}); MakeRequest("foo.cc"); @@ -639,7 +639,7 @@ TEST_SUITE("ImportPipeline") { } TEST_CASE_FIXTURE(Fixture, "one index request") { - indexer = IIndexer::MakeTestIndexer({{"foo.cc", 100}}); + indexer = IIndexer::MakeTestIndexer({IIndexer::TestEntry{"foo.cc", 100}}); MakeRequest("foo.cc"); @@ -651,7 +651,8 @@ TEST_SUITE("ImportPipeline") { } TEST_CASE_FIXTURE(Fixture, "multiple index requests") { - indexer = IIndexer::MakeTestIndexer({{"foo.cc", 100}, {"bar.cc", 5}}); + indexer = IIndexer::MakeTestIndexer( + {IIndexer::TestEntry{"foo.cc", 100}, IIndexer::TestEntry{"bar.cc", 5}}); MakeRequest("foo.cc"); MakeRequest("bar.cc");