@@ -92,11 +92,13 @@ TEST_F(OverlayCDBTest, GetCompileCommand) {
92
92
EXPECT_EQ (CDB.getCompileCommand (testPath (" missing.cc" )), std::nullopt);
93
93
94
94
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));
96
97
EXPECT_THAT (CDB.getCompileCommand (testPath (" foo.cc" ))->CommandLine ,
97
98
Contains (" -DA=3" ));
98
99
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));
100
102
EXPECT_THAT (CDB.getCompileCommand (testPath (" missing.cc" ))->CommandLine ,
101
103
Contains (" -DA=3" ));
102
104
}
@@ -111,7 +113,7 @@ TEST_F(OverlayCDBTest, NoBase) {
111
113
OverlayCDB CDB (nullptr , {" -DA=6" });
112
114
EXPECT_EQ (CDB.getCompileCommand (testPath (" bar.cc" )), std::nullopt);
113
115
auto Override = cmd (testPath (" bar.cc" ), " -DA=5" );
114
- CDB.setCompileCommand (testPath (" bar.cc" ), Override);
116
+ EXPECT_TRUE ( CDB.setCompileCommand (testPath (" bar.cc" ), Override) );
115
117
EXPECT_THAT (CDB.getCompileCommand (testPath (" bar.cc" ))->CommandLine ,
116
118
Contains (" -DA=5" ));
117
119
@@ -128,10 +130,10 @@ TEST_F(OverlayCDBTest, Watch) {
128
130
Changes.push_back (ChangedFiles);
129
131
});
130
132
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) );
135
137
EXPECT_THAT (Changes, ElementsAre (ElementsAre (" A.cpp" ), ElementsAre (" B.cpp" ),
136
138
ElementsAre (" A.cpp" ), ElementsAre (" C.cpp" )));
137
139
}
@@ -151,7 +153,7 @@ TEST_F(OverlayCDBTest, Adjustments) {
151
153
tooling::CompileCommand BarCommand;
152
154
BarCommand.Filename = testPath (" bar.cc" );
153
155
BarCommand.CommandLine = {" clang++" , " -DB=1" , testPath (" bar.cc" )};
154
- CDB.setCompileCommand (testPath (" bar.cc" ), BarCommand);
156
+ EXPECT_TRUE ( CDB.setCompileCommand (testPath (" bar.cc" ), BarCommand) );
155
157
Cmd = *CDB.getCompileCommand (testPath (" bar.cc" ));
156
158
EXPECT_THAT (
157
159
Cmd.CommandLine ,
@@ -412,7 +414,7 @@ TEST(GlobalCompilationDatabaseTest, NonCanonicalFilenames) {
412
414
413
415
llvm::SmallString<128 > Root (testRoot ());
414
416
llvm::sys::path::append (Root, " build" , " .." , " a.cc" );
415
- DB.setCompileCommand (Root.str (), tooling::CompileCommand ());
417
+ EXPECT_TRUE ( DB.setCompileCommand (Root.str (), tooling::CompileCommand () ));
416
418
EXPECT_THAT (DiscoveredFiles, UnorderedElementsAre (testPath (" a.cc" )));
417
419
DiscoveredFiles.clear ();
418
420
@@ -432,7 +434,7 @@ TEST_F(OverlayCDBTest, GetProjectInfo) {
432
434
EXPECT_EQ (DB.getProjectInfo (Header)->SourceRoot , testRoot ());
433
435
434
436
// Shouldn't change after an override.
435
- DB.setCompileCommand (File, tooling::CompileCommand ());
437
+ EXPECT_TRUE ( DB.setCompileCommand (File, tooling::CompileCommand () ));
436
438
EXPECT_EQ (DB.getProjectInfo (File)->SourceRoot , testRoot ());
437
439
EXPECT_EQ (DB.getProjectInfo (Header)->SourceRoot , testRoot ());
438
440
}
0 commit comments