コード例 #1
0
ファイル: runner.c プロジェクト: thoni56/cgreen
/**
   run()
   
   N.B. Although this is neither an API or public function, it is
   documented as a good place to put a breakpoint. Do not change the
   name or semantics of this function, it should continue to be very
   close to the test code. */
static void run(CgreenTest *spec) {
#ifdef __cplusplus
    std::string message = "an exception was thrown during test: ";
    try {
#endif
        spec->run();
#ifdef __cplusplus
        return;
    } catch(const std::exception& exception) {
        message += '[';
        message += exception.what();
        message += ']';
    } catch(const std::exception* exception) {
        message += '[';
        message += exception->what();
        message += ']';
    } catch(const std::string& exception_message) {
        message += '[';
        message += exception_message;
        message += ']';
    } catch(const std::string *exception_message) {
        message += '[';
        message += *exception_message;
        message += ']';
    } catch(const char *exception_message) {
        message += '[';
        message += exception_message;
        message += ']';
    } catch (...) {
        message += "unknown exception type";
    }
    va_list no_arguments;
    memset(&no_arguments, 0, sizeof(va_list));
    TestReporter *reporter = get_test_reporter();
    reporter->show_incomplete(reporter, spec->filename, spec->line, message.c_str(), no_arguments);
    send_reporter_exception_notification(reporter);
#endif
}