mirror of
https://github.com/fmtlib/fmt.git
synced 2026-05-03 19:30:47 +02:00
More tests
This commit is contained in:
+4
-1
@@ -1702,7 +1702,7 @@ struct test_context {
|
||||
template <typename Id>
|
||||
constexpr void check_arg_id(Id) {}
|
||||
|
||||
constexpr unsigned next_arg_index(const char *&) { return 33; }
|
||||
constexpr unsigned next_arg_index() { return 33; }
|
||||
|
||||
void on_error(const char *) {}
|
||||
|
||||
@@ -1903,4 +1903,7 @@ TEST(FormatTest, FormatStringErrors) {
|
||||
EXPECT_ERROR("{:.x}", "missing precision specifier", int);
|
||||
EXPECT_ERROR("{}", "argument index out of range");
|
||||
EXPECT_ERROR("{1}", "argument index out of range", int);
|
||||
EXPECT_ERROR("{1}{}",
|
||||
"cannot switch from manual to automatic argument indexing",
|
||||
int, int);
|
||||
}
|
||||
|
||||
+2
-2
@@ -87,14 +87,14 @@ TEST(PrintfTest, NumberIsTooBigInArgIndex) {
|
||||
|
||||
TEST(PrintfTest, SwitchArgIndexing) {
|
||||
EXPECT_THROW_MSG(fmt::sprintf("%1$d%", 1, 2),
|
||||
format_error, "invalid format string");
|
||||
format_error, "cannot switch from manual to automatic argument indexing");
|
||||
EXPECT_THROW_MSG(fmt::sprintf(format("%1$d%{}d", BIG_NUM), 1, 2),
|
||||
format_error, "number is too big");
|
||||
EXPECT_THROW_MSG(fmt::sprintf("%1$d%d", 1, 2),
|
||||
format_error, "cannot switch from manual to automatic argument indexing");
|
||||
|
||||
EXPECT_THROW_MSG(fmt::sprintf("%d%1$", 1, 2),
|
||||
format_error, "invalid format string");
|
||||
format_error, "cannot switch from automatic to manual argument indexing");
|
||||
EXPECT_THROW_MSG(fmt::sprintf(format("%d%{}$d", BIG_NUM), 1, 2),
|
||||
format_error, "number is too big");
|
||||
EXPECT_THROW_MSG(fmt::sprintf("%d%1$d", 1, 2),
|
||||
|
||||
Reference in New Issue
Block a user