diff options
Diffstat (limited to 'clang/unittests/Tooling/CompilationDatabaseTest.cpp')
-rw-r--r-- | clang/unittests/Tooling/CompilationDatabaseTest.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/unittests/Tooling/CompilationDatabaseTest.cpp b/clang/unittests/Tooling/CompilationDatabaseTest.cpp index cc948b8..3bfb0ec 100644 --- a/clang/unittests/Tooling/CompilationDatabaseTest.cpp +++ b/clang/unittests/Tooling/CompilationDatabaseTest.cpp @@ -281,6 +281,15 @@ TEST_F(FileMatchTrieTest, CannotResolveRelativePath) { EXPECT_EQ("Cannot resolve relative paths", Error); } +TEST_F(FileMatchTrieTest, SingleFile) { + Trie.insert("/root/RootFile.cc"); + EXPECT_EQ("", find("/root/rootfile.cc")); + // Add subpath to avoid `if (Children.empty())` special case + // which we hit at previous `find()`. + Trie.insert("/root/otherpath/OtherFile.cc"); + EXPECT_EQ("", find("/root/rootfile.cc")); +} + TEST(findCompileArgsInJsonDatabase, FindsNothingIfEmpty) { std::string ErrorMessage; CompileCommand NotFound = findCompileArgsInJsonDatabase( |