Support compile-time strings and compile-time format string compilation in module

Make just the necessary parts available for lookup from client context.
This commit is contained in:
Daniela Engert
2021-06-11 09:38:53 -07:00
committed by Victor Zverovich
parent 3423d75475
commit 0193e7c428
4 changed files with 53 additions and 36 deletions
+8
View File
@@ -445,3 +445,11 @@ TEST(module_test, has_formatter) {
TEST(module_test, is_formattable) {
EXPECT_FALSE(fmt::is_formattable<disabled_formatter>::value);
}
TEST(module_test, compile_format_string) {
using namespace fmt::literals;
EXPECT_EQ("42", fmt::format("{0:x}"_cf, 0x42));
EXPECT_EQ(L"42", fmt::format(L"{:}"_cf, 42));
EXPECT_EQ("4.2", fmt::format("{arg:3.1f}"_cf, "arg"_a = 4.2));
EXPECT_EQ(L" 42", fmt::format(L"{arg:>3}"_cf, L"arg"_a = L"42"));
}