Lines Matching full:fmt
8 #include "fmt/format.h"
12 // Test that there is no issues with specializations when fmt/ostream.h is
13 // included after fmt/format.h.
14 namespace fmt { namespace
21 } // namespace fmt
25 #include "fmt/ostream.h"
26 #include "fmt/ranges.h"
31 using fmt::format;
32 using fmt::format_error;
61 EXPECT_EQ("streamable_enum", fmt::format("{}", streamable_enum())); in TEST()
62 EXPECT_EQ("0", fmt::format("{}", unstreamable_enum())); in TEST()
63 EXPECT_EQ(L"streamable_enum", fmt::format(L"{}", streamable_enum())); in TEST()
64 EXPECT_EQ(L"0", fmt::format(L"{}", unstreamable_enum())); in TEST()
68 : fmt::detail::arg_formatter<fmt::format_context::iterator, char> {
69 fmt::format_parse_context parse_ctx;
70 test_arg_formatter(fmt::format_context& ctx, fmt::format_specs& s) in test_arg_formatter()
71 : fmt::detail::arg_formatter<fmt::format_context::iterator, char>( in test_arg_formatter()
77 fmt::memory_buffer buffer; in TEST()
78 fmt::format_context ctx(fmt::detail::buffer_appender<char>{buffer}, in TEST()
79 fmt::format_args()); in TEST()
80 fmt::format_specs spec; in TEST()
82 fmt::visit_format_arg( in TEST()
83 af, fmt::detail::make_arg<fmt::format_context>(streamable_enum())); in TEST()
127 EXPECT_EQ("", fmt::format("{}", EmptyTest())); in TEST()
132 fmt::print(os, "Don't {}!", "panic"); in TEST()
135 fmt::print(wos, L"Don't {}!", L"panic"); in TEST()
141 fmt::memory_buffer buffer; in TEST()
144 fmt::detail::write_buffer(os, buffer); in TEST()
149 size_t max_size = fmt::detail::max_value<size_t>(); in TEST()
150 std::streamsize max_streamsize = fmt::detail::max_value<std::streamsize>(); in TEST()
151 if (max_size <= fmt::detail::to_unsigned(max_streamsize)) return; in TEST()
153 struct test_buffer final : fmt::detail::buffer<char> { in TEST()
155 : fmt::detail::buffer<char>(nullptr, size, size) {} in TEST()
176 auto n = std::min(size, fmt::detail::to_unsigned(max_streamsize)); in TEST()
182 fmt::detail::write_buffer(os, buffer); in TEST()
187 EXPECT_EQ("1, 2, 3", fmt::format("{}", fmt::join(v, v + 3, ", "))); in TEST()
213 namespace fmt { namespace
220 } // namespace fmt
224 EXPECT_EQ("2", fmt::format("{}", TestTemplate<int>())); in TEST()
230 auto result = fmt::format_to_n(buffer, 3, "{}", fmt_test::ABC()); in TEST()
233 EXPECT_EQ("ABCx", fmt::string_view(buffer, 4)); in TEST()
234 result = fmt::format_to_n(buffer, 3, "x{}y", fmt_test::ABC()); in TEST()
237 EXPECT_EQ("xABx", fmt::string_view(buffer, 4)); in TEST()
243 using namespace fmt::literals; in TEST()
255 EXPECT_EQ("42", fmt::format("{:d}", convertible<unsigned short>(42))); in TEST()
256 EXPECT_EQ(L"42", fmt::format(L"{:d}", convertible<unsigned short>(42))); in TEST()
257 EXPECT_EQ("foo", fmt::format("{}", convertible<const char*>("foo"))); in TEST()
275 EXPECT_EQ("bar", fmt::format("{}", explicitly_convertible_to_string_like())); in TEST()
280 explicit operator fmt::detail::std_string_view<char>() const { in operator fmt::detail::std_string_view<char>()
291 EXPECT_EQ("bar", fmt::format("{}", explicitly_convertible_to_string_like())); in TEST()
304 EXPECT_EQ("foo", fmt::format("{}", streamable_and_convertible_to_bool())); in TEST()
316 EXPECT_EQ("foo", fmt::format("{}", copyfmt_test())); in TEST()
320 EXPECT_EQ("42", fmt::format(FMT_STRING("{}"), 42)); in TEST()
324 EXPECT_EQ("ABC", fmt::to_string(fmt_test::ABC())); in TEST()