diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2015-09-16 18:28:42 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2015-09-16 18:28:42 +0000 |
| commit | 6d0a76768539630ccece17e449b8a76135d1b421 (patch) | |
| tree | 9e5065bb2ff1676aa7d782313b06eb7fe9e60131 /clang/unittests/Tooling | |
| parent | 7cb59e1a0f000e11d4dfb839f0ddbb0cba34f179 (diff) | |
| download | bcm5719-llvm-6d0a76768539630ccece17e449b8a76135d1b421.tar.gz bcm5719-llvm-6d0a76768539630ccece17e449b8a76135d1b421.zip | |
[tooling] Add unit tests for change in r247468.
llvm-svn: 247832
Diffstat (limited to 'clang/unittests/Tooling')
| -rw-r--r-- | clang/unittests/Tooling/CompilationDatabaseTest.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/unittests/Tooling/CompilationDatabaseTest.cpp b/clang/unittests/Tooling/CompilationDatabaseTest.cpp index 8e1f8284283..b7e7a72d235 100644 --- a/clang/unittests/Tooling/CompilationDatabaseTest.cpp +++ b/clang/unittests/Tooling/CompilationDatabaseTest.cpp @@ -98,8 +98,8 @@ TEST(JSONCompilationDatabase, GetAllCompileCommands) { StringRef FileName1("file1"); StringRef Command1("command1"); StringRef Directory2("//net/dir2"); - StringRef FileName2("file1"); - StringRef Command2("command1"); + StringRef FileName2("file2"); + StringRef Command2("command2"); std::vector<CompileCommand> Commands = getAllCompileCommands( ("[{\"directory\":\"" + Directory1 + "\"," + @@ -111,9 +111,11 @@ TEST(JSONCompilationDatabase, GetAllCompileCommands) { ErrorMessage); EXPECT_EQ(2U, Commands.size()) << ErrorMessage; EXPECT_EQ(Directory1, Commands[0].Directory) << ErrorMessage; + EXPECT_EQ(FileName1, Commands[0].Filename) << ErrorMessage; ASSERT_EQ(1u, Commands[0].CommandLine.size()); EXPECT_EQ(Command1, Commands[0].CommandLine[0]) << ErrorMessage; EXPECT_EQ(Directory2, Commands[1].Directory) << ErrorMessage; + EXPECT_EQ(FileName2, Commands[1].Filename) << ErrorMessage; ASSERT_EQ(1u, Commands[1].CommandLine.size()); EXPECT_EQ(Command2, Commands[1].CommandLine[0]) << ErrorMessage; } @@ -427,14 +429,16 @@ TEST(FixedCompilationDatabase, ReturnsFixedCommandLine) { CommandLine.push_back("one"); CommandLine.push_back("two"); FixedCompilationDatabase Database(".", CommandLine); + StringRef FileName("source"); std::vector<CompileCommand> Result = - Database.getCompileCommands("source"); + Database.getCompileCommands(FileName); ASSERT_EQ(1ul, Result.size()); std::vector<std::string> ExpectedCommandLine(1, "clang-tool"); ExpectedCommandLine.insert(ExpectedCommandLine.end(), CommandLine.begin(), CommandLine.end()); ExpectedCommandLine.push_back("source"); EXPECT_EQ(".", Result[0].Directory); + EXPECT_EQ(FileName, Result[0].Filename); EXPECT_EQ(ExpectedCommandLine, Result[0].CommandLine); } |

