Add std::exception as a base clase off std::runtime_error and provide unit test for it.

This commit is contained in:
Jason Turner
2011-03-09 21:39:21 -07:00
committed by lefticus@gmail.com
parent 0b97fcb4df
commit d9a92a5148
3 changed files with 28 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
// Tests to make sure that the order in which function dispatches occur is correct
#include <chaiscript/chaiscript.hpp>
int main()
{
chaiscript::ChaiScript chai;
try {
chai.eval("throw(runtime_error(\"error\"));");
} catch (const chaiscript::Boxed_Value &bv) {
const std::exception &e = chaiscript::boxed_cast<const std::exception &>(bv);
if (e.what() == std::string("error"))
{
return EXIT_SUCCESS;
}
}
return EXIT_FAILURE;
}