Test negative precision.
This commit is contained in:
parent
4099a1269b
commit
d0587445cb
@ -723,7 +723,6 @@ void fmt::BasicWriter<Char>::PrintfParser::Format(
|
||||
spec.precision_ = GetIntValue(arg);
|
||||
else if (!error)
|
||||
error = "precision is not integer";
|
||||
// TODO: check for negative precision
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,11 +266,11 @@ TEST(PrintfTest, IgnorePrecisionForNonNumericArg) {
|
||||
|
||||
TEST(PrintfTest, DynamicPrecision) {
|
||||
EXPECT_EQ("00042", str(fmt::sprintf("%.*d", 5, 42)));
|
||||
EXPECT_EQ("42", str(fmt::sprintf("%.*d", -5, 42)));
|
||||
EXPECT_THROW_MSG(fmt::sprintf("%.*d", 5.0, 42), FormatError,
|
||||
"precision is not integer");
|
||||
EXPECT_THROW_MSG(fmt::sprintf("%.*d"), FormatError,
|
||||
"argument index is out of range in format");
|
||||
// TODO: more tests
|
||||
}
|
||||
|
||||
// TODO: test length and type specifier
|
||||
|
Loading…
Reference in New Issue
Block a user