mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-19 20:18:49 +00:00
Check for argument indexing switch
This commit is contained in:
parent
d45544d14e
commit
643fb0662e
@ -3296,6 +3296,7 @@ class dynamic_specs_handler :
|
||||
|
||||
template <typename Id>
|
||||
arg_ref_type make_arg_ref(Id arg_id) {
|
||||
context_.check_arg_id(arg_id);
|
||||
return arg_ref_type(arg_id);
|
||||
}
|
||||
|
||||
|
@ -1562,6 +1562,10 @@ TEST(FormatTest, DynamicFormatter) {
|
||||
EXPECT_EQ("42", format("{:d}", num));
|
||||
EXPECT_EQ("foo", format("{:s}", str));
|
||||
EXPECT_EQ(" 42 foo ", format("{:{}} {:{}}", num, 3, str, 4));
|
||||
EXPECT_THROW_MSG(format("{0:{}}", num),
|
||||
format_error, "cannot switch from manual to automatic argument indexing");
|
||||
EXPECT_THROW_MSG(format("{:{0}}", num),
|
||||
format_error, "cannot switch from automatic to manual argument indexing");
|
||||
EXPECT_THROW_MSG(format("{:=}", str),
|
||||
format_error, "format specifier '=' requires numeric argument");
|
||||
EXPECT_THROW_MSG(format("{:+}", str),
|
||||
|
Loading…
Reference in New Issue
Block a user