Fix typos.

This commit is contained in:
Nicolas Lesser 2018-12-05 19:07:52 +01:00
parent 6c07444642
commit 52013c25a1
No known key found for this signature in database
GPG Key ID: 55F9BC675F85A2DF

View File

@ -25,9 +25,9 @@
#undef max
#if FMT_HAS_CPP_ATTRIBUTE(noreturn)
# define FMT_NORETURN [[noreturn]]
#define FMT_NORETURN [[noreturn]]
#else
# define FMT_NORETURN
#define FMT_NORETURN
#endif
using fmt::internal::fp;
@ -108,10 +108,8 @@ TEST(FPTest, Grisu2FormatCompilesWithNonIEEEDouble) {
}
template <typename T>
struct ValueExtractor: fmt::internal::function<T> {
T operator()(T value) {
return value;
}
struct ValueExtractor : fmt::internal::function<T> {
T operator()(T value) { return value; }
template <typename U>
FMT_NORETURN T operator()(U) {
@ -178,8 +176,8 @@ TEST(FormatTest, FormatErrorCode) {
}
{
fmt::memory_buffer buffer;
std::string prefix(
fmt::inline_buffer_size - msg.size() - sep.size() + 1, 'x');
std::string prefix(fmt::inline_buffer_size - msg.size() - sep.size() + 1,
'x');
fmt::format_error_code(buffer, 42, prefix);
EXPECT_EQ(msg, to_string(buffer));
}
@ -188,8 +186,7 @@ TEST(FormatTest, FormatErrorCode) {
// Test maximum buffer size.
msg = fmt::format("error {}", codes[i]);
fmt::memory_buffer buffer;
std::string prefix(
fmt::inline_buffer_size - msg.size() - sep.size(), 'x');
std::string prefix(fmt::inline_buffer_size - msg.size() - sep.size(), 'x');
fmt::format_error_code(buffer, codes[i], prefix);
EXPECT_EQ(prefix + sep + msg, to_string(buffer));
std::size_t size = fmt::inline_buffer_size;
@ -207,24 +204,25 @@ TEST(FormatTest, CountCodePoints) {
}
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");
EXPECT_WRITE(stdout, fmt::print(fg(fmt::color::blue), "blue"),
"\x1b[38;2;000;000;255mblue\x1b[0m");
EXPECT_WRITE(stdout,
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(
EXPECT_WRITE(
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");
}