zstring: Support std::format
Change-Id: I8ea0a298e438fddb61573eb8e2349ecd125e60f1
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/test/zstring.cpp b/test/zstring.cpp
index 53c3a14..25ce5b0 100644
--- a/test/zstring.cpp
+++ b/test/zstring.cpp
@@ -2,6 +2,7 @@
#include <stdplus/zstring.hpp>
+#include <format>
#include <iostream>
#include <string>
#include <string_view>
@@ -39,6 +40,8 @@
std::cerr << const_zstring(as);
EXPECT_EQ("dd", fmt::format("d{}", zs));
EXPECT_EQ("dc", fmt::format("d{}", const_zstring(as)));
+ EXPECT_EQ("dd", std::format("d{}", zs));
+ EXPECT_EQ("dc", std::format("d{}", const_zstring(as)));
auto from_str = [&](const_zstring cs) { EXPECT_EQ(cs, "ac"); };
from_str("ac"s);
diff --git a/test/zstring_view.cpp b/test/zstring_view.cpp
index 0ef7fb7..f856757 100644
--- a/test/zstring_view.cpp
+++ b/test/zstring_view.cpp
@@ -2,6 +2,7 @@
#include <stdplus/zstring_view.hpp>
+#include <format>
#include <iostream>
#include <set>
#include <string>
@@ -57,6 +58,7 @@
std::cerr << s1;
EXPECT_EQ("bac", fmt::format("b{}", s1));
+ EXPECT_EQ("bac", std::format("b{}", s1));
std::unordered_set<zstring_view> uset{s1, s2};
EXPECT_EQ(1, uset.count("ac"));