Final test report now includes the test failure message

This commit is contained in:
Crzyrndm 2018-06-18 18:56:23 +12:00
parent cfef764ab9
commit 6d16ffaddf
3 changed files with 9 additions and 10 deletions

View File

@ -20,7 +20,7 @@
catch (...) \
{ \
} \
throw xlnt::exception("test failed -> " XLNT_STRINGIFY(expression)); \
throw xlnt::exception("assert failed -> " XLNT_STRINGIFY(expression)); \
} while (false)
#define xlnt_assert_throws_nothing(expression) \
@ -34,7 +34,7 @@
catch (...) \
{ \
} \
throw xlnt::exception("test failed -> " XLNT_STRINGIFY(expression)); \
throw xlnt::exception("assert throws nothing failed -> " XLNT_STRINGIFY(expression)); \
} while (false)
#define xlnt_assert_throws(expression, exception_type) \
@ -51,7 +51,7 @@
catch (...) \
{ \
} \
throw xlnt::exception("test failed -> " XLNT_STRINGIFY(expression)); \
throw xlnt::exception("assert throws failed -> " XLNT_STRINGIFY(expression)); \
} while (false)
#define xlnt_assert_equals(left, right) xlnt_assert(left == right)

View File

@ -41,16 +41,15 @@ public:
}
catch (std::exception &ex)
{
std::string fail_msg = test.second + " failed with:\n" + std::string(ex.what());
std::cout << "*\n"
<< test.second << " failed with:\n"
<< ex.what() << '\n';
<< fail_msg << '\n';
status.tests_failed++;
status.failures.push_back(test.second);
status.failures.push_back(fail_msg);
}
catch (...)
{
std::cout << "*\n"
<< test.second << " failed" << '\n';
std::cout << "*\n" << test.second << " failed\n";
status.tests_failed++;
status.failures.push_back(test.second);
}

View File

@ -63,11 +63,11 @@ void run_tests()
void print_summary()
{
std::cout << std::endl;
std::cout << "\n\n";
for (auto failure : overall_status.failures)
{
std::cout << failure << " failed" << std::endl;
std::cout << failure << "\n\n";
}
}