[libc-commits] [PATCH] D75103: [libc] [UnitTest] Give UnitTest gtest like colors

Alex Brachet via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Feb 25 00:51:22 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG29e2cb87491c: [libc] [UnitTest] Give UnitTest gtest like colors (authored by abrachet).
Herald added a project: libc-project.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75103/new/

https://reviews.llvm.org/D75103

Files:
  libc/utils/UnitTest/Test.cpp


Index: libc/utils/UnitTest/Test.cpp
===================================================================
--- libc/utils/UnitTest/Test.cpp
+++ libc/utils/UnitTest/Test.cpp
@@ -132,7 +132,10 @@
   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 @@
     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;
     }
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75103.246384.patch
Type: text/x-patch
Size: 1152 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20200225/9b5d4ae9/attachment-0001.bin>


More information about the libc-commits mailing list