diff options
author | Alex Brachet <alexbrachetmialot@gmail.com> | 2020-02-25 03:46:09 -0500 |
---|---|---|
committer | Alex Brachet <alexbrachetmialot@gmail.com> | 2020-02-25 03:46:09 -0500 |
commit | 29e2cb87491cfc3690f7467acfef8a0323eba8b4 (patch) | |
tree | a55c80ec5ff2adc43a25882990f1f16851288ba1 /libc/utils | |
parent | [X86] Pass parameters into selectVectorAddr to remove dependency on X86Masked... (diff) | |
download | llvm-project-29e2cb87491cfc3690f7467acfef8a0323eba8b4.tar.gz llvm-project-29e2cb87491cfc3690f7467acfef8a0323eba8b4.tar.bz2 llvm-project-29e2cb87491cfc3690f7467acfef8a0323eba8b4.zip |
[libc] [UnitTest] Give UnitTest gtest like colors
Summary:
This is a quality of life change to make it a little nicer to look at, NFC.
This patch makes the RUN and OK lines green and FAILED lines red to match gtest's output.
Reviewers: sivachandra, gchatelet, PaulkaToast
Reviewed By: gchatelet
Subscribers: MaskRay, tschuett, libc-commits
Differential Revision: https://reviews.llvm.org/D75103
Diffstat (limited to 'libc/utils')
-rw-r--r-- | libc/utils/UnitTest/Test.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libc/utils/UnitTest/Test.cpp b/libc/utils/UnitTest/Test.cpp index 99fb17d143ed..b2c4f2df0ed8 100644 --- a/libc/utils/UnitTest/Test.cpp +++ b/libc/utils/UnitTest/Test.cpp @@ -132,7 +132,10 @@ int Test::runTests() { int FailCount = 0; for (Test *T = Start; T != nullptr; T = T->Next, ++TestCount) { const char *TestName = T->getName(); - llvm::outs() << "[ RUN ] " << TestName << '\n'; + constexpr auto GREEN = llvm::raw_ostream::GREEN; + constexpr auto RED = llvm::raw_ostream::RED; + constexpr auto RESET = llvm::raw_ostream::RESET; + llvm::outs() << GREEN << "[ RUN ] " << RESET << TestName << '\n'; RunContext Ctx; T->SetUp(); T->Run(Ctx); @@ -140,11 +143,11 @@ int Test::runTests() { auto Result = Ctx.status(); switch (Result) { case RunContext::Result_Fail: - llvm::outs() << "[ FAILED ] " << TestName << '\n'; + llvm::outs() << RED << "[ FAILED ] " << RESET << TestName << '\n'; ++FailCount; break; case RunContext::Result_Pass: - llvm::outs() << "[ OK ] " << TestName << '\n'; + llvm::outs() << GREEN << "[ OK ] " << RESET << TestName << '\n'; break; } } |