Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMartin Hořeňovský2020-03-28 11:06:14 +0100
committerMartin Hořeňovský2020-03-28 11:06:14 +0100
commita6baa6dda6dd06c1024d20b82c9fa400bacf4cac (patch)
tree28c8e9ef1c744994a075f86744dacea6a62885ed
parent5c9367d4f1796c3a4a6d4eb74bea3a0b87f23590 (diff)
downloadcatch3-a6baa6dda6dd06c1024d20b82c9fa400bacf4cac.tar.gz
Cleanup in exception matchers
No more nested namespace for the matcher, and there is now a doxygen explanatory comment on the factory function.
-rw-r--r--src/catch2/matchers/catch_matchers_exception.cpp7
-rw-r--r--src/catch2/matchers/catch_matchers_exception.hpp6
2 files changed, 4 insertions, 9 deletions
diff --git a/src/catch2/matchers/catch_matchers_exception.cpp b/src/catch2/matchers/catch_matchers_exception.cpp
index eec08f88..c8e8110d 100644
--- a/src/catch2/matchers/catch_matchers_exception.cpp
+++ b/src/catch2/matchers/catch_matchers_exception.cpp
@@ -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
diff --git a/src/catch2/matchers/catch_matchers_exception.hpp b/src/catch2/matchers/catch_matchers_exception.hpp
index 74355cd8..5688218f 100644
--- a/src/catch2/matchers/catch_matchers_exception.hpp
+++ b/src/catch2/matchers/catch_matchers_exception.hpp
@@ -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