When clang is built outside of the LLVM tree (against a corresponding version),
there is no definition providing for operator<<(std::ostream &, StringRef) which
is required for the assertion routines in google-test tests. Avoid the
compilation failure by explicitly stringifying the StringRef prior to use.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200096
91177308-0d34-0410-b5e6-
96231b3b80d8
OwningPtr<FrontendActionFactory> Factory(newFrontendActionFactory(&Finder));
if (!runToolOnCodeWithArgs(Factory->create(), Code, Args, FileName))
- return testing::AssertionFailure() << "Parsing error in \"" << Code << "\"";
+ return testing::AssertionFailure()
+ << "Parsing error in \"" << Code.str() << "\"";
if (Printer.getNumFoundDecls() == 0)
return testing::AssertionFailure()
if (Printer.getPrinted() != ExpectedPrinted)
return ::testing::AssertionFailure()
- << "Expected \"" << ExpectedPrinted << "\", "
- "got \"" << Printer.getPrinted() << "\"";
+ << "Expected \"" << ExpectedPrinted.str() << "\", "
+ "got \"" << Printer.getPrinted().str() << "\"";
return ::testing::AssertionSuccess();
}
OwningPtr<FrontendActionFactory> Factory(newFrontendActionFactory(&Finder));
if (!runToolOnCodeWithArgs(Factory->create(), Code, Args))
- return testing::AssertionFailure() << "Parsing error in \"" << Code << "\"";
+ return testing::AssertionFailure()
+ << "Parsing error in \"" << Code.str() << "\"";
if (Printer.getNumFoundStmts() == 0)
return testing::AssertionFailure()
if (Printer.getPrinted() != ExpectedPrinted)
return ::testing::AssertionFailure()
- << "Expected \"" << ExpectedPrinted << "\", "
- "got \"" << Printer.getPrinted() << "\"";
+ << "Expected \"" << ExpectedPrinted.str() << "\", "
+ "got \"" << Printer.getPrinted().str() << "\"";
return ::testing::AssertionSuccess();
}
std::string ErrorMessage;
EXPECT_EQ(NULL, JSONCompilationDatabase::loadFromBuffer(JSONDatabase,
ErrorMessage))
- << "Expected an error because of: " << Explanation;
+ << "Expected an error because of: " << Explanation.str();
}
TEST(JSONCompilationDatabase, ErrsOnInvalidFormat) {