mirror of
https://github.com/fmtlib/fmt.git
synced 2026-05-19 23:24:55 +02:00
Renamed enum color to colors.
Added enum colors conversion to rgb struct. Added colors_test.cpp. Removed print_colored. Renamed enum colors back to color. Removed unnecessary inline keyword. Removed print_rgb.
This commit is contained in:
committed by
Victor Zverovich
parent
0508bbc7ae
commit
ce500635c7
@@ -5,6 +5,7 @@
|
||||
//
|
||||
// For the license information refer to format.h.
|
||||
|
||||
#define FMT_EXTENDED_COLORS
|
||||
#define FMT_NOEXCEPT
|
||||
#undef FMT_SHARED
|
||||
#include "test-assert.h"
|
||||
@@ -116,3 +117,10 @@ TEST(FormatTest, FormatErrorCode) {
|
||||
EXPECT_EQ(msg, to_string(buffer));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(ColorsTest, Colors) {
|
||||
EXPECT_WRITE(stdout, fmt::print(fmt::rgb(255,20,30), "rgb(255,20,30)"),
|
||||
"\x1b[38;2;255;020;030mrgb(255,20,30)\x1b[0m");
|
||||
EXPECT_WRITE(stdout, fmt::print(fmt::color::blue,"blue"),
|
||||
"\x1b[38;2;000;000;255mblue\x1b[0m");
|
||||
}
|
||||
|
||||
@@ -1266,13 +1266,6 @@ TEST(FormatTest, Print) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#if FMT_USE_FILE_DESCRIPTORS
|
||||
TEST(FormatTest, PrintColored) {
|
||||
EXPECT_WRITE(stdout, fmt::print_colored(fmt::red, "Hello, {}!\n", "world"),
|
||||
"\x1b[31mHello, world!\n\x1b[0m");
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(FormatTest, Variadic) {
|
||||
EXPECT_EQ("abc1", format("{}c{}", "ab", 1));
|
||||
EXPECT_EQ(L"abc1", format(L"{}c{}", L"ab", 1));
|
||||
|
||||
Reference in New Issue
Block a user