diff --git a/libcxx/include/__format/parser_std_format_spec.h b/libcxx/include/__format/parser_std_format_spec.h --- a/libcxx/include/__format/parser_std_format_spec.h +++ b/libcxx/include/__format/parser_std_format_spec.h @@ -214,7 +214,7 @@ __format::__parse_arg_id(__begin, __end, __parse_ctx); if (__r.__ptr == __end || *__r.__ptr != _CharT('}')) - __throw_format_error("A format-spec arg-id should terminate at a '}'"); + __throw_format_error("Invalid arg-id"); ++__r.__ptr; return __r; diff --git a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_bool.pass.cpp b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_bool.pass.cpp --- a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_bool.pass.cpp +++ b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_bool.pass.cpp @@ -160,19 +160,14 @@ test_exception>("End of input while parsing format-spec arg-id", CSTR("{")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR("{0")); + test_exception>("Invalid arg-id", CSTR("{0")); test_exception>( "The arg-id of the format-spec starts with an invalid character", CSTR("{a")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR("{1")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR("{9")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR("{9:")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR("{9a")); + test_exception>("Invalid arg-id", CSTR("{1")); + test_exception>("Invalid arg-id", CSTR("{9")); + test_exception>("Invalid arg-id", CSTR("{9:")); + test_exception>("Invalid arg-id", CSTR("{9a")); static_assert(std::__format::__number_max == 2'147'483'647, "Update the assert and the test."); diff --git a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_char.pass.cpp b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_char.pass.cpp --- a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_char.pass.cpp +++ b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_char.pass.cpp @@ -169,19 +169,14 @@ test_exception>("End of input while parsing format-spec arg-id", CSTR("{")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR("{0")); + test_exception>("Invalid arg-id", CSTR("{0")); test_exception>( "The arg-id of the format-spec starts with an invalid character", CSTR("{a")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR("{1")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR("{9")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR("{9:")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR("{9a")); + test_exception>("Invalid arg-id", CSTR("{1")); + test_exception>("Invalid arg-id", CSTR("{9")); + test_exception>("Invalid arg-id", CSTR("{9:")); + test_exception>("Invalid arg-id", CSTR("{9a")); static_assert(std::__format::__number_max == 2'147'483'647, "Update the assert and the test."); diff --git a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_integer.pass.cpp b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_integer.pass.cpp --- a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_integer.pass.cpp +++ b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_integer.pass.cpp @@ -209,19 +209,14 @@ test_exception>("End of input while parsing format-spec arg-id", CSTR("{")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR("{0")); + test_exception>("Invalid arg-id", CSTR("{0")); test_exception>( "The arg-id of the format-spec starts with an invalid character", CSTR("{a")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR("{1")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR("{9")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR("{9:")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR("{9a")); + test_exception>("Invalid arg-id", CSTR("{1")); + test_exception>("Invalid arg-id", CSTR("{9")); + test_exception>("Invalid arg-id", CSTR("{9:")); + test_exception>("Invalid arg-id", CSTR("{9a")); static_assert(std::__format::__number_max == 2'147'483'647, "Update the assert and the test."); diff --git a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_string.pass.cpp b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_string.pass.cpp --- a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_string.pass.cpp +++ b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_string.pass.cpp @@ -164,19 +164,14 @@ test_exception>("End of input while parsing format-spec arg-id", CSTR("{")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR("{0")); + test_exception>("Invalid arg-id", CSTR("{0")); test_exception>( "The arg-id of the format-spec starts with an invalid character", CSTR("{a")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR("{1")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR("{9")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR("{9:")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR("{9a")); + test_exception>("Invalid arg-id", CSTR("{1")); + test_exception>("Invalid arg-id", CSTR("{9")); + test_exception>("Invalid arg-id", CSTR("{9:")); + test_exception>("Invalid arg-id", CSTR("{9a")); static_assert(std::__format::__number_max == 2'147'483'647, "Update the assert and the test."); @@ -226,19 +221,14 @@ test_exception>("End of input while parsing format-spec arg-id", CSTR(".{")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR(".{0")); + test_exception>("Invalid arg-id", CSTR(".{0")); test_exception>( "The arg-id of the format-spec starts with an invalid character", CSTR(".{a")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR(".{1")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR(".{9")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR(".{9:")); - test_exception>( - "A format-spec arg-id should terminate at a '}'", CSTR(".{9a")); + test_exception>("Invalid arg-id", CSTR(".{1")); + test_exception>("Invalid arg-id", CSTR(".{9")); + test_exception>("Invalid arg-id", CSTR(".{9:")); + test_exception>("Invalid arg-id", CSTR(".{9a")); static_assert(std::__format::__number_max == 2'147'483'647, "Update the assert and the test."); diff --git a/libcxx/test/std/utilities/format/format.functions/format_tests.h b/libcxx/test/std/utilities/format/format.functions/format_tests.h --- a/libcxx/test/std/utilities/format/format.functions/format_tests.h +++ b/libcxx/test/std/utilities/format/format.functions/format_tests.h @@ -176,9 +176,7 @@ "Using automatic argument numbering in manual argument numbering mode", STR("hello {0:{}}"), world, 1); // Arg-id may not have leading zeros. - check_exception( - "A format-spec arg-id should terminate at a '}'", - STR("hello {0:{01}}"), world, 1); + check_exception("Invalid arg-id", STR("hello {0:{01}}"), world, 1); // *** precision *** #if _LIBCPP_VERSION @@ -214,9 +212,7 @@ "Using automatic argument numbering in manual argument numbering mode", STR("hello {0:.{}}"), world, 1); // Arg-id may not have leading zeros. - check_exception( - "A format-spec arg-id should terminate at a '}'", - STR("hello {0:.{01}}"), world, 1); + check_exception("Invalid arg-id", STR("hello {0:.{01}}"), world, 1); // *** locale-specific form *** check_exception("The format-spec should consume the input or end with a '}'",