From d0587445cb05cc927a12e8007a96c489903bad08 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Mon, 23 Jun 2014 08:39:32 -0700 Subject: [PATCH] Test negative precision. --- format.cc | 1 - test/printf-test.cc | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/format.cc b/format.cc index c9120f98..4f26b4d0 100644 --- a/format.cc +++ b/format.cc @@ -723,7 +723,6 @@ void fmt::BasicWriter::PrintfParser::Format( spec.precision_ = GetIntValue(arg); else if (!error) error = "precision is not integer"; - // TODO: check for negative precision } } diff --git a/test/printf-test.cc b/test/printf-test.cc index 91f05609..83104168 100644 --- a/test/printf-test.cc +++ b/test/printf-test.cc @@ -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