Cleanup in exception matchers

No more nested namespace for the matcher, and there is now a doxygen
explanatory comment on the factory function.
This commit is contained in:
Martin Hořeňovský 2020-03-28 11:06:14 +01:00
parent 5c9367d4f1
commit a6baa6dda6
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
2 changed files with 4 additions and 9 deletions

View File

@ -10,7 +10,6 @@
namespace Catch {
namespace Matchers {
namespace Exception {
bool ExceptionMessageMatcher::match(std::exception const& ex) const {
return ex.what() == m_message;
@ -20,11 +19,9 @@ std::string ExceptionMessageMatcher::describe() const {
return "exception message matches \"" + m_message + "\"";
}
}
Exception::ExceptionMessageMatcher Message(std::string const& message) {
return Exception::ExceptionMessageMatcher(message);
ExceptionMessageMatcher Message(std::string const& message) {
return ExceptionMessageMatcher(message);
}
// namespace Exception
} // namespace Matchers
} // namespace Catch

View File

@ -11,7 +11,6 @@
namespace Catch {
namespace Matchers {
namespace Exception {
class ExceptionMessageMatcher final : public MatcherBase<std::exception> {
std::string m_message;
@ -26,9 +25,8 @@ public:
std::string describe() const override;
};
} // namespace Exception
Exception::ExceptionMessageMatcher Message(std::string const& message);
//! Creates a matcher that checks whether a std derived exception has the provided message
ExceptionMessageMatcher Message(std::string const& message);
} // namespace Matchers
} // namespace Catch