@@ -92,11 +92,13 @@ TEST_F(OverlayCDBTest, GetCompileCommand) {
9292 EXPECT_EQ (CDB.getCompileCommand (testPath (" missing.cc" )), std::nullopt );
9393
9494 auto Override = cmd (testPath (" foo.cc" ), " -DA=3" );
95- CDB.setCompileCommand (testPath (" foo.cc" ), Override);
95+ EXPECT_TRUE (CDB.setCompileCommand (testPath (" foo.cc" ), Override));
96+ EXPECT_FALSE (CDB.setCompileCommand (testPath (" foo.cc" ), Override));
9697 EXPECT_THAT (CDB.getCompileCommand (testPath (" foo.cc" ))->CommandLine ,
9798 Contains (" -DA=3" ));
9899 EXPECT_EQ (CDB.getCompileCommand (testPath (" missing.cc" )), std::nullopt );
99- CDB.setCompileCommand (testPath (" missing.cc" ), Override);
100+ EXPECT_TRUE (CDB.setCompileCommand (testPath (" missing.cc" ), Override));
101+ EXPECT_FALSE (CDB.setCompileCommand (testPath (" missing.cc" ), Override));
100102 EXPECT_THAT (CDB.getCompileCommand (testPath (" missing.cc" ))->CommandLine ,
101103 Contains (" -DA=3" ));
102104}
@@ -111,7 +113,7 @@ TEST_F(OverlayCDBTest, NoBase) {
111113 OverlayCDB CDB (nullptr , {" -DA=6" });
112114 EXPECT_EQ (CDB.getCompileCommand (testPath (" bar.cc" )), std::nullopt );
113115 auto Override = cmd (testPath (" bar.cc" ), " -DA=5" );
114- CDB.setCompileCommand (testPath (" bar.cc" ), Override);
116+ EXPECT_TRUE ( CDB.setCompileCommand (testPath (" bar.cc" ), Override) );
115117 EXPECT_THAT (CDB.getCompileCommand (testPath (" bar.cc" ))->CommandLine ,
116118 Contains (" -DA=5" ));
117119
@@ -128,10 +130,10 @@ TEST_F(OverlayCDBTest, Watch) {
128130 Changes.push_back (ChangedFiles);
129131 });
130132
131- Inner.setCompileCommand (" A.cpp" , tooling::CompileCommand ());
132- Outer.setCompileCommand (" B.cpp" , tooling::CompileCommand ());
133- Inner.setCompileCommand (" A.cpp" , std::nullopt );
134- Outer.setCompileCommand (" C.cpp" , std::nullopt );
133+ EXPECT_TRUE ( Inner.setCompileCommand (" A.cpp" , tooling::CompileCommand () ));
134+ EXPECT_TRUE ( Outer.setCompileCommand (" B.cpp" , tooling::CompileCommand () ));
135+ EXPECT_TRUE ( Inner.setCompileCommand (" A.cpp" , std::nullopt ) );
136+ EXPECT_TRUE ( Outer.setCompileCommand (" C.cpp" , std::nullopt ) );
135137 EXPECT_THAT (Changes, ElementsAre (ElementsAre (" A.cpp" ), ElementsAre (" B.cpp" ),
136138 ElementsAre (" A.cpp" ), ElementsAre (" C.cpp" )));
137139}
@@ -151,7 +153,7 @@ TEST_F(OverlayCDBTest, Adjustments) {
151153 tooling::CompileCommand BarCommand;
152154 BarCommand.Filename = testPath (" bar.cc" );
153155 BarCommand.CommandLine = {" clang++" , " -DB=1" , testPath (" bar.cc" )};
154- CDB.setCompileCommand (testPath (" bar.cc" ), BarCommand);
156+ EXPECT_TRUE ( CDB.setCompileCommand (testPath (" bar.cc" ), BarCommand) );
155157 Cmd = *CDB.getCompileCommand (testPath (" bar.cc" ));
156158 EXPECT_THAT (
157159 Cmd.CommandLine ,
@@ -412,7 +414,7 @@ TEST(GlobalCompilationDatabaseTest, NonCanonicalFilenames) {
412414
413415 llvm::SmallString<128 > Root (testRoot ());
414416 llvm::sys::path::append (Root, " build" , " .." , " a.cc" );
415- DB.setCompileCommand (Root.str (), tooling::CompileCommand ());
417+ EXPECT_TRUE ( DB.setCompileCommand (Root.str (), tooling::CompileCommand () ));
416418 EXPECT_THAT (DiscoveredFiles, UnorderedElementsAre (testPath (" a.cc" )));
417419 DiscoveredFiles.clear ();
418420
@@ -432,7 +434,7 @@ TEST_F(OverlayCDBTest, GetProjectInfo) {
432434 EXPECT_EQ (DB.getProjectInfo (Header)->SourceRoot , testRoot ());
433435
434436 // Shouldn't change after an override.
435- DB.setCompileCommand (File, tooling::CompileCommand ());
437+ EXPECT_TRUE ( DB.setCompileCommand (File, tooling::CompileCommand () ));
436438 EXPECT_EQ (DB.getProjectInfo (File)->SourceRoot , testRoot ());
437439 EXPECT_EQ (DB.getProjectInfo (Header)->SourceRoot , testRoot ());
438440}
0 commit comments