Allow getting size of dynamic format arg store (#4270)

This commit is contained in:
Hannes Harnisch
2024-12-19 04:54:35 +01:00
committed by GitHub
parent 873670ba3f
commit 7c50da5385
2 changed files with 17 additions and 0 deletions

View File

@@ -186,3 +186,17 @@ TEST(args_test, move_constructor) {
store.reset();
EXPECT_EQ(fmt::vformat("{} {} {a1}", moved_store), "42 foo foo");
}
TEST(args_test, size) {
fmt::dynamic_format_arg_store<fmt::format_context> store;
EXPECT_EQ(store.size(), 0);
store.push_back(42);
EXPECT_EQ(store.size(), 1);
store.push_back("Molybdenum");
EXPECT_EQ(store.size(), 2);
store.clear();
EXPECT_EQ(store.size(), 0);
}