Fix typos.
This commit is contained in:
parent
6c07444642
commit
52013c25a1
@ -25,9 +25,9 @@
|
|||||||
#undef max
|
#undef max
|
||||||
|
|
||||||
#if FMT_HAS_CPP_ATTRIBUTE(noreturn)
|
#if FMT_HAS_CPP_ATTRIBUTE(noreturn)
|
||||||
# define FMT_NORETURN [[noreturn]]
|
#define FMT_NORETURN [[noreturn]]
|
||||||
#else
|
#else
|
||||||
# define FMT_NORETURN
|
#define FMT_NORETURN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using fmt::internal::fp;
|
using fmt::internal::fp;
|
||||||
@ -108,10 +108,8 @@ TEST(FPTest, Grisu2FormatCompilesWithNonIEEEDouble) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct ValueExtractor: fmt::internal::function<T> {
|
struct ValueExtractor : fmt::internal::function<T> {
|
||||||
T operator()(T value) {
|
T operator()(T value) { return value; }
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename U>
|
template <typename U>
|
||||||
FMT_NORETURN T operator()(U) {
|
FMT_NORETURN T operator()(U) {
|
||||||
@ -178,8 +176,8 @@ TEST(FormatTest, FormatErrorCode) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
fmt::memory_buffer buffer;
|
fmt::memory_buffer buffer;
|
||||||
std::string prefix(
|
std::string prefix(fmt::inline_buffer_size - msg.size() - sep.size() + 1,
|
||||||
fmt::inline_buffer_size - msg.size() - sep.size() + 1, 'x');
|
'x');
|
||||||
fmt::format_error_code(buffer, 42, prefix);
|
fmt::format_error_code(buffer, 42, prefix);
|
||||||
EXPECT_EQ(msg, to_string(buffer));
|
EXPECT_EQ(msg, to_string(buffer));
|
||||||
}
|
}
|
||||||
@ -188,8 +186,7 @@ TEST(FormatTest, FormatErrorCode) {
|
|||||||
// Test maximum buffer size.
|
// Test maximum buffer size.
|
||||||
msg = fmt::format("error {}", codes[i]);
|
msg = fmt::format("error {}", codes[i]);
|
||||||
fmt::memory_buffer buffer;
|
fmt::memory_buffer buffer;
|
||||||
std::string prefix(
|
std::string prefix(fmt::inline_buffer_size - msg.size() - sep.size(), 'x');
|
||||||
fmt::inline_buffer_size - msg.size() - sep.size(), 'x');
|
|
||||||
fmt::format_error_code(buffer, codes[i], prefix);
|
fmt::format_error_code(buffer, codes[i], prefix);
|
||||||
EXPECT_EQ(prefix + sep + msg, to_string(buffer));
|
EXPECT_EQ(prefix + sep + msg, to_string(buffer));
|
||||||
std::size_t size = fmt::inline_buffer_size;
|
std::size_t size = fmt::inline_buffer_size;
|
||||||
@ -207,24 +204,25 @@ TEST(FormatTest, CountCodePoints) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(ColorsTest, Colors) {
|
TEST(ColorsTest, Colors) {
|
||||||
EXPECT_WRITE(stdout, fmt::print(fg(fmt::rgb(255,20,30)), "rgb(255,20,30)"),
|
EXPECT_WRITE(stdout, fmt::print(fg(fmt::rgb(255, 20, 30)), "rgb(255,20,30)"),
|
||||||
"\x1b[38;2;255;020;030mrgb(255,20,30)\x1b[0m");
|
"\x1b[38;2;255;020;030mrgb(255,20,30)\x1b[0m");
|
||||||
EXPECT_WRITE(stdout, fmt::print(fg(fmt::color::blue), "blue"),
|
EXPECT_WRITE(stdout, fmt::print(fg(fmt::color::blue), "blue"),
|
||||||
"\x1b[38;2;000;000;255mblue\x1b[0m");
|
"\x1b[38;2;000;000;255mblue\x1b[0m");
|
||||||
EXPECT_WRITE(stdout,
|
EXPECT_WRITE(
|
||||||
fmt::print(fg(fmt::color::blue) | bg(fmt::color::red), "two color"),
|
|
||||||
"\x1b[38;2;000;000;255m\x1b[48;2;255;000;000mtwo color\x1b[0m");
|
|
||||||
EXPECTED_WRITE(stdout, fmt::print(fmt::emphasis::bold, "bold"),
|
|
||||||
"\x1b[1mbold\x1b[0m");
|
|
||||||
EXPECTED_WRITE(stdout, fmt::print(fmt::emphasis::underline, "underline"),
|
|
||||||
"\x1b[3munderline\x1b[0m");
|
|
||||||
EXPECTED_WRITE(stdout, fmt::print(fmt::emphasis::italic, "italic"),
|
|
||||||
"\x1b[4mitalic\x1b[0m");
|
|
||||||
EXPECTED_WRITE(stdout,
|
|
||||||
fmt::print(fmt::emphasis::strikethrough, "strikethrough"),
|
|
||||||
"\x1b[9mstrikethrough\x1b[0m");
|
|
||||||
EXPECTED_WRITE(
|
|
||||||
stdout,
|
stdout,
|
||||||
fmt::prirnt(fg(fmt::color::blue) | fmt::emphasis::bold, "blue/bold"),
|
fmt::print(fg(fmt::color::blue) | bg(fmt::color::red), "two color"),
|
||||||
|
"\x1b[38;2;000;000;255m\x1b[48;2;255;000;000mtwo color\x1b[0m");
|
||||||
|
EXPECT_WRITE(stdout, fmt::print(fmt::emphasis::bold, "bold"),
|
||||||
|
"\x1b[1mbold\x1b[0m");
|
||||||
|
EXPECT_WRITE(stdout, fmt::print(fmt::emphasis::underline, "underline"),
|
||||||
|
"\x1b[3munderline\x1b[0m");
|
||||||
|
EXPECT_WRITE(stdout, fmt::print(fmt::emphasis::italic, "italic"),
|
||||||
|
"\x1b[4mitalic\x1b[0m");
|
||||||
|
EXPECT_WRITE(stdout,
|
||||||
|
fmt::print(fmt::emphasis::strikethrough, "strikethrough"),
|
||||||
|
"\x1b[9mstrikethrough\x1b[0m");
|
||||||
|
EXPECT_WRITE(
|
||||||
|
stdout,
|
||||||
|
fmt::print(fg(fmt::color::blue) | fmt::emphasis::bold, "blue/bold"),
|
||||||
"\x1b[38;2;000;000;255m\x1b[1mblue/bold\x1b[0m");
|
"\x1b[38;2;000;000;255m\x1b[1mblue/bold\x1b[0m");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user