Changeset 315 in pacpusframework


Ignore:
Timestamp:
07/28/14 17:11:27 (10 years ago)
Author:
Marek Kurdej
Message:

TestFileLib: fixes on errinfo_api_function.

Location:
trunk/src/FileLib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/FileLib/src/DbiteFile.cpp

    r303 r315  
    129129        // TODO: readAndDiagnoseHeader();
    130130        close();
    131         BOOST_THROW_EXCEPTION(e
    132             //<< "cannot read header"
     131        BOOST_THROW_EXCEPTION(DbiteException("cannot read header")
     132            << errinfo_api_function("open")
    133133            << errinfo_nested_exception(copy_exception(e))
    134134        );
  • trunk/src/FileLib/test/TestFileLib.cpp

    r312 r315  
    7777};
    7878
     79template <typename ErrorInfo>
     80struct HasErrorInfo<ErrorInfo, char const*>
     81    : noncopyable
     82{
     83private:
     84    typedef char const* E;
     85public:
     86    HasErrorInfo(E const& expectedValue)
     87        : mExpectedValue(expectedValue)
     88    {
     89    }
     90
     91    bool operator()(DbiteException const& ex)
     92    {
     93        LOG_INFO("diagnostic_information: " << diagnostic_information(ex));
     94        E const* value = get_error_info<ErrorInfo>(ex);
     95        if (!value) {
     96            return false;
     97        }
     98        return std::string(mExpectedValue) == std::string(*value);
     99    }
     100
     101private:
     102    E const mExpectedValue;
     103};
     104
    79105BOOST_AUTO_TEST_SUITE(suiteBasic)
    80106
Note: See TracChangeset for help on using the changeset viewer.