From a0ffeccc707679d50cd8d4fba0e6f20a3450d474 Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Sun, 4 Jun 2023 21:32:10 +0200 Subject: [libc++][format] Improves run-time diagnostics. After parsing a std-format-spec it's validated, depending on the type used some format options are not allowed. This improves the error messages in the exceptions thrown upon failure. Depends on D155364 Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D155366 --- libcxx/include/__format/formatter_bool.h | 2 +- libcxx/include/__format/formatter_char.h | 2 +- libcxx/include/__format/formatter_floating_point.h | 2 +- libcxx/include/__format/formatter_integer.h | 2 +- libcxx/include/__format/formatter_pointer.h | 2 +- libcxx/include/__format/parser_std_format_spec.h | 152 +++++++++++++++++---- .../format.functions.tests.h | 56 ++++---- .../vector.bool.fmt/format.functions.tests.h | 14 +- .../format/format.functions/fill.unicode.pass.cpp | 2 +- .../format/format.functions/format_tests.h | 138 ++++++++++--------- .../format.range.fmtset/format.functions.tests.h | 80 +++++------ .../format.range.fmtstr/format.functions.tests.h | 28 ++-- .../format.functions.tests.h | 52 +++---- 13 files changed, 318 insertions(+), 214 deletions(-) (limited to 'libcxx') diff --git a/libcxx/include/__format/formatter_bool.h b/libcxx/include/__format/formatter_bool.h index ad50f04..3c8ae95f 100644 --- a/libcxx/include/__format/formatter_bool.h +++ b/libcxx/include/__format/formatter_bool.h @@ -39,7 +39,7 @@ public: template _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) { typename _ParseContext::iterator __result = __parser_.__parse(__ctx, __format_spec::__fields_integral); - __format_spec::__process_parsed_bool(__parser_); + __format_spec::__process_parsed_bool(__parser_, "a bool"); return __result; } diff --git a/libcxx/include/__format/formatter_char.h b/libcxx/include/__format/formatter_char.h index 8b1b357..d6e61e8 100644 --- a/libcxx/include/__format/formatter_char.h +++ b/libcxx/include/__format/formatter_char.h @@ -37,7 +37,7 @@ public: template _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) { typename _ParseContext::iterator __result = __parser_.__parse(__ctx, __format_spec::__fields_integral); - __format_spec::__process_parsed_char(__parser_); + __format_spec::__process_parsed_char(__parser_, "a character"); return __result; } diff --git a/libcxx/include/__format/formatter_floating_point.h b/libcxx/include/__format/formatter_floating_point.h index e01d7b8..fbb8aa9 100644 --- a/libcxx/include/__format/formatter_floating_point.h +++ b/libcxx/include/__format/formatter_floating_point.h @@ -762,7 +762,7 @@ public: template _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) { typename _ParseContext::iterator __result = __parser_.__parse(__ctx, __format_spec::__fields_floating_point); - __format_spec::__process_parsed_floating_point(__parser_); + __format_spec::__process_parsed_floating_point(__parser_, "a floating-point"); return __result; } diff --git a/libcxx/include/__format/formatter_integer.h b/libcxx/include/__format/formatter_integer.h index dca3cb3..5590bff 100644 --- a/libcxx/include/__format/formatter_integer.h +++ b/libcxx/include/__format/formatter_integer.h @@ -37,7 +37,7 @@ public: template _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) { typename _ParseContext::iterator __result = __parser_.__parse(__ctx, __format_spec::__fields_integral); - __format_spec::__process_parsed_integer(__parser_); + __format_spec::__process_parsed_integer(__parser_, "an integer"); return __result; } diff --git a/libcxx/include/__format/formatter_pointer.h b/libcxx/include/__format/formatter_pointer.h index 18aaee1..a221261 100644 --- a/libcxx/include/__format/formatter_pointer.h +++ b/libcxx/include/__format/formatter_pointer.h @@ -35,7 +35,7 @@ public: template _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) { typename _ParseContext::iterator __result = __parser_.__parse(__ctx, __format_spec::__fields_pointer); - __format_spec::__process_display_type_pointer(__parser_.__type_); + __format_spec::__process_display_type_pointer(__parser_.__type_, "a pointer"); return __result; } diff --git a/libcxx/include/__format/parser_std_format_spec.h b/libcxx/include/__format/parser_std_format_spec.h index 29cce4c..5147b5e 100644 --- a/libcxx/include/__format/parser_std_format_spec.h +++ b/libcxx/include/__format/parser_std_format_spec.h @@ -36,6 +36,7 @@ #include <__type_traits/is_trivially_copyable.h> #include <__variant/monostate.h> #include +#include #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -51,6 +52,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace __format_spec { +_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void +__throw_invalid_option_format_error(const char* __id, const char* __option) { + std::__throw_format_error( + (string("The format specifier for ") + __id + " does not allow the " + __option + " option").c_str()); +} + +_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __throw_invalid_type_format_error(const char* __id) { + std::__throw_format_error( + (string("The type option contains an invalid value for ") + __id + " formatting argument").c_str()); +} + template _LIBCPP_HIDE_FROM_ABI constexpr __format::__parse_number_result<_Iterator> __parse_arg_id(_Iterator __begin, _Iterator __end, _ParseContext& __ctx) { @@ -186,7 +198,7 @@ enum class _LIBCPP_ENUM_VIS __sign : uint8_t { }; enum class _LIBCPP_ENUM_VIS __type : uint8_t { - __default, + __default = 0, __string, __binary_lower_case, __binary_upper_case, @@ -208,6 +220,25 @@ enum class _LIBCPP_ENUM_VIS __type : uint8_t { __debug }; +_LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __create_type_mask(__type __t) { + uint32_t __shift = static_cast(__t); + if (__shift == 0) + return 1; + + if (__shift > 31) + std::__throw_format_error("The type does not fit in the mask"); + + return 1 << __shift; +} + +inline constexpr uint32_t __type_mask_integer = + __create_type_mask(__type::__binary_lower_case) | // + __create_type_mask(__type::__binary_upper_case) | // + __create_type_mask(__type::__decimal) | // + __create_type_mask(__type::__octal) | // + __create_type_mask(__type::__hexadecimal_lower_case) | // + __create_type_mask(__type::__hexadecimal_upper_case); + struct __std { __alignment __alignment_ : 3; __sign __sign_ : 2; @@ -383,11 +414,86 @@ public: return __begin; if (__begin != __end && *__begin != _CharT('}')) - std::__throw_format_error("The format-spec should consume the input or end with a '}'"); + std::__throw_format_error("The format specifier should consume the input or end with a '}'"); return __begin; } + // Validates the selected the parsed data. + // + // The valid fields in the parser may depend on the display type + // selected. But the type is the last optional field, so by the time + // it's known an option can't be used, it already has been parsed. + // This does the validation again. + // + // For example an integral may have a sign, zero-padding, or alternate + // form when the type option is not 'c'. So the generic approach is: + // + // typename _ParseContext::iterator __result = __parser_.__parse(__ctx, __format_spec::__fields_integral); + // if (__parser.__type_ == __format_spec::__type::__char) { + // __parser.__validate((__format_spec::__fields_bool, "an integer"); + // ... // more char adjustments + // } else { + // ... // validate an integral type. + // } + // + // For some types all valid options need a second validation run, like + // boolean types. + // + // Depending on whether the validation is done at compile-time or + // run-time the error differs + // - run-time the exception is thrown and contains the type of field + // being validated. + // - at compile-time the line with `std::__throw_format_error` is shown + // in the output. In that case it's important for the error to be on one + // line. + // Note future versions of C++ may allow better compile-time error + // reporting. + _LIBCPP_HIDE_FROM_ABI constexpr void + __validate(__fields __fields, const char* __id, uint32_t __type_mask = -1) const { + if (!__fields.__sign_ && __sign_ != __sign::__default) { + if (std::is_constant_evaluated()) + std::__throw_format_error("The format specifier does not allow the sign option"); + else + __format_spec::__throw_invalid_option_format_error(__id, "sign"); + } + + if (!__fields.__alternate_form_ && __alternate_form_) { + if (std::is_constant_evaluated()) + std::__throw_format_error("The format specifier does not allow the alternate form option"); + else + __format_spec::__throw_invalid_option_format_error(__id, "alternate form"); + } + + if (!__fields.__zero_padding_ && __alignment_ == __alignment::__zero_padding) { + if (std::is_constant_evaluated()) + std::__throw_format_error("The format specifier does not allow the zero-padding option"); + else + __format_spec::__throw_invalid_option_format_error(__id, "zero-padding"); + } + + if (!__fields.__precision_ && __precision_ != -1) { // Works both when the precision has a value or an arg-id. + if (std::is_constant_evaluated()) + std::__throw_format_error("The format specifier does not allow the precision option"); + else + __format_spec::__throw_invalid_option_format_error(__id, "precision"); + } + + if (!__fields.__locale_specific_form_ && __locale_specific_form_) { + if (std::is_constant_evaluated()) + std::__throw_format_error("The format specifier does not allow the locale-specific form option"); + else + __format_spec::__throw_invalid_option_format_error(__id, "locale-specific form"); + } + + if ((__create_type_mask(__type_) & __type_mask) == 0) { + if (std::is_constant_evaluated()) + std::__throw_format_error("The format specifier uses an invalid value for the type option"); + else + __format_spec::__throw_invalid_type_format_error(__id); + } + } + /// \returns the `__parsed_specifications` with the resolved dynamic sizes.. _LIBCPP_HIDE_FROM_ABI __parsed_specifications<_CharT> __get_parsed_std_specifications(auto& __ctx) const { @@ -788,31 +894,23 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __process_display_type_string(__format_spec } template -_LIBCPP_HIDE_FROM_ABI constexpr void __process_display_type_bool_string(__parser<_CharT>& __parser) { - if (__parser.__sign_ != __sign::__default) - std::__throw_format_error("A sign field isn't allowed in this format-spec"); - - if (__parser.__alternate_form_) - std::__throw_format_error("An alternate form field isn't allowed in this format-spec"); - - if (__parser.__alignment_ == __alignment::__zero_padding) - std::__throw_format_error("A zero-padding field isn't allowed in this format-spec"); - +_LIBCPP_HIDE_FROM_ABI constexpr void __process_display_type_bool_string(__parser<_CharT>& __parser, const char* __id) { + __parser.__validate(__format_spec::__fields_bool, __id); if (__parser.__alignment_ == __alignment::__default) __parser.__alignment_ = __alignment::__left; } template -_LIBCPP_HIDE_FROM_ABI constexpr void __process_display_type_char(__parser<_CharT>& __parser) { - __format_spec::__process_display_type_bool_string(__parser); +_LIBCPP_HIDE_FROM_ABI constexpr void __process_display_type_char(__parser<_CharT>& __parser, const char* __id) { + __format_spec::__process_display_type_bool_string(__parser, __id); } template -_LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_bool(__parser<_CharT>& __parser) { +_LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_bool(__parser<_CharT>& __parser, const char* __id) { switch (__parser.__type_) { case __format_spec::__type::__default: case __format_spec::__type::__string: - __format_spec::__process_display_type_bool_string(__parser); + __format_spec::__process_display_type_bool_string(__parser, __id); break; case __format_spec::__type::__binary_lower_case: @@ -824,17 +922,17 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_bool(__parser<_CharT>& __p break; default: - std::__throw_format_error("The format-spec type has a type not supported for a bool argument"); + __format_spec::__throw_invalid_type_format_error(__id); } } template -_LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_char(__parser<_CharT>& __parser) { +_LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_char(__parser<_CharT>& __parser, const char* __id) { switch (__parser.__type_) { case __format_spec::__type::__default: case __format_spec::__type::__char: case __format_spec::__type::__debug: - __format_spec::__process_display_type_char(__parser); + __format_spec::__process_display_type_char(__parser, __id); break; case __format_spec::__type::__binary_lower_case: @@ -846,12 +944,12 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_char(__parser<_CharT>& __p break; default: - std::__throw_format_error("The format-spec type has a type not supported for a char argument"); + __format_spec::__throw_invalid_type_format_error(__id); } } template -_LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_integer(__parser<_CharT>& __parser) { +_LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_integer(__parser<_CharT>& __parser, const char* __id) { switch (__parser.__type_) { case __format_spec::__type::__default: case __format_spec::__type::__binary_lower_case: @@ -863,16 +961,16 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_integer(__parser<_CharT>& break; case __format_spec::__type::__char: - __format_spec::__process_display_type_char(__parser); + __format_spec::__process_display_type_char(__parser, __id); break; default: - std::__throw_format_error("The format-spec type has a type not supported for an integer argument"); + __format_spec::__throw_invalid_type_format_error(__id); } } template -_LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_floating_point(__parser<_CharT>& __parser) { +_LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_floating_point(__parser<_CharT>& __parser, const char* __id) { switch (__parser.__type_) { case __format_spec::__type::__default: case __format_spec::__type::__hexfloat_lower_case: @@ -891,11 +989,11 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_floating_point(__parser<_C break; default: - std::__throw_format_error("The format-spec type has a type not supported for a floating-point argument"); + __format_spec::__throw_invalid_type_format_error(__id); } } -_LIBCPP_HIDE_FROM_ABI constexpr void __process_display_type_pointer(__format_spec::__type __type) { +_LIBCPP_HIDE_FROM_ABI constexpr void __process_display_type_pointer(__format_spec::__type __type, const char* __id) { switch (__type) { case __format_spec::__type::__default: case __format_spec::__type::__pointer_lower_case: @@ -903,7 +1001,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __process_display_type_pointer(__format_spe break; default: - std::__throw_format_error("The format-spec type has a type not supported for a pointer argument"); + __format_spec::__throw_invalid_type_format_error(__id); } } diff --git a/libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.tests.h b/libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.tests.h index 2497bc8..96a83d2 100644 --- a/libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.tests.h +++ b/libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.tests.h @@ -93,33 +93,33 @@ void test_char_default(TestFunction check, ExceptionTest check_exception, auto&& check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); // *** sign *** - check_exception("A sign field isn't allowed in this format-spec", SV("{::-}"), input); - check_exception("A sign field isn't allowed in this format-spec", SV("{::+}"), input); - check_exception("A sign field isn't allowed in this format-spec", SV("{:: }"), input); + check_exception("The format specifier for a character does not allow the sign option", SV("{::-}"), input); + check_exception("The format specifier for a character does not allow the sign option", SV("{::+}"), input); + check_exception("The format specifier for a character does not allow the sign option", SV("{:: }"), input); check(SV("[72, 101, 108, 108, 111]"), SV("{::-d}"), input); check(SV("[+72, +101, +108, +108, +111]"), SV("{::+d}"), input); check(SV("[ 72, 101, 108, 108, 111]"), SV("{:: d}"), input); // *** alternate form *** - check_exception("An alternate form field isn't allowed in this format-spec", SV("{::#}"), input); + check_exception("The format specifier for a character does not allow the alternate form option", SV("{::#}"), input); check(SV("[0x48, 0x65, 0x6c, 0x6c, 0x6f]"), SV("{::#x}"), input); // *** zero-padding *** - check_exception("A zero-padding field isn't allowed in this format-spec", SV("{::05}"), input); + check_exception("The format specifier for a character does not allow the zero-padding option", SV("{::05}"), input); check(SV("[00110, 00145, 00154, 00154, 00157]"), SV("{::05o}"), input); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input); // *** locale-specific form *** check(SV("[H, e, l, l, o]"), SV("{::L}"), input); // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("bBcdoxX?")) - check_exception("The format-spec type has a type not supported for a char argument", fmt, input); + check_exception("The type option contains an invalid value for a character formatting argument", fmt, input); // ***** Both have a format-spec check(SV("^^[:H, :e, :l, :l, :o]^^^"), SV("{:^^25::>2}"), input); @@ -177,7 +177,7 @@ void test_char_string(TestFunction check, ExceptionTest check_exception, auto&& // ***** Only underlying has a format-spec check_exception("Type s and an underlying format specification can't be used together", SV("{:s:}"), input); for (std::basic_string_view fmt : fmt_invalid_nested_types("bBcdoxX?")) - check_exception("The format-spec type has a type not supported for a char argument", fmt, input); + check_exception("The type option contains an invalid value for a character formatting argument", fmt, input); // ***** Both have a format-spec check_exception("Type s and an underlying format specification can't be used together", SV("{:5s:5}"), input); @@ -366,33 +366,33 @@ void test_bool(TestFunction check, ExceptionTest check_exception, auto&& input) check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); // *** sign *** - check_exception("A sign field isn't allowed in this format-spec", SV("{::-}"), input); - check_exception("A sign field isn't allowed in this format-spec", SV("{::+}"), input); - check_exception("A sign field isn't allowed in this format-spec", SV("{:: }"), input); + check_exception("The format specifier for a bool does not allow the sign option", SV("{::-}"), input); + check_exception("The format specifier for a bool does not allow the sign option", SV("{::+}"), input); + check_exception("The format specifier for a bool does not allow the sign option", SV("{:: }"), input); check(SV("[1, 1, 0]"), SV("{::-d}"), input); check(SV("[+1, +1, +0]"), SV("{::+d}"), input); check(SV("[ 1, 1, 0]"), SV("{:: d}"), input); // *** alternate form *** - check_exception("An alternate form field isn't allowed in this format-spec", SV("{::#}"), input); + check_exception("The format specifier for a bool does not allow the alternate form option", SV("{::#}"), input); check(SV("[0x1, 0x1, 0x0]"), SV("{::#x}"), input); // *** zero-padding *** - check_exception("A zero-padding field isn't allowed in this format-spec", SV("{::05}"), input); + check_exception("The format specifier for a bool does not allow the zero-padding option", SV("{::05}"), input); check(SV("[00001, 00001, 00000]"), SV("{::05o}"), input); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input); // *** locale-specific form *** check(SV("[true, true, false]"), SV("{::L}"), input); // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("bBdosxX")) - check_exception("The format-spec type has a type not supported for a bool argument", fmt, input); + check_exception("The type option contains an invalid value for a bool formatting argument", fmt, input); // ***** Both have a format-spec check(SV("^^[:::true, :::true, ::false]^^^"), SV("{:^^32::>7}"), input); @@ -491,14 +491,14 @@ void test_int(TestFunction check, ExceptionTest check_exception, auto&& input) { check(SV("[-0x2a, 0x001, 0x002, 0x02a]"), SV("{::#05x}"), input); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input); // *** locale-specific form *** check(SV("[-42, 1, 2, 42]"), SV("{::L}"), input); // does nothing in this test, but is accepted. // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("bBcdoxX")) - check_exception("The format-spec type has a type not supported for an integer argument", fmt, input); + check_exception("The type option contains an invalid value for an integer formatting argument", fmt, input); // ***** Both have a format-spec check(SV("^^[::-42, ::::1, ::::2, :::42]^^^"), SV("{:^^33::>5}"), input); @@ -621,7 +621,7 @@ void test_floating_point(TestFunction check, ExceptionTest check_exception, auto // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("aAeEfFgG")) - check_exception("The format-spec type has a type not supported for a floating-point argument", fmt, input); + check_exception("The type option contains an invalid value for a floating-point formatting argument", fmt, input); // ***** Both have a format-spec check(SV("^^[-42.5, ::::0, :1.25, :42.5]^^^"), SV("{:^^33::>5}"), input); @@ -672,7 +672,7 @@ void test_pointer(TestFunction check, ExceptionTest check_exception, auto&& inpu check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); // *** sign *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input); // *** alternate form *** check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input); @@ -711,10 +711,10 @@ void test_pointer(TestFunction check, ExceptionTest check_exception, auto&& inpu check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); // *** sign *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::-}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input); // *** alternate form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::#}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input); // *** zero-padding *** check(SV("[0x0000]"), SV("{::06}"), input); @@ -722,14 +722,14 @@ void test_pointer(TestFunction check, ExceptionTest check_exception, auto&& inpu check(SV("[0X0000]"), SV("{::06P}"), input); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input); // *** locale-specific form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::L}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input); // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("pP")) - check_exception("The format-spec type has a type not supported for a pointer argument", fmt, input); + check_exception("The type option contains an invalid value for a pointer formatting argument", fmt, input); // ***** Both have a format-spec check(SV("^^[::0x0]^^^"), SV("{:^^12::>5}"), input); @@ -778,7 +778,7 @@ void test_string(TestFunction check, ExceptionTest check_exception, auto&& input check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); // *** sign *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input); // *** alternate form *** check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input); @@ -817,10 +817,10 @@ void test_string(TestFunction check, ExceptionTest check_exception, auto&& input check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); // *** sign *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::-}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input); // *** alternate form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::#}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input); // *** zero-padding *** check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input); @@ -833,7 +833,7 @@ void test_string(TestFunction check, ExceptionTest check_exception, auto&& input check_exception("The format-spec precision field doesn't contain a value or arg-id", SV("{::.}"), input); // *** locale-specific form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::L}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input); // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("s?")) diff --git a/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/format.functions.tests.h b/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/format.functions.tests.h index 4f17a99..d17ddf9 100644 --- a/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/format.functions.tests.h +++ b/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/format.functions.tests.h @@ -77,30 +77,30 @@ void format_test_vector_bool(TestFunction check, ExceptionTest check_exception, check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); // *** sign *** - check_exception("A sign field isn't allowed in this format-spec", SV("{::-}"), input); - check_exception("A sign field isn't allowed in this format-spec", SV("{::+}"), input); - check_exception("A sign field isn't allowed in this format-spec", SV("{:: }"), input); + check_exception("The format specifier for a bool does not allow the sign option", SV("{::-}"), input); + check_exception("The format specifier for a bool does not allow the sign option", SV("{::+}"), input); + check_exception("The format specifier for a bool does not allow the sign option", SV("{:: }"), input); check(SV("[1, 1, 0]"), SV("{::-d}"), input); check(SV("[+1, +1, +0]"), SV("{::+d}"), input); check(SV("[ 1, 1, 0]"), SV("{:: d}"), input); // *** alternate form *** - check_exception("An alternate form field isn't allowed in this format-spec", SV("{::#}"), input); + check_exception("The format specifier for a bool does not allow the alternate form option", SV("{::#}"), input); check(SV("[0x1, 0x1, 0x0]"), SV("{::#x}"), input); // *** zero-padding *** - check_exception("A zero-padding field isn't allowed in this format-spec", SV("{::05}"), input); + check_exception("The format specifier for a bool does not allow the zero-padding option", SV("{::05}"), input); check(SV("[00001, 00001, 00000]"), SV("{::05o}"), input); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input); // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("bBdosxX")) - check_exception("The format-spec type has a type not supported for a bool argument", fmt, input); + check_exception("The type option contains an invalid value for a bool formatting argument", fmt, input); // ***** Both have a format-spec check(SV("^^[:::true, :::true, ::false]^^^"), SV("{:^^32::>7}"), input); diff --git a/libcxx/test/std/utilities/format/format.functions/fill.unicode.pass.cpp b/libcxx/test/std/utilities/format/format.functions/fill.unicode.pass.cpp index c9d80f6..03546a6 100644 --- a/libcxx/test/std/utilities/format/format.functions/fill.unicode.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/fill.unicode.pass.cpp @@ -117,7 +117,7 @@ void test() { check_exception("The fill character contains an invalid value", std::wstring_view{L"{:\xddff^}"}, 42); check_exception( - "The format-spec should consume the input or end with a '}'", std::wstring_view{L"{:\xdc00\xd800^}"}, 42); + "The format specifier should consume the input or end with a '}'", std::wstring_view{L"{:\xdc00\xd800^}"}, 42); check_exception("The fill character contains an invalid value", std::wstring_view{L"{:\x00110000^}"}, 42); check_exception("The fill character contains an invalid value", std::wstring_view{L"{:\x0011ffff^}"}, 42); diff --git a/libcxx/test/std/utilities/format/format.functions/format_tests.h b/libcxx/test/std/utilities/format/format.functions/format_tests.h index 0273435..535d1fb 100644 --- a/libcxx/test/std/utilities/format/format.functions/format_tests.h +++ b/libcxx/test/std/utilities/format/format.functions/format_tests.h @@ -522,10 +522,10 @@ void format_test_string(const W& world, const U& universe, TestFunction check, E check(SV("hello uni#####"), SV("hello {:#<8.3s}"), universe); // *** sign *** - check_exception("The format-spec should consume the input or end with a '}'", SV("hello {:-}"), world); + check_exception("The format specifier should consume the input or end with a '}'", SV("hello {:-}"), world); // *** alternate form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("hello {:#}"), world); + check_exception("The format specifier should consume the input or end with a '}'", SV("hello {:#}"), world); // *** zero-padding *** check_exception("A format-spec width field shouldn't have a leading zero", SV("hello {:0}"), world); @@ -580,7 +580,7 @@ void format_test_string(const W& world, const U& universe, TestFunction check, E check_exception("Invalid arg-id", SV("hello {0:.{01}}"), world, 1); // *** locale-specific form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("hello {:L}"), world); + check_exception("The format specifier should consume the input or end with a '}'", SV("hello {:L}"), world); // *** type *** #if TEST_STD_VER > 20 @@ -733,37 +733,37 @@ void format_test_bool(TestFunction check, ExceptionTest check_exception) { check(SV("answer is '-false--'"), SV("answer is '{:-^8s}'"), false); // *** Sign *** - check_exception("A sign field isn't allowed in this format-spec", SV("{:-}"), true); - check_exception("A sign field isn't allowed in this format-spec", SV("{:+}"), true); - check_exception("A sign field isn't allowed in this format-spec", SV("{: }"), true); + check_exception("The format specifier for a bool does not allow the sign option", SV("{:-}"), true); + check_exception("The format specifier for a bool does not allow the sign option", SV("{:+}"), true); + check_exception("The format specifier for a bool does not allow the sign option", SV("{: }"), true); - check_exception("A sign field isn't allowed in this format-spec", SV("{:-s}"), true); - check_exception("A sign field isn't allowed in this format-spec", SV("{:+s}"), true); - check_exception("A sign field isn't allowed in this format-spec", SV("{: s}"), true); + check_exception("The format specifier for a bool does not allow the sign option", SV("{:-s}"), true); + check_exception("The format specifier for a bool does not allow the sign option", SV("{:+s}"), true); + check_exception("The format specifier for a bool does not allow the sign option", SV("{: s}"), true); // *** alternate form *** - check_exception("An alternate form field isn't allowed in this format-spec", SV("{:#}"), true); - check_exception("An alternate form field isn't allowed in this format-spec", SV("{:#s}"), true); + check_exception("The format specifier for a bool does not allow the alternate form option", SV("{:#}"), true); + check_exception("The format specifier for a bool does not allow the alternate form option", SV("{:#s}"), true); // *** zero-padding *** - check_exception("A zero-padding field isn't allowed in this format-spec", SV("{:0}"), true); - check_exception("A zero-padding field isn't allowed in this format-spec", SV("{:0s}"), true); + check_exception("The format specifier for a bool does not allow the zero-padding option", SV("{:0}"), true); + check_exception("The format specifier for a bool does not allow the zero-padding option", SV("{:0s}"), true); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), true); - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.0}"), true); - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.42}"), true); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), true); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.0}"), true); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.42}"), true); - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.s}"), true); - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.0s}"), true); - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.42s}"), true); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.s}"), true); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.0s}"), true); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.42s}"), true); // *** locale-specific form *** // See locale-specific_form.pass.cpp // *** type *** for (const auto& fmt : invalid_types("bBdosxX")) - check_exception("The format-spec type has a type not supported for a bool argument", fmt, true); + check_exception("The type option contains an invalid value for a bool formatting argument", fmt, true); } template @@ -841,16 +841,16 @@ void format_test_bool_as_integer(TestFunction check, ExceptionTest check_excepti check(SV("answer is 0X0000000000"), SV("answer is {:#012X}"), false); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), true); - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.0}"), true); - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.42}"), true); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), true); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.0}"), true); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.42}"), true); // *** locale-specific form *** // See locale-specific_form.pass.cpp // *** type *** for (const auto& fmt : invalid_types("bBcdosxX")) - check_exception("The format-spec type has a type not supported for a bool argument", fmt, true); + check_exception("The type option contains an invalid value for a bool formatting argument", fmt, true); } template @@ -974,16 +974,16 @@ void format_test_integer_as_integer(TestFunction check, ExceptionTest check_exce check(SV("answer is +0X00000002A"), SV("answer is {:+#012X}"), I(42)); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), I(0)); - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.0}"), I(0)); - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.42}"), I(0)); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), I(0)); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.0}"), I(0)); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.42}"), I(0)); // *** locale-specific form *** // See locale-specific_form.pass.cpp // *** type *** for (const auto& fmt : invalid_types("bBcdoxX")) - check_exception("The format-spec type has a type not supported for an integer argument", fmt, 42); + check_exception("The type option contains an invalid value for an integer formatting argument", fmt, 42); } template @@ -1001,20 +1001,22 @@ void format_test_integer_as_char(TestFunction check, ExceptionTest check_excepti // *** Sign *** check(SV("answer is *"), SV("answer is {:c}"), I(42)); - check_exception("A sign field isn't allowed in this format-spec", SV("answer is {:-c}"), I(42)); - check_exception("A sign field isn't allowed in this format-spec", SV("answer is {:+c}"), I(42)); - check_exception("A sign field isn't allowed in this format-spec", SV("answer is {: c}"), I(42)); + check_exception("The format specifier for an integer does not allow the sign option", SV("answer is {:-c}"), I(42)); + check_exception("The format specifier for an integer does not allow the sign option", SV("answer is {:+c}"), I(42)); + check_exception("The format specifier for an integer does not allow the sign option", SV("answer is {: c}"), I(42)); // *** alternate form *** - check_exception("An alternate form field isn't allowed in this format-spec", SV("answer is {:#c}"), I(42)); + check_exception( + "The format specifier for an integer does not allow the alternate form option", SV("answer is {:#c}"), I(42)); // *** zero-padding & width *** - check_exception("A zero-padding field isn't allowed in this format-spec", SV("answer is {:01c}"), I(42)); + check_exception( + "The format specifier for an integer does not allow the zero-padding option", SV("answer is {:01c}"), I(42)); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.c}"), I(0)); - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.0c}"), I(0)); - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.42c}"), I(0)); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.c}"), I(0)); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.0c}"), I(0)); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.42c}"), I(0)); // *** locale-specific form *** // Note it has no effect but it's allowed. @@ -1022,7 +1024,7 @@ void format_test_integer_as_char(TestFunction check, ExceptionTest check_excepti // *** type *** for (const auto& fmt : invalid_types("bBcdoxX")) - check_exception("The format-spec type has a type not supported for an integer argument", fmt, I(42)); + check_exception("The type option contains an invalid value for an integer formatting argument", fmt, I(42)); // *** Validate range *** // The code has some duplications to keep the if statement readable. @@ -1189,30 +1191,34 @@ void format_test_char(TestFunction check, ExceptionTest check_exception) { check(SV("answer is '--*---'"), SV("answer is '{:-^6c}'"), CharT('*')); // *** Sign *** - check_exception("A sign field isn't allowed in this format-spec", SV("{:-}"), CharT('*')); - check_exception("A sign field isn't allowed in this format-spec", SV("{:+}"), CharT('*')); - check_exception("A sign field isn't allowed in this format-spec", SV("{: }"), CharT('*')); + check_exception("The format specifier for a character does not allow the sign option", SV("{:-}"), CharT('*')); + check_exception("The format specifier for a character does not allow the sign option", SV("{:+}"), CharT('*')); + check_exception("The format specifier for a character does not allow the sign option", SV("{: }"), CharT('*')); - check_exception("A sign field isn't allowed in this format-spec", SV("{:-c}"), CharT('*')); - check_exception("A sign field isn't allowed in this format-spec", SV("{:+c}"), CharT('*')); - check_exception("A sign field isn't allowed in this format-spec", SV("{: c}"), CharT('*')); + check_exception("The format specifier for a character does not allow the sign option", SV("{:-c}"), CharT('*')); + check_exception("The format specifier for a character does not allow the sign option", SV("{:+c}"), CharT('*')); + check_exception("The format specifier for a character does not allow the sign option", SV("{: c}"), CharT('*')); // *** alternate form *** - check_exception("An alternate form field isn't allowed in this format-spec", SV("{:#}"), CharT('*')); - check_exception("An alternate form field isn't allowed in this format-spec", SV("{:#c}"), CharT('*')); + check_exception( + "The format specifier for a character does not allow the alternate form option", SV("{:#}"), CharT('*')); + check_exception( + "The format specifier for a character does not allow the alternate form option", SV("{:#c}"), CharT('*')); // *** zero-padding *** - check_exception("A zero-padding field isn't allowed in this format-spec", SV("{:0}"), CharT('*')); - check_exception("A zero-padding field isn't allowed in this format-spec", SV("{:0c}"), CharT('*')); + check_exception( + "The format specifier for a character does not allow the zero-padding option", SV("{:0}"), CharT('*')); + check_exception( + "The format specifier for a character does not allow the zero-padding option", SV("{:0c}"), CharT('*')); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), CharT('*')); - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.0}"), CharT('*')); - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.42}"), CharT('*')); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), CharT('*')); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.0}"), CharT('*')); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.42}"), CharT('*')); - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.c}"), CharT('*')); - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.0c}"), CharT('*')); - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.42c}"), CharT('*')); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.c}"), CharT('*')); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.0c}"), CharT('*')); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.42c}"), CharT('*')); // *** locale-specific form *** // Note it has no effect but it's allowed. @@ -1226,7 +1232,7 @@ void format_test_char(TestFunction check, ExceptionTest check_exception) { const char* valid_types = "bBcdoxX"; #endif for (const auto& fmt : invalid_types(valid_types)) - check_exception("The format-spec type has a type not supported for a char argument", fmt, CharT('*')); + check_exception("The type option contains an invalid value for a character formatting argument", fmt, CharT('*')); } template @@ -1284,9 +1290,9 @@ void format_test_char_as_integer(TestFunction check, ExceptionTest check_excepti check(SV("answer is +0X00000002A"), SV("answer is {:+#012X}"), CharT('*')); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.d}"), CharT('*')); - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.0d}"), CharT('*')); - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.42d}"), CharT('*')); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.d}"), CharT('*')); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.0d}"), CharT('*')); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.42d}"), CharT('*')); // *** locale-specific form *** // See locale-specific_form.pass.cpp @@ -1298,7 +1304,7 @@ void format_test_char_as_integer(TestFunction check, ExceptionTest check_excepti const char* valid_types = "bBcdoxX"; #endif for (const auto& fmt : invalid_types(valid_types)) - check_exception("The format-spec type has a type not supported for a char argument", fmt, '*'); + check_exception("The type option contains an invalid value for a character formatting argument", fmt, '*'); } template @@ -2916,7 +2922,7 @@ void format_test_floating_point(TestFunction check, ExceptionTest check_exceptio // *** type *** for (const auto& fmt : invalid_types("aAeEfFgG")) - check_exception("The format-spec type has a type not supported for a floating-point argument", fmt, F(1)); + check_exception("The type option contains an invalid value for a floating-point formatting argument", fmt, F(1)); } template @@ -2945,12 +2951,12 @@ void format_test_pointer(TestFunction check, ExceptionTest check_exception) { check(SV("answer is ':0x0::'"), SV("answer is '{::^06}'"), P(nullptr)); // *** Sign *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), P(nullptr)); - check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), P(nullptr)); - check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), P(nullptr)); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), P(nullptr)); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), P(nullptr)); + check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), P(nullptr)); // *** alternate form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), P(nullptr)); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), P(nullptr)); // *** zero-padding *** check(SV("answer is '0x0000'"), SV("answer is '{:06}'"), P(nullptr)); @@ -2958,14 +2964,14 @@ void format_test_pointer(TestFunction check, ExceptionTest check_exception) { check(SV("answer is '0X0000'"), SV("answer is '{:06P}'"), P(nullptr)); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), P(nullptr)); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), P(nullptr)); // *** locale-specific form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), P(nullptr)); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), P(nullptr)); // *** type *** for (const auto& fmt : invalid_types("pP")) - check_exception("The format-spec type has a type not supported for a pointer argument", fmt, P(nullptr)); + check_exception("The type option contains an invalid value for a pointer formatting argument", fmt, P(nullptr)); } template diff --git a/libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.tests.h b/libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.tests.h index 671785f..adafa12 100644 --- a/libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.tests.h +++ b/libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.tests.h @@ -90,33 +90,33 @@ void test_char_default(TestFunction check, ExceptionTest check_exception) { check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); // *** sign *** - check_exception("A sign field isn't allowed in this format-spec", SV("{::-}"), input); - check_exception("A sign field isn't allowed in this format-spec", SV("{::+}"), input); - check_exception("A sign field isn't allowed in this format-spec", SV("{:: }"), input); + check_exception("The format specifier for a character does not allow the sign option", SV("{::-}"), input); + check_exception("The format specifier for a character does not allow the sign option", SV("{::+}"), input); + check_exception("The format specifier for a character does not allow the sign option", SV("{:: }"), input); check(SV("{97, 98, 99}"), SV("{::-d}"), input); check(SV("{+97, +98, +99}"), SV("{::+d}"), input); check(SV("{ 97, 98, 99}"), SV("{:: d}"), input); // *** alternate form *** - check_exception("An alternate form field isn't allowed in this format-spec", SV("{::#}"), input); + check_exception("The format specifier for a character does not allow the alternate form option", SV("{::#}"), input); check(SV("{0x61, 0x62, 0x63}"), SV("{::#x}"), input); // *** zero-padding *** - check_exception("A zero-padding field isn't allowed in this format-spec", SV("{::05}"), input); + check_exception("The format specifier for a character does not allow the zero-padding option", SV("{::05}"), input); check(SV("{00141, 00142, 00143}"), SV("{::05o}"), input); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input); // *** locale-specific form *** check(SV("{a, b, c}"), SV("{::L}"), input); // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("bBcdoxX?")) - check_exception("The format-spec type has a type not supported for a char argument", fmt, input); + check_exception("The type option contains an invalid value for a character formatting argument", fmt, input); // ***** Both have a format-spec check(SV("^^{:a, :b, :c}^^^"), SV("{:^^17::>2}"), input); @@ -180,7 +180,7 @@ void test_char_string(TestFunction check, [[maybe_unused]] ExceptionTest check_e // ***** Only underlying has a format-spec check_exception("Type s and an underlying format specification can't be used together", SV("{:s:}"), input); for (std::basic_string_view fmt : fmt_invalid_nested_types("bBcdoxX?")) - check_exception("The format-spec type has a type not supported for a char argument", fmt, input); + check_exception("The type option contains an invalid value for a character formatting argument", fmt, input); // ***** Both have a format-spec check_exception("Type s and an underlying format specification can't be used together", SV("{:5s:5}"), input); @@ -323,33 +323,33 @@ void test_char_to_wchar(TestFunction check, ExceptionTest check_exception) { check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); // *** sign *** - check_exception("A sign field isn't allowed in this format-spec", SV("{::-}"), input); - check_exception("A sign field isn't allowed in this format-spec", SV("{::+}"), input); - check_exception("A sign field isn't allowed in this format-spec", SV("{:: }"), input); + check_exception("The format specifier for a character does not allow the sign option", SV("{::-}"), input); + check_exception("The format specifier for a character does not allow the sign option", SV("{::+}"), input); + check_exception("The format specifier for a character does not allow the sign option", SV("{:: }"), input); check(SV("{97, 98, 99}"), SV("{::-d}"), input); check(SV("{+97, +98, +99}"), SV("{::+d}"), input); check(SV("{ 97, 98, 99}"), SV("{:: d}"), input); // *** alternate form *** - check_exception("An alternate form field isn't allowed in this format-spec", SV("{::#}"), input); + check_exception("The format specifier for a character does not allow the alternate form option", SV("{::#}"), input); check(SV("{0x61, 0x62, 0x63}"), SV("{::#x}"), input); // *** zero-padding *** - check_exception("A zero-padding field isn't allowed in this format-spec", SV("{::05}"), input); + check_exception("The format specifier for a character does not allow the zero-padding option", SV("{::05}"), input); check(SV("{00141, 00142, 00143}"), SV("{::05o}"), input); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input); // *** locale-specific form *** check(SV("{a, b, c}"), SV("{::L}"), input); // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("bBcdoxX?")) - check_exception("The format-spec type has a type not supported for a char argument", fmt, input); + check_exception("The type option contains an invalid value for a character formatting argument", fmt, input); // ***** Both have a format-spec check(SV("^^{:a, :b, :c}^^^"), SV("{:^^17::>2}"), input); @@ -440,33 +440,33 @@ void test_bool(TestFunction check, ExceptionTest check_exception) { check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); // *** sign *** - check_exception("A sign field isn't allowed in this format-spec", SV("{::-}"), input); - check_exception("A sign field isn't allowed in this format-spec", SV("{::+}"), input); - check_exception("A sign field isn't allowed in this format-spec", SV("{:: }"), input); + check_exception("The format specifier for a bool does not allow the sign option", SV("{::-}"), input); + check_exception("The format specifier for a bool does not allow the sign option", SV("{::+}"), input); + check_exception("The format specifier for a bool does not allow the sign option", SV("{:: }"), input); check(SV("{0, 1}"), SV("{::-d}"), input); check(SV("{+0, +1}"), SV("{::+d}"), input); check(SV("{ 0, 1}"), SV("{:: d}"), input); // *** alternate form *** - check_exception("An alternate form field isn't allowed in this format-spec", SV("{::#}"), input); + check_exception("The format specifier for a bool does not allow the alternate form option", SV("{::#}"), input); check(SV("{0x0, 0x1}"), SV("{::#x}"), input); // *** zero-padding *** - check_exception("A zero-padding field isn't allowed in this format-spec", SV("{::05}"), input); + check_exception("The format specifier for a bool does not allow the zero-padding option", SV("{::05}"), input); check(SV("{00000, 00001}"), SV("{::05o}"), input); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input); // *** locale-specific form *** check(SV("{false, true}"), SV("{::L}"), input); // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("bBdosxX")) - check_exception("The format-spec type has a type not supported for a bool argument", fmt, input); + check_exception("The type option contains an invalid value for a bool formatting argument", fmt, input); // ***** Both have a format-spec check(SV("^^{::false, :::true}^^^"), SV("{:^^23::>7}"), input); @@ -543,33 +543,33 @@ void test_bool_multiset(TestFunction check, ExceptionTest check_exception) { check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); // *** sign *** - check_exception("A sign field isn't allowed in this format-spec", SV("{::-}"), input); - check_exception("A sign field isn't allowed in this format-spec", SV("{::+}"), input); - check_exception("A sign field isn't allowed in this format-spec", SV("{:: }"), input); + check_exception("The format specifier for a bool does not allow the sign option", SV("{::-}"), input); + check_exception("The format specifier for a bool does not allow the sign option", SV("{::+}"), input); + check_exception("The format specifier for a bool does not allow the sign option", SV("{:: }"), input); check(SV("{1, 1, 0}"), SV("{::-d}"), input); check(SV("{+1, +1, +0}"), SV("{::+d}"), input); check(SV("{ 1, 1, 0}"), SV("{:: d}"), input); // *** alternate form *** - check_exception("An alternate form field isn't allowed in this format-spec", SV("{::#}"), input); + check_exception("The format specifier for a bool does not allow the alternate form option", SV("{::#}"), input); check(SV("{0x1, 0x1, 0x0}"), SV("{::#x}"), input); // *** zero-padding *** - check_exception("A zero-padding field isn't allowed in this format-spec", SV("{::05}"), input); + check_exception("The format specifier for a bool does not allow the zero-padding option", SV("{::05}"), input); check(SV("{00001, 00001, 00000}"), SV("{::05o}"), input); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input); // *** locale-specific form *** check(SV("{true, true, false}"), SV("{::L}"), input); // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("bBdosxX")) - check_exception("The format-spec type has a type not supported for a bool argument", fmt, input); + check_exception("The type option contains an invalid value for a bool formatting argument", fmt, input); // ***** Both have a format-spec check(SV("^^{:::true, :::true, ::false}^^^"), SV("{:^^32::>7}"), input); @@ -661,14 +661,14 @@ void test_int(TestFunction check, ExceptionTest check_exception, auto&& input) { check(SV("{-0x2a, 0x001, 0x002, 0x02a}"), SV("{::#05x}"), input); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input); // *** locale-specific form *** check(SV("{-42, 1, 2, 42}"), SV("{::L}"), input); // does nothing in this test, but is accepted. // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("bBcdoxX")) - check_exception("The format-spec type has a type not supported for an integer argument", fmt, input); + check_exception("The type option contains an invalid value for an integer formatting argument", fmt, input); // ***** Both have a format-spec check(SV("^^{::-42, ::::1, ::::2, :::42}^^^"), SV("{:^^33::>5}"), input); @@ -790,7 +790,7 @@ void test_floating_point(TestFunction check, ExceptionTest check_exception, auto // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("aAeEfFgG")) - check_exception("The format-spec type has a type not supported for a floating-point argument", fmt, input); + check_exception("The type option contains an invalid value for a floating-point formatting argument", fmt, input); // ***** Both have a format-spec check(SV("^^{-42.5, ::::0, :1.25, :42.5}^^^"), SV("{:^^33::>5}"), input); @@ -880,10 +880,10 @@ void test_pointer(TestFunction check, ExceptionTest check_exception, auto&& inpu check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); // *** sign *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::-}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input); // *** alternate form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::#}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input); // *** zero-padding *** check(SV("{0x0000}"), SV("{::06}"), input); @@ -891,14 +891,14 @@ void test_pointer(TestFunction check, ExceptionTest check_exception, auto&& inpu check(SV("{0X0000}"), SV("{::06P}"), input); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input); // *** locale-specific form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::L}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input); // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("pP")) - check_exception("The format-spec type has a type not supported for a pointer argument", fmt, input); + check_exception("The type option contains an invalid value for a pointer formatting argument", fmt, input); // ***** Both have a format-spec check(SV("^^{::0x0}^^^"), SV("{:^^12::>5}"), input); @@ -986,10 +986,10 @@ void test_string(TestFunction check, ExceptionTest check_exception, auto&& input check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); // *** sign *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::-}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input); // *** alternate form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::#}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input); // *** zero-padding *** check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input); @@ -1002,7 +1002,7 @@ void test_string(TestFunction check, ExceptionTest check_exception, auto&& input check_exception("The format-spec precision field doesn't contain a value or arg-id", SV("{::.}"), input); // *** locale-specific form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::L}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input); // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("s?")) diff --git a/libcxx/test/std/utilities/format/format.range/format.range.fmtstr/format.functions.tests.h b/libcxx/test/std/utilities/format/format.range/format.range.fmtstr/format.functions.tests.h index c0e9c9d..9e70f8f 100644 --- a/libcxx/test/std/utilities/format/format.range/format.range.fmtstr/format.functions.tests.h +++ b/libcxx/test/std/utilities/format/format.range/format.range.fmtstr/format.functions.tests.h @@ -75,10 +75,10 @@ void test_string(TestFunction check, ExceptionTest check_exception, auto&& input check_exception("The format-spec fill field contains an invalid character", SV("{:{<}"), input); // *** sign *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input); // *** alternate form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input); // *** zero-padding *** check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input); @@ -91,7 +91,7 @@ void test_string(TestFunction check, ExceptionTest check_exception, auto&& input check(SV("hel "), SV("{:{}.{}}"), input, 5, 3); // *** locale-specific form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input); // *** type *** check(SV("hello"), SV("{:s}"), input); @@ -136,7 +136,7 @@ void test_range_string(TestFunction check, ExceptionTest check_exception, auto&& check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); // *** sign *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input); // *** alternate form *** check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input); @@ -176,10 +176,10 @@ void test_range_string(TestFunction check, ExceptionTest check_exception, auto&& check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); // *** sign *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::-}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input); // *** alternate form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::#}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input); // *** zero-padding *** check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input); @@ -192,7 +192,7 @@ void test_range_string(TestFunction check, ExceptionTest check_exception, auto&& check_exception("The format-spec precision field doesn't contain a value or arg-id", SV("{::.}"), input); // *** locale-specific form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::L}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input); // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("s?")) @@ -260,10 +260,10 @@ void test_debug_string(TestFunction check, ExceptionTest check_exception, auto&& check_exception("The format-spec fill field contains an invalid character", SV("{:{<}"), input); // *** sign *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input); // *** alternate form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input); // *** zero-padding *** check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input); @@ -276,7 +276,7 @@ void test_debug_string(TestFunction check, ExceptionTest check_exception, auto&& check(SV("\"he "), SV("{:{}.{}}"), input, 5, 3); // *** locale-specific form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input); // *** type *** check(SV("\"hello\""), SV("{:s}"), input); // escape overrides the type option s @@ -322,7 +322,7 @@ void test_range_debug_string(TestFunction check, ExceptionTest check_exception, check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); // *** sign *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input); + check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input); // *** alternate form *** check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input); @@ -362,10 +362,10 @@ void test_range_debug_string(TestFunction check, ExceptionTest check_exception, check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); // *** sign *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::-}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input); // *** alternate form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::#}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input); // *** zero-padding *** check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input); @@ -378,7 +378,7 @@ void test_range_debug_string(TestFunction check, ExceptionTest check_exception, check_exception("The format-spec precision field doesn't contain a value or arg-id", SV("{::.}"), input); // *** locale-specific form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::L}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input); // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("s?")) diff --git a/libcxx/test/std/utilities/format/format.range/format.range.formatter/format.functions.tests.h b/libcxx/test/std/utilities/format/format.range/format.range.formatter/format.functions.tests.h index 550450d..953948f 100644 --- a/libcxx/test/std/utilities/format/format.range/format.range.formatter/format.functions.tests.h +++ b/libcxx/test/std/utilities/format/format.range/format.range.formatter/format.functions.tests.h @@ -97,33 +97,33 @@ void test_char_default(TestFunction check, ExceptionTest check_exception, auto&& check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); // *** sign *** - check_exception("A sign field isn't allowed in this format-spec", SV("{::-}"), input); - check_exception("A sign field isn't allowed in this format-spec", SV("{::+}"), input); - check_exception("A sign field isn't allowed in this format-spec", SV("{:: }"), input); + check_exception("The format specifier for a character does not allow the sign option", SV("{::-}"), input); + check_exception("The format specifier for a character does not allow the sign option", SV("{::+}"), input); + check_exception("The format specifier for a character does not allow the sign option", SV("{:: }"), input); check(SV("[72, 101, 108, 108, 111]"), SV("{::-d}"), input); check(SV("[+72, +101, +108, +108, +111]"), SV("{::+d}"), input); check(SV("[ 72, 101, 108, 108, 111]"), SV("{:: d}"), input); // *** alternate form *** - check_exception("An alternate form field isn't allowed in this format-spec", SV("{::#}"), input); + check_exception("The format specifier for a character does not allow the alternate form option", SV("{::#}"), input); check(SV("[0x48, 0x65, 0x6c, 0x6c, 0x6f]"), SV("{::#x}"), input); // *** zero-padding *** - check_exception("A zero-padding field isn't allowed in this format-spec", SV("{::05}"), input); + check_exception("The format specifier for a character does not allow the zero-padding option", SV("{::05}"), input); check(SV("[00110, 00145, 00154, 00154, 00157]"), SV("{::05o}"), input); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input); // *** locale-specific form *** check(SV("[H, e, l, l, o]"), SV("{::L}"), input); // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("bBcdoxX?")) - check_exception("The format-spec type has a type not supported for a char argument", fmt, input); + check_exception("The type option contains an invalid value for a character formatting argument", fmt, input); // ***** Both have a format-spec check(SV("^^[:H, :e, :l, :l, :o]^^^"), SV("{:^^25::>2}"), input); @@ -181,7 +181,7 @@ void test_char_string(TestFunction check, ExceptionTest check_exception, auto&& // ***** Only underlying has a format-spec check_exception("Type s and an underlying format specification can't be used together", SV("{:s:}"), input); for (std::basic_string_view fmt : fmt_invalid_nested_types("bBcdoxX?")) - check_exception("The format-spec type has a type not supported for a char argument", fmt, input); + check_exception("The type option contains an invalid value for a character formatting argument", fmt, input); // ***** Both have a format-spec check_exception("Type s and an underlying format specification can't be used together", SV("{:5s:5}"), input); @@ -355,33 +355,33 @@ void test_bool(TestFunction check, ExceptionTest check_exception) { check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); // *** sign *** - check_exception("A sign field isn't allowed in this format-spec", SV("{::-}"), input); - check_exception("A sign field isn't allowed in this format-spec", SV("{::+}"), input); - check_exception("A sign field isn't allowed in this format-spec", SV("{:: }"), input); + check_exception("The format specifier for a bool does not allow the sign option", SV("{::-}"), input); + check_exception("The format specifier for a bool does not allow the sign option", SV("{::+}"), input); + check_exception("The format specifier for a bool does not allow the sign option", SV("{:: }"), input); check(SV("[1, 1, 0]"), SV("{::-d}"), input); check(SV("[+1, +1, +0]"), SV("{::+d}"), input); check(SV("[ 1, 1, 0]"), SV("{:: d}"), input); // *** alternate form *** - check_exception("An alternate form field isn't allowed in this format-spec", SV("{::#}"), input); + check_exception("The format specifier for a bool does not allow the alternate form option", SV("{::#}"), input); check(SV("[0x1, 0x1, 0x0]"), SV("{::#x}"), input); // *** zero-padding *** - check_exception("A zero-padding field isn't allowed in this format-spec", SV("{::05}"), input); + check_exception("The format specifier for a bool does not allow the zero-padding option", SV("{::05}"), input); check(SV("[00001, 00001, 00000]"), SV("{::05o}"), input); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input); // *** locale-specific form *** check(SV("[true, true, false]"), SV("{::L}"), input); // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("bBdosxX")) - check_exception("The format-spec type has a type not supported for a bool argument", fmt, input); + check_exception("The type option contains an invalid value for a bool formatting argument", fmt, input); // ***** Both have a format-spec check(SV("^^[:::true, :::true, ::false]^^^"), SV("{:^^32::>7}"), input); @@ -472,14 +472,14 @@ void test_int(TestFunction check, ExceptionTest check_exception, auto&& input) { check(SV("[0x001, 0x002, 0x02a, -0x2a]"), SV("{::#05x}"), input); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input); // *** locale-specific form *** check(SV("[1, 2, 42, -42]"), SV("{::L}"), input); // does nothing in this test, but is accepted. // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("bBcdoxX")) - check_exception("The format-spec type has a type not supported for an integer argument", fmt, input); + check_exception("The type option contains an invalid value for an integer formatting argument", fmt, input); // ***** Both have a format-spec check(SV("^^[::::1, ::::2, :::42, ::-42]^^^"), SV("{:^^33::>5}"), input); @@ -603,7 +603,7 @@ void test_floating_point(TestFunction check, ExceptionTest check_exception, auto // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("aAeEfFgG")) - check_exception("The format-spec type has a type not supported for a floating-point argument", fmt, input); + check_exception("The type option contains an invalid value for a floating-point formatting argument", fmt, input); // ***** Both have a format-spec check(SV("^^[-42.5, ::::0, :1.25, :42.5]^^^"), SV("{:^^33::>5}"), input); @@ -694,10 +694,10 @@ void test_pointer(TestFunction check, ExceptionTest check_exception, auto&& inpu check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); // *** sign *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::-}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input); // *** alternate form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::#}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input); // *** zero-padding *** check(SV("[0x0000]"), SV("{::06}"), input); @@ -705,14 +705,14 @@ void test_pointer(TestFunction check, ExceptionTest check_exception, auto&& inpu check(SV("[0X0000]"), SV("{::06P}"), input); // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input); // *** locale-specific form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::L}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input); // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("pP")) - check_exception("The format-spec type has a type not supported for a pointer argument", fmt, input); + check_exception("The type option contains an invalid value for a pointer formatting argument", fmt, input); // ***** Both have a format-spec check(SV("^^[::0x0]^^^"), SV("{:^^12::>5}"), input); @@ -799,10 +799,10 @@ void test_string(TestFunction check, ExceptionTest check_exception, auto&& input check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); // *** sign *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::-}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input); // *** alternate form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::#}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input); // *** zero-padding *** check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input); @@ -815,7 +815,7 @@ void test_string(TestFunction check, ExceptionTest check_exception, auto&& input check_exception("The format-spec precision field doesn't contain a value or arg-id", SV("{::.}"), input); // *** locale-specific form *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{::L}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input); // *** type *** for (std::basic_string_view fmt : fmt_invalid_nested_types("s?")) -- cgit v1.1