Lines Matching full:fmt
21 // Check if fmt/core.h compiles with windows.h included before it.
26 #include "fmt/core.h"
31 using fmt::basic_format_arg;
32 using fmt::string_view;
33 using fmt::detail::buffer;
34 using fmt::detail::make_arg;
35 using fmt::detail::value;
77 static_assert(!std::is_destructible<fmt::detail::buffer<int>>(), in TEST()
125 const fmt::detail::buffer<char>& const_buffer = buffer; in TEST()
188 EXPECT_EQ(fmt::string_view(buffer.data(), buffer.size()), "0123456789"); in TEST()
206 auto args = fmt::format_args(); in TEST()
212 using parse_context_type = fmt::format_parse_context;
227 fmt::format_parse_context ctx;
229 fmt::format_parse_context& parse_context() { return ctx; } in parse_context()
235 fmt::detail::value<custom_context> arg( in TEST()
236 fmt::detail::arg_mapper<custom_context>().map(t)); in TEST()
237 custom_context ctx = {false, fmt::format_parse_context("")}; in TEST()
296 fmt::visit_format_arg( \
297 visitor, make_arg<fmt::basic_format_context<iterator, Char>>(value)); \
317 fmt::enable_if_t<std::is_integral<T>::value, T> test_value() { in test_value()
322 fmt::enable_if_t<std::is_floating_point<T>::value, T> test_value() { in test_value()
353 fmt::wstring_view sref(str); in TEST()
357 CHECK_ARG_(wchar_t, sref, fmt::wstring_view(str)); in TEST()
370 fmt::basic_format_arg<fmt::format_context>::handle h) const { in operator ()()
371 struct test_buffer final : fmt::detail::buffer<char> { in operator ()()
373 test_buffer() : fmt::detail::buffer<char>(data, 0, 10) {} in operator ()()
376 fmt::format_parse_context parse_ctx(""); in operator ()()
377 fmt::format_context ctx{fmt::detail::buffer_appender<char>(buffer), in operator ()()
378 fmt::format_args()}; in operator ()()
388 mock_visitor<fmt::basic_format_arg<fmt::format_context>::handle>; in TEST()
391 fmt::visit_format_arg(v, make_arg<fmt::format_context>(test)); in TEST()
395 testing::StrictMock<mock_visitor<fmt::monostate>> visitor; in TEST()
397 fmt::basic_format_arg<fmt::format_context> arg; in TEST()
398 fmt::visit_format_arg(visitor, arg); in TEST()
402 fmt::dynamic_format_arg_store<fmt::format_context> store; in TEST()
406 EXPECT_EQ("42 and abc1 and 1.5", fmt::vformat("{} and {} and {}", store)); in TEST()
411 fmt::dynamic_format_arg_store<fmt::format_context> store; in TEST()
415 store.push_back(fmt::string_view{str}); in TEST()
418 std::string result = fmt::vformat("{} and {} and {}", store); in TEST()
440 fmt::dynamic_format_arg_store<fmt::format_context> store; in TEST()
448 std::string result = fmt::vformat("{} and {} and {}", store); in TEST()
453 fmt::dynamic_format_arg_store<fmt::format_context> store; in TEST()
454 store.push_back(fmt::arg("a1", 42)); in TEST()
455 EXPECT_EQ("42", fmt::vformat("{a1}", store)); in TEST()
459 fmt::dynamic_format_arg_store<fmt::format_context> store; in TEST()
461 store.push_back(fmt::arg("a1", str)); in TEST()
462 store.push_back(fmt::arg("a2", std::cref(str))); in TEST()
464 EXPECT_EQ("1234567890 and X234567890", fmt::vformat("{a1} and {a2}", store)); in TEST()
468 fmt::dynamic_format_arg_store<fmt::format_context> store; in TEST()
470 // Note: fmt::arg() constructs an object which holds a reference in TEST()
480 auto a1 = fmt::arg("a1_", a1_val); in TEST()
485 std::string result = fmt::vformat("{a1_} and {} and {} and {}", store); in TEST()
490 fmt::dynamic_format_arg_store<fmt::format_context> store; in TEST()
492 store.push_back(fmt::arg("c1", c)); in TEST()
494 store.push_back(fmt::arg("c2", c)); in TEST()
496 store.push_back(fmt::arg("c_ref", std::cref(c))); in TEST()
498 std::string result = fmt::vformat("{c1} and {c2} and {c_ref}", store); in TEST()
503 fmt::dynamic_format_arg_store<fmt::format_context> store; in TEST()
506 std::string result = fmt::vformat("{}", store); in TEST()
510 result = fmt::vformat("{} and {}", store); in TEST()
515 result = fmt::vformat("{}", store); in TEST()
520 fmt::dynamic_format_arg_store<fmt::format_context> store; in TEST()
523 store.push_back(fmt::arg("a1", 42)); in TEST()
524 std::string result = fmt::vformat("{a1} and {}", store); in TEST()
545 fmt::dynamic_format_arg_store<fmt::format_context> store; in TEST()
551 EXPECT_EQ(fmt::vformat("{}", store), "foo"); in TEST()
609 using fmt::has_formatter; in TEST()
610 using context = fmt::format_context; in TEST()
647 EXPECT_EQ(fmt::format("{}", convertible_to_int()), "foo"); in TEST()
648 EXPECT_EQ(fmt::format("{}", convertible_to_c_string()), "bar"); in TEST()
664 inline fmt::basic_string_view<Char> to_string_view(const my_string<Char>& s) in to_string_view()
679 struct derived_from_string_view : fmt::basic_string_view<Char> {};
683 EXPECT_TRUE(fmt::detail::is_string<TypeParam*>::value); in TYPED_TEST()
684 EXPECT_TRUE(fmt::detail::is_string<const TypeParam*>::value); in TYPED_TEST()
685 EXPECT_TRUE(fmt::detail::is_string<TypeParam[2]>::value); in TYPED_TEST()
686 EXPECT_TRUE(fmt::detail::is_string<const TypeParam[2]>::value); in TYPED_TEST()
687 EXPECT_TRUE(fmt::detail::is_string<std::basic_string<TypeParam>>::value); in TYPED_TEST()
688 EXPECT_TRUE(fmt::detail::is_string<fmt::basic_string_view<TypeParam>>::value); in TYPED_TEST()
690 fmt::detail::is_string<derived_from_string_view<TypeParam>>::value); in TYPED_TEST()
691 using string_view = fmt::detail::std_string_view<TypeParam>; in TYPED_TEST()
693 fmt::detail::is_string<string_view>::value); in TYPED_TEST()
694 EXPECT_TRUE(fmt::detail::is_string<my_ns::my_string<TypeParam>>::value); in TYPED_TEST()
695 EXPECT_FALSE(fmt::detail::is_string<my_ns::non_string>::value); in TYPED_TEST()
699 // This should work without including fmt/format.h. in TEST()
701 # error fmt/format.h must not be included in the core test in TEST()
703 EXPECT_EQ(fmt::format("{}", 42), "42"); in TEST()
707 // This should work without including fmt/format.h. in TEST()
709 # error fmt/format.h must not be included in the core test in TEST()
712 fmt::format_to(std::back_inserter(s), "{}", 42); in TEST()
719 fmt::detail::type type = in TEST()
720 fmt::detail::mapped_type_constant<my_string<char>, in TEST()
721 fmt::format_context>::value; in TEST()
722 EXPECT_EQ(type, fmt::detail::type::string_type); in TEST()
727 EXPECT_EQ(fmt::format(my_string<char>("{}"), 42), "42"); in TEST()
735 operator fmt::string_view() const { return "foo"; } in operator fmt::string_view()
739 EXPECT_EQ("foo", fmt::format("{}", implicitly_convertible_to_string_view())); in TEST()
745 explicit operator fmt::string_view() const { return "foo"; } in operator fmt::string_view()
749 EXPECT_EQ("foo", fmt::format("{}", explicitly_convertible_to_string_view())); in TEST()
759 fmt::format("{}", explicitly_convertible_to_std_string_view())); in TEST()
772 EXPECT_EQ("foo", fmt::format("{}", disabled_rvalue_conversion())); in TEST()