Deprecate Format and update tests.

This commit is contained in:
Victor Zverovich
2014-06-28 15:58:02 -07:00
parent 09f40191f4
commit e06e9f885c
4 changed files with 254 additions and 295 deletions
+12 -3
View File
@@ -34,7 +34,7 @@
#if FMT_USE_VARIADIC_TEMPLATES && FMT_USE_RVALUE_REFERENCES
using fmt::Format;
using fmt::format;
using fmt::FormatError;
// Returns a number UINT_MAX + 1 formatted as a string.
@@ -226,6 +226,8 @@ TEST(PrintfTest, DynamicWidth) {
"width is not integer");
EXPECT_THROW_MSG(fmt::sprintf("%*d"), FormatError,
"argument index is out of range in format");
EXPECT_THROW_MSG(fmt::sprintf("%*d", BIG_NUM, 42), FormatError,
"number is too big in format");
}
TEST(PrintfTest, IntPrecision) {
@@ -266,13 +268,20 @@ TEST(PrintfTest, IgnorePrecisionForNonNumericArg) {
TEST(PrintfTest, DynamicPrecision) {
EXPECT_EQ("00042", str(fmt::sprintf("%.*d", 5, 42)));
EXPECT_EQ("42", str(fmt::sprintf("%.*d", -5, 42)));
// TODO
//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");
//EXPECT_THROW_MSG(fmt::sprintf("%.*d", BIG_NUM, 42), FormatError,
// "number is too big in format");
}
// TODO: test length and type specifier
TEST(PrintfTest, Length) {
// TODO
}
// TODO: test type specifier
#endif