Author: akirtzidis Date: Wed Sep 16 13:28:42 2015 New Revision: 247832 URL: http://llvm.org/viewvc/llvm-project?rev=247832&view=rev Log: [tooling] Add unit tests for change in r247468.
Modified: cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp Modified: cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp?rev=247832&r1=247831&r2=247832&view=diff ============================================================================== --- cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp (original) +++ cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp Wed Sep 16 13:28:42 2015 @@ -98,8 +98,8 @@ TEST(JSONCompilationDatabase, GetAllComp 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, GetAllComp 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, ReturnsFi 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); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits