From 4b8b8b91c2d463b3a4ca6ea8a268f67631f84e5e Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Fri, 7 May 2021 13:40:18 -0700 Subject: [PATCH] LibTest: Convert Crash test runner to outln(..) --- Userland/Libraries/LibTest/CrashTest.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Userland/Libraries/LibTest/CrashTest.cpp b/Userland/Libraries/LibTest/CrashTest.cpp index a6e1f3ae61..5eba071c75 100644 --- a/Userland/Libraries/LibTest/CrashTest.cpp +++ b/Userland/Libraries/LibTest/CrashTest.cpp @@ -20,19 +20,19 @@ Crash::Crash(String test_type, Function crash_function) bool Crash::run(RunType run_type) { - printf("\x1B[33mTesting\x1B[0m: \"%s\"\n", m_type.characters()); + outln("\x1B[33mTesting\x1B[0m: \"{}\"", m_type); auto run_crash_and_print_if_error = [this]() -> bool { auto failure = m_crash_function(); // If we got here something went wrong - printf("\x1B[31mFAIL\x1B[0m: "); + out("\x1B[31mFAIL\x1B[0m: "); switch (failure) { case Failure::DidNotCrash: - printf("Did not crash!\n"); + outln("Did not crash!"); break; case Failure::UnexpectedError: - printf("Unexpected error!\n"); + outln("Unexpected error!"); break; default: VERIFY_NOT_REACHED(); @@ -43,7 +43,6 @@ bool Crash::run(RunType run_type) if (run_type == RunType::UsingCurrentProcess) { return run_crash_and_print_if_error(); } else { - // Run the test in a child process so that we do not crash the crash program :^) pid_t pid = fork(); if (pid < 0) { @@ -57,7 +56,7 @@ bool Crash::run(RunType run_type) int status; waitpid(pid, &status, 0); if (WIFSIGNALED(status)) { - printf("\x1B[32mPASS\x1B[0m: Terminated with signal %d\n", WTERMSIG(status)); + outln("\x1B[32mPASS\x1B[0m: Terminated with signal {}", WTERMSIG(status)); return true; } return false;