X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Ftest.cc;h=66d258a0b009094430793e268598203ee8a836b9;hb=c6581942a9f3089c1d14e2cbc749d47a93247e78;hp=92c1226b24ffca5e7b686926b99753c20051200c;hpb=a2d3699da26720a399bd7f563ccdbccf26e610c5;p=awesomized%2Flibmemcached diff --git a/libtest/test.cc b/libtest/test.cc index 92c1226b..66d258a0 100644 --- a/libtest/test.cc +++ b/libtest/test.cc @@ -226,9 +226,7 @@ int main(int argc, char *argv[]) delete world; return EXIT_SUCCESS; - case TEST_FATAL: case TEST_FAILURE: - case TEST_MEMORY_ALLOCATION_FAILURE: delete world; return EXIT_FAILURE; } @@ -276,7 +274,6 @@ int main(int argc, char *argv[]) case TEST_SUCCESS: break; - case TEST_FATAL: case TEST_FAILURE: Out << next->name << " [ failed ]"; failed= true; @@ -288,8 +285,8 @@ int main(int argc, char *argv[]) skipped= true; goto cleanup; - case TEST_MEMORY_ALLOCATION_FAILURE: - test_assert(0, "Allocation failure, or unknown return"); + default: + throw fatal_message("invalid return code"); } Out << "Collection: " << next->name; @@ -381,7 +378,6 @@ int main(int argc, char *argv[]) stats.success++; break; - case TEST_FATAL: case TEST_FAILURE: stats.failed++; failed= true; @@ -394,8 +390,8 @@ int main(int argc, char *argv[]) Out << "\tTesting " << run->name << "\t\t\t\t\t" << "[ " << test_strerror(return_code) << " ]"; break; - case TEST_MEMORY_ALLOCATION_FAILURE: - test_assert(0, "Memory Allocation Error"); + default: + throw fatal_message("invalid return code"); } if (test_failed(world->on_error(return_code, creators_ptr))) @@ -464,6 +460,10 @@ cleanup: { std::cerr << e.what() << std::endl; } + catch (std::bad_alloc& e) + { + std::cerr << e.what() << std::endl; + } catch (...) { std::cerr << "Unknown exception halted execution" << std::endl;