From e5c39cad9c325cdda906fdc934e29d8c2eeb532f Mon Sep 17 00:00:00 2001 From: Soonho Kong Date: Tue, 23 Jul 2013 18:41:56 -0700 Subject: [PATCH] Add color code in format.cpp to test how it looks on terminal --- src/tests/util/format.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/tests/util/format.cpp b/src/tests/util/format.cpp index d66224e45..81d56fe73 100644 --- a/src/tests/util/format.cpp +++ b/src/tests/util/format.cpp @@ -9,6 +9,10 @@ Author: Soonho Kong using namespace lean; +void color(const char *s, int n) { + std::cout << "\e[" << (31 + n % 7) << "m" << s << "\e[0m"; +} + static void tst1() { format f_atom1("foo"); format f_atom2("bar"); @@ -36,6 +40,13 @@ static void tst1() { << "f6 = " << f6 << std::endl << "f7 = " << f7 << std::endl ; + + color("This ", 0); + color("is ", 1); + color("how ", 2); + color("we ", 3); + color("work.", 4); + std::cout << std::endl; } int main() {