Changeset 303 in pacpusframework for trunk/src/FileLib/test/TestFileLib.cpp
- Timestamp:
- Apr 8, 2014, 11:22:06 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/FileLib/test/TestFileLib.cpp
r301 r303 21 21 #include <Pacpus/kernel/Log.h> 22 22 23 #include <boost/exception/diagnostic_information.hpp> 24 #include <boost/exception/errinfo_api_function.hpp> 25 #include <boost/exception/get_error_info.hpp> 23 26 #include <boost/noncopyable.hpp> 24 27 #include <cstdio> 25 28 26 DECLARE_STATIC_LOGGER("pacpus.framework.test.FileLib") ;29 DECLARE_STATIC_LOGGER("pacpus.framework.test.FileLib") 27 30 28 31 using namespace boost; … … 31 34 32 35 struct HasExceptionMessage 33 36 : noncopyable 34 37 { 35 38 HasExceptionMessage(const string expectedMessage) … … 48 51 }; 49 52 53 template < 54 typename ErrorInfo, 55 typename E = typename ErrorInfo::error_info::value_type 56 > 57 struct HasErrorInfo 58 : noncopyable 59 { 60 HasErrorInfo(E const& expectedValue) 61 : mExpectedValue(expectedValue) 62 { 63 } 64 65 bool operator()(DbiteException const& ex) 66 { 67 LOG_INFO("diagnostic_information: " << diagnostic_information(ex)); 68 E const* value = get_error_info<ErrorInfo>(ex); 69 if (!value) { 70 return false; 71 } 72 return mExpectedValue == *value; 73 } 74 75 private: 76 E const mExpectedValue; 77 }; 78 50 79 BOOST_AUTO_TEST_SUITE(suiteBasic) 51 80 … … 150 179 (df.open("data/bad-empty-file.dbt", ReadMode)) 151 180 , DbiteException 152 , HasExceptionMessage("cannot read header") 181 // , HasExceptionMessage("cannot read data") // FIXME: cannot read header 182 , HasErrorInfo<errinfo_api_function>("open") 153 183 ); 154 184 } … … 164 194 (df.open("data/bad-incomplete-header.dbt", ReadMode)) 165 195 , DbiteException 166 , HasExceptionMessage("cannot read header")196 , HasExceptionMessage("cannot read data") // FIXME: cannot read header 167 197 ); 168 198 }
Note:
See TracChangeset
for help on using the changeset viewer.