X-Git-Url: http://git.tdb.fi/?p=libs%2Ftest.git;a=blobdiff_plain;f=source%2Ftest.cpp;h=b4693b294ea57cfaa54194ebf33e79fd0335813a;hp=0c2081bf0303c68f4306e5ccce65dfdfafa50bb2;hb=9cb2cd7e532e8edfc27a113d5efa735bcaa85d3a;hpb=7867d19e116a19c5f7ade801e8c0a0eebb7196f4 diff --git a/source/test.cpp b/source/test.cpp index 0c2081b..b4693b2 100644 --- a/source/test.cpp +++ b/source/test.cpp @@ -88,14 +88,26 @@ void Test::run(bool verbose) } catch(const exception &e) { - if(exc_check && exc_check->check(e)) + if(exc_check) { - pass_test(); - debug(Debug::demangle(typeid(e).name())); - debug(e.what()); + if(exc_check->check(e)) + { + pass_test(); + debug(Debug::demangle(typeid(e).name())); + debug(e.what()); + } + else + { + fail_test("Exception of incorrect type thrown"); + debug(format("%s (expected %s)", Debug::demangle(typeid(e).name()), Debug::demangle(exc_check->get_type_info().name()))); + debug(e.what()); + } } else + { + debug(Debug::demangle(typeid(e).name())); fail_test(e.what()); + } } catch(...) {