34 inline ::testing::AssertionResult
throws_with(std::function<
void()>
const& fn, std::string
const& needle) {
37 }
catch (std::runtime_error
const& e) {
38 std::string
const what = e.what();
39 if (what.find(needle) != std::string::npos) {
40 return ::testing::AssertionSuccess();
42 return ::testing::AssertionFailure() << expected_message(needle, what);
44 }
catch (std::exception
const& e) {
45 return ::testing::AssertionFailure() << wrong_exception(e.what());
47 return ::testing::AssertionFailure() <<
"did not throw";
inline ::testing::AssertionResult throws_with(std::function< void()> const &fn, std::string const &needle)
gtest assertion: fn throws a std::runtime_error whose what() contains needle.
Definition ThrowsWith.hpp:34