diff --git a/libcxx/test/std/containers/container.adaptors/container.adaptors.format/parse.pass.cpp b/libcxx/test/std/containers/container.adaptors/container.adaptors.format/parse.pass.cpp --- a/libcxx/test/std/containers/container.adaptors/container.adaptors.format/parse.pass.cpp +++ b/libcxx/test/std/containers/container.adaptors/container.adaptors.format/parse.pass.cpp @@ -39,30 +39,30 @@ #define SV(S) MAKE_STRING_VIEW(CharT, S) template -constexpr void test_parse(StringViewT fmt) { +constexpr void test_parse(StringViewT fmt, std::size_t offset) { using CharT = typename StringViewT::value_type; auto parse_ctx = std::basic_format_parse_context(fmt); std::formatter formatter; static_assert(std::semiregular); std::same_as auto it = formatter.parse(parse_ctx); - assert(it == fmt.end() - (!fmt.empty() && fmt.back() == '}')); + assert(it == fmt.end() - offset); } template -constexpr void test_parse(StringViewT fmt) { - test_parse>(fmt); - test_parse>(fmt); - test_parse>(fmt); +constexpr void test_parse(StringViewT fmt, std::size_t offset) { + test_parse>(fmt, offset); + test_parse>(fmt, offset); + test_parse>(fmt, offset); } template constexpr void test_fmt() { - test_parse(SV("")); - test_parse(SV(":d")); + test_parse(SV(""), 0); + test_parse(SV(":d"), 0); - test_parse(SV("}")); - test_parse(SV(":d}")); + test_parse(SV("}"), 1); + test_parse(SV(":d}"), 1); } constexpr bool test() { diff --git a/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/parse.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/parse.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/parse.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/parse.pass.cpp @@ -36,23 +36,23 @@ #define SV(S) MAKE_STRING_VIEW(CharT, S) template -constexpr void test_parse(StringViewT fmt) { +constexpr void test_parse(StringViewT fmt, std::size_t offset) { using CharT = typename StringViewT::value_type; auto parse_ctx = std::basic_format_parse_context(fmt); std::formatter>::reference, CharT> formatter; static_assert(std::semiregular); std::same_as auto it = formatter.parse(parse_ctx); - assert(it == fmt.end() - (!fmt.empty() && fmt.back() == '}')); + assert(it == fmt.end() - offset); } template constexpr void test_fmt() { - test_parse(SV("")); - test_parse(SV("b")); + test_parse(SV(""), 0); + test_parse(SV("b"), 0); - test_parse(SV("}")); - test_parse(SV("b}")); + test_parse(SV("}"), 1); + test_parse(SV("b}"), 1); } constexpr bool test() { diff --git a/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/parse.pass.cpp b/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/parse.pass.cpp --- a/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/parse.pass.cpp +++ b/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/parse.pass.cpp @@ -35,23 +35,23 @@ #define SV(S) MAKE_STRING_VIEW(CharT, S) template -constexpr void test_parse(StringViewT fmt) { +constexpr void test_parse(StringViewT fmt, std::size_t offset) { using CharT = typename StringViewT::value_type; auto parse_ctx = std::basic_format_parse_context(fmt); std::formatter formatter; static_assert(std::semiregular); std::same_as auto it = formatter.parse(parse_ctx); - assert(it == fmt.end() - (!fmt.empty() && fmt.back() == '}')); + assert(it == fmt.end() - offset); } template constexpr void test_fmt() { - test_parse(SV("")); - test_parse(SV("1")); + test_parse(SV(""), 0); + test_parse(SV("1"), 0); - test_parse(SV("}")); - test_parse(SV("1}")); + test_parse(SV("}"), 1); + test_parse(SV("1}"), 1); } constexpr bool test() { diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.handle.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.handle.pass.cpp --- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.handle.pass.cpp +++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.handle.pass.cpp @@ -38,13 +38,13 @@ } }; -void test(std::string expected, std::string_view fmt, color arg) { +void test(std::string expected, std::string_view fmt, color arg, std::size_t offset) { auto parse_ctx = std::format_parse_context(fmt); std::formatter formatter; static_assert(std::semiregular); auto it = formatter.parse(parse_ctx); - assert(it == fmt.end() - (!fmt.empty() && fmt.back() == '}')); + assert(it == fmt.end() - offset); std::string result; auto out = std::back_inserter(result); @@ -64,9 +64,9 @@ std::string_view fmt{f}; assert(fmt.back() == '}' && "Pre-condition failure"); - test(expected, fmt, arg); + test(expected, fmt, arg, 1); fmt.remove_suffix(1); - test(expected, fmt, arg); + test(expected, fmt, arg, 0); } int main(int, char**) { diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.bool.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.bool.pass.cpp --- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.bool.pass.cpp +++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.bool.pass.cpp @@ -32,14 +32,14 @@ #define STR(S) MAKE_STRING(CharT, S) template -void test(StringT expected, StringViewT fmt, bool arg) { +void test(StringT expected, StringViewT fmt, bool arg, std::size_t offset) { using CharT = typename StringT::value_type; auto parse_ctx = std::basic_format_parse_context(fmt); std::formatter formatter; static_assert(std::semiregular); auto it = formatter.parse(parse_ctx); - assert(it == fmt.end() - (!fmt.empty() && fmt.back() == '}')); + assert(it == fmt.end() - offset); StringT result; auto out = std::back_inserter(result); @@ -61,9 +61,9 @@ std::basic_string_view fmt{f}; assert(fmt.back() == CharT('}') && "Pre-condition failure"); - test(expected, fmt, arg); + test(expected, fmt, arg, 1); fmt.remove_suffix(1); - test(expected, fmt, arg); + test(expected, fmt, arg, 0); } template diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.c_string.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.c_string.pass.cpp --- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.c_string.pass.cpp +++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.c_string.pass.cpp @@ -33,13 +33,13 @@ #define CSTR(S) MAKE_CSTRING(CharT, S) template -void test(StringT expected, StringViewT fmt, const CharT* a) { +void test(StringT expected, StringViewT fmt, const CharT* a, std::size_t offset) { auto parse_ctx = std::basic_format_parse_context(fmt); std::formatter formatter; static_assert(std::semiregular); auto it = formatter.parse(parse_ctx); - assert(it == fmt.end() - (!fmt.empty() && fmt.back() == '}')); + assert(it == fmt.end() - offset); StringT result; auto out = std::back_inserter(result); @@ -61,9 +61,9 @@ std::basic_string_view fmt{f}; assert(fmt.back() == CharT('}') && "Pre-condition failure"); - test(expected, fmt, arg); + test(expected, fmt, arg, 1); fmt.remove_suffix(1); - test(expected, fmt, arg); + test(expected, fmt, arg, 0); } #if TEST_STD_VER > 20 diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.pass.cpp --- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.pass.cpp +++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.pass.cpp @@ -33,14 +33,14 @@ #define SV(S) MAKE_STRING_VIEW(CharT, S) template -void test(StringT expected, StringViewT fmt, ArgumentT arg) { +void test(StringT expected, StringViewT fmt, ArgumentT arg, std::size_t offset) { using CharT = typename StringT::value_type; auto parse_ctx = std::basic_format_parse_context(fmt); std::formatter formatter; static_assert(std::semiregular); auto it = formatter.parse(parse_ctx); - assert(it == fmt.end() - (!fmt.empty() && fmt.back() == '}')); + assert(it == fmt.end() - offset); StringT result; auto out = std::back_inserter(result); @@ -62,9 +62,9 @@ std::basic_string_view fmt{f}; assert(fmt.back() == CharT('}') && "Pre-condition failure"); - test(expected, fmt, arg); + test(expected, fmt, arg, 1); fmt.remove_suffix(1); - test(expected, fmt, arg); + test(expected, fmt, arg, 0); } #if TEST_STD_VER > 20 diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char_array.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char_array.pass.cpp --- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char_array.pass.cpp +++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char_array.pass.cpp @@ -44,14 +44,15 @@ static const std::size_t size = N - 1; template - void test(const std::basic_string& expected, const std::basic_string_view& fmt) const { + void + test(const std::basic_string& expected, const std::basic_string_view& fmt, std::size_t offset) const { using Str = CharT[size]; std::basic_format_parse_context parse_ctx{fmt}; std::formatter formatter; static_assert(std::semiregular); auto it = formatter.parse(parse_ctx); - assert(it == fmt.end() - (!fmt.empty() && fmt.back() == '}')); + assert(it == fmt.end() - offset); std::basic_string result; auto out = std::back_inserter(result); @@ -76,9 +77,9 @@ std::basic_string_view fmt{f}; assert(fmt.back() == CharT('}') && "Pre-condition failure"); - test(expected, fmt); + test(expected, fmt, 1); fmt.remove_suffix(1); - test(expected, fmt); + test(expected, fmt, 0); } }; diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.floating_point.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.floating_point.pass.cpp --- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.floating_point.pass.cpp +++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.floating_point.pass.cpp @@ -44,13 +44,13 @@ #define STR(S) MAKE_STRING(CharT, S) template -void test(std::basic_string_view fmt, ArithmeticT arg, std::basic_string expected) { +void test(std::basic_string_view fmt, ArithmeticT arg, std::basic_string expected, std::size_t offset) { auto parse_ctx = std::basic_format_parse_context(fmt); std::formatter formatter; static_assert(std::semiregular); auto it = formatter.parse(parse_ctx); - assert(it == fmt.end() - (!fmt.empty() && fmt.back() == '}')); + assert(it == fmt.end() - offset); std::basic_string result; auto out = std::back_inserter(result); @@ -78,9 +78,9 @@ std::basic_string_view fmt{f}; assert(fmt.back() == CharT('}') && "Pre-condition failure"); - test(fmt, arg, expected); + test(fmt, arg, expected, 1); fmt.remove_suffix(1); - test(fmt, arg, expected); + test(fmt, arg, expected, 0); } template diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.pointer.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.pointer.pass.cpp --- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.pointer.pass.cpp +++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.pointer.pass.cpp @@ -37,14 +37,14 @@ #define STR(S) MAKE_STRING(CharT, S) template -void test(StringT expected, StringViewT fmt, PointerT arg) { +void test(StringT expected, StringViewT fmt, PointerT arg, std::size_t offset) { using CharT = typename StringT::value_type; auto parse_ctx = std::basic_format_parse_context(fmt); std::formatter formatter; static_assert(std::semiregular); auto it = formatter.parse(parse_ctx); - assert(it == fmt.end() - (!fmt.empty() && fmt.back() == '}')); + assert(it == fmt.end() - offset); StringT result; auto out = std::back_inserter(result); @@ -74,9 +74,9 @@ std::basic_string_view fmt{f}; assert(fmt.back() == CharT('}') && "Pre-condition failure"); - test(expected, fmt, arg); + test(expected, fmt, arg, 1); fmt.remove_suffix(1); - test(expected, fmt, arg); + test(expected, fmt, arg, 0); } template diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.signed_integral.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.signed_integral.pass.cpp --- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.signed_integral.pass.cpp +++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.signed_integral.pass.cpp @@ -39,14 +39,14 @@ #define STR(S) MAKE_STRING(CharT, S) template -void test(StringT expected, StringViewT fmt, ArithmeticT arg) { +void test(StringT expected, StringViewT fmt, ArithmeticT arg, std::size_t offset) { using CharT = typename StringT::value_type; auto parse_ctx = std::basic_format_parse_context(fmt); std::formatter formatter; static_assert(std::semiregular); auto it = formatter.parse(parse_ctx); - assert(it == fmt.end() - (!fmt.empty() && fmt.back() == '}')); + assert(it == fmt.end() - offset); StringT result; auto out = std::back_inserter(result); @@ -68,9 +68,9 @@ std::basic_string_view fmt{f}; assert(fmt.back() == CharT('}') && "Pre-condition failure"); - test(expected, fmt, arg); + test(expected, fmt, arg, 1); fmt.remove_suffix(1); - test(expected, fmt, arg); + test(expected, fmt, arg, 0); } template diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.string.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.string.pass.cpp --- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.string.pass.cpp +++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.string.pass.cpp @@ -35,7 +35,7 @@ #define CSTR(S) MAKE_CSTRING(CharT, S) template -void test(StringT expected, StringViewT fmt, StringT a) { +void test(StringT expected, StringViewT fmt, StringT a, std::size_t offset) { static_assert( std::same_as::value_type> && @@ -47,7 +47,7 @@ static_assert(std::semiregular); auto it = formatter.parse(parse_ctx); - assert(it == fmt.end() - (!fmt.empty() && fmt.back() == '}')); + assert(it == fmt.end() - offset); StringT result; auto out = std::back_inserter(result); @@ -70,9 +70,9 @@ std::basic_string_view fmt{f}; assert(fmt.back() == CharT('}') && "Pre-condition failure"); - test(expected, fmt, arg); + test(expected, fmt, arg, 1); fmt.remove_suffix(1); - test(expected, fmt, arg); + test(expected, fmt, arg, 0); } #if TEST_STD_VER > 20 diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.unsigned_integral.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.unsigned_integral.pass.cpp --- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.unsigned_integral.pass.cpp +++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.unsigned_integral.pass.cpp @@ -39,14 +39,14 @@ #define STR(S) MAKE_STRING(CharT, S) template -void test(StringT expected, StringViewT fmt, ArithmeticT arg) { +void test(StringT expected, StringViewT fmt, ArithmeticT arg, std::size_t offset) { using CharT = typename StringT::value_type; auto parse_ctx = std::basic_format_parse_context(fmt); std::formatter formatter; static_assert(std::semiregular); auto it = formatter.parse(parse_ctx); - assert(it == fmt.end() - (!fmt.empty() && fmt.back() == '}')); + assert(it == fmt.end() - offset); StringT result; auto out = std::back_inserter(result); @@ -68,9 +68,9 @@ std::basic_string_view fmt{f}; assert(fmt.back() == CharT('}') && "Pre-condition failure"); - test(expected, fmt, arg); + test(expected, fmt, arg, 1); fmt.remove_suffix(1); - test(expected, fmt, arg); + test(expected, fmt, arg, 0); } template diff --git a/libcxx/test/std/utilities/format/format.range/format.range.fmtdef/parse.pass.cpp b/libcxx/test/std/utilities/format/format.range/format.range.fmtdef/parse.pass.cpp --- a/libcxx/test/std/utilities/format/format.range/format.range.fmtdef/parse.pass.cpp +++ b/libcxx/test/std/utilities/format/format.range/format.range.fmtdef/parse.pass.cpp @@ -32,23 +32,23 @@ #define SV(S) MAKE_STRING_VIEW(CharT, S) template -constexpr void test_parse(StringViewT fmt) { +constexpr void test_parse(StringViewT fmt, std::size_t offset) { using CharT = typename StringViewT::value_type; auto parse_ctx = std::basic_format_parse_context(fmt); std::formatter, CharT> formatter; static_assert(std::semiregular); std::same_as auto it = formatter.parse(parse_ctx); - assert(it == fmt.end() - (!fmt.empty() && fmt.back() == '}')); + assert(it == fmt.end() - offset); } template constexpr void test_fmt() { - test_parse(SV("")); - test_parse(SV(":5")); + test_parse(SV(""), 0); + test_parse(SV(":5"), 0); - test_parse(SV("}")); - test_parse(SV(":5}")); + test_parse(SV("}"), 1); + test_parse(SV(":5}"), 1); } constexpr bool test() { diff --git a/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/parse.pass.cpp b/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/parse.pass.cpp --- a/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/parse.pass.cpp +++ b/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/parse.pass.cpp @@ -35,23 +35,23 @@ #define SV(S) MAKE_STRING_VIEW(CharT, S) template -constexpr void test_parse(StringViewT fmt) { +constexpr void test_parse(StringViewT fmt, std::size_t offset) { using CharT = typename StringViewT::value_type; auto parse_ctx = std::basic_format_parse_context(fmt); std::formatter, CharT> formatter; static_assert(std::semiregular); std::same_as auto it = formatter.parse(parse_ctx); - assert(it == fmt.end() - (!fmt.empty() && fmt.back() == '}')); + assert(it == fmt.end() - offset); } template constexpr void test_fmt() { - test_parse(SV("")); - test_parse(SV(":5")); + test_parse(SV(""), 0); + test_parse(SV(":5"), 0); - test_parse(SV("}")); - test_parse(SV(":5}")); + test_parse(SV("}"), 1); + test_parse(SV(":5}"), 1); } constexpr bool test() { diff --git a/libcxx/test/std/utilities/format/format.range/format.range.fmtset/parse.pass.cpp b/libcxx/test/std/utilities/format/format.range/format.range.fmtset/parse.pass.cpp --- a/libcxx/test/std/utilities/format/format.range/format.range.fmtset/parse.pass.cpp +++ b/libcxx/test/std/utilities/format/format.range/format.range.fmtset/parse.pass.cpp @@ -35,23 +35,23 @@ #define SV(S) MAKE_STRING_VIEW(CharT, S) template -constexpr void test_parse(StringViewT fmt) { +constexpr void test_parse(StringViewT fmt, std::size_t offset) { using CharT = typename StringViewT::value_type; auto parse_ctx = std::basic_format_parse_context(fmt); std::formatter, CharT> formatter; static_assert(std::semiregular); std::same_as auto it = formatter.parse(parse_ctx); - assert(it == fmt.end() - (!fmt.empty() && fmt.back() == '}')); + assert(it == fmt.end() - offset); } template constexpr void test_fmt() { - test_parse(SV("")); - test_parse(SV(":5")); + test_parse(SV(""), 0); + test_parse(SV(":5"), 0); - test_parse(SV("}")); - test_parse(SV(":5}")); + test_parse(SV("}"), 1); + test_parse(SV(":5}"), 1); } constexpr bool test() { diff --git a/libcxx/test/std/utilities/format/format.range/format.range.fmtstr/parse.pass.cpp b/libcxx/test/std/utilities/format/format.range/format.range.fmtstr/parse.pass.cpp --- a/libcxx/test/std/utilities/format/format.range/format.range.fmtstr/parse.pass.cpp +++ b/libcxx/test/std/utilities/format/format.range/format.range.fmtstr/parse.pass.cpp @@ -33,27 +33,27 @@ #include "test_macros.h" template -constexpr void test_parse(StringViewT fmt) { +constexpr void test_parse(StringViewT fmt, std::size_t offset) { using CharT = typename StringViewT::value_type; auto parse_ctx = std::basic_format_parse_context(fmt); FormatterT formatter; static_assert(std::semiregular); std::same_as auto it = formatter.parse(parse_ctx); - assert(it == fmt.end() - (!fmt.empty() && fmt.back() == '}')); + assert(it == fmt.end() - offset); } template -constexpr void test_formatters(StringViewT fmt) { +constexpr void test_formatters(StringViewT fmt, std::size_t offset) { using CharT = typename StringViewT::value_type; - test_parse>, CharT>>(fmt); - test_parse>, CharT>>(fmt); + test_parse>, CharT>>(fmt, offset); + test_parse>, CharT>>(fmt, offset); } template constexpr void test_char_type() { - test_formatters(SV("")); - test_formatters(SV("}")); + test_formatters(SV(""), 0); + test_formatters(SV("}"), 1); } constexpr bool test() { diff --git a/libcxx/test/std/utilities/format/format.range/format.range.formatter/parse.pass.cpp b/libcxx/test/std/utilities/format/format.range/format.range.formatter/parse.pass.cpp --- a/libcxx/test/std/utilities/format/format.range/format.range.formatter/parse.pass.cpp +++ b/libcxx/test/std/utilities/format/format.range/format.range.formatter/parse.pass.cpp @@ -35,23 +35,23 @@ #define SV(S) MAKE_STRING_VIEW(CharT, S) template -constexpr void test_parse(StringViewT fmt) { +constexpr void test_parse(StringViewT fmt, std::size_t offset) { using CharT = typename StringViewT::value_type; auto parse_ctx = std::basic_format_parse_context(fmt); std::range_formatter formatter; static_assert(std::semiregular); std::same_as auto it = formatter.parse(parse_ctx); - assert(it == fmt.end() - (!fmt.empty() && fmt.back() == '}')); + assert(it == fmt.end() - offset); } template constexpr void test_fmt() { - test_parse(SV("")); - test_parse(SV(":d")); + test_parse(SV(""), 0); + test_parse(SV(":d"), 0); - test_parse(SV("}")); - test_parse(SV(":d}")); + test_parse(SV("}"), 1); + test_parse(SV(":d}"), 1); } constexpr bool test() { diff --git a/libcxx/test/std/utilities/format/format.tuple/parse.pass.cpp b/libcxx/test/std/utilities/format/format.tuple/parse.pass.cpp --- a/libcxx/test/std/utilities/format/format.tuple/parse.pass.cpp +++ b/libcxx/test/std/utilities/format/format.tuple/parse.pass.cpp @@ -36,23 +36,23 @@ #define SV(S) MAKE_STRING_VIEW(CharT, S) template -constexpr void test(StringViewT fmt) { +constexpr void test(StringViewT fmt, std::size_t offset) { using CharT = typename StringViewT::value_type; auto parse_ctx = std::basic_format_parse_context(fmt); std::formatter formatter; static_assert(std::semiregular); std::same_as auto it = formatter.parse(parse_ctx); - assert(it == fmt.end() - (!fmt.empty() && fmt.back() == '}')); + assert(it == fmt.end() - offset); } template constexpr void test() { - test(SV("")); - test(SV("42")); + test(SV(""), 0); + test(SV("42"), 0); - test(SV("}")); - test(SV("42}")); + test(SV("}"), 1); + test(SV("42}"), 1); } template