diff --git a/include/fmt/core.h b/include/fmt/core.h index 4e72d15d..3d4064b1 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -665,6 +665,7 @@ struct formatter { formatter() = delete; }; +// DEPRECATED! // Specifies if T has an enabled formatter specialization. A type can be // formattable even if it doesn't have a formatter e.g. via a conversion. template @@ -1510,6 +1511,7 @@ template class basic_format_context { using parse_context_type = basic_format_parse_context; template using formatter_type = formatter; + basic_format_context(basic_format_context&&) = default; basic_format_context(const basic_format_context&) = delete; void operator=(const basic_format_context&) = delete; /** diff --git a/test/core-test.cc b/test/core-test.cc index a20c0620..d3fdf536 100644 --- a/test/core-test.cc +++ b/test/core-test.cc @@ -5,6 +5,12 @@ // // For the license information refer to format.h. +// clang-format off +#include "test-assert.h" +// clang-format on + +#include "fmt/core.h" + #include #include #include @@ -16,50 +22,57 @@ #include #include "gmock.h" -#include "test-assert.h" -// Check if fmt/core.h compiles with windows.h included before it. -#ifdef _WIN32 -# include -#endif - -#include "fmt/core.h" #if defined(FMT_COMPILE_TIME_CHECKS) && FMT_COMPILE_TIME_CHECKS # include "fmt/format.h" #endif -#undef min -#undef max - -using fmt::basic_format_arg; using fmt::string_view; using fmt::detail::buffer; -using fmt::detail::make_arg; -using fmt::detail::value; using testing::_; using testing::Invoke; using testing::Return; -using testing::StrictMock; -struct test_struct {}; +TEST(string_view_test, value_type) { + static_assert(std::is_same::value, ""); +} -FMT_BEGIN_NAMESPACE -template struct formatter { - template - auto parse(ParseContext& ctx) -> decltype(ctx.begin()) { - return ctx.begin(); +TEST(string_view_test, length) { + // Test that string_view::size() returns string length, not buffer size. + char str[100] = "some string"; + EXPECT_EQ(std::strlen(str), string_view(str).size()); + EXPECT_LT(std::strlen(str), sizeof(str)); +} + +// Check string_view's comparison operator. +template