Flush std::cout after printing Catch results

This commit is contained in:
Josiah VanderZee 2024-05-17 06:27:41 -05:00
parent a9d52ca126
commit ded8ba2337
1 changed files with 6 additions and 0 deletions

View File

@ -29,6 +29,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/numeric.h"
#include "porting.h"
#include <iostream>
content_t t_CONTENT_STONE;
content_t t_CONTENT_GRASS;
content_t t_CONTENT_TORCH;
@ -238,7 +240,11 @@ bool run_tests()
rawstream << "Catch test results: " << std::endl;
// Catch prints out the results of this invocation.
// Catch prints to stdout, whereas rawstream prints to
// stderr. We have to flush stdout manually to make sure
// they show up in the right order in the output.
auto num_catch_tests_failed = Catch::Session().run();
std::cout.flush();
// We count the all the Catch tests as one test for Minetest's own logging
// because we don't have a way to tell how many individual tests Catch ran.
num_total_tests_run = 1;