mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 10:47:35 +02:00
@ -1121,7 +1121,7 @@ using use_formatter =
|
|||||||
bool_constant<(std::is_class<T>::value || std::is_enum<T>::value ||
|
bool_constant<(std::is_class<T>::value || std::is_enum<T>::value ||
|
||||||
std::is_union<T>::value || std::is_array<T>::value) &&
|
std::is_union<T>::value || std::is_array<T>::value) &&
|
||||||
!has_to_string_view<T>::value && !is_named_arg<T>::value &&
|
!has_to_string_view<T>::value && !is_named_arg<T>::value &&
|
||||||
!use_format_as<T>::value && !use_format_as_member<T>::value>;
|
!use_format_as<T>::value && !use_format_as_member<U>::value>;
|
||||||
|
|
||||||
template <typename Char, typename T, typename U = remove_const_t<T>>
|
template <typename Char, typename T, typename U = remove_const_t<T>>
|
||||||
auto has_formatter_impl(T* p, buffered_context<Char>* ctx = nullptr)
|
auto has_formatter_impl(T* p, buffered_context<Char>* ctx = nullptr)
|
||||||
|
@ -13,13 +13,17 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "fmt/os.h" // fmt::system_category
|
#include "fmt/os.h" // fmt::system_category
|
||||||
#include "fmt/ranges.h"
|
|
||||||
#include "gtest-extra.h" // StartsWith
|
#include "gtest-extra.h" // StartsWith
|
||||||
|
|
||||||
#ifdef __cpp_lib_filesystem
|
#ifdef __cpp_lib_filesystem
|
||||||
TEST(std_test, path) {
|
TEST(std_test, path) {
|
||||||
using std::filesystem::path;
|
using std::filesystem::path;
|
||||||
EXPECT_EQ(fmt::format("{}", path("/usr/bin")), "/usr/bin");
|
EXPECT_EQ(fmt::format("{}", path("/usr/bin")), "/usr/bin");
|
||||||
|
|
||||||
|
// see #4303
|
||||||
|
const path p = "/usr/bin";
|
||||||
|
EXPECT_EQ(fmt::format("{}", p), "/usr/bin");
|
||||||
|
|
||||||
EXPECT_EQ(fmt::format("{:?}", path("/usr/bin")), "\"/usr/bin\"");
|
EXPECT_EQ(fmt::format("{:?}", path("/usr/bin")), "\"/usr/bin\"");
|
||||||
EXPECT_EQ(fmt::format("{:8}", path("foo")), "foo ");
|
EXPECT_EQ(fmt::format("{:8}", path("foo")), "foo ");
|
||||||
|
|
||||||
@ -44,6 +48,9 @@ TEST(std_test, path) {
|
|||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Intentionally delayed include to test #4303
|
||||||
|
#include "fmt/ranges.h"
|
||||||
|
|
||||||
// Test ambiguity problem described in #2954.
|
// Test ambiguity problem described in #2954.
|
||||||
TEST(ranges_std_test, format_vector_path) {
|
TEST(ranges_std_test, format_vector_path) {
|
||||||
auto p = std::filesystem::path("foo/bar.txt");
|
auto p = std::filesystem::path("foo/bar.txt");
|
||||||
|
Reference in New Issue
Block a user