mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 15:26:11 +01:00
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:
parent
5c9367d4f1
commit
a6baa6dda6
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
namespace Matchers {
|
namespace Matchers {
|
||||||
namespace Exception {
|
|
||||||
|
|
||||||
bool ExceptionMessageMatcher::match(std::exception const& ex) const {
|
bool ExceptionMessageMatcher::match(std::exception const& ex) const {
|
||||||
return ex.what() == m_message;
|
return ex.what() == m_message;
|
||||||
@ -20,11 +19,9 @@ std::string ExceptionMessageMatcher::describe() const {
|
|||||||
return "exception message matches \"" + m_message + "\"";
|
return "exception message matches \"" + m_message + "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
ExceptionMessageMatcher Message(std::string const& message) {
|
||||||
Exception::ExceptionMessageMatcher Message(std::string const& message) {
|
return ExceptionMessageMatcher(message);
|
||||||
return Exception::ExceptionMessageMatcher(message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// namespace Exception
|
|
||||||
} // namespace Matchers
|
} // namespace Matchers
|
||||||
} // namespace Catch
|
} // namespace Catch
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
namespace Matchers {
|
namespace Matchers {
|
||||||
namespace Exception {
|
|
||||||
|
|
||||||
class ExceptionMessageMatcher final : public MatcherBase<std::exception> {
|
class ExceptionMessageMatcher final : public MatcherBase<std::exception> {
|
||||||
std::string m_message;
|
std::string m_message;
|
||||||
@ -26,9 +25,8 @@ public:
|
|||||||
std::string describe() const override;
|
std::string describe() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Exception
|
//! Creates a matcher that checks whether a std derived exception has the provided message
|
||||||
|
ExceptionMessageMatcher Message(std::string const& message);
|
||||||
Exception::ExceptionMessageMatcher Message(std::string const& message);
|
|
||||||
|
|
||||||
} // namespace Matchers
|
} // namespace Matchers
|
||||||
} // namespace Catch
|
} // namespace Catch
|
||||||
|
Loading…
Reference in New Issue
Block a user