mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-29 18:27:40 +02:00
Exclude recursive ranges from the formatter specialization for ranges (#2974)
* 2954: Add test case * Eliminate extra-test and merge it into existing std-test instead. Add conditionals for filesystem::path testing that does not run into the ambiguity problem. * #2968: Introduce additional compile-time predicate to detect recursive ranges and reject them in formatter specialization for ranges. In addition, introduce additional wrapper traits for the individual logical operands of the complete range constraints * #2968: Eliminate preprocessor condition that enables the formatter specialization for std::filesystem::path * #2968: Eliminate preprocessor condition that enables the test for the formatter specialization for std::filesystem::path * Use own bool_constant, which is available for all C++ versions * Reintroduce previous workaround but restrict to VS 2015 for now * Comma fix * - Rename is_not_recursive_range to is_nonrecursive_range and add comment that explains it being depending on is_range being true - Merge has_fallback_formatter_delayed into is_formattable_delayed and add comment that explains it being depending on is_not_recursive_range being true - Replace disjunction in formatter specialization by has_fallback_formatter_delayed - Get rid of unneeded detail:: prefixes within namespace detail
This commit is contained in:
@ -14,10 +14,7 @@
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
TEST(std_test, path) {
|
||||
// Test ambiguity problem described in #2954. We need to exclude compilers
|
||||
// where the ambiguity problem cannot be solved for now.
|
||||
#if defined(__cpp_lib_filesystem) && \
|
||||
(!FMT_MSC_VERSION || FMT_MSC_VERSION >= 1920)
|
||||
#ifdef __cpp_lib_filesystem
|
||||
EXPECT_EQ(fmt::format("{:8}", std::filesystem::path("foo")), "\"foo\" ");
|
||||
EXPECT_EQ(fmt::format("{}", std::filesystem::path("foo\"bar.txt")),
|
||||
"\"foo\\\"bar.txt\"");
|
||||
@ -37,10 +34,8 @@ TEST(std_test, path) {
|
||||
}
|
||||
|
||||
TEST(ranges_std_test, format_vector_path) {
|
||||
// Test ambiguity problem described in #2954. We need to exclude compilers
|
||||
// where the ambiguity problem cannot be solved for now.
|
||||
#if defined(__cpp_lib_filesystem) && \
|
||||
(!FMT_MSC_VERSION || FMT_MSC_VERSION >= 1920)
|
||||
// Test ambiguity problem described in #2954.
|
||||
#ifdef __cpp_lib_filesystem
|
||||
auto p = std::filesystem::path("foo/bar.txt");
|
||||
auto c = std::vector<std::string>{"abc", "def"};
|
||||
EXPECT_EQ(fmt::format("path={}, range={}", p, c),
|
||||
|
Reference in New Issue
Block a user