mirror of
https://github.com/fmtlib/fmt.git
synced 2026-05-04 19:44:09 +02:00
Deprecate Format and update tests.
This commit is contained in:
+12
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user