libmoost
|
00001 /* vim:set ts=3 sw=3 sts=3 et: */ 00028 #ifndef MOOST_TESTING_ERROR_MATCHER_H__ 00029 #define MOOST_TESTING_ERROR_MATCHER_H__ 00030 00031 #include <boost/test/unit_test.hpp> 00032 #include <boost/regex.hpp> 00033 00034 namespace moost { namespace testing { 00035 00036 struct error_matcher 00037 { 00038 error_matcher(const std::string& regex) 00039 : m_regex(regex) 00040 { 00041 } 00042 00043 template <typename ErrT> 00044 bool operator() (const ErrT& e) const 00045 { 00046 BOOST_TEST_MESSAGE("exception: " << e.what()); 00047 return boost::regex_match(e.what(), m_regex); 00048 } 00049 00050 private: 00051 const boost::regex m_regex; 00052 }; 00053 00054 }} 00055 00056 #endif