Get rid of FormatErrorReporter.
This commit is contained in:
parent
8cc0d21124
commit
42de4f1f7d
66
format.cc
66
format.cc
@ -565,13 +565,6 @@ class fmt::internal::ArgFormatter :
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Char>
|
|
||||||
void fmt::internal::FormatErrorReporter<Char>::operator()(
|
|
||||||
const Char *s, fmt::StringRef message) const {
|
|
||||||
if (find_closing_brace(s, num_open_braces))
|
|
||||||
throw fmt::FormatError(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fills the padding around the content and returns the pointer to the
|
// Fills the padding around the content and returns the pointer to the
|
||||||
// content area.
|
// content area.
|
||||||
template <typename Char>
|
template <typename Char>
|
||||||
@ -763,22 +756,23 @@ inline const Arg
|
|||||||
unsigned arg_index = 0;
|
unsigned arg_index = 0;
|
||||||
if (*s < '0' || *s > '9') {
|
if (*s < '0' || *s > '9') {
|
||||||
if (*s != '}' && *s != ':')
|
if (*s != '}' && *s != ':')
|
||||||
report_error_(s, "invalid argument index in format string");
|
throw FormatError("invalid format string");
|
||||||
const Arg &arg = next_arg();
|
const Arg &arg = next_arg();
|
||||||
if (error_)
|
if (error_)
|
||||||
report_error_(s, error_);
|
throw FormatError(error_);
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
if (next_arg_index_ > 0) {
|
if (next_arg_index_ > 0) {
|
||||||
report_error_(s,
|
throw FormatError(
|
||||||
"cannot switch from automatic to manual argument indexing");
|
"cannot switch from automatic to manual argument indexing");
|
||||||
}
|
}
|
||||||
next_arg_index_ = -1;
|
next_arg_index_ = -1;
|
||||||
arg_index = parse_nonnegative_int(s, error_);
|
arg_index = parse_nonnegative_int(s, error_);
|
||||||
if (error_)
|
if (arg_index >= args_.size()) {
|
||||||
report_error_(s, error_); // TODO: don't use report_error_
|
if (!error_)
|
||||||
if (arg_index >= args_.size())
|
error_ = "argument index is out of range in format";
|
||||||
report_error_(s, "argument index is out of range in format");
|
return DUMMY_ARG;
|
||||||
|
}
|
||||||
return args_[arg_index];
|
return args_[arg_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -787,12 +781,12 @@ void fmt::BasicFormatter<Char>::check_sign(
|
|||||||
const Char *&s, const Arg &arg) {
|
const Char *&s, const Arg &arg) {
|
||||||
char sign = static_cast<char>(*s);
|
char sign = static_cast<char>(*s);
|
||||||
if (arg.type > Arg::LAST_NUMERIC_TYPE) {
|
if (arg.type > Arg::LAST_NUMERIC_TYPE) {
|
||||||
report_error_(s, fmt::format(
|
throw FormatError(fmt::format(
|
||||||
"format specifier '{}' requires numeric argument", sign).c_str());
|
"format specifier '{}' requires numeric argument", sign));
|
||||||
}
|
}
|
||||||
if (arg.type == Arg::UINT || arg.type == Arg::ULONG_LONG) {
|
if (arg.type == Arg::UINT || arg.type == Arg::ULONG_LONG) {
|
||||||
report_error_(s, fmt::format(
|
throw FormatError(fmt::format(
|
||||||
"format specifier '{}' requires signed argument", sign).c_str());
|
"format specifier '{}' requires signed argument", sign));
|
||||||
}
|
}
|
||||||
++s;
|
++s;
|
||||||
}
|
}
|
||||||
@ -1099,12 +1093,12 @@ const Char *fmt::BasicFormatter<Char>::format(
|
|||||||
if (p != s) {
|
if (p != s) {
|
||||||
if (c == '}') break;
|
if (c == '}') break;
|
||||||
if (c == '{')
|
if (c == '{')
|
||||||
report_error_(s, "invalid fill character '{'");
|
throw FormatError("invalid fill character '{'");
|
||||||
s += 2;
|
s += 2;
|
||||||
spec.fill_ = c;
|
spec.fill_ = c;
|
||||||
} else ++s;
|
} else ++s;
|
||||||
if (spec.align_ == ALIGN_NUMERIC && arg.type > Arg::LAST_NUMERIC_TYPE)
|
if (spec.align_ == ALIGN_NUMERIC && arg.type > Arg::LAST_NUMERIC_TYPE)
|
||||||
report_error_(s, "format specifier '=' requires numeric argument");
|
throw FormatError("format specifier '=' requires numeric argument");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (--p >= s);
|
} while (--p >= s);
|
||||||
@ -1128,7 +1122,8 @@ const Char *fmt::BasicFormatter<Char>::format(
|
|||||||
|
|
||||||
if (*s == '#') {
|
if (*s == '#') {
|
||||||
if (arg.type > Arg::LAST_NUMERIC_TYPE)
|
if (arg.type > Arg::LAST_NUMERIC_TYPE)
|
||||||
report_error_(s, "format specifier '#' requires numeric argument");
|
// TODO: make FormatError accept arguments
|
||||||
|
throw FormatError("format specifier '#' requires numeric argument");
|
||||||
spec.flags_ |= HASH_FLAG;
|
spec.flags_ |= HASH_FLAG;
|
||||||
++s;
|
++s;
|
||||||
}
|
}
|
||||||
@ -1137,7 +1132,7 @@ const Char *fmt::BasicFormatter<Char>::format(
|
|||||||
if ('0' <= *s && *s <= '9') {
|
if ('0' <= *s && *s <= '9') {
|
||||||
if (*s == '0') {
|
if (*s == '0') {
|
||||||
if (arg.type > Arg::LAST_NUMERIC_TYPE)
|
if (arg.type > Arg::LAST_NUMERIC_TYPE)
|
||||||
report_error_(s, "format specifier '0' requires numeric argument");
|
throw FormatError("format specifier '0' requires numeric argument");
|
||||||
spec.align_ = ALIGN_NUMERIC;
|
spec.align_ = ALIGN_NUMERIC;
|
||||||
spec.fill_ = '0';
|
spec.fill_ = '0';
|
||||||
}
|
}
|
||||||
@ -1145,7 +1140,7 @@ const Char *fmt::BasicFormatter<Char>::format(
|
|||||||
// and more efficient than checking if the next char is a digit.
|
// and more efficient than checking if the next char is a digit.
|
||||||
spec.width_ = parse_nonnegative_int(s, error);
|
spec.width_ = parse_nonnegative_int(s, error);
|
||||||
if (error)
|
if (error)
|
||||||
report_error_(s, error);
|
throw FormatError(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse precision.
|
// Parse precision.
|
||||||
@ -1155,16 +1150,19 @@ const Char *fmt::BasicFormatter<Char>::format(
|
|||||||
if ('0' <= *s && *s <= '9') {
|
if ('0' <= *s && *s <= '9') {
|
||||||
spec.precision_ = parse_nonnegative_int(s, error);
|
spec.precision_ = parse_nonnegative_int(s, error);
|
||||||
if (error)
|
if (error)
|
||||||
report_error_(s, error);
|
throw FormatError(error);
|
||||||
} else if (*s == '{') {
|
} else if (*s == '{') {
|
||||||
++s;
|
++s;
|
||||||
++report_error_.num_open_braces;
|
|
||||||
const Arg &precision_arg = parse_arg_index(s);
|
const Arg &precision_arg = parse_arg_index(s);
|
||||||
|
if (*s++ != '}')
|
||||||
|
throw FormatError("unmatched '{' in format");
|
||||||
|
if (error_)
|
||||||
|
throw FormatError(error_);
|
||||||
ULongLong value = 0;
|
ULongLong value = 0;
|
||||||
switch (precision_arg.type) {
|
switch (precision_arg.type) {
|
||||||
case Arg::INT:
|
case Arg::INT:
|
||||||
if (precision_arg.int_value < 0)
|
if (precision_arg.int_value < 0)
|
||||||
report_error_(s, "negative precision in format");
|
throw FormatError("negative precision in format");
|
||||||
value = precision_arg.int_value;
|
value = precision_arg.int_value;
|
||||||
break;
|
break;
|
||||||
case Arg::UINT:
|
case Arg::UINT:
|
||||||
@ -1172,26 +1170,23 @@ const Char *fmt::BasicFormatter<Char>::format(
|
|||||||
break;
|
break;
|
||||||
case Arg::LONG_LONG:
|
case Arg::LONG_LONG:
|
||||||
if (precision_arg.long_long_value < 0)
|
if (precision_arg.long_long_value < 0)
|
||||||
report_error_(s, "negative precision in format");
|
throw FormatError("negative precision in format");
|
||||||
value = precision_arg.long_long_value;
|
value = precision_arg.long_long_value;
|
||||||
break;
|
break;
|
||||||
case Arg::ULONG_LONG:
|
case Arg::ULONG_LONG:
|
||||||
value = precision_arg.ulong_long_value;
|
value = precision_arg.ulong_long_value;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
report_error_(s, "precision is not integer");
|
throw FormatError("precision is not integer");
|
||||||
}
|
}
|
||||||
if (value > INT_MAX)
|
if (value > INT_MAX)
|
||||||
report_error_(s, "number is too big in format");
|
throw FormatError("number is too big in format");
|
||||||
spec.precision_ = static_cast<int>(value);
|
spec.precision_ = static_cast<int>(value);
|
||||||
if (*s++ != '}')
|
|
||||||
throw FormatError("unmatched '{' in format");
|
|
||||||
--report_error_.num_open_braces;
|
|
||||||
} else {
|
} else {
|
||||||
report_error_(s, "missing precision in format");
|
throw FormatError("missing precision in format");
|
||||||
}
|
}
|
||||||
if (arg.type != Arg::DOUBLE && arg.type != Arg::LONG_DOUBLE) {
|
if (arg.type != Arg::DOUBLE && arg.type != Arg::LONG_DOUBLE) {
|
||||||
report_error_(s,
|
throw FormatError(
|
||||||
"precision specifier requires floating-point argument");
|
"precision specifier requires floating-point argument");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1203,6 +1198,8 @@ const Char *fmt::BasicFormatter<Char>::format(
|
|||||||
|
|
||||||
if (*s++ != '}')
|
if (*s++ != '}')
|
||||||
throw FormatError("unmatched '{' in format");
|
throw FormatError("unmatched '{' in format");
|
||||||
|
if (error_)
|
||||||
|
throw FormatError(error_);
|
||||||
start_ = s;
|
start_ = s;
|
||||||
|
|
||||||
// Format argument.
|
// Format argument.
|
||||||
@ -1226,7 +1223,6 @@ void fmt::BasicFormatter<Char>::format(
|
|||||||
}
|
}
|
||||||
if (c == '}')
|
if (c == '}')
|
||||||
throw FormatError("unmatched '}' in format");
|
throw FormatError("unmatched '}' in format");
|
||||||
report_error_.num_open_braces = 1;
|
|
||||||
write(writer_, start_, s - 1);
|
write(writer_, start_, s - 1);
|
||||||
Arg arg = parse_arg_index(s);
|
Arg arg = parse_arg_index(s);
|
||||||
s = format(s, arg);
|
s = format(s, arg);
|
||||||
|
10
format.h
10
format.h
@ -553,15 +553,6 @@ void format_windows_error(
|
|||||||
fmt::Writer &out, int error_code, fmt::StringRef message);
|
fmt::Writer &out, int error_code, fmt::StringRef message);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Throws Exception(message) if format contains '}', otherwise throws
|
|
||||||
// FormatError reporting unmatched '{'. The idea is that unmatched '{'
|
|
||||||
// should override other errors.
|
|
||||||
template <typename Char>
|
|
||||||
struct FormatErrorReporter {
|
|
||||||
int num_open_braces;
|
|
||||||
void operator()(const Char *s, fmt::StringRef message) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Computes max(Arg, 1) at compile time. It is used to avoid errors about
|
// Computes max(Arg, 1) at compile time. It is used to avoid errors about
|
||||||
// allocating an array of 0 size.
|
// allocating an array of 0 size.
|
||||||
template <unsigned Arg>
|
template <unsigned Arg>
|
||||||
@ -893,7 +884,6 @@ class BasicFormatter : private internal::FormatterBase {
|
|||||||
private:
|
private:
|
||||||
BasicWriter<Char> &writer_;
|
BasicWriter<Char> &writer_;
|
||||||
const Char *start_;
|
const Char *start_;
|
||||||
internal::FormatErrorReporter<Char> report_error_;
|
|
||||||
|
|
||||||
// Parses argument index and returns an argument with this index.
|
// Parses argument index and returns an argument with this index.
|
||||||
const internal::Arg &parse_arg_index(const Char *&s);
|
const internal::Arg &parse_arg_index(const Char *&s);
|
||||||
|
@ -585,7 +585,7 @@ TEST(FormatterTest, Escape) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(FormatterTest, UnmatchedBraces) {
|
TEST(FormatterTest, UnmatchedBraces) {
|
||||||
EXPECT_THROW_MSG(format("{"), FormatError, "unmatched '{' in format");
|
EXPECT_THROW_MSG(format("{"), FormatError, "invalid format string");
|
||||||
EXPECT_THROW_MSG(format("}"), FormatError, "unmatched '}' in format");
|
EXPECT_THROW_MSG(format("}"), FormatError, "unmatched '}' in format");
|
||||||
EXPECT_THROW_MSG(format("{0{}"), FormatError, "unmatched '{' in format");
|
EXPECT_THROW_MSG(format("{0{}"), FormatError, "unmatched '{' in format");
|
||||||
}
|
}
|
||||||
@ -605,9 +605,8 @@ TEST(FormatterTest, ArgsInDifferentPositions) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(FormatterTest, ArgErrors) {
|
TEST(FormatterTest, ArgErrors) {
|
||||||
EXPECT_THROW_MSG(format("{"), FormatError, "unmatched '{' in format");
|
EXPECT_THROW_MSG(format("{"), FormatError, "invalid format string");
|
||||||
EXPECT_THROW_MSG(format("{x}"), FormatError,
|
EXPECT_THROW_MSG(format("{x}"), FormatError, "invalid format string");
|
||||||
"invalid argument index in format string");
|
|
||||||
EXPECT_THROW_MSG(format("{0"), FormatError, "unmatched '{' in format");
|
EXPECT_THROW_MSG(format("{0"), FormatError, "unmatched '{' in format");
|
||||||
EXPECT_THROW_MSG(format("{0}"), FormatError,
|
EXPECT_THROW_MSG(format("{0}"), FormatError,
|
||||||
"argument index is out of range in format");
|
"argument index is out of range in format");
|
||||||
@ -622,7 +621,8 @@ TEST(FormatterTest, ArgErrors) {
|
|||||||
safe_sprintf(format_str, "{%u", INT_MAX + 1u);
|
safe_sprintf(format_str, "{%u", INT_MAX + 1u);
|
||||||
EXPECT_THROW_MSG(format(format_str), FormatError, "unmatched '{' in format");
|
EXPECT_THROW_MSG(format(format_str), FormatError, "unmatched '{' in format");
|
||||||
safe_sprintf(format_str, "{%u}", INT_MAX + 1u);
|
safe_sprintf(format_str, "{%u}", INT_MAX + 1u);
|
||||||
EXPECT_THROW_MSG(format(format_str), FormatError, "number is too big in format");
|
EXPECT_THROW_MSG(format(format_str), FormatError,
|
||||||
|
"number is too big in format");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(FormatterTest, AutoArgIndex) {
|
TEST(FormatterTest, AutoArgIndex) {
|
||||||
@ -727,7 +727,7 @@ TEST(FormatterTest, CenterAlign) {
|
|||||||
|
|
||||||
TEST(FormatterTest, Fill) {
|
TEST(FormatterTest, Fill) {
|
||||||
EXPECT_THROW_MSG(format("{0:{<5}", 'c'),
|
EXPECT_THROW_MSG(format("{0:{<5}", 'c'),
|
||||||
FormatError, "unmatched '{' in format");
|
FormatError, "invalid fill character '{'");
|
||||||
EXPECT_THROW_MSG(format("{0:{<5}}", 'c'),
|
EXPECT_THROW_MSG(format("{0:{<5}}", 'c'),
|
||||||
FormatError, "invalid fill character '{'");
|
FormatError, "invalid fill character '{'");
|
||||||
EXPECT_EQ("**42", format("{0:*>4}", 42));
|
EXPECT_EQ("**42", format("{0:*>4}", 42));
|
||||||
@ -896,18 +896,20 @@ TEST(FormatterTest, Width) {
|
|||||||
char format_str[BUFFER_SIZE];
|
char format_str[BUFFER_SIZE];
|
||||||
safe_sprintf(format_str, "{0:%u", UINT_MAX);
|
safe_sprintf(format_str, "{0:%u", UINT_MAX);
|
||||||
increment(format_str + 3);
|
increment(format_str + 3);
|
||||||
EXPECT_THROW_MSG(format(format_str), FormatError, "unmatched '{' in format");
|
EXPECT_THROW_MSG(format(format_str), FormatError,
|
||||||
|
"number is too big in format");
|
||||||
std::size_t size = std::strlen(format_str);
|
std::size_t size = std::strlen(format_str);
|
||||||
format_str[size] = '}';
|
format_str[size] = '}';
|
||||||
format_str[size + 1] = 0;
|
format_str[size + 1] = 0;
|
||||||
EXPECT_THROW_MSG(format(format_str, 0),
|
EXPECT_THROW_MSG(format(format_str, 0), FormatError,
|
||||||
FormatError, "number is too big in format");
|
"number is too big in format");
|
||||||
|
|
||||||
safe_sprintf(format_str, "{0:%u", INT_MAX + 1u);
|
safe_sprintf(format_str, "{0:%u", INT_MAX + 1u);
|
||||||
EXPECT_THROW_MSG(format(format_str), FormatError, "unmatched '{' in format");
|
EXPECT_THROW_MSG(format(format_str), FormatError,
|
||||||
|
"number is too big in format");
|
||||||
safe_sprintf(format_str, "{0:%u}", INT_MAX + 1u);
|
safe_sprintf(format_str, "{0:%u}", INT_MAX + 1u);
|
||||||
EXPECT_THROW_MSG(format(format_str, 0),
|
EXPECT_THROW_MSG(format(format_str, 0), FormatError,
|
||||||
FormatError, "number is too big in format");
|
"number is too big in format");
|
||||||
EXPECT_EQ(" -42", format("{0:4}", -42));
|
EXPECT_EQ(" -42", format("{0:4}", -42));
|
||||||
EXPECT_EQ(" 42", format("{0:5}", 42u));
|
EXPECT_EQ(" 42", format("{0:5}", 42u));
|
||||||
EXPECT_EQ(" -42", format("{0:6}", -42l));
|
EXPECT_EQ(" -42", format("{0:6}", -42l));
|
||||||
@ -926,26 +928,28 @@ TEST(FormatterTest, Precision) {
|
|||||||
char format_str[BUFFER_SIZE];
|
char format_str[BUFFER_SIZE];
|
||||||
safe_sprintf(format_str, "{0:.%u", UINT_MAX);
|
safe_sprintf(format_str, "{0:.%u", UINT_MAX);
|
||||||
increment(format_str + 4);
|
increment(format_str + 4);
|
||||||
EXPECT_THROW_MSG(format(format_str), FormatError, "unmatched '{' in format");
|
EXPECT_THROW_MSG(format(format_str), FormatError,
|
||||||
|
"number is too big in format");
|
||||||
std::size_t size = std::strlen(format_str);
|
std::size_t size = std::strlen(format_str);
|
||||||
format_str[size] = '}';
|
format_str[size] = '}';
|
||||||
format_str[size + 1] = 0;
|
format_str[size + 1] = 0;
|
||||||
EXPECT_THROW_MSG(format(format_str, 0),
|
EXPECT_THROW_MSG(format(format_str, 0), FormatError,
|
||||||
FormatError, "number is too big in format");
|
"number is too big in format");
|
||||||
|
|
||||||
safe_sprintf(format_str, "{0:.%u", INT_MAX + 1u);
|
safe_sprintf(format_str, "{0:.%u", INT_MAX + 1u);
|
||||||
EXPECT_THROW_MSG(format(format_str), FormatError, "unmatched '{' in format");
|
EXPECT_THROW_MSG(format(format_str), FormatError,
|
||||||
|
"number is too big in format");
|
||||||
safe_sprintf(format_str, "{0:.%u}", INT_MAX + 1u);
|
safe_sprintf(format_str, "{0:.%u}", INT_MAX + 1u);
|
||||||
EXPECT_THROW_MSG(format(format_str, 0),
|
EXPECT_THROW_MSG(format(format_str, 0), FormatError,
|
||||||
FormatError, "number is too big in format");
|
"number is too big in format");
|
||||||
|
|
||||||
EXPECT_THROW_MSG(format("{0:.", 0),
|
EXPECT_THROW_MSG(format("{0:.", 0),
|
||||||
FormatError, "unmatched '{' in format");
|
FormatError, "missing precision in format");
|
||||||
EXPECT_THROW_MSG(format("{0:.}", 0),
|
EXPECT_THROW_MSG(format("{0:.}", 0),
|
||||||
FormatError, "missing precision in format");
|
FormatError, "missing precision in format");
|
||||||
EXPECT_THROW_MSG(format("{0:.2", 0),
|
|
||||||
FormatError, "unmatched '{' in format");
|
|
||||||
|
|
||||||
|
EXPECT_THROW_MSG(format("{0:.2", 0),
|
||||||
|
FormatError, "precision specifier requires floating-point argument");
|
||||||
EXPECT_THROW_MSG(format("{0:.2}", 42),
|
EXPECT_THROW_MSG(format("{0:.2}", 42),
|
||||||
FormatError, "precision specifier requires floating-point argument");
|
FormatError, "precision specifier requires floating-point argument");
|
||||||
EXPECT_THROW_MSG(format("{0:.2f}", 42),
|
EXPECT_THROW_MSG(format("{0:.2f}", 42),
|
||||||
@ -997,25 +1001,26 @@ TEST(FormatterTest, Precision) {
|
|||||||
TEST(FormatterTest, RuntimePrecision) {
|
TEST(FormatterTest, RuntimePrecision) {
|
||||||
char format_str[BUFFER_SIZE];
|
char format_str[BUFFER_SIZE];
|
||||||
safe_sprintf(format_str, "{0:.{%u", UINT_MAX);
|
safe_sprintf(format_str, "{0:.{%u", UINT_MAX);
|
||||||
increment(format_str + 4);
|
increment(format_str + 5);
|
||||||
EXPECT_THROW_MSG(format(format_str), FormatError, "unmatched '{' in format");
|
EXPECT_THROW_MSG(format(format_str), FormatError, "unmatched '{' in format");
|
||||||
std::size_t size = std::strlen(format_str);
|
std::size_t size = std::strlen(format_str);
|
||||||
format_str[size] = '}';
|
format_str[size] = '}';
|
||||||
format_str[size + 1] = 0;
|
format_str[size + 1] = 0;
|
||||||
EXPECT_THROW_MSG(format(format_str, 0), FormatError, "unmatched '{' in format");
|
EXPECT_THROW_MSG(format(format_str, 0), FormatError,
|
||||||
|
"number is too big in format");
|
||||||
format_str[size + 1] = '}';
|
format_str[size + 1] = '}';
|
||||||
format_str[size + 2] = 0;
|
format_str[size + 2] = 0;
|
||||||
EXPECT_THROW_MSG(format(format_str, 0),
|
EXPECT_THROW_MSG(format(format_str, 0),
|
||||||
FormatError, "number is too big in format");
|
FormatError, "number is too big in format");
|
||||||
|
|
||||||
EXPECT_THROW_MSG(format("{0:.{", 0),
|
EXPECT_THROW_MSG(format("{0:.{", 0),
|
||||||
FormatError, "unmatched '{' in format");
|
FormatError, "invalid format string");
|
||||||
EXPECT_THROW_MSG(format("{0:.{}", 0),
|
EXPECT_THROW_MSG(format("{0:.{}", 0),
|
||||||
FormatError, "unmatched '{' in format");
|
FormatError, "cannot switch from manual to automatic argument indexing");
|
||||||
EXPECT_THROW_MSG(format("{0:.{x}}", 0),
|
EXPECT_THROW_MSG(format("{0:.{x}}", 0),
|
||||||
FormatError, "invalid argument index in format string");
|
FormatError, "invalid format string");
|
||||||
EXPECT_THROW_MSG(format("{0:.{1}", 0, 0),
|
EXPECT_THROW_MSG(format("{0:.{1}", 0, 0),
|
||||||
FormatError, "unmatched '{' in format");
|
FormatError, "precision specifier requires floating-point argument");
|
||||||
EXPECT_THROW_MSG(format("{0:.{1}}", 0),
|
EXPECT_THROW_MSG(format("{0:.{1}}", 0),
|
||||||
FormatError, "argument index is out of range in format");
|
FormatError, "argument index is out of range in format");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user