diff --git a/libcxx/include/__chrono/formatter.h b/libcxx/include/__chrono/formatter.h --- a/libcxx/include/__chrono/formatter.h +++ b/libcxx/include/__chrono/formatter.h @@ -514,19 +514,19 @@ } else { // Test __weekday_name_ before __weekday_ to give a better error. if (__specs.__chrono_.__weekday_name_ && !__formatter::__weekday_name_ok(__value)) - std::__throw_format_error("formatting a weekday name needs a valid weekday"); + std::__throw_format_error("Formatting a weekday name needs a valid weekday"); if (__specs.__chrono_.__weekday_ && !__formatter::__weekday_ok(__value)) - std::__throw_format_error("formatting a weekday needs a valid weekday"); + std::__throw_format_error("Formatting a weekday needs a valid weekday"); if (__specs.__chrono_.__day_of_year_ && !__formatter::__date_ok(__value)) - std::__throw_format_error("formatting a day of year needs a valid date"); + std::__throw_format_error("Formatting a day of year needs a valid date"); if (__specs.__chrono_.__week_of_year_ && !__formatter::__date_ok(__value)) - std::__throw_format_error("formatting a week of year needs a valid date"); + std::__throw_format_error("Formatting a week of year needs a valid date"); if (__specs.__chrono_.__month_name_ && !__formatter::__month_name_ok(__value)) - std::__throw_format_error("formatting a month name from an invalid month number"); + std::__throw_format_error("Formatting a month name from an invalid month number"); if constexpr (__is_hh_mm_ss<_Tp>) { // Note this is a pedantic intepretation of the Standard. A hh_mm_ss @@ -545,7 +545,7 @@ // - Write it as not valid, // - or write the number of days. if (__specs.__chrono_.__hour_ && __value.hours().count() > 23) - std::__throw_format_error("formatting a hour needs a valid value"); + std::__throw_format_error("Formatting a hour needs a valid value"); if (__value.is_negative()) __sstr << _CharT('-'); diff --git a/libcxx/include/__chrono/parser_std_format_spec.h b/libcxx/include/__chrono/parser_std_format_spec.h --- a/libcxx/include/__chrono/parser_std_format_spec.h +++ b/libcxx/include/__chrono/parser_std_format_spec.h @@ -165,12 +165,12 @@ "undefined behavior by evaluating data not in the input"); if (*__begin != _CharT('%') && *__begin != _CharT('}')) - std::__throw_format_error("Expected '%' or '}' in the chrono format-string"); + std::__throw_format_error("The format specifier expects a '%' or a '}'"); do { switch (*__begin) { case _CharT('{'): - std::__throw_format_error("The chrono-specs contains a '{'"); + std::__throw_format_error("The chrono specifiers contain a '{'"); case _CharT('}'): return __begin; @@ -195,7 +195,7 @@ __parse_conversion_spec(_ConstIterator& __begin, _ConstIterator __end, __flags __flags) { ++__begin; if (__begin == __end) - std::__throw_format_error("End of input while parsing the modifier chrono conversion-spec"); + std::__throw_format_error("End of input while parsing a conversion specifier"); switch (*__begin) { case _CharT('n'): diff --git a/libcxx/include/__format/format_functions.h b/libcxx/include/__format/format_functions.h --- a/libcxx/include/__format/format_functions.h +++ b/libcxx/include/__format/format_functions.h @@ -128,13 +128,13 @@ _LIBCPP_HIDE_FROM_ABI constexpr __arg_t arg(size_t __id) const { if (__id >= __size_) - std::__throw_format_error("Argument index out of bounds"); + std::__throw_format_error("The argument index value is too larger for the number of arguments supplied"); return __args_[__id]; } _LIBCPP_HIDE_FROM_ABI constexpr const __compile_time_handle<_CharT>& __handle(size_t __id) const { if (__id >= __size_) - std::__throw_format_error("Argument index out of bounds"); + std::__throw_format_error("The argument index value is too larger for the number of arguments supplied"); return __handles_[__id]; } @@ -257,13 +257,13 @@ __parse_ctx.advance_to(__r.__last); break; default: - std::__throw_format_error("The replacement field arg-id should terminate at a ':' or '}'"); + std::__throw_format_error("The argument index should end with a ':' or a '}'"); } if constexpr (same_as<_Ctx, __compile_time_basic_format_context<_CharT>>) { __arg_t __type = __ctx.arg(__r.__value); if (__type == __arg_t::__none) - std::__throw_format_error("Argument index out of bounds"); + std::__throw_format_error("The argument index value is too larger for the number of arguments supplied"); else if (__type == __arg_t::__handle) __ctx.__handle(__r.__value).__parse(__parse_ctx); else if (__parse) @@ -272,7 +272,7 @@ _VSTD::__visit_format_arg( [&](auto __arg) { if constexpr (same_as) - std::__throw_format_error("Argument index out of bounds"); + std::__throw_format_error("The argument index value is too larger for the number of arguments supplied"); else if constexpr (same_as::handle>) __arg.format(__parse_ctx, __ctx); else { diff --git a/libcxx/include/__format/format_string.h b/libcxx/include/__format/format_string.h --- a/libcxx/include/__format/format_string.h +++ b/libcxx/include/__format/format_string.h @@ -123,7 +123,7 @@ if (__v > __number_max || (__begin != __end_input && *__begin >= _CharT('0') && *__begin <= _CharT('9'))) - std::__throw_format_error("The numeric value of the format-spec is too large"); + std::__throw_format_error("The numeric value of the format specifier is too large"); __value = __v; } @@ -153,7 +153,7 @@ return __detail::__parse_automatic(__begin, __end, __parse_ctx); } if (*__begin < _CharT('0') || *__begin > _CharT('9')) - std::__throw_format_error("The arg-id of the format-spec starts with an invalid character"); + std::__throw_format_error("The argument index starts with an invalid character"); return __detail::__parse_manual(__begin, __end, __parse_ctx); } diff --git a/libcxx/include/__format/formatter_bool.h b/libcxx/include/__format/formatter_bool.h --- a/libcxx/include/__format/formatter_bool.h +++ b/libcxx/include/__format/formatter_bool.h @@ -41,7 +41,7 @@ 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 --- a/libcxx/include/__format/formatter_char.h +++ b/libcxx/include/__format/formatter_char.h @@ -36,7 +36,7 @@ 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 --- a/libcxx/include/__format/formatter_floating_point.h +++ b/libcxx/include/__format/formatter_floating_point.h @@ -730,7 +730,7 @@ 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 --- a/libcxx/include/__format/formatter_integer.h +++ b/libcxx/include/__format/formatter_integer.h @@ -37,7 +37,7 @@ 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 --- a/libcxx/include/__format/formatter_pointer.h +++ b/libcxx/include/__format/formatter_pointer.h @@ -35,7 +35,7 @@ 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/formatter_tuple.h b/libcxx/include/__format/formatter_tuple.h --- a/libcxx/include/__format/formatter_tuple.h +++ b/libcxx/include/__format/formatter_tuple.h @@ -54,22 +54,20 @@ auto __begin = __parser_.__parse(__ctx, __format_spec::__fields_tuple); auto __end = __ctx.end(); - if (__begin != __end) { - if (*__begin == _CharT('m')) { - if constexpr (sizeof...(_Args) == 2) { - set_separator(_LIBCPP_STATICALLY_WIDEN(_CharT, ": ")); - set_brackets({}, {}); - ++__begin; - } else - std::__throw_format_error("The format specifier m requires a pair or a two-element tuple"); - } else if (*__begin == _CharT('n')) { + // Note 'n' is part of the type here + if (__parser_.__clear_brackets_) + set_brackets({}, {}); + else if (__begin != __end && *__begin == _CharT('m')) { + if constexpr (sizeof...(_Args) == 2) { + set_separator(_LIBCPP_STATICALLY_WIDEN(_CharT, ": ")); set_brackets({}, {}); ++__begin; - } + } else + std::__throw_format_error("Type m requires a pair or a tuple with two elements"); } 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 '}'"); __ctx.advance_to(__begin); 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 @@ -19,6 +19,7 @@ #include <__algorithm/copy_n.h> #include <__algorithm/find_if.h> #include <__algorithm/min.h> +#include <__algorithm/ranges_any_of.h> #include <__assert> #include <__concepts/arithmetic.h> #include <__concepts/same_as.h> @@ -36,7 +37,10 @@ #include <__type_traits/common_type.h> #include <__type_traits/is_trivially_copyable.h> #include <__variant/monostate.h> +#include #include +#include +#include #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -52,6 +56,17 @@ 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) { @@ -59,12 +74,12 @@ // This function is a wrapper to call the real parser. But it does the // validation for the pre-conditions and post-conditions. if (__begin == __end) - std::__throw_format_error("End of input while parsing format-spec arg-id"); + std::__throw_format_error("End of input while parsing an argument index"); __format::__parse_number_result __r = __format::__parse_arg_id(__begin, __end, __ctx); if (__r.__last == __end || *__r.__last != _CharT('}')) - std::__throw_format_error("Invalid arg-id"); + std::__throw_format_error("The argument index is invalid"); ++__r.__last; return __r; @@ -85,7 +100,7 @@ [](auto __arg) -> uint32_t { using _Type = decltype(__arg); if constexpr (same_as<_Type, monostate>) - std::__throw_format_error("Argument index out of bounds"); + std::__throw_format_error("The argument index value is too larger for the number of arguments supplied"); // [format.string.std]/8 // If { arg-idopt } is used in a width or precision, the value of the @@ -101,12 +116,12 @@ same_as<_Type, long long> || same_as<_Type, unsigned long long>) { if constexpr (signed_integral<_Type>) { if (__arg < 0) - std::__throw_format_error("A format-spec arg-id replacement shouldn't have a negative value"); + std::__throw_format_error("An argument index may not have a negative value"); } using _CT = common_type_t<_Type, decltype(__format::__number_max)>; if (static_cast<_CT>(__arg) > static_cast<_CT>(__format::__number_max)) - std::__throw_format_error("A format-spec arg-id replacement exceeds the maximum supported value"); + std::__throw_format_error("The value of the argument index exceeds its maximum value"); return __arg; } else @@ -121,42 +136,47 @@ /// explicitly. // TODO FMT Use an ABI tag for this struct. struct __fields { - uint8_t __sign_ : 1 {false}; - uint8_t __alternate_form_ : 1 {false}; - uint8_t __zero_padding_ : 1 {false}; - uint8_t __precision_ : 1 {false}; - uint8_t __locale_specific_form_ : 1 {false}; - uint8_t __type_ : 1 {false}; + uint16_t __sign_ : 1 {false}; + uint16_t __alternate_form_ : 1 {false}; + uint16_t __zero_padding_ : 1 {false}; + uint16_t __precision_ : 1 {false}; + uint16_t __locale_specific_form_ : 1 {false}; + uint16_t __type_ : 1 {false}; // Determines the valid values for fill. // // Originally the fill could be any character except { and }. Range-based // formatters use the colon to mark the beginning of the // underlying-format-spec. To avoid parsing ambiguities these formatter // specializations prohibit the use of the colon as a fill character. - uint8_t __use_range_fill_ : 1 {false}; + uint16_t __use_range_fill_ : 1 {false}; + uint16_t __clear_brackets_ : 1 {false}; + uint16_t __consume_all_ : 1 {false}; }; // By not placing this constant in the formatter class it's not duplicated for // char and wchar_t. +inline constexpr __fields __fields_bool{.__locale_specific_form_ = true, .__type_ = true, .__consume_all_ = true}; inline constexpr __fields __fields_integral{ .__sign_ = true, .__alternate_form_ = true, .__zero_padding_ = true, .__locale_specific_form_ = true, - .__type_ = true}; + .__type_ = true, + .__consume_all_ = true}; inline constexpr __fields __fields_floating_point{ .__sign_ = true, .__alternate_form_ = true, .__zero_padding_ = true, .__precision_ = true, .__locale_specific_form_ = true, - .__type_ = true}; -inline constexpr __fields __fields_string{.__precision_ = true, .__type_ = true}; -inline constexpr __fields __fields_pointer{.__type_ = true}; + .__type_ = true, + .__consume_all_ = true}; +inline constexpr __fields __fields_string{.__precision_ = true, .__type_ = true, .__consume_all_ = true}; +inline constexpr __fields __fields_pointer{.__type_ = true, .__consume_all_ = true}; # if _LIBCPP_STD_VER >= 23 -inline constexpr __fields __fields_tuple{.__use_range_fill_ = true}; -inline constexpr __fields __fields_range{.__use_range_fill_ = true}; +inline constexpr __fields __fields_tuple{.__use_range_fill_ = true, .__clear_brackets_ = true}; +inline constexpr __fields __fields_range{.__use_range_fill_ = true, .__clear_brackets_ = true}; inline constexpr __fields __fields_fill_align_width{}; # endif @@ -200,9 +220,45 @@ __fixed_upper_case, __general_lower_case, __general_upper_case, - __debug + __debug, + __range, + __stream_like, }; +inline constexpr array __types_integer{ + __type::__binary_lower_case, + __type::__binary_upper_case, + __type::__decimal, + __type::__octal, + __type::__hexadecimal_lower_case, + __type::__hexadecimal_upper_case}; + +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; +} + +template <__type... __types> +consteval uint32_t __create_type_mask() { + uint32_t __result = 0; + ([&] { __result |= __create_type_mask(__types); }(), ...); + return __result; +} + +inline constexpr uint32_t __type_mask_integer = + __create_type_mask<__type::__binary_lower_case, + __type::__binary_upper_case, + __type::__decimal, + __type::__octal, + __type::__hexadecimal_lower_case, + __type::__hexadecimal_upper_case>(); + struct __std { __alignment __alignment_ : 3; __sign __sign_ : 2; @@ -303,6 +359,19 @@ template class _LIBCPP_TEMPLATE_VIS __parser { public: + // Parses the format specification. + // + // Depending on whether the parsing is done compile-time or run-time + // the method slightly differs. + // - Only parses a field when it is in the __fields. Accepting all + // fields and then validate the valid ones has a performance impact. + // This is faster but gives slighly worse error messages. + // - compile-time when a field is not accepted the parser will still + // parse it and give an error when it's present. This gives a more + // accurate error. + // The idea is that most times the format instead of the vformat + // functions are used. In that case the error will be detected during + // compilation and there is no need to pay for the run-time overhead. template _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator __parse(_ParseContext& __ctx, __fields __fields) { auto __begin = __ctx.begin(); @@ -313,35 +382,131 @@ if (__parse_fill_align(__begin, __end, __fields.__use_range_fill_) && __begin == __end) return __begin; - if (__fields.__sign_ && __parse_sign(__begin) && __begin == __end) - return __begin; + if (__fields.__sign_) { + if (__parse_sign(__begin) && __begin == __end) + return __begin; + } else if (std::is_constant_evaluated() && __parse_sign(__begin)) { + std::__throw_format_error("The format specification does not allow the sign option"); + } - if (__fields.__alternate_form_ && __parse_alternate_form(__begin) && __begin == __end) - return __begin; + if (__fields.__alternate_form_) { + if (__parse_alternate_form(__begin) && __begin == __end) + return __begin; + } else if (std::is_constant_evaluated() && __parse_alternate_form(__begin)) + std::__throw_format_error("The format specifier does not allow the alternate form option"); - if (__fields.__zero_padding_ && __parse_zero_padding(__begin) && __begin == __end) - return __begin; + if (__fields.__zero_padding_) { + if (__parse_zero_padding(__begin) && __begin == __end) + return __begin; + } else if (std::is_constant_evaluated() && __parse_zero_padding(__begin)) + std::__throw_format_error("The format specifier does not allow the zero-padding option"); if (__parse_width(__begin, __end, __ctx) && __begin == __end) return __begin; - if (__fields.__precision_ && __parse_precision(__begin, __end, __ctx) && __begin == __end) - return __begin; + if (__fields.__precision_) { + if (__parse_precision(__begin, __end, __ctx) && __begin == __end) + return __begin; + } else if (std::is_constant_evaluated() && __parse_precision(__begin, __end, __ctx)) + std::__throw_format_error("The format specifier does not allow the precision option"); + + if (__fields.__locale_specific_form_) { + if (__parse_locale_specific_form(__begin) && __begin == __end) + return __begin; + } else if (std::is_constant_evaluated() && __parse_locale_specific_form(__begin)) + std::__throw_format_error("The format specifier does not allow the locale-specific form option"); + + if (__fields.__clear_brackets_) { + if (__parse_clear_brackets(__begin) && __begin == __end) + return __begin; + } else if (std::is_constant_evaluated() && __parse_clear_brackets(__begin)) + std::__throw_format_error("The format specifier does not allow the n option"); + + if (__fields.__type_) + __parse_type(__begin); - if (__fields.__locale_specific_form_ && __parse_locale_specific_form(__begin) && __begin == __end) + if (!__fields.__consume_all_) return __begin; - if (__fields.__type_) { - __parse_type(__begin); + if (__begin != __end && *__begin != _CharT('}')) + std::__throw_format_error("The format specifier should consume the input or end with a '}'"); + + return __begin; + } - // When __type_ is false the calling parser is expected to do additional - // parsing. In that case that parser should do the end of format string - // validation. - if (__begin != __end && *__begin != _CharT('}')) - std::__throw_format_error("The format-spec should consume the input or end with a '}'"); + // 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 + // a boolean types. + // + // Depending on whether the validation is done compile-time or + // run-time the error differs + // - run-time the exception is thrown and contains the type of field + // being validated. + // - compile-time the line with `std::__throw_format_error` is shown + // in the output. In that case it's important the error is 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"); } - return __begin; + 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"); + } + + 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.. @@ -378,7 +543,7 @@ __sign __sign_ : 2 {__sign::__default}; bool __alternate_form_ : 1 {false}; bool __locale_specific_form_ : 1 {false}; - bool __reserved_0_ : 1 {false}; + bool __clear_brackets_ : 1 {false}; __type __type_{__type::__default}; // These flags are only used for formatting chrono. Since the struct has @@ -393,8 +558,8 @@ bool __month_name_ : 1 {false}; - uint8_t __reserved_1_ : 2 {0}; - uint8_t __reserved_2_ : 6 {0}; + uint8_t __reserved_0_ : 2 {0}; + uint8_t __reserved_1_ : 6 {0}; // These two flags are only used internally and not part of the // __parsed_specifications. Therefore put them at the end. bool __width_as_arg_ : 1 {false}; @@ -430,9 +595,9 @@ // The forbidden fill characters all code points formed from a single code unit, thus the // check can be omitted when more code units are used. if (__use_range_fill && (__fill == _CharT('{') || __fill == _CharT('}') || __fill == _CharT(':'))) - std::__throw_format_error("The format-spec range-fill field contains an invalid character"); + std::__throw_format_error("The fill option contains an invalid value"); else if (__fill == _CharT('{') || __fill == _CharT('}')) - std::__throw_format_error("The format-spec fill field contains an invalid character"); + std::__throw_format_error("The fill option contains an invalid value"); } # ifndef _LIBCPP_HAS_NO_UNICODE @@ -449,7 +614,7 @@ __unicode::__code_point_view<_CharT> __view{__begin, __end}; __unicode::__consume_result __consumed = __view.__consume(); if (__consumed.__status != __unicode::__consume_result::__ok) - std::__throw_format_error("The format-spec contains malformed Unicode characters"); + std::__throw_format_error("The format specifier contains malformed Unicode characters"); if (__view.__position() < __end && __parse_alignment(*__view.__position())) { ptrdiff_t __code_units = __view.__position() - __begin; @@ -480,7 +645,7 @@ "undefined behavior by evaluating data not in the input"); if (__begin + 1 != __end && __parse_alignment(*(__begin + 1))) { if (!__unicode::__is_scalar_value(*__begin)) - std::__throw_format_error("The fill character contains an invalid value"); + std::__throw_format_error("The fill option contains an invalid value"); __validate_fill_character(*__begin, __use_range_fill); @@ -567,7 +732,7 @@ template _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_width(_Iterator& __begin, _Iterator __end, auto& __ctx) { if (*__begin == _CharT('0')) - std::__throw_format_error("A format-spec width field shouldn't have a leading zero"); + std::__throw_format_error("The width option should not have a leading zero"); if (*__begin == _CharT('{')) { __format::__parse_number_result __r = __format_spec::__parse_arg_id(++__begin, __end, __ctx); @@ -595,7 +760,7 @@ ++__begin; if (__begin == __end) - std::__throw_format_error("End of input while parsing format-spec precision"); + std::__throw_format_error("End of input while parsing format specifier precision"); if (*__begin == _CharT('{')) { __format::__parse_number_result __arg_id = __format_spec::__parse_arg_id(++__begin, __end, __ctx); @@ -606,7 +771,7 @@ } if (*__begin < _CharT('0') || *__begin > _CharT('9')) - std::__throw_format_error("The format-spec precision field doesn't contain a value or arg-id"); + std::__throw_format_error("The precision option does not contain a value or argument index"); __format::__parse_number_result __r = __format::__parse_number(__begin, __end); __precision_ = __r.__value; @@ -625,6 +790,16 @@ return true; } + template + _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_clear_brackets(_Iterator& __begin) { + if (*__begin != _CharT('n')) + return false; + + __clear_brackets_ = true; + ++__begin; + return true; + } + template _LIBCPP_HIDE_FROM_ABI constexpr void __parse_type(_Iterator& __begin) { // Determines the type. It does not validate whether the selected type is @@ -726,36 +901,28 @@ break; default: - std::__throw_format_error("The format-spec type has a type not supported for a string argument"); + std::__throw_format_error("The type option contains an invalid value for a string formatting argument"); } } 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: @@ -767,17 +934,17 @@ 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: @@ -789,12 +956,16 @@ 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); } } +// [format.formatter.spec]/2.3 +// For each charT, for each cv-unqualified arithmetic type ArithmeticT +// other than char, wchar_t, char8_t, char16_t, or char32_t, a +// specialization 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: @@ -803,19 +974,20 @@ case __format_spec::__type::__decimal: case __format_spec::__type::__hexadecimal_lower_case: case __format_spec::__type::__hexadecimal_upper_case: + //__format_spec::__process_display_type_integer(__parser, __id); 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: @@ -834,18 +1006,18 @@ 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: 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/include/__format/range_formatter.h b/libcxx/include/__format/range_formatter.h --- a/libcxx/include/__format/range_formatter.h +++ b/libcxx/include/__format/range_formatter.h @@ -66,18 +66,8 @@ // The n field overrides a possible m type, therefore delay applying the // effect of n until the type has been procesed. - bool __clear_brackets = (*__begin == _CharT('n')); - if (__clear_brackets) { - ++__begin; - if (__begin == __end) [[unlikely]] { - // Since there is no more data, clear the brackets before returning. - set_brackets({}, {}); - return __parse_empty_range_underlying_spec(__ctx, __begin); - } - } - __parse_type(__begin, __end); - if (__clear_brackets) + if (__parser_.__clear_brackets_) set_brackets({}, {}); if (__begin == __end) [[unlikely]] return __parse_empty_range_underlying_spec(__ctx, __begin); @@ -93,7 +83,7 @@ // processed by the underlying. For example {:-} for a range in invalid, // the sign field is not present. Without this check the underlying_ will // get -} as input which my be valid. - 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 '}'"); __ctx.advance_to(__begin); __begin = __underlying_.parse(__ctx); @@ -106,13 +96,13 @@ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ // could consume more than it should. 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 '}'"); if (__parser_.__type_ != __format_spec::__type::__default) { // [format.range.formatter]/6 // If the range-type is s or ?s, then there shall be no n option and no // range-underlying-spec. - if (__clear_brackets) { + if (__parser_.__clear_brackets_) { if (__parser_.__type_ == __format_spec::__type::__string) std::__throw_format_error("The n option and type s can't be used together"); std::__throw_format_error("The n option and type ?s can't be used together"); @@ -235,7 +225,7 @@ set_separator(_LIBCPP_STATICALLY_WIDEN(_CharT, ", ")); ++__begin; } else - std::__throw_format_error("The range-format-spec type m requires two elements for a pair or tuple"); + std::__throw_format_error("Type m requires a pair or a tuple with two elements"); break; case _CharT('s'): @@ -243,18 +233,18 @@ __parser_.__type_ = __format_spec::__type::__string; ++__begin; } else - std::__throw_format_error("The range-format-spec type s requires formatting a character type"); + std::__throw_format_error("Type s requires character type as formatting argument"); break; case _CharT('?'): ++__begin; if (__begin == __end || *__begin != _CharT('s')) - 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 '}'"); if constexpr (same_as<_Tp, _CharT>) { __parser_.__type_ = __format_spec::__type::__debug; ++__begin; } else - std::__throw_format_error("The range-format-spec type ?s requires formatting a character type"); + std::__throw_format_error("Type ?s requires character type as formatting argument"); } } 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 --- 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 @@ -49,34 +49,34 @@ check(SV("__['H', 'e', 'l', 'l', 'o']___"), SV("{:_^{}}"), input, 30); check(SV("#####['H', 'e', 'l', 'l', 'o']"), SV("{:#>{}}"), input, 30); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__'H', 'e', 'l', 'l', 'o'___"), SV("{:_^28n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("[H , e , l , l , o ]"), SV("{::4}"), input); @@ -89,45 +89,47 @@ check(SV("[_H__, _e__, _l__, _l__, _o__]"), SV("{::_^{}}"), input, 4); check(SV("[:::H, :::e, :::l, :::l, :::o]"), SV("{:::>{}}"), input, 4); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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 + // ***** Both have a format specifier check(SV("^^[:H, :e, :l, :l, :o]^^^"), SV("{:^^25::>2}"), input); check(SV("^^[:H, :e, :l, :l, :o]^^^"), SV("{:^^{}::>2}"), input, 25); check(SV("^^[:H, :e, :l, :l, :o]^^^"), SV("{:^^{}::>{}}"), input, 25, 2); - check_exception("Argument index out of bounds", SV("{:^^{}::>2}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 25); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>2}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 25); } template @@ -147,37 +149,37 @@ check(SV("_Hello__"), SV("{:_^{}s}"), input, 8); check(SV("###Hello"), SV("{:#>{}s}"), input, 8); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:} 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); @@ -200,32 +202,32 @@ check(SV(R"(_"Hello"__)"), SV("{:_^{}?s}"), input, 10); check(SV(R"(###"Hello")"), SV("{:#>{}?s}"), input, 10); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}{}}"), input, 24); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__true, true, false___"), SV("{:_^22n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("[true , true , false ]"), SV("{::7}"), input); @@ -362,45 +360,47 @@ check(SV("[_true__, _true__, _false_]"), SV("{::_^{}}"), input, 7); check(SV("[:::true, :::true, ::false]"), SV("{:::>{}}"), input, 7); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); check(SV("^^[:::true, :::true, ::false]^^^"), SV("{:^^{}::>7}"), input, 32); check(SV("^^[:::true, :::true, ::false]^^^"), SV("{:^^{}::>{}}"), input, 32, 7); - check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 32); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>5}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 32); } template @@ -432,36 +432,36 @@ check(SV("__[-42, 1, 2, 42]___"), SV("{:_^{}}"), input, 20); check(SV("#####[-42, 1, 2, 42]"), SV("{:#>{}}"), input, 20); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__-42, 1, 2, 42___"), SV("{:_^18n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("[ -42, 1, 2, 42]"), SV("{::5}"), input); @@ -474,8 +474,8 @@ check(SV("[_-42_, __1__, __2__, _42__]"), SV("{::_^{}}"), input, 5); check(SV("[::-42, ::::1, ::::2, :::42]"), SV("{:::>{}}"), input, 5); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", SV("{::{<}"), input); // *** sign *** check(SV("[-42, 1, 2, 42]"), SV("{::-}"), input); @@ -491,22 +491,24 @@ 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); check(SV("^^[::-42, ::::1, ::::2, :::42]^^^"), SV("{:^^{}::>5}"), input, 33); check(SV("^^[::-42, ::::1, ::::2, :::42]^^^"), SV("{:^^{}::>{}}"), input, 33, 5); - check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 33); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>5}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 33); } template @@ -538,36 +540,36 @@ check(SV("__[-42.5, 0, 1.25, 42.5]___"), SV("{:_^{}}"), input, 27); check(SV("#####[-42.5, 0, 1.25, 42.5]"), SV("{:#>{}}"), input, 27); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__-42.5, 0, 1.25, 42.5___"), SV("{:_^25n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("[-42.5, 0, 1.25, 42.5]"), SV("{::5}"), input); @@ -580,8 +582,8 @@ check(SV("[-42.5, __0__, 1.25_, 42.5_]"), SV("{::_^{}}"), input, 5); check(SV("[-42.5, ::::0, :1.25, :42.5]"), SV("{:::>{}}"), input, 5); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", SV("{::{<}"), input); // *** sign *** check(SV("[-42.5, 0, 1.25, 42.5]"), SV("{::-}"), input); @@ -602,7 +604,7 @@ check(SV("[-42, 0, 1.2, 42]"), SV("{::.{}}"), input, 2); check(SV("[-42.500, 0.000, 1.250, 42.500]"), SV("{::.{}f}"), input, 3); - check_exception("The format-spec precision field doesn't contain a value or arg-id", SV("{::.}"), input); + check_exception("The precision option does not contain a value or argument index", SV("{::.}"), input); // *** locale-specific form *** check(SV("[-42.5, 0, 1.25, 42.5]"), SV("{::L}"), input); // does not require locales present @@ -621,7 +623,7 @@ // *** 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); @@ -633,9 +635,16 @@ check(SV("^^[::-42, ::::0, ::1.2, :::42]^^^"), SV("{:^^{}::>{}.2}"), input, 33, 5); check(SV("^^[::-42, ::::0, ::1.2, :::42]^^^"), SV("{:^^{}::>{}.{}}"), input, 33, 5, 2); - check_exception("Argument index out of bounds", SV("{:^^{}::>5.2}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}.2}"), input, 33); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}.{}}"), input, 33, 5); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>5.2}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}.2}"), input, 33); + check_exception( + "The argument index value is too larger for the number of arguments supplied", + SV("{:^^{}::>{}.{}}"), + input, + 33, + 5); } template @@ -667,34 +676,34 @@ check(SV("__[0x0]___"), SV("{:_^{}}"), input, 10); check(SV("#####[0x0]"), SV("{:#>{}}"), input, 10); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("_0x0_"), SV("{:_^5n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("[ 0x0]"), SV("{::5}"), input); @@ -707,27 +716,27 @@ check(SV("[_0x0_]"), SV("{::_^{}}"), input, 5); check(SV("[::0x0]"), SV("{:::>{}}"), input, 5); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); + check_exception("The width option should not have a leading zero", SV("{::05}"), 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("p")) - 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); @@ -738,8 +747,10 @@ check(SV("^^[::0x0]^^^"), SV("{:^^{}::>5}"), input, 12); check(SV("^^[::0x0]^^^"), SV("{:^^{}::>{}}"), input, 12, 5); - check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 12); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>5}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 12); } template @@ -771,34 +782,34 @@ check(SV(R"(__["Hello", "world"]___)"), SV("{:_^{}}"), input, 23); check(SV(R"(#####["Hello", "world"])"), SV("{:#>{}}"), input, 23); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV(R"(_"Hello", "world"_)"), SV("{:_^18n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV(R"([Hello , world ])"), SV("{::8}"), input); @@ -811,31 +822,31 @@ check(SV(R"([_Hello__, _world__])"), SV("{::_^{}}"), input, 8); check(SV(R"([:::Hello, :::world])"), SV("{:::>{}}"), input, 8); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); + check_exception("The width option should not have a leading zero", SV("{::05}"), input); // *** precision *** check(SV(R"([Hel, wor])"), SV("{::.3}"), input); check(SV(R"([Hel, wor])"), SV("{::.{}}"), input, 3); - check_exception("The format-spec precision field doesn't contain a value or arg-id", SV("{::.}"), input); + check_exception("The precision option does not contain a value or argument index", 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?")) - check_exception("The format-spec type has a type not supported for a string argument", fmt, input); + check_exception("The type option contains an invalid value for a string formatting argument", fmt, input); // ***** Both have a format-spec check(SV(R"(^^[:::Hello, :::world]^^^)"), SV("{:^^25::>8}"), input); @@ -846,8 +857,10 @@ check(SV(R"(^^[:::Hello, :::world]^^^)"), SV("{:^^{}::>8}"), input, 25); check(SV(R"(^^[:::Hello, :::world]^^^)"), SV("{:^^{}::>{}}"), input, 25, 8); - check_exception("Argument index out of bounds", SV("{:^^{}::>8}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 25); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>8}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 25); } template @@ -879,41 +892,41 @@ check(SV("__[0xaaaa, 0x5555, 0xaa55]___"), SV("{:_^{}}"), input, 29); check(SV("#####[0xaaaa, 0x5555, 0xaa55]"), SV("{:#>{}}"), input, 29); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__0xaaaa, 0x5555, 0xaa55___"), SV("{:_^27n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec - check_exception("The format-spec type has a type not supported for a status argument", SV("{::*<7}"), input); + check_exception("The type option contains an invalid value for a status formatting argument", SV("{::*<7}"), input); for (std::basic_string_view fmt : fmt_invalid_nested_types("sxX")) - check_exception("The format-spec type has a type not supported for a status argument", fmt, input); + check_exception("The type option contains an invalid value for a status formatting argument", fmt, input); check(SV("[0xaaaa, 0x5555, 0xaa55]"), SV("{::x}"), input); check(SV("[0XAAAA, 0X5555, 0XAA55]"), SV("{::X}"), input); @@ -923,7 +936,8 @@ check(SV("^^[0XAAAA, 0X5555, 0XAA55]^^^"), SV("{:^^29:X}"), input); check(SV("^^[0XAAAA, 0X5555, 0XAA55]^^^"), SV("{:^^{}:X}"), input, 29); - check_exception("Argument index out of bounds", SV("{:^^{}:X}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:X}"), input); } template 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 --- 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 @@ -30,37 +30,37 @@ check(SV("__[true, true, false]___"), SV("{:_^{}}"), input, 24); check(SV("#####[true, true, false]"), SV("{:#>{}}"), input, 24); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__true, true, false___"), SV("{:_^22n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("[true , true , false ]"), SV("{::7}"), input); @@ -73,42 +73,44 @@ check(SV("[_true__, _true__, _false_]"), SV("{::_^{}}"), input, 7); check(SV("[:::true, :::true, ::false]"), SV("{:::>{}}"), input, 7); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); check(SV("^^[:::true, :::true, ::false]^^^"), SV("{:^^{}::>7}"), input, 32); check(SV("^^[:::true, :::true, ::false]^^^"), SV("{:^^{}::>{}}"), input, 32, 7); - check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 32); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>5}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 32); } template diff --git a/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/format.functions.tests.h b/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/format.functions.tests.h --- a/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/format.functions.tests.h +++ b/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/format.functions.tests.h @@ -50,8 +50,8 @@ #endif // !defined(__APPLE__) && !defined(__FreeBSD__) /***** Test the type generic part *****/ - check_exception("The format-spec fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); // *** sign *** check_exception("The replacement field misses a terminating '}'", SV("{:-}"), input); @@ -62,7 +62,7 @@ check_exception("The replacement field misses a terminating '}'", SV("{:#}"), input); // *** zero-padding *** - check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input); + check_exception("The width option should not have a leading zero", SV("{:0}"), input); // *** precision *** check_exception("The replacement field misses a terminating '}'", SV("{:.}"), input); diff --git a/libcxx/test/std/time/time.syn/formatter.hh_mm_ss.pass.cpp b/libcxx/test/std/time/time.syn/formatter.hh_mm_ss.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.hh_mm_ss.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.hh_mm_ss.pass.cpp @@ -499,20 +499,20 @@ // This looks odd, however the 24 hours is not valid for a 24 hour clock. // TODO FMT discuss what the "proper" behaviour is. - check_exception("formatting a hour needs a valid value", SV("{:%H"), std::chrono::hh_mm_ss{24h}); - check_exception("formatting a hour needs a valid value", SV("{:%OH"), std::chrono::hh_mm_ss{24h}); - check_exception("formatting a hour needs a valid value", SV("{:%I"), std::chrono::hh_mm_ss{24h}); - check_exception("formatting a hour needs a valid value", SV("{:%OI"), std::chrono::hh_mm_ss{24h}); + check_exception("Formatting a hour needs a valid value", SV("{:%H"), std::chrono::hh_mm_ss{24h}); + check_exception("Formatting a hour needs a valid value", SV("{:%OH"), std::chrono::hh_mm_ss{24h}); + check_exception("Formatting a hour needs a valid value", SV("{:%I"), std::chrono::hh_mm_ss{24h}); + check_exception("Formatting a hour needs a valid value", SV("{:%OI"), std::chrono::hh_mm_ss{24h}); check(SV("00"), SV("{:%M}"), std::chrono::hh_mm_ss{24h}); check(SV("00"), SV("{:%OM}"), std::chrono::hh_mm_ss{24h}); check(SV("00"), SV("{:%S}"), std::chrono::hh_mm_ss{24h}); check(SV("00"), SV("{:%OS}"), std::chrono::hh_mm_ss{24h}); - check_exception("formatting a hour needs a valid value", SV("{:%p"), std::chrono::hh_mm_ss{24h}); - check_exception("formatting a hour needs a valid value", SV("{:%R"), std::chrono::hh_mm_ss{24h}); - check_exception("formatting a hour needs a valid value", SV("{:%T"), std::chrono::hh_mm_ss{24h}); - check_exception("formatting a hour needs a valid value", SV("{:%r"), std::chrono::hh_mm_ss{24h}); - check_exception("formatting a hour needs a valid value", SV("{:%X"), std::chrono::hh_mm_ss{24h}); - check_exception("formatting a hour needs a valid value", SV("{:%EX"), std::chrono::hh_mm_ss{24h}); + check_exception("Formatting a hour needs a valid value", SV("{:%p"), std::chrono::hh_mm_ss{24h}); + check_exception("Formatting a hour needs a valid value", SV("{:%R"), std::chrono::hh_mm_ss{24h}); + check_exception("Formatting a hour needs a valid value", SV("{:%T"), std::chrono::hh_mm_ss{24h}); + check_exception("Formatting a hour needs a valid value", SV("{:%r"), std::chrono::hh_mm_ss{24h}); + check_exception("Formatting a hour needs a valid value", SV("{:%X"), std::chrono::hh_mm_ss{24h}); + check_exception("Formatting a hour needs a valid value", SV("{:%EX"), std::chrono::hh_mm_ss{24h}); } template @@ -539,14 +539,13 @@ SV("EX")}, std::chrono::hh_mm_ss{0ms}); - check_exception("Expected '%' or '}' in the chrono format-string", SV("{:A"), std::chrono::hh_mm_ss{0ms}); - check_exception("The chrono-specs contains a '{'", SV("{:%%{"), std::chrono::hh_mm_ss{0ms}); - check_exception( - "End of input while parsing the modifier chrono conversion-spec", SV("{:%"), std::chrono::hh_mm_ss{0ms}); + check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::hh_mm_ss{0ms}); + check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::hh_mm_ss{0ms}); + check_exception("End of input while parsing a conversion specifier", SV("{:%"), std::chrono::hh_mm_ss{0ms}); check_exception("End of input while parsing the modifier E", SV("{:%E"), std::chrono::hh_mm_ss{0ms}); check_exception("End of input while parsing the modifier O", SV("{:%O"), std::chrono::hh_mm_ss{0ms}); - check_exception("Expected '%' or '}' in the chrono format-string", SV("{:.3}"), std::chrono::hh_mm_ss{0ms}); + check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::hh_mm_ss{0ms}); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.syn/formatter.day.pass.cpp b/libcxx/test/std/time/time.syn/formatter.day.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.day.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.day.pass.cpp @@ -113,14 +113,14 @@ test_valid_values(); check_invalid_types({SV("d"), SV("e"), SV("Od"), SV("Oe")}, 0d); - check_exception("Expected '%' or '}' in the chrono format-string", SV("{:A"), 0d); - check_exception("The chrono-specs contains a '{'", SV("{:%%{"), 0d); - check_exception("End of input while parsing the modifier chrono conversion-spec", SV("{:%"), 0d); + check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), 0d); + check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), 0d); + check_exception("End of input while parsing a conversion specifier", SV("{:%"), 0d); check_exception("End of input while parsing the modifier E", SV("{:%E"), 0d); check_exception("End of input while parsing the modifier O", SV("{:%O"), 0d); // Precision not allowed - check_exception("Expected '%' or '}' in the chrono format-string", SV("{:.3}"), 0d); + check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), 0d); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.syn/formatter.duration.pass.cpp b/libcxx/test/std/time/time.syn/formatter.duration.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.duration.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.duration.pass.cpp @@ -1076,14 +1076,14 @@ SV("R"), SV("S"), SV("t"), SV("T"), SV("X"), SV("EX"), SV("OH"), SV("OI"), SV("OM"), SV("OS")}, 0ms); - check_exception("Expected '%' or '}' in the chrono format-string", SV("{:A"), 0ms); - check_exception("The chrono-specs contains a '{'", SV("{:%%{"), 0ms); - check_exception("End of input while parsing the modifier chrono conversion-spec", SV("{:%"), 0ms); + check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), 0ms); + check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), 0ms); + check_exception("End of input while parsing a conversion specifier", SV("{:%"), 0ms); check_exception("End of input while parsing the modifier E", SV("{:%E"), 0ms); check_exception("End of input while parsing the modifier O", SV("{:%O"), 0ms); // Precision not allowed - check_exception("Expected '%' or '}' in the chrono format-string", SV("{:.3}"), 0ms); + check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), 0ms); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.syn/formatter.file_time.pass.cpp b/libcxx/test/std/time/time.syn/formatter.file_time.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.file_time.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.file_time.pass.cpp @@ -918,14 +918,14 @@ SV("OI"), SV("Om"), SV("OM"), SV("OS"), SV("Ou"), SV("OU"), SV("OV"), SV("Ow"), SV("OW"), SV("Oy"), SV("Oz")}, file_seconds(0s)); - check_exception("Expected '%' or '}' in the chrono format-string", SV("{:A"), file_seconds(0s)); - check_exception("The chrono-specs contains a '{'", SV("{:%%{"), file_seconds(0s)); - check_exception("End of input while parsing the modifier chrono conversion-spec", SV("{:%"), file_seconds(0s)); + check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), file_seconds(0s)); + check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), file_seconds(0s)); + check_exception("End of input while parsing a conversion specifier", SV("{:%"), file_seconds(0s)); check_exception("End of input while parsing the modifier E", SV("{:%E"), file_seconds(0s)); check_exception("End of input while parsing the modifier O", SV("{:%O"), file_seconds(0s)); // Precision not allowed - check_exception("Expected '%' or '}' in the chrono format-string", SV("{:.3}"), file_seconds(0s)); + check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), file_seconds(0s)); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.syn/formatter.local_time.pass.cpp b/libcxx/test/std/time/time.syn/formatter.local_time.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.local_time.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.local_time.pass.cpp @@ -869,15 +869,14 @@ }, std::chrono::local_seconds(0s)); - check_exception("Expected '%' or '}' in the chrono format-string", SV("{:A"), std::chrono::local_seconds(0s)); - check_exception("The chrono-specs contains a '{'", SV("{:%%{"), std::chrono::local_seconds(0s)); - check_exception( - "End of input while parsing the modifier chrono conversion-spec", SV("{:%"), std::chrono::local_seconds(0s)); + check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::local_seconds(0s)); + check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::local_seconds(0s)); + check_exception("End of input while parsing a conversion specifier", SV("{:%"), std::chrono::local_seconds(0s)); check_exception("End of input while parsing the modifier E", SV("{:%E"), std::chrono::local_seconds(0s)); check_exception("End of input while parsing the modifier O", SV("{:%O"), std::chrono::local_seconds(0s)); // Precision not allowed - check_exception("Expected '%' or '}' in the chrono format-string", SV("{:.3}"), std::chrono::local_seconds(0s)); + check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::local_seconds(0s)); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.syn/formatter.month.pass.cpp b/libcxx/test/std/time/time.syn/formatter.month.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.month.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.month.pass.cpp @@ -53,17 +53,17 @@ template static void test_valid_values() { // Test that %b, %h, and %B throw an exception. - check_exception("formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::month{200}); - check_exception("formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::month{13}); - check_exception("formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::month{255}); + check_exception("Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::month{200}); + check_exception("Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::month{13}); + check_exception("Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::month{255}); - check_exception("formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::month{0}); - check_exception("formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::month{13}); - check_exception("formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::month{255}); + check_exception("Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::month{0}); + check_exception("Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::month{13}); + check_exception("Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::month{255}); - check_exception("formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::month{0}); - check_exception("formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::month{13}); - check_exception("formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::month{255}); + check_exception("Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::month{0}); + check_exception("Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::month{13}); + check_exception("Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::month{255}); constexpr std::basic_string_view fmt = SV("{:%%b='%b'%t%%B='%B'%t%%h='%h'%t%%m='%m'%t%%Om='%Om'%n}"); constexpr std::basic_string_view lfmt = SV("{:L%%b='%b'%t%%B='%B'%t%%h='%h'%t%%m='%m'%t%%Om='%Om'%n}"); @@ -182,14 +182,14 @@ test_valid_values(); check_invalid_types({SV("b"), SV("B"), SV("h"), SV("m"), SV("Om")}, std::chrono::January); - check_exception("Expected '%' or '}' in the chrono format-string", SV("{:A"), std::chrono::January); - check_exception("The chrono-specs contains a '{'", SV("{:%%{"), std::chrono::January); - check_exception("End of input while parsing the modifier chrono conversion-spec", SV("{:%"), std::chrono::January); + check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::January); + check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::January); + check_exception("End of input while parsing a conversion specifier", SV("{:%"), std::chrono::January); check_exception("End of input while parsing the modifier E", SV("{:%E"), std::chrono::January); check_exception("End of input while parsing the modifier O", SV("{:%O"), std::chrono::January); // Precision not allowed - check_exception("Expected '%' or '}' in the chrono format-string", SV("{:.3}"), std::chrono::January); + check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::January); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.syn/formatter.month_day.pass.cpp b/libcxx/test/std/time/time.syn/formatter.month_day.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.month_day.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.month_day.pass.cpp @@ -75,33 +75,33 @@ template static void test_valid_values() { // Test that %b, %h, and %B throw an exception. - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::month_day{std::chrono::month{200}, std::chrono::day{31}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::month_day{std::chrono::month{13}, std::chrono::day{31}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::month_day{std::chrono::month{255}, std::chrono::day{31}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::month_day{std::chrono::month{0}, std::chrono::day{31}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::month_day{std::chrono::month{13}, std::chrono::day{31}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::month_day{std::chrono::month{255}, std::chrono::day{31}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::month_day{std::chrono::month{0}, std::chrono::day{31}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::month_day{std::chrono::month{13}, std::chrono::day{31}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::month_day{std::chrono::month{255}, std::chrono::day{31}}); @@ -460,13 +460,13 @@ check_invalid_types({SV("b"), SV("B"), SV("d"), SV("e"), SV("h"), SV("m"), SV("Od"), SV("Oe"), SV("Om")}, std::chrono::month_day{std::chrono::January, std::chrono::day{31}}); - check_exception("Expected '%' or '}' in the chrono format-string", + check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::month_day{std::chrono::January, std::chrono::day{31}}); - check_exception("The chrono-specs contains a '{'", + check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::month_day{std::chrono::January, std::chrono::day{31}}); - check_exception("End of input while parsing the modifier chrono conversion-spec", + check_exception("End of input while parsing a conversion specifier", SV("{:%"), std::chrono::month_day{std::chrono::January, std::chrono::day{31}}); check_exception("End of input while parsing the modifier E", @@ -477,7 +477,7 @@ std::chrono::month_day{std::chrono::January, std::chrono::day{31}}); // Precision not allowed - check_exception("Expected '%' or '}' in the chrono format-string", + check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::month_day{std::chrono::January, std::chrono::day{31}}); } diff --git a/libcxx/test/std/time/time.syn/formatter.month_day_last.pass.cpp b/libcxx/test/std/time/time.syn/formatter.month_day_last.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.month_day_last.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.month_day_last.pass.cpp @@ -53,33 +53,33 @@ template static void test_valid_values() { // Test that %b, %h, and %B throw an exception. - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::month_day_last{std::chrono::month{200}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::month_day_last{std::chrono::month{13}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::month_day_last{std::chrono::month{255}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::month_day_last{std::chrono::month{0}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::month_day_last{std::chrono::month{13}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::month_day_last{std::chrono::month{255}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::month_day_last{std::chrono::month{0}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::month_day_last{std::chrono::month{13}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::month_day_last{std::chrono::month{255}}); @@ -380,9 +380,10 @@ {SV("b"), SV("B"), SV("h"), SV("m"), SV("Om")}, std::chrono::month_day_last{std::chrono::January}); check_exception( - "Expected '%' or '}' in the chrono format-string", SV("{:A"), std::chrono::month_day_last{std::chrono::January}); - check_exception("The chrono-specs contains a '{'", SV("{:%%{"), std::chrono::month_day_last{std::chrono::January}); - check_exception("End of input while parsing the modifier chrono conversion-spec", + "The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::month_day_last{std::chrono::January}); + check_exception( + "The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::month_day_last{std::chrono::January}); + check_exception("End of input while parsing a conversion specifier", SV("{:%"), std::chrono::month_day_last{std::chrono::January}); check_exception( @@ -391,9 +392,8 @@ "End of input while parsing the modifier O", SV("{:%O"), std::chrono::month_day_last{std::chrono::January}); // Precision not allowed - check_exception("Expected '%' or '}' in the chrono format-string", - SV("{:.3}"), - std::chrono::month_day_last{std::chrono::January}); + check_exception( + "The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::month_day_last{std::chrono::January}); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.syn/formatter.month_weekday.pass.cpp b/libcxx/test/std/time/time.syn/formatter.month_weekday.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.month_weekday.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.month_weekday.pass.cpp @@ -122,59 +122,59 @@ static void test_invalid_values() { // Test that %a, %b, %h, %a, and %B throw an exception. check_exception( - "formatting a weekday name needs a valid weekday", + "Formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::month_weekday{std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 1}}); check_exception( - "formatting a weekday name needs a valid weekday", + "Formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::month_weekday{std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{255}, 1}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::month_weekday{std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::month_weekday{std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::month_weekday{std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::month_weekday{std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::month_weekday{std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::month_weekday{std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}); check_exception( - "formatting a weekday name needs a valid weekday", + "Formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::month_weekday{std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 1}}); check_exception( - "formatting a weekday name needs a valid weekday", + "Formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::month_weekday{std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{255}, 1}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::month_weekday{std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::month_weekday{std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::month_weekday{std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}); } @@ -687,15 +687,15 @@ std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}); check_exception( - "Expected '%' or '}' in the chrono format-string", + "The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}); check_exception( - "The chrono-specs contains a '{'", + "The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}); check_exception( - "End of input while parsing the modifier chrono conversion-spec", + "End of input while parsing a conversion specifier", SV("{:%"), std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}); check_exception( @@ -709,7 +709,7 @@ // Precision not allowed check_exception( - "Expected '%' or '}' in the chrono format-string", + "The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}); } diff --git a/libcxx/test/std/time/time.syn/formatter.sys_time.pass.cpp b/libcxx/test/std/time/time.syn/formatter.sys_time.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.sys_time.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.sys_time.pass.cpp @@ -917,15 +917,14 @@ SV("OI"), SV("Om"), SV("OM"), SV("OS"), SV("Ou"), SV("OU"), SV("OV"), SV("Ow"), SV("OW"), SV("Oy"), SV("Oz")}, std::chrono::sys_seconds(0s)); - check_exception("Expected '%' or '}' in the chrono format-string", SV("{:A"), std::chrono::sys_seconds(0s)); - check_exception("The chrono-specs contains a '{'", SV("{:%%{"), std::chrono::sys_seconds(0s)); - check_exception( - "End of input while parsing the modifier chrono conversion-spec", SV("{:%"), std::chrono::sys_seconds(0s)); + check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::sys_seconds(0s)); + check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::sys_seconds(0s)); + check_exception("End of input while parsing a conversion specifier", SV("{:%"), std::chrono::sys_seconds(0s)); check_exception("End of input while parsing the modifier E", SV("{:%E"), std::chrono::sys_seconds(0s)); check_exception("End of input while parsing the modifier O", SV("{:%O"), std::chrono::sys_seconds(0s)); // Precision not allowed - check_exception("Expected '%' or '}' in the chrono format-string", SV("{:.3}"), std::chrono::sys_seconds(0s)); + check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::sys_seconds(0s)); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.syn/formatter.weekday.pass.cpp b/libcxx/test/std/time/time.syn/formatter.weekday.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.weekday.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.weekday.pass.cpp @@ -121,10 +121,10 @@ template static void test_invalid_values() { // Test that %a and %A throw an exception. - check_exception("formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::weekday(8)); - check_exception("formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::weekday(255)); - check_exception("formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::weekday(8)); - check_exception("formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::weekday(255)); + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::weekday(8)); + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::weekday(255)); + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::weekday(8)); + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::weekday(255)); constexpr std::basic_string_view fmt = SV("{:%%u='%u'%t%%Ou='%Ou'%t%%w='%w'%t%%Ow='%Ow'%n}"); constexpr std::basic_string_view lfmt = SV("{:L%%u='%u'%t%%Ou='%Ou'%t%%w='%w'%t%%Ow='%Ow'%n}"); @@ -182,14 +182,14 @@ check_invalid_types( {SV("a"), SV("A"), SV("t"), SV("u"), SV("w"), SV("Ou"), SV("Ow")}, std::chrono::weekday(0)); - check_exception("Expected '%' or '}' in the chrono format-string", SV("{:A"), std::chrono::weekday(0)); - check_exception("The chrono-specs contains a '{'", SV("{:%%{"), std::chrono::weekday(0)); - check_exception("End of input while parsing the modifier chrono conversion-spec", SV("{:%"), std::chrono::weekday(0)); + check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::weekday(0)); + check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::weekday(0)); + check_exception("End of input while parsing a conversion specifier", SV("{:%"), std::chrono::weekday(0)); check_exception("End of input while parsing the modifier E", SV("{:%E"), std::chrono::weekday(0)); check_exception("End of input while parsing the modifier O", SV("{:%O"), std::chrono::weekday(0)); // Precision not allowed - check_exception("Expected '%' or '}' in the chrono format-string", SV("{:.3}"), std::chrono::weekday(0)); + check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::weekday(0)); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.syn/formatter.weekday_index.pass.cpp b/libcxx/test/std/time/time.syn/formatter.weekday_index.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.weekday_index.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.weekday_index.pass.cpp @@ -233,16 +233,16 @@ template static void test_invalid_values() { // Test that %a and %A throw an exception. - check_exception("formatting a weekday name needs a valid weekday", + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::weekday_indexed{std::chrono::weekday(8), 1}); - check_exception("formatting a weekday name needs a valid weekday", + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::weekday_indexed{std::chrono::weekday(255), 1}); - check_exception("formatting a weekday name needs a valid weekday", + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::weekday_indexed{std::chrono::weekday(8), 1}); - check_exception("formatting a weekday name needs a valid weekday", + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::weekday_indexed{std::chrono::weekday(255), 1}); @@ -382,12 +382,12 @@ check_invalid_types({SV("a"), SV("A"), SV("t"), SV("u"), SV("w"), SV("Ou"), SV("Ow")}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}); - check_exception("Expected '%' or '}' in the chrono format-string", + check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::weekday_indexed{std::chrono::weekday(0), 1}); check_exception( - "The chrono-specs contains a '{'", SV("{:%%{"), std::chrono::weekday_indexed{std::chrono::weekday(0), 1}); - check_exception("End of input while parsing the modifier chrono conversion-spec", + "The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::weekday_indexed{std::chrono::weekday(0), 1}); + check_exception("End of input while parsing a conversion specifier", SV("{:%"), std::chrono::weekday_indexed{std::chrono::weekday(0), 1}); check_exception("End of input while parsing the modifier E", @@ -398,7 +398,7 @@ std::chrono::weekday_indexed{std::chrono::weekday(0), 1}); // Precision not allowed - check_exception("Expected '%' or '}' in the chrono format-string", + check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::weekday_indexed{std::chrono::weekday(0), 1}); } diff --git a/libcxx/test/std/time/time.syn/formatter.weekday_last.pass.cpp b/libcxx/test/std/time/time.syn/formatter.weekday_last.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.weekday_last.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.weekday_last.pass.cpp @@ -216,16 +216,16 @@ template static void test_invalid_values() { // Test that %a and %A throw an exception. - check_exception("formatting a weekday name needs a valid weekday", + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::weekday_last{std::chrono::weekday(8)}); - check_exception("formatting a weekday name needs a valid weekday", + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::weekday_last{std::chrono::weekday(255)}); - check_exception("formatting a weekday name needs a valid weekday", + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::weekday_last{std::chrono::weekday(8)}); - check_exception("formatting a weekday name needs a valid weekday", + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::weekday_last{std::chrono::weekday(255)}); @@ -288,9 +288,10 @@ std::chrono::weekday_last{std::chrono::weekday(0)}); check_exception( - "Expected '%' or '}' in the chrono format-string", SV("{:A"), std::chrono::weekday_last{std::chrono::weekday(0)}); - check_exception("The chrono-specs contains a '{'", SV("{:%%{"), std::chrono::weekday_last{std::chrono::weekday(0)}); - check_exception("End of input while parsing the modifier chrono conversion-spec", + "The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::weekday_last{std::chrono::weekday(0)}); + check_exception( + "The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::weekday_last{std::chrono::weekday(0)}); + check_exception("End of input while parsing a conversion specifier", SV("{:%"), std::chrono::weekday_last{std::chrono::weekday(0)}); check_exception( @@ -299,9 +300,8 @@ "End of input while parsing the modifier O", SV("{:%O"), std::chrono::weekday_last{std::chrono::weekday(0)}); // Precision not allowed - check_exception("Expected '%' or '}' in the chrono format-string", - SV("{:.3}"), - std::chrono::weekday_last{std::chrono::weekday(0)}); + check_exception( + "The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::weekday_last{std::chrono::weekday(0)}); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.syn/formatter.year.pass.cpp b/libcxx/test/std/time/time.syn/formatter.year.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.year.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.year.pass.cpp @@ -290,14 +290,14 @@ check_invalid_types( {SV("C"), SV("y"), SV("Y"), SV("EC"), SV("Ey"), SV("EY"), SV("Oy")}, std::chrono::year{1970}); - check_exception("Expected '%' or '}' in the chrono format-string", SV("{:A"), std::chrono::year{1970}); - check_exception("The chrono-specs contains a '{'", SV("{:%%{"), std::chrono::year{1970}); - check_exception("End of input while parsing the modifier chrono conversion-spec", SV("{:%"), std::chrono::year{1970}); + check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::year{1970}); + check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::year{1970}); + check_exception("End of input while parsing a conversion specifier", SV("{:%"), std::chrono::year{1970}); check_exception("End of input while parsing the modifier E", SV("{:%E"), std::chrono::year{1970}); check_exception("End of input while parsing the modifier O", SV("{:%O"), std::chrono::year{1970}); // Precision not allowed - check_exception("Expected '%' or '}' in the chrono format-string", SV("{:.3}"), std::chrono::year{1970}); + check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::year{1970}); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.syn/formatter.year_month.pass.cpp b/libcxx/test/std/time/time.syn/formatter.year_month.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.year_month.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.year_month.pass.cpp @@ -57,11 +57,11 @@ template static void test_invalid_values() { // Test that %b and %B throw an exception. - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{0}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{0}}); } @@ -259,13 +259,13 @@ {SV("b"), SV("B"), SV("C"), SV("EC"), SV("Ey"), SV("EY"), SV("h"), SV("m"), SV("Om"), SV("Oy"), SV("y"), SV("Y")}, std::chrono::year_month{std::chrono::year{1970}, std::chrono::January}); - check_exception("Expected '%' or '}' in the chrono format-string", + check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::year_month{std::chrono::year{1970}, std::chrono::January}); - check_exception("The chrono-specs contains a '{'", + check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::year_month{std::chrono::year{1970}, std::chrono::January}); - check_exception("End of input while parsing the modifier chrono conversion-spec", + check_exception("End of input while parsing a conversion specifier", SV("{:%"), std::chrono::year_month{std::chrono::year{1970}, std::chrono::January}); check_exception("End of input while parsing the modifier E", @@ -276,7 +276,7 @@ std::chrono::year_month{std::chrono::year{1970}, std::chrono::January}); // Precision not allowed - check_exception("Expected '%' or '}' in the chrono format-string", + check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::year_month{std::chrono::year{1970}, std::chrono::January}); } diff --git a/libcxx/test/std/time/time.syn/formatter.year_month_day.pass.cpp b/libcxx/test/std/time/time.syn/formatter.year_month_day.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.year_month_day.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.year_month_day.pass.cpp @@ -136,254 +136,254 @@ template static void test_invalid_values() { // Test that %a, %A, %b, %B, %h, %j, %u, %U, %V, %w, %W, %Ou, %OU, %OV, %Ow, and %OW throw an exception. - check_exception("formatting a weekday name needs a valid weekday", + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}}); - check_exception("formatting a weekday name needs a valid weekday", + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}}); - check_exception("formatting a weekday name needs a valid weekday", + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::year_month_day{ std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year - check_exception("formatting a weekday name needs a valid weekday", + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}}); - check_exception("formatting a weekday name needs a valid weekday", + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}}); - check_exception("formatting a weekday name needs a valid weekday", + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}}); - check_exception("formatting a weekday name needs a valid weekday", + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}}); - check_exception("formatting a weekday name needs a valid weekday", + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::year_month_day{ std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year - check_exception("formatting a weekday name needs a valid weekday", + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}}); - check_exception("formatting a weekday name needs a valid weekday", + check_exception("Formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{13}, std::chrono::day{31}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{255}, std::chrono::day{31}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{200}, std::chrono::day{31}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{13}, std::chrono::day{31}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{255}, std::chrono::day{31}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{13}, std::chrono::day{31}}); - check_exception("formatting a month name from an invalid month number", + check_exception("Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{255}, std::chrono::day{31}}); - check_exception("formatting a day of year needs a valid date", + check_exception("Formatting a day of year needs a valid date", SV("{:%j}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}}); - check_exception("formatting a day of year needs a valid date", + check_exception("Formatting a day of year needs a valid date", SV("{:%j}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}}); - check_exception("formatting a day of year needs a valid date", + check_exception("Formatting a day of year needs a valid date", SV("{:%j}"), std::chrono::year_month_day{ std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year - check_exception("formatting a day of year needs a valid date", + check_exception("Formatting a day of year needs a valid date", SV("{:%j}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}}); - check_exception("formatting a day of year needs a valid date", + check_exception("Formatting a day of year needs a valid date", SV("{:%j}"), std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}}); - check_exception("formatting a weekday needs a valid weekday", + check_exception("Formatting a weekday needs a valid weekday", SV("{:%u}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}}); - check_exception("formatting a weekday needs a valid weekday", + check_exception("Formatting a weekday needs a valid weekday", SV("{:%u}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}}); - check_exception("formatting a weekday needs a valid weekday", + check_exception("Formatting a weekday needs a valid weekday", SV("{:%u}"), std::chrono::year_month_day{ std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year - check_exception("formatting a weekday needs a valid weekday", + check_exception("Formatting a weekday needs a valid weekday", SV("{:%u}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}}); - check_exception("formatting a weekday needs a valid weekday", + check_exception("Formatting a weekday needs a valid weekday", SV("{:%u}"), std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%U}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%U}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%U}"), std::chrono::year_month_day{ std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%U}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%U}"), std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%V}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%V}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%V}"), std::chrono::year_month_day{ std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%V}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%V}"), std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}}); - check_exception("formatting a weekday needs a valid weekday", + check_exception("Formatting a weekday needs a valid weekday", SV("{:%w}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}}); - check_exception("formatting a weekday needs a valid weekday", + check_exception("Formatting a weekday needs a valid weekday", SV("{:%w}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}}); - check_exception("formatting a weekday needs a valid weekday", + check_exception("Formatting a weekday needs a valid weekday", SV("{:%w}"), std::chrono::year_month_day{ std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year - check_exception("formatting a weekday needs a valid weekday", + check_exception("Formatting a weekday needs a valid weekday", SV("{:%w}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}}); - check_exception("formatting a weekday needs a valid weekday", + check_exception("Formatting a weekday needs a valid weekday", SV("{:%w}"), std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%W}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%W}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%W}"), std::chrono::year_month_day{ std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%W}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%W}"), std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}}); - check_exception("formatting a weekday needs a valid weekday", + check_exception("Formatting a weekday needs a valid weekday", SV("{:%Ou}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}}); - check_exception("formatting a weekday needs a valid weekday", + check_exception("Formatting a weekday needs a valid weekday", SV("{:%Ou}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}}); - check_exception("formatting a weekday needs a valid weekday", + check_exception("Formatting a weekday needs a valid weekday", SV("{:%Ou}"), std::chrono::year_month_day{ std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year - check_exception("formatting a weekday needs a valid weekday", + check_exception("Formatting a weekday needs a valid weekday", SV("{:%Ou}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}}); - check_exception("formatting a weekday needs a valid weekday", + check_exception("Formatting a weekday needs a valid weekday", SV("{:%Ou}"), std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%OU}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%OU}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%OU}"), std::chrono::year_month_day{ std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%OU}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%OU}"), std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%OV}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%OV}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%OV}"), std::chrono::year_month_day{ std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%OV}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%OV}"), std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}}); - check_exception("formatting a weekday needs a valid weekday", + check_exception("Formatting a weekday needs a valid weekday", SV("{:%Ow}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}}); - check_exception("formatting a weekday needs a valid weekday", + check_exception("Formatting a weekday needs a valid weekday", SV("{:%Ow}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}}); - check_exception("formatting a weekday needs a valid weekday", + check_exception("Formatting a weekday needs a valid weekday", SV("{:%Ow}"), std::chrono::year_month_day{ std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year - check_exception("formatting a weekday needs a valid weekday", + check_exception("Formatting a weekday needs a valid weekday", SV("{:%Ow}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}}); - check_exception("formatting a weekday needs a valid weekday", + check_exception("Formatting a weekday needs a valid weekday", SV("{:%Ow}"), std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%OW}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%OW}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%OW}"), std::chrono::year_month_day{ std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%OW}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}}); - check_exception("formatting a week of year needs a valid date", + check_exception("Formatting a week of year needs a valid date", SV("{:%OW}"), std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}}); } @@ -1051,13 +1051,13 @@ SV("u"), SV("U"), SV("V"), SV("w"), SV("W"), SV("x"), SV("y"), SV("Y")}, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::January, std::chrono::day{31}}); - check_exception("Expected '%' or '}' in the chrono format-string", + check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::January, std::chrono::day{31}}); - check_exception("The chrono-specs contains a '{'", + check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::January, std::chrono::day{31}}); - check_exception("End of input while parsing the modifier chrono conversion-spec", + check_exception("End of input while parsing a conversion specifier", SV("{:%"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::January, std::chrono::day{31}}); check_exception("End of input while parsing the modifier E", @@ -1068,7 +1068,7 @@ std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::January, std::chrono::day{31}}); // Precision not allowed - check_exception("Expected '%' or '}' in the chrono format-string", + check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::January, std::chrono::day{31}}); } diff --git a/libcxx/test/std/time/time.syn/formatter.year_month_day_last.pass.cpp b/libcxx/test/std/time/time.syn/formatter.year_month_day_last.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.year_month_day_last.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.year_month_day_last.pass.cpp @@ -96,158 +96,158 @@ static void test_invalid_values() { // Test that %a, %A, %b, %B, %h, %j, %u, %U, %V, %w, %W, %Ou, %OU, %OV, %Ow, and %OW throw an exception. check_exception( - "formatting a weekday name needs a valid weekday", + "Formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}}); check_exception( - "formatting a weekday name needs a valid weekday", + "Formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}}); check_exception( - "formatting a weekday name needs a valid weekday", + "Formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}}); check_exception( - "formatting a weekday name needs a valid weekday", + "Formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{13}}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{255}}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{200}}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{13}}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{255}}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{13}}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{255}}}); check_exception( - "formatting a day of year needs a valid date", + "Formatting a day of year needs a valid date", SV("{:%j}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}}); check_exception( - "formatting a day of year needs a valid date", + "Formatting a day of year needs a valid date", SV("{:%j}"), std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}}); check_exception( - "formatting a weekday needs a valid weekday", + "Formatting a weekday needs a valid weekday", SV("{:%u}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}}); check_exception( - "formatting a weekday needs a valid weekday", + "Formatting a weekday needs a valid weekday", SV("{:%u}"), std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%U}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%U}"), std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%V}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%V}"), std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}}); check_exception( - "formatting a weekday needs a valid weekday", + "Formatting a weekday needs a valid weekday", SV("{:%w}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}}); check_exception( - "formatting a weekday needs a valid weekday", + "Formatting a weekday needs a valid weekday", SV("{:%w}"), std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%W}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%W}"), std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}}); check_exception( - "formatting a weekday needs a valid weekday", + "Formatting a weekday needs a valid weekday", SV("{:%Ou}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}}); check_exception( - "formatting a weekday needs a valid weekday", + "Formatting a weekday needs a valid weekday", SV("{:%Ou}"), std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%OU}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%OU}"), std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%OV}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%OV}"), std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}}); check_exception( - "formatting a weekday needs a valid weekday", + "Formatting a weekday needs a valid weekday", SV("{:%Ow}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}}); check_exception( - "formatting a weekday needs a valid weekday", + "Formatting a weekday needs a valid weekday", SV("{:%Ow}"), std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%OW}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%OW}"), std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}}); } @@ -898,15 +898,15 @@ std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::January}}); check_exception( - "Expected '%' or '}' in the chrono format-string", + "The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::January}}); check_exception( - "The chrono-specs contains a '{'", + "The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::January}}); check_exception( - "End of input while parsing the modifier chrono conversion-spec", + "End of input while parsing a conversion specifier", SV("{:%"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::January}}); check_exception( @@ -920,7 +920,7 @@ // Precision not allowed check_exception( - "Expected '%' or '}' in the chrono format-string", + "The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::January}}); } diff --git a/libcxx/test/std/time/time.syn/formatter.year_month_weekday.pass.cpp b/libcxx/test/std/time/time.syn/formatter.year_month_weekday.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.year_month_weekday.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.year_month_weekday.pass.cpp @@ -145,127 +145,127 @@ static void test_invalid_values() { // Test that %a, %A, %b, %B, %h, %j, %u, %U, %V, %w, %W, %Ou, %OU, %OV, %Ow, and %OW throw an exception. check_exception( - "formatting a weekday name needs a valid weekday", + "Formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{13}, 1}}); check_exception( - "formatting a weekday name needs a valid weekday", + "Formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{13}, 1}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}); check_exception( - "formatting a day of year needs a valid date", + "Formatting a day of year needs a valid date", SV("{:%j}"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 7}}); check_exception( - "formatting a day of year needs a valid date", + "Formatting a day of year needs a valid date", SV("{:%j}"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{13}, 1}}); check_exception( - "formatting a day of year needs a valid date", + "Formatting a day of year needs a valid date", SV("{:%j}"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}); check_exception( - "formatting a day of year needs a valid date", + "Formatting a day of year needs a valid date", SV("{:%j}"), std::chrono::year_month_weekday{ std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}); check_exception( - "formatting a weekday needs a valid weekday", + "Formatting a weekday needs a valid weekday", SV("{:%u}"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{13}, 1}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%U}"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 7}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%U}"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{13}, 1}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%U}"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%U}"), std::chrono::year_month_weekday{ std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%V}"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 7}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%V}"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{13}, 1}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%V}"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%V}"), std::chrono::year_month_weekday{ std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}); check_exception( - "formatting a weekday needs a valid weekday", + "Formatting a weekday needs a valid weekday", SV("{:%w}"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{13}, 1}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%W}"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 7}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%W}"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{13}, 1}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%W}"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}); check_exception( - "formatting a week of year needs a valid date", + "Formatting a week of year needs a valid date", SV("{:%W}"), std::chrono::year_month_weekday{ std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}); @@ -695,17 +695,17 @@ std::chrono::year{1970}, std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}); check_exception( - "Expected '%' or '}' in the chrono format-string", + "The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}); check_exception( - "The chrono-specs contains a '{'", + "The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}); check_exception( - "End of input while parsing the modifier chrono conversion-spec", + "End of input while parsing a conversion specifier", SV("{:%"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}); @@ -722,7 +722,7 @@ // Precision not allowed check_exception( - "Expected '%' or '}' in the chrono format-string", + "The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::year_month_weekday{ std::chrono::year{1970}, std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}); diff --git a/libcxx/test/std/time/time.syn/formatter.year_month_weekday_last.pass.cpp b/libcxx/test/std/time/time.syn/formatter.year_month_weekday_last.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.year_month_weekday_last.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.year_month_weekday_last.pass.cpp @@ -73,41 +73,41 @@ // Weekday name conversion check_exception( - "formatting a weekday name needs a valid weekday", + "Formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::year_month_weekday_last{ std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}); check_exception( - "formatting a weekday name needs a valid weekday", + "Formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::year_month_weekday_last{ std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}); // Weekday conversion check_exception( - "formatting a weekday needs a valid weekday", + "Formatting a weekday needs a valid weekday", SV("{:%u}"), std::chrono::year_month_weekday_last{ std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}); check_exception( - "formatting a weekday needs a valid weekday", + "Formatting a weekday needs a valid weekday", SV("{:%w}"), std::chrono::year_month_weekday_last{ std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}); check_exception( - "formatting a weekday needs a valid weekday", + "Formatting a weekday needs a valid weekday", SV("{:%Ou}"), std::chrono::year_month_weekday_last{ std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}); check_exception( - "formatting a weekday needs a valid weekday", + "Formatting a weekday needs a valid weekday", SV("{:%Ow}"), std::chrono::year_month_weekday_last{ std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}); // Day of year field check_exception( - "formatting a day of year needs a valid date", + "Formatting a day of year needs a valid date", SV("{:%j}"), std::chrono::year_month_weekday_last{ std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}); @@ -157,24 +157,24 @@ // Day of year field check_exception( - "formatting a day of year needs a valid date", + "Formatting a day of year needs a valid date", SV("{:%j}"), std::chrono::year_month_weekday_last{ std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{1}}}); // Month name conversion check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::year_month_weekday_last{ std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{1}}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::year_month_weekday_last{ std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{1}}}); check_exception( - "formatting a month name from an invalid month number", + "Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::year_month_weekday_last{ std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{1}}}); @@ -211,7 +211,7 @@ // Day of year field check_exception( - "formatting a day of year needs a valid date", + "Formatting a day of year needs a valid date", SV("{:%j}"), std::chrono::year_month_weekday_last{ std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{1}}}); 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 --- a/libcxx/test/std/utilities/format/format.functions/fill.unicode.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/fill.unicode.pass.cpp @@ -75,53 +75,55 @@ // Invalid Unicode Scalar Values if constexpr (std::same_as) { - check_exception("The format-spec contains malformed Unicode characters", SV("{:\xed\xa0\x80^}"), 42); // U+D800 - check_exception("The format-spec contains malformed Unicode characters", SV("{:\xed\xa0\xbf^}"), 42); // U+DBFF - check_exception("The format-spec contains malformed Unicode characters", SV("{:\xed\xbf\x80^}"), 42); // U+DC00 - check_exception("The format-spec contains malformed Unicode characters", SV("{:\xed\xbf\xbf^}"), 42); // U+DFFF + check_exception("The format specifier contains malformed Unicode characters", SV("{:\xed\xa0\x80^}"), 42); // U+D800 + check_exception("The format specifier contains malformed Unicode characters", SV("{:\xed\xa0\xbf^}"), 42); // U+DBFF + check_exception("The format specifier contains malformed Unicode characters", SV("{:\xed\xbf\x80^}"), 42); // U+DC00 + check_exception("The format specifier contains malformed Unicode characters", SV("{:\xed\xbf\xbf^}"), 42); // U+DFFF check_exception( - "The format-spec contains malformed Unicode characters", SV("{:\xf4\x90\x80\x80^}"), 42); // U+110000 + "The format specifier contains malformed Unicode characters", SV("{:\xf4\x90\x80\x80^}"), 42); // U+110000 check_exception( - "The format-spec contains malformed Unicode characters", SV("{:\xf4\x90\xbf\xbf^}"), 42); // U+11FFFF + "The format specifier contains malformed Unicode characters", SV("{:\xf4\x90\xbf\xbf^}"), 42); // U+11FFFF - check_exception("The format-spec contains malformed Unicode characters", + check_exception("The format specifier contains malformed Unicode characters", SV("{:\x80^}"), 42); // Trailing code unit with no leading one. - check_exception( - "The format-spec contains malformed Unicode characters", SV("{:\xc0^}"), 42); // Missing trailing code unit. - check_exception( - "The format-spec contains malformed Unicode characters", SV("{:\xe0\x80^}"), 42); // Missing trailing code unit. - check_exception("The format-spec contains malformed Unicode characters", + check_exception("The format specifier contains malformed Unicode characters", + SV("{:\xc0^}"), + 42); // Missing trailing code unit. + check_exception("The format specifier contains malformed Unicode characters", + SV("{:\xe0\x80^}"), + 42); // Missing trailing code unit. + check_exception("The format specifier contains malformed Unicode characters", SV("{:\xf0\x80^}"), 42); // Missing two trailing code units. - check_exception("The format-spec contains malformed Unicode characters", + check_exception("The format specifier contains malformed Unicode characters", SV("{:\xf0\x80\x80^}"), 42); // Missing trailing code unit. #ifndef TEST_HAS_NO_WIDE_CHARACTERS } else { # ifdef TEST_SHORT_WCHAR - check_exception("The format-spec contains malformed Unicode characters", std::wstring_view{L"{:\xd800^}"}, 42); - check_exception("The format-spec contains malformed Unicode characters", std::wstring_view{L"{:\xdbff^}"}, 42); - check_exception("The format-spec contains malformed Unicode characters", std::wstring_view{L"{:\xdc00^}"}, 42); - check_exception("The format-spec contains malformed Unicode characters", std::wstring_view{L"{:\xddff^}"}, 42); + check_exception("The format specifier contains malformed Unicode characters", std::wstring_view{L"{:\xd800^}"}, 42); + check_exception("The format specifier contains malformed Unicode characters", std::wstring_view{L"{:\xdbff^}"}, 42); + check_exception("The format specifier contains malformed Unicode characters", std::wstring_view{L"{:\xdc00^}"}, 42); + check_exception("The format specifier contains malformed Unicode characters", std::wstring_view{L"{:\xddff^}"}, 42); - check_exception("The format-spec contains malformed Unicode characters", + check_exception("The format specifier contains malformed Unicode characters", std::wstring_view{L"{:\xdc00\xd800^}"}, 42); // Reverted surrogates. # else // TEST_SHORT_WCHAR - check_exception("The fill character contains an invalid value", std::wstring_view{L"{:\xd800^}"}, 42); - check_exception("The fill character contains an invalid value", std::wstring_view{L"{:\xdbff^}"}, 42); - check_exception("The fill character contains an invalid value", std::wstring_view{L"{:\xdc00^}"}, 42); - check_exception("The fill character contains an invalid value", std::wstring_view{L"{:\xddff^}"}, 42); + check_exception("The fill option contains an invalid value", std::wstring_view{L"{:\xd800^}"}, 42); + check_exception("The fill option contains an invalid value", std::wstring_view{L"{:\xdbff^}"}, 42); + check_exception("The fill option contains an invalid value", std::wstring_view{L"{:\xdc00^}"}, 42); + check_exception("The fill option 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); + check_exception("The fill option contains an invalid value", std::wstring_view{L"{:\x00110000^}"}, 42); + check_exception("The fill option contains an invalid value", std::wstring_view{L"{:\x0011ffff^}"}, 42); # endif // TEST_SHORT_WCHAR #endif // TEST_HAS_NO_WIDE_CHARACTERS } 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 @@ -130,13 +130,13 @@ 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); + check_exception("The width option should not have a leading zero", SV("hello {:0}"), world); // *** width *** // Width 0 allowed, but not useful for string arguments. @@ -145,39 +145,39 @@ #ifdef _LIBCPP_VERSION // This limit isn't specified in the Standard. static_assert(std::__format::__number_max == 2'147'483'647, "Update the assert and the test."); - check_exception("The numeric value of the format-spec is too large", SV("{:2147483648}"), world); - check_exception("The numeric value of the format-spec is too large", SV("{:5000000000}"), world); - check_exception("The numeric value of the format-spec is too large", SV("{:10000000000}"), world); + check_exception("The numeric value of the format specifier is too large", SV("{:2147483648}"), world); + check_exception("The numeric value of the format specifier is too large", SV("{:5000000000}"), world); + check_exception("The numeric value of the format specifier is too large", SV("{:10000000000}"), world); #endif - check_exception("A format-spec arg-id replacement shouldn't have a negative value", SV("hello {:{}}"), world, -1); - check_exception("A format-spec arg-id replacement exceeds the maximum supported value", SV("hello {:{}}"), world, - unsigned(-1)); - check_exception("Argument index out of bounds", SV("hello {:{}}"), world); + check_exception("An argument index may not have a negative value", SV("hello {:{}}"), world, -1); + check_exception("The value of the argument index exceeds its maximum value", SV("hello {:{}}"), world, unsigned(-1)); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("hello {:{}}"), world); check_exception( "Replacement argument isn't a standard signed or unsigned integer type", SV("hello {:{}}"), world, universe); check_exception("Using manual argument numbering in automatic argument numbering mode", SV("hello {:{0}}"), world, 1); check_exception("Using automatic argument numbering in manual argument numbering mode", SV("hello {0:{}}"), world, 1); // Arg-id may not have leading zeros. - check_exception("Invalid arg-id", SV("hello {0:{01}}"), world, 1); + check_exception("The argument index is invalid", SV("hello {0:{01}}"), world, 1); // *** precision *** #ifdef _LIBCPP_VERSION // This limit isn't specified in the Standard. static_assert(std::__format::__number_max == 2'147'483'647, "Update the assert and the test."); - check_exception("The numeric value of the format-spec is too large", SV("{:.2147483648}"), world); - check_exception("The numeric value of the format-spec is too large", SV("{:.5000000000}"), world); - check_exception("The numeric value of the format-spec is too large", SV("{:.10000000000}"), world); + check_exception("The numeric value of the format specifier is too large", SV("{:.2147483648}"), world); + check_exception("The numeric value of the format specifier is too large", SV("{:.5000000000}"), world); + check_exception("The numeric value of the format specifier is too large", SV("{:.10000000000}"), world); #endif // Precision 0 allowed, but not useful for string arguments. check(SV("hello "), SV("hello {:.{}}"), world, 0); // Precision may have leading zeros. Secondly tests the value is still base 10. check(SV("hello 0123456789"), SV("hello {:.000010}"), STR("0123456789abcdef")); - check_exception("A format-spec arg-id replacement shouldn't have a negative value", SV("hello {:.{}}"), world, -1); - check_exception("A format-spec arg-id replacement exceeds the maximum supported value", SV("hello {:.{}}"), world, - ~0u); - check_exception("Argument index out of bounds", SV("hello {:.{}}"), world); + check_exception("An argument index may not have a negative value", SV("hello {:.{}}"), world, -1); + check_exception("The value of the argument index exceeds its maximum value", SV("hello {:.{}}"), world, ~0u); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("hello {:.{}}"), world); check_exception( "Replacement argument isn't a standard signed or unsigned integer type", SV("hello {:.{}}"), world, universe); check_exception("Using manual argument numbering in automatic argument numbering mode", SV("hello {:.{0}}"), world, @@ -185,10 +185,10 @@ check_exception("Using automatic argument numbering in manual argument numbering mode", SV("hello {0:.{}}"), world, 1); // Arg-id may not have leading zeros. - check_exception("Invalid arg-id", SV("hello {0:.{01}}"), world, 1); + check_exception("The argument index is invalid", 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 @@ -197,7 +197,7 @@ const char* valid_types = "s"; #endif for (const auto& fmt : invalid_types(valid_types)) - check_exception("The format-spec type has a type not supported for a string argument", fmt, world); + check_exception("The type option contains an invalid value for a string formatting argument", fmt, world); } template @@ -341,37 +341,38 @@ 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 @@ -449,16 +450,16 @@ 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 bool formatting argument", fmt, true); } template @@ -582,16 +583,20 @@ 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)); + + 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("{:.{}}"), I(0), true); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.{}}"), I(0), 1.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, I(0)); } template @@ -609,20 +614,26 @@ // *** 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)); + + 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("{:.{}c}"), I(0), true); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.{}c}"), I(0), 1.0); // *** locale-specific form *** // Note it has no effect but it's allowed. @@ -630,7 +641,7 @@ // *** 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(0)); // *** Validate range *** // The code has some duplications to keep the if statement readable. @@ -797,30 +808,34 @@ 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. @@ -834,7 +849,7 @@ 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 @@ -892,9 +907,9 @@ 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 @@ -906,7 +921,7 @@ 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, CharT('*')); } template @@ -2524,7 +2539,7 @@ // *** 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 @@ -2548,25 +2563,31 @@ check(SV("answer is ':0x0::'"), SV("answer is '{::^6}'"), 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_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), P(nullptr)); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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("{:.}"), nullptr); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.0}"), nullptr); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.42}"), nullptr); + + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.{}}"), nullptr); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.{}}"), nullptr, true); + check_exception("The format specifier should consume the input or end with a '}'", SV("{:.{}}"), nullptr, 1.0); // *** 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("p")) - 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 @@ -2594,7 +2615,7 @@ // *** type *** for (const auto& fmt : invalid_types("xXs")) - check_exception("The format-spec type has a type not supported for a status argument", fmt, status::foo); + check_exception("The type option contains an invalid value for a status formatting argument", fmt, status::foo); } template @@ -2668,7 +2689,6 @@ template void format_tests(TestFunction check, ExceptionTest check_exception) { // *** Test escaping *** - check(SV("{"), SV("{{")); check(SV("}"), SV("}}")); check(SV("{:^}"), SV("{{:^}}")); @@ -2727,10 +2747,10 @@ check_exception("The format string contains an invalid escape sequence", SV("{:}-}"), 42); check_exception("The format string contains an invalid escape sequence", SV("} ")); - check_exception("The arg-id of the format-spec starts with an invalid character", SV("{-"), 42); - check_exception("Argument index out of bounds", SV("hello {}")); - check_exception("Argument index out of bounds", SV("hello {0}")); - check_exception("Argument index out of bounds", SV("hello {1}"), 42); + check_exception("The argument index starts with an invalid character", SV("{-"), 42); + check_exception("The argument index value is too larger for the number of arguments supplied", SV("hello {}")); + check_exception("The argument index value is too larger for the number of arguments supplied", SV("hello {0}")); + check_exception("The argument index value is too larger for the number of arguments supplied", SV("hello {1}"), 42); // *** Test char format argument *** // The `char` to `wchar_t` formatting is tested separately. @@ -2778,7 +2798,6 @@ format_test_bool(check, check_exception); format_test_bool_as_integer(check, check_exception); } - // *** Test signed integral format argument *** check(SV("hello 42"), SV("hello {}"), static_cast(42)); check(SV("hello 42"), SV("hello {}"), static_cast(42)); @@ -2788,6 +2807,7 @@ #ifndef TEST_HAS_NO_INT128 check(SV("hello 42"), SV("hello {}"), static_cast<__int128_t>(42)); #endif + if constexpr (modus == execution_modus::full) format_test_signed_integer(check, check_exception); diff --git a/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.tests.h b/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.tests.h --- a/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.tests.h +++ b/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.tests.h @@ -41,37 +41,37 @@ check(SV("__{'a': 'A', 'b': 'B', 'c': 'C'}___"), SV("{:_^{}}"), input, 35); check(SV("#####{'a': 'A', 'b': 'B', 'c': 'C'}"), SV("{:#>{}}"), input, 35); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__'a': 'A', 'b': 'B', 'c': 'C'___"), SV("{:_^33n}"), input); // *** type *** check(SV("__{'a': 'A', 'b': 'B', 'c': 'C'}___"), SV("{:_^35m}"), input); // the m type does the same as the default. - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec @@ -85,43 +85,45 @@ check(SV("{__'a': 'A'___, __'b': 'B'___, __'c': 'C'___}"), SV("{::_^{}}"), input, 13); check(SV("{#####'a': 'A', #####'b': 'B', #####'c': 'C'}"), SV("{::#>{}}"), input, 13); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{:::<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{::05}"), 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 *** check(SV("{'a': 'A', 'b': 'B', 'c': 'C'}"), SV("{::m}"), input); check(SV("{'a': 'A', 'b': 'B', 'c': 'C'}"), SV("{::n}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Both have a format-spec check(SV("^^{###'a': 'A', ###'b': 'B', ###'c': 'C'}^^^"), SV("{:^^44:#>11}"), input); check(SV("^^{###'a': 'A', ###'b': 'B', ###'c': 'C'}^^^"), SV("{:^^{}:#>11}"), input, 44); check(SV("^^{###'a': 'A', ###'b': 'B', ###'c': 'C'}^^^"), SV("{:^^{}:#>{}}"), input, 44, 11); - check_exception("Argument index out of bounds", SV("{:^^{}:#>11}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 44); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>11}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 44); } // @@ -149,37 +151,37 @@ check(SV("__{'a': 'A', 'b': 'B', 'c': 'C'}___"), SV("{:_^{}}"), input, 35); check(SV("#####{'a': 'A', 'b': 'B', 'c': 'C'}"), SV("{:#>{}}"), input, 35); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__'a': 'A', 'b': 'B', 'c': 'C'___"), SV("{:_^33n}"), input); // *** type *** check(SV("__{'a': 'A', 'b': 'B', 'c': 'C'}___"), SV("{:_^35m}"), input); // the m type does the same as the default. - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("{'a': 'A' , 'b': 'B' , 'c': 'C' }"), SV("{::13}"), input); @@ -192,43 +194,45 @@ check(SV("{__'a': 'A'___, __'b': 'B'___, __'c': 'C'___}"), SV("{::_^{}}"), input, 13); check(SV("{#####'a': 'A', #####'b': 'B', #####'c': 'C'}"), SV("{::#>{}}"), input, 13); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{:::<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{::05}"), 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 *** check(SV("{'a': 'A', 'b': 'B', 'c': 'C'}"), SV("{::m}"), input); check(SV("{'a': 'A', 'b': 'B', 'c': 'C'}"), SV("{::n}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Both have a format-spec check(SV("^^{###'a': 'A', ###'b': 'B', ###'c': 'C'}^^^"), SV("{:^^44:#>11}"), input); check(SV("^^{###'a': 'A', ###'b': 'B', ###'c': 'C'}^^^"), SV("{:^^{}:#>11}"), input, 44); check(SV("^^{###'a': 'A', ###'b': 'B', ###'c': 'C'}^^^"), SV("{:^^{}:#>{}}"), input, 44, 11); - check_exception("Argument index out of bounds", SV("{:^^{}:#>11}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 44); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>11}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 44); } #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS @@ -255,37 +259,37 @@ check(SV("__{false: 0, true: 42, true: 1}___"), SV("{:_^{}}"), input, 34); check(SV("#####{false: 0, true: 42, true: 1}"), SV("{:#>{}}"), input, 34); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__false: 0, true: 42, true: 1___"), SV("{:_^32n}"), input); // *** type *** check(SV("__{false: 0, true: 42, true: 1}___"), SV("{:_^34m}"), input); // the m type does the same as the default. - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("{false: 0 , true: 42 , true: 1 }"), SV("{::10}"), input); @@ -298,38 +302,40 @@ check(SV("{_false: 0_, _true: 42_, _true: 1__}"), SV("{::_^{}}"), input, 10); check(SV("{##false: 0, ##true: 42, ###true: 1}"), SV("{::#>{}}"), input, 10); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{:::<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{::05}"), 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("")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Both have a format-spec check(SV("^^{##false: 0, ##true: 42, ###true: 1}^^^"), SV("{:^^41:#>10}"), input); check(SV("^^{##false: 0, ##true: 42, ###true: 1}^^^"), SV("{:^^{}:#>10}"), input, 41); check(SV("^^{##false: 0, ##true: 42, ###true: 1}^^^"), SV("{:^^{}:#>{}}"), input, 41, 10); - check_exception("Argument index out of bounds", SV("{:^^{}:#>10}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 41); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>10}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 41); } // @@ -353,37 +359,37 @@ check(SV("__{-42: 42, 1: -1, 42: -42}___"), SV("{:_^{}}"), input, 30); check(SV("#####{-42: 42, 1: -1, 42: -42}"), SV("{:#>{}}"), input, 30); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__-42: 42, 1: -1, 42: -42___"), SV("{:_^28n}"), input); // *** type *** check(SV("__{-42: 42, 1: -1, 42: -42}___"), SV("{:_^30m}"), input); // the m type does the same as the default. - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("{-42: 42 , 1: -1 , 42: -42 }"), SV("{::10}"), input); @@ -396,38 +402,40 @@ check(SV("{_-42: 42__, __1: -1___, _42: -42__}"), SV("{::_^{}}"), input, 10); check(SV("{###-42: 42, #####1: -1, ###42: -42}"), SV("{::#>{}}"), input, 10); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{:::<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{::05}"), 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("")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Both have a format-spec check(SV("^^{###-42: 42, #####1: -1, ###42: -42}^^^"), SV("{:^^41:#>10}"), input); check(SV("^^{###-42: 42, #####1: -1, ###42: -42}^^^"), SV("{:^^{}:#>10}"), input, 41); check(SV("^^{###-42: 42, #####1: -1, ###42: -42}^^^"), SV("{:^^{}:#>{}}"), input, 41, 10); - check_exception("Argument index out of bounds", SV("{:^^{}:#>10}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 41); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>10}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 41); } template @@ -458,37 +466,37 @@ check(SV("__{-42: 42, 1: -1}___"), SV("{:_^{}}"), input, 21); check(SV("#####{-42: 42, 1: -1}"), SV("{:#>{}}"), input, 21); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__-42: 42, 1: -1___"), SV("{:_^19n}"), input); // *** type *** check(SV("__{-42: 42, 1: -1}___"), SV("{:_^21m}"), input); // the m type does the same as the default. - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("{-42: 42 , 1: -1 }"), SV("{::10}"), input); @@ -501,38 +509,40 @@ check(SV("{_-42: 42__, __1: -1___}"), SV("{::_^{}}"), input, 10); check(SV("{###-42: 42, #####1: -1}"), SV("{::#>{}}"), input, 10); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{:::<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{::05}"), 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("")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Both have a format-spec check(SV("^^{###-42: 42, #####1: -1}^^^"), SV("{:^^29:#>10}"), input); check(SV("^^{###-42: 42, #####1: -1}^^^"), SV("{:^^{}:#>10}"), input, 29); check(SV("^^{###-42: 42, #####1: -1}^^^"), SV("{:^^{}:#>{}}"), input, 29, 10); - check_exception("Argument index out of bounds", SV("{:^^{}:#>10}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 29); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>10}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 29); } // @@ -558,35 +568,35 @@ check(SV("__{0x0: 0x0}___"), SV("{:_^{}}"), input, 15); check(SV("#####{0x0: 0x0}"), SV("{:#>{}}"), input, 15); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__0x0: 0x0___"), SV("{:_^13n}"), input); // *** type *** check(SV("__{0x0: 0x0}___"), SV("{:_^15m}"), input); // the m type does the same as the default. - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("{0x0: 0x0 }"), SV("{::13}"), input); @@ -599,38 +609,40 @@ check(SV("{__0x0: 0x0___}"), SV("{::_^{}}"), input, 13); check(SV("{#####0x0: 0x0}"), SV("{::#>{}}"), input, 13); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{:::<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{::05}"), 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("")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Both have a format-spec check(SV("^^{###0x0: 0x0}^^^"), SV("{:^^18:#>11}"), input); check(SV("^^{###0x0: 0x0}^^^"), SV("{:^^{}:#>11}"), input, 18); check(SV("^^{###0x0: 0x0}^^^"), SV("{:^^{}:#>{}}"), input, 18, 11); - check_exception("Argument index out of bounds", SV("{:^^{}:#>11}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 18); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>11}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 18); } // @@ -657,35 +669,35 @@ check(SV(R"(__{"hello": "HELLO", "world": "WORLD"}___)"), SV("{:_^{}}"), input, 41); check(SV(R"(#####{"hello": "HELLO", "world": "WORLD"})"), SV("{:#>{}}"), input, 41); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV(R"(__"hello": "HELLO", "world": "WORLD"___)"), SV("{:_^39n}"), input); // *** type *** check(SV(R"(__{"hello": "HELLO", "world": "WORLD"}___)"), SV("{:_^41m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV(R"({"hello": "HELLO" , "world": "WORLD" })"), SV("{::21}"), input); @@ -698,30 +710,30 @@ check(SV(R"({__"hello": "HELLO"___, __"world": "WORLD"___})"), SV("{::_^{}}"), input, 21); check(SV(R"({#####"hello": "HELLO", #####"world": "WORLD"})"), SV("{::#>{}}"), input, 21); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{:::<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{::05}"), 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("")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Both have a format-spec @@ -729,8 +741,10 @@ check(SV(R"(^^{#####"hello": "HELLO", #####"world": "WORLD"}^^^)"), SV("{:^^{}:#>21}"), input, 51); check(SV(R"(^^{#####"hello": "HELLO", #####"world": "WORLD"}^^^)"), SV("{:^^{}:#>{}}"), input, 51, 21); - check_exception("Argument index out of bounds", SV("{:^^{}:#>21}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 51); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>21}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 51); } // @@ -756,34 +770,34 @@ check(SV("__{0xaa55: 0xaaaa, 0xaa55: 0x5555}___"), SV("{:_^{}}"), input, 37); check(SV("#####{0xaa55: 0xaaaa, 0xaa55: 0x5555}"), SV("{:#>{}}"), input, 37); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__0xaa55: 0xaaaa, 0xaa55: 0x5555___"), SV("{:_^35n}"), input); // *** type *** check(SV("__{0xaa55: 0xaaaa, 0xaa55: 0x5555}___"), SV("{:_^37}"), input); // the m type does the same as the default. - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); // Underlying can't have a format-spec } 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 --- 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 @@ -48,32 +48,32 @@ check(SV("__{'a', 'b', 'c'}___"), SV("{:_^{}}"), input, 20); check(SV("#####{'a', 'b', 'c'}"), SV("{:#>{}}"), input, 20); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__'a', 'b', 'c'___"), SV("{:_^18n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); // ***** Only underlying has a format-spec check(SV("{a , b , c }"), SV("{::4}"), input); @@ -86,45 +86,47 @@ check(SV("{_a__, _b__, _c__}"), SV("{::_^{}}"), input, 4); check(SV("{:::a, :::b, :::c}"), SV("{:::>{}}"), input, 4); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); check(SV("^^{:a, :b, :c}^^^"), SV("{:^^{}::>2}"), input, 17); check(SV("^^{:a, :b, :c}^^^"), SV("{:^^{}::>{}}"), input, 17, 2); - check_exception("Argument index out of bounds", SV("{:^^{}::>2}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 17); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>2}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 17); } // A set can be written as a string, based on @@ -150,37 +152,37 @@ check(SV("_abc__"), SV("{:_^{}s}"), input, 6); check(SV("###abc"), SV("{:#>{}s}"), input, 6); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:} 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); @@ -209,32 +211,32 @@ check(SV(R"(_"abc"__)"), SV("{:_^{}?s}"), input, 8); check(SV(R"(###"abc")"), SV("{:#>{}?s}"), input, 8); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}{}}"), input, 20); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__'a', 'b', 'c'___"), SV("{:_^18n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); // ***** Only underlying has a format-spec check(SV("{a , b , c }"), SV("{::4}"), input); @@ -319,45 +321,47 @@ check(SV("{_a__, _b__, _c__}"), SV("{::_^{}}"), input, 4); check(SV("{:::a, :::b, :::c}"), SV("{:::>{}}"), input, 4); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); check(SV("^^{:a, :b, :c}^^^"), SV("{:^^{}::>2}"), input, 17); check(SV("^^{:a, :b, :c}^^^"), SV("{:^^{}::>{}}"), input, 17, 2); - check_exception("Argument index out of bounds", SV("{:^^{}::>2}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 17); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>2}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 17); // The types s and ?s may only be used when using range_formatter // where the types T and charT are the same. This means this can't be used for @@ -365,8 +369,8 @@ // debug-enabled specialization. using CharT = wchar_t; - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); } #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS @@ -393,37 +397,37 @@ check(SV("__{false, true}___"), SV("{:_^{}}"), input, 18); check(SV("#####{false, true}"), SV("{:#>{}}"), input, 18); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__false, true___"), SV("{:_^16n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("{false , true }"), SV("{::7}"), input); @@ -436,45 +440,47 @@ check(SV("{_false_, _true__}"), SV("{::_^{}}"), input, 7); check(SV("{::false, :::true}"), SV("{:::>{}}"), input, 7); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); check(SV("^^{::false, :::true}^^^"), SV("{:^^{}::>7}"), input, 23); check(SV("^^{::false, :::true}^^^"), SV("{:^^{}::>{}}"), input, 23, 7); - check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 23); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>5}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 23); } template @@ -496,37 +502,37 @@ check(SV("__{true, true, false}___"), SV("{:_^{}}"), input, 24); check(SV("#####{true, true, false}"), SV("{:#>{}}"), input, 24); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__true, true, false___"), SV("{:_^22n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("{true , true , false }"), SV("{::7}"), input); @@ -539,45 +545,47 @@ check(SV("{_true__, _true__, _false_}"), SV("{::_^{}}"), input, 7); check(SV("{:::true, :::true, ::false}"), SV("{:::>{}}"), input, 7); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); check(SV("^^{:::true, :::true, ::false}^^^"), SV("{:^^{}::>7}"), input, 32); check(SV("^^{:::true, :::true, ::false}^^^"), SV("{:^^{}::>{}}"), input, 32, 7); - check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 32); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>5}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 32); } // @@ -601,37 +609,37 @@ check(SV("__{-42, 1, 2, 42}___"), SV("{:_^{}}"), input, 20); check(SV("#####{-42, 1, 2, 42}"), SV("{:#>{}}"), input, 20); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__-42, 1, 2, 42___"), SV("{:_^18n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("{ -42, 1, 2, 42}"), SV("{::5}"), input); @@ -644,8 +652,8 @@ check(SV("{_-42_, __1__, __2__, _42__}"), SV("{::_^{}}"), input, 5); check(SV("{::-42, ::::1, ::::2, :::42}"), SV("{:::>{}}"), input, 5); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", SV("{::{<}"), input); // *** sign *** check(SV("{-42, 1, 2, 42}"), SV("{::-}"), input); @@ -661,22 +669,24 @@ 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); check(SV("^^{::-42, ::::1, ::::2, :::42}^^^"), SV("{:^^{}::>5}"), input, 33); check(SV("^^{::-42, ::::1, ::::2, :::42}^^^"), SV("{:^^{}::>{}}"), input, 33, 5); - check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 33); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>5}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 33); } template @@ -706,37 +716,37 @@ check(SV("__{-42.5, 0, 1.25, 42.5}___"), SV("{:_^{}}"), input, 27); check(SV("#####{-42.5, 0, 1.25, 42.5}"), SV("{:#>{}}"), input, 27); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__-42.5, 0, 1.25, 42.5___"), SV("{:_^25n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("{-42.5, 0, 1.25, 42.5}"), SV("{::5}"), input); @@ -749,8 +759,8 @@ check(SV("{-42.5, __0__, 1.25_, 42.5_}"), SV("{::_^{}}"), input, 5); check(SV("{-42.5, ::::0, :1.25, :42.5}"), SV("{:::>{}}"), input, 5); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", SV("{::{<}"), input); // *** sign *** check(SV("{-42.5, 0, 1.25, 42.5}"), SV("{::-}"), input); @@ -771,7 +781,7 @@ check(SV("{-42, 0, 1.2, 42}"), SV("{::.{}}"), input, 2); check(SV("{-42.500, 0.000, 1.250, 42.500}"), SV("{::.{}f}"), input, 3); - check_exception("The format-spec precision field doesn't contain a value or arg-id", SV("{::.}"), input); + check_exception("The precision option does not contain a value or argument index", SV("{::.}"), input); // *** locale-specific form *** check(SV("{-42.5, 0, 1.25, 42.5}"), SV("{::L}"), input); // does not require locales present @@ -790,7 +800,7 @@ // *** 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); @@ -802,9 +812,16 @@ check(SV("^^{::-42, ::::0, ::1.2, :::42}^^^"), SV("{:^^{}::>{}.2}"), input, 33, 5); check(SV("^^{::-42, ::::0, ::1.2, :::42}^^^"), SV("{:^^{}::>{}.{}}"), input, 33, 5, 2); - check_exception("Argument index out of bounds", SV("{:^^{}::>5.2}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}.2}"), input, 33); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}.{}}"), input, 33, 5); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>5.2}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}.2}"), input, 33); + check_exception( + "The argument index value is too larger for the number of arguments supplied", + SV("{:^^{}::>{}.{}}"), + input, + 33, + 5); } template @@ -835,35 +852,35 @@ check(SV("__{0x0}___"), SV("{:_^{}}"), input, 10); check(SV("#####{0x0}"), SV("{:#>{}}"), input, 10); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("_0x0_"), SV("{:_^5n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("{ 0x0}"), SV("{::5}"), input); @@ -876,27 +893,27 @@ check(SV("{_0x0_}"), SV("{::_^{}}"), input, 5); check(SV("{::0x0}"), SV("{:::>{}}"), input, 5); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); + check_exception("The width option should not have a leading zero", SV("{::05}"), 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("p")) - 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); @@ -907,8 +924,10 @@ check(SV("^^{::0x0}^^^"), SV("{:^^{}::>5}"), input, 12); check(SV("^^{::0x0}^^^"), SV("{:^^{}::>{}}"), input, 12, 5); - check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 12); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>5}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 12); } template @@ -939,35 +958,35 @@ check(SV(R"(__{"Hello", "world"}___)"), SV("{:_^{}}"), input, 23); check(SV(R"(#####{"Hello", "world"})"), SV("{:#>{}}"), input, 23); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV(R"(_"Hello", "world"_)"), SV("{:_^18n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV(R"({Hello , world })"), SV("{::8}"), input); @@ -980,31 +999,31 @@ check(SV(R"({_Hello__, _world__})"), SV("{::_^{}}"), input, 8); check(SV(R"({:::Hello, :::world})"), SV("{:::>{}}"), input, 8); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); + check_exception("The width option should not have a leading zero", SV("{::05}"), input); // *** precision *** check(SV(R"({Hel, wor})"), SV("{::.3}"), input); check(SV(R"({Hel, wor})"), SV("{::.{}}"), input, 3); - check_exception("The format-spec precision field doesn't contain a value or arg-id", SV("{::.}"), input); + check_exception("The precision option does not contain a value or argument index", 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?")) - check_exception("The format-spec type has a type not supported for a string argument", fmt, input); + check_exception("The type option contains an invalid value for a string formatting argument", fmt, input); // ***** Both have a format-spec check(SV(R"(^^{:::Hello, :::world}^^^)"), SV("{:^^25::>8}"), input); @@ -1015,8 +1034,10 @@ check(SV(R"(^^{:::Hello, :::world}^^^)"), SV("{:^^{}::>8}"), input, 25); check(SV(R"(^^{:::Hello, :::world}^^^)"), SV("{:^^{}::>{}}"), input, 25, 8); - check_exception("Argument index out of bounds", SV("{:^^{}::>8}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 25); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>8}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 25); } template @@ -1048,40 +1069,40 @@ check(SV("__{0x5555, 0xaa55, 0xaaaa}___"), SV("{:_^{}}"), input, 29); check(SV("#####{0x5555, 0xaa55, 0xaaaa}"), SV("{:#>{}}"), input, 29); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__0x5555, 0xaa55, 0xaaaa___"), SV("{:_^27n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec - check_exception("The format-spec type has a type not supported for a status argument", SV("{::*<7}"), input); + check_exception("The type option contains an invalid value for a status formatting argument", SV("{::*<7}"), input); check(SV("{0x5555, 0xaa55, 0xaaaa}"), SV("{::x}"), input); check(SV("{0X5555, 0XAA55, 0XAAAA}"), SV("{::X}"), input); @@ -1091,7 +1112,8 @@ check(SV("^^{0X5555, 0XAA55, 0XAAAA}^^^"), SV("{:^^29:X}"), input); check(SV("^^{0X5555, 0XAA55, 0XAAAA}^^^"), SV("{:^^{}:X}"), input, 29); - check_exception("Argument index out of bounds", SV("{:^^{}:X}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:X}"), input); } // @@ -1115,26 +1137,26 @@ check(SV("__{(1, 'a'), (42, '*')}___"), SV("{:_^{}}"), input, 26); check(SV("#####{(1, 'a'), (42, '*')}"), SV("{:#>{}}"), input, 26); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__(1, 'a'), (42, '*')___"), SV("{:_^24n}"), input); @@ -1142,11 +1164,11 @@ // *** type *** check(SV("__{(1, 'a'), (42, '*')}___"), SV("{:_^26m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("{(1, 'a') , (42, '*') }"), SV("{::11}"), input); @@ -1159,35 +1181,35 @@ check(SV("{_(1, 'a')__, _(42, '*')_}"), SV("{::_^{}}"), input, 11); check(SV("{###(1, 'a'), ##(42, '*')}"), SV("{::#>{}}"), input, 11); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{:::<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{::05}"), 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 *** check(SV("{1: 'a', 42: '*'}"), SV("{::m}"), input); check(SV("{1, 'a', 42, '*'}"), SV("{::n}"), input); - check_exception("The format-spec should consume the input or end with a '}'", SV("{::s}"), input); - check_exception("The format-spec should consume the input or end with a '}'", SV("{::?s}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::s}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::?s}"), input); for (std::basic_string_view fmt : fmt_invalid_nested_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Both have a format-spec check(SV("^^{###(1, 'a'), ##(42, '*')}^^^"), SV("{:^^31:#>11}"), input); @@ -1195,8 +1217,10 @@ check(SV("^^{###(1, 'a'), ##(42, '*')}^^^"), SV("{:^^{}:#>11}"), input, 31); check(SV("^^{###(1, 'a'), ##(42, '*')}^^^"), SV("{:^^{}:#>{}}"), input, 31, 11); - check_exception("Argument index out of bounds", SV("{:^^{}:#>5}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 31); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>5}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 31); check(SV("1: 'a', 42: '*'"), SV("{:n:m}"), input); check(SV("1, 'a', 42, '*'"), SV("{:n:n}"), input); @@ -1235,37 +1259,37 @@ check(SV("__{(42), (99)}___"), SV("{:_^{}}"), input, 17); check(SV("#####{(42), (99)}"), SV("{:#>{}}"), input, 17); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__(42), (99)___"), SV("{:_^15n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("{(42) , (99) }"), SV("{::7}"), input); @@ -1278,35 +1302,35 @@ check(SV("{_(42)__, _(99)__}"), SV("{::_^{}}"), input, 7); check(SV("{###(42), ###(99)}"), SV("{::#>{}}"), input, 7); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{:::<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{::05}"), 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 *** check(SV("{42, 99}"), SV("{::n}"), input); - check_exception("The format specifier m requires a pair or a two-element tuple", SV("{::m}"), input); - check_exception("The format-spec should consume the input or end with a '}'", SV("{::s}"), input); - check_exception("The format-spec should consume the input or end with a '}'", SV("{::?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{::m}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::s}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::?s}"), input); for (std::basic_string_view fmt : fmt_invalid_nested_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Both have a format-spec check(SV("^^{###(42), ###(99)}^^^"), SV("{:^^23:#>7}"), input); @@ -1314,8 +1338,10 @@ check(SV("^^{###(42), ###(99)}^^^"), SV("{:^^{}:#>7}"), input, 23); check(SV("^^{###(42), ###(99)}^^^"), SV("{:^^{}:#>{}}"), input, 23, 7); - check_exception("Argument index out of bounds", SV("{:^^{}:#>5}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 23); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>5}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 23); } // @@ -1341,37 +1367,37 @@ check(SV("__{(1, 10, 100), (42, 99, 0)}___"), SV("{:_^{}}"), input, 32); check(SV("#####{(1, 10, 100), (42, 99, 0)}"), SV("{:#>{}}"), input, 32); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__(1, 10, 100), (42, 99, 0)___"), SV("{:_^30n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("{(1, 10, 100) , (42, 99, 0) }"), SV("{::14}"), input); @@ -1384,35 +1410,35 @@ check(SV("{_(1, 10, 100)_, _(42, 99, 0)__}"), SV("{::_^{}}"), input, 14); check(SV("{##(1, 10, 100), ###(42, 99, 0)}"), SV("{::#>{}}"), input, 14); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{:::<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{::05}"), 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 *** check(SV("{1, 10, 100, 42, 99, 0}"), SV("{::n}"), input); - check_exception("The format specifier m requires a pair or a two-element tuple", SV("{::m}"), input); - check_exception("The format-spec should consume the input or end with a '}'", SV("{::s}"), input); - check_exception("The format-spec should consume the input or end with a '}'", SV("{::?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{::m}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::s}"), input); + check_exception("The format specifier should consume the input or end with a '}'", SV("{::?s}"), input); for (std::basic_string_view fmt : fmt_invalid_nested_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Both have a format-spec check(SV("^^{##(1, 10, 100), ###(42, 99, 0)}^^^"), SV("{:^^37:#>14}"), input); @@ -1420,8 +1446,10 @@ check(SV("^^{##(1, 10, 100), ###(42, 99, 0)}^^^"), SV("{:^^{}:#>14}"), input, 37); check(SV("^^{##(1, 10, 100), ###(42, 99, 0)}^^^"), SV("{:^^{}:#>{}}"), input, 37, 14); - check_exception("Argument index out of bounds", SV("{:^^{}:#>5}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 37); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>5}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 37); } // 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 --- 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 @@ -71,17 +71,17 @@ check(SV("__hello___"), SV("{:_^{}}"), input, 10); check(SV(":::::hello"), SV("{::>{}}"), input, 10); - check_exception("The format-spec fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), input); // *** precision *** check(SV("hel"), SV("{:.3}"), input); @@ -91,13 +91,13 @@ 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); check(SV("\"hello\""), SV("{:?}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s?")) - check_exception("The format-spec type has a type not supported for a string argument", fmt, input); + check_exception("The type option contains an invalid value for a string formatting argument", fmt, input); } template @@ -131,35 +131,35 @@ check(SV(R"(__[Hello, world]___)"), SV("{:_^{}}"), input, 19); check(SV(R"(#####[Hello, world])"), SV("{:#>{}}"), input, 19); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV(R"(_Hello, world_)"), SV("{:_^14n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV(R"([Hello , world ])"), SV("{::8}"), input); @@ -172,31 +172,31 @@ check(SV(R"([_Hello__, _world__])"), SV("{::_^{}}"), input, 8); check(SV(R"([:::Hello, :::world])"), SV("{:::>{}}"), input, 8); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); + check_exception("The width option should not have a leading zero", SV("{::05}"), input); // *** precision *** check(SV(R"([Hel, wor])"), SV("{::.3}"), input); check(SV(R"([Hel, wor])"), SV("{::.{}}"), input, 3); - check_exception("The format-spec precision field doesn't contain a value or arg-id", SV("{::.}"), input); + check_exception("The precision option does not contain a value or argument index", 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?")) - check_exception("The format-spec type has a type not supported for a string argument", fmt, input); + check_exception("The type option contains an invalid value for a string formatting argument", fmt, input); // ***** Both have a format-spec check(SV(R"(^^[:::Hello, :::world]^^^)"), SV("{:^^25::>8}"), input); @@ -207,8 +207,10 @@ check(SV(R"(^^[:::Hello, :::world]^^^)"), SV("{:^^{}::>8}"), input, 25); check(SV(R"(^^[:::Hello, :::world]^^^)"), SV("{:^^{}::>{}}"), input, 25, 8); - check_exception("Argument index out of bounds", SV("{:^^{}::>8}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 25); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>8}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 25); } template @@ -256,17 +258,17 @@ check(SV("__\"hello\"___"), SV("{:_^{}}"), input, 12); check(SV(":::::\"hello\""), SV("{::>{}}"), input, 12); - check_exception("The format-spec fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), input); // *** precision *** check(SV("\"he"), SV("{:.3}"), input); @@ -276,13 +278,13 @@ 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 check(SV("\"hello\""), SV("{:?}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s?")) - check_exception("The format-spec type has a type not supported for a string argument", fmt, input); + check_exception("The type option contains an invalid value for a string formatting argument", fmt, input); } template @@ -317,35 +319,35 @@ check(SV(R"(__["Hello", "world"]___)"), SV("{:_^{}}"), input, 23); check(SV(R"(#####["Hello", "world"])"), SV("{:#>{}}"), input, 23); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV(R"(_"Hello", "world"_)"), SV("{:_^18n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV(R"(["Hello" , "world" ])"), SV("{::10}"), input); @@ -358,31 +360,31 @@ check(SV(R"([_"Hello"__, _"world"__])"), SV("{::_^{}}"), input, 10); check(SV(R"([:::"Hello", :::"world"])"), SV("{:::>{}}"), input, 10); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); + check_exception("The width option should not have a leading zero", SV("{::05}"), input); // *** precision *** check(SV(R"(["He, "wo])"), SV("{::.3}"), input); check(SV(R"(["He, "wo])"), SV("{::.{}}"), input, 3); - check_exception("The format-spec precision field doesn't contain a value or arg-id", SV("{::.}"), input); + check_exception("The precision option does not contain a value or argument index", 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?")) - check_exception("The format-spec type has a type not supported for a string argument", fmt, input); + check_exception("The type option contains an invalid value for a string formatting argument", fmt, input); // ***** Both have a format-spec check(SV(R"(^^[:::"Hello", :::"world"]^^^)"), SV("{:^^29::>10}"), input); @@ -393,8 +395,10 @@ check(SV(R"(^^[:::"Hello", :::"world"]^^^)"), SV("{:^^{}::>10}"), input, 29); check(SV(R"(^^[:::"Hello", :::"world"]^^^)"), SV("{:^^{}::>{}}"), input, 29, 10); - check_exception("Argument index out of bounds", SV("{:^^{}::>10}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 29); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>10}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 29); } template 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 --- 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 @@ -53,34 +53,34 @@ check(SV("__['H', 'e', 'l', 'l', 'o']___"), SV("{:_^{}}"), input, 30); check(SV("#####['H', 'e', 'l', 'l', 'o']"), SV("{:#>{}}"), input, 30); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__'H', 'e', 'l', 'l', 'o'___"), SV("{:_^28n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("[H , e , l , l , o ]"), SV("{::4}"), input); @@ -93,45 +93,47 @@ check(SV("[_H__, _e__, _l__, _l__, _o__]"), SV("{::_^{}}"), input, 4); check(SV("[:::H, :::e, :::l, :::l, :::o]"), SV("{:::>{}}"), input, 4); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); check(SV("^^[:H, :e, :l, :l, :o]^^^"), SV("{:^^{}::>2}"), input, 25); check(SV("^^[:H, :e, :l, :l, :o]^^^"), SV("{:^^{}::>{}}"), input, 25, 2); - check_exception("Argument index out of bounds", SV("{:^^{}::>2}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 25); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>2}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 25); } template @@ -151,37 +153,37 @@ check(SV("_Hello__"), SV("{:_^{}s}"), input, 8); check(SV("###Hello"), SV("{:#>{}s}"), input, 8); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:} 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); @@ -204,32 +206,32 @@ check(SV(R"(_"\"Hello'"__)"), SV("{:_^{}?s}"), input, 13); check(SV(R"(###"\"Hello'")"), SV("{:#>{}?s}"), input, 13); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}{}}"), input, 24); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__true, true, false___"), SV("{:_^22n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("[true , true , false ]"), SV("{::7}"), input); @@ -351,45 +351,47 @@ check(SV("[_true__, _true__, _false_]"), SV("{::_^{}}"), input, 7); check(SV("[:::true, :::true, ::false]"), SV("{:::>{}}"), input, 7); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); check(SV("^^[:::true, :::true, ::false]^^^"), SV("{:^^{}::>7}"), input, 32); check(SV("^^[:::true, :::true, ::false]^^^"), SV("{:^^{}::>{}}"), input, 32, 7); - check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 32); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>5}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 32); } // @@ -413,36 +415,36 @@ check(SV("__[1, 2, 42, -42]___"), SV("{:_^{}}"), input, 20); check(SV("#####[1, 2, 42, -42]"), SV("{:#>{}}"), input, 20); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__1, 2, 42, -42___"), SV("{:_^18n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("[ 1, 2, 42, -42]"), SV("{::5}"), input); @@ -455,8 +457,8 @@ check(SV("[__1__, __2__, _42__, _-42_]"), SV("{::_^{}}"), input, 5); check(SV("[::::1, ::::2, :::42, ::-42]"), SV("{:::>{}}"), input, 5); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", SV("{::{<}"), input); // *** sign *** check(SV("[1, 2, 42, -42]"), SV("{::-}"), input); @@ -472,22 +474,24 @@ 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); check(SV("^^[::::1, ::::2, :::42, ::-42]^^^"), SV("{:^^{}::>5}"), input, 33); check(SV("^^[::::1, ::::2, :::42, ::-42]^^^"), SV("{:^^{}::>{}}"), input, 33, 5); - check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 33); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>5}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 33); } template @@ -520,36 +524,36 @@ check(SV("__[-42.5, 0, 1.25, 42.5]___"), SV("{:_^{}}"), input, 27); check(SV("#####[-42.5, 0, 1.25, 42.5]"), SV("{:#>{}}"), input, 27); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__-42.5, 0, 1.25, 42.5___"), SV("{:_^25n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("[-42.5, 0, 1.25, 42.5]"), SV("{::5}"), input); @@ -562,8 +566,8 @@ check(SV("[-42.5, __0__, 1.25_, 42.5_]"), SV("{::_^{}}"), input, 5); check(SV("[-42.5, ::::0, :1.25, :42.5]"), SV("{:::>{}}"), input, 5); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", SV("{::{<}"), input); // *** sign *** check(SV("[-42.5, 0, 1.25, 42.5]"), SV("{::-}"), input); @@ -584,7 +588,7 @@ check(SV("[-42, 0, 1.2, 42]"), SV("{::.{}}"), input, 2); check(SV("[-42.500, 0.000, 1.250, 42.500]"), SV("{::.{}f}"), input, 3); - check_exception("The format-spec precision field doesn't contain a value or arg-id", SV("{::.}"), input); + check_exception("The precision option does not contain a value or argument index", SV("{::.}"), input); // *** locale-specific form *** check(SV("[-42.5, 0, 1.25, 42.5]"), SV("{::L}"), input); // does not require locales present @@ -603,7 +607,7 @@ // *** 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); @@ -615,9 +619,16 @@ check(SV("^^[::-42, ::::0, ::1.2, :::42]^^^"), SV("{:^^{}::>{}.2}"), input, 33, 5); check(SV("^^[::-42, ::::0, ::1.2, :::42]^^^"), SV("{:^^{}::>{}.{}}"), input, 33, 5, 2); - check_exception("Argument index out of bounds", SV("{:^^{}::>5.2}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}.2}"), input, 33); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}.{}}"), input, 33, 5); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>5.2}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}.2}"), input, 33); + check_exception( + "The argument index value is too larger for the number of arguments supplied", + SV("{:^^{}::>{}.{}}"), + input, + 33, + 5); } template @@ -650,34 +661,34 @@ check(SV("__[0x0]___"), SV("{:_^{}}"), input, 10); check(SV("#####[0x0]"), SV("{:#>{}}"), input, 10); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("_0x0_"), SV("{:_^5n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("[ 0x0]"), SV("{::5}"), input); @@ -690,27 +701,27 @@ check(SV("[_0x0_]"), SV("{::_^{}}"), input, 5); check(SV("[::0x0]"), SV("{:::>{}}"), input, 5); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); + check_exception("The width option should not have a leading zero", SV("{::05}"), 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("p")) - 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); @@ -721,8 +732,10 @@ check(SV("^^[::0x0]^^^"), SV("{:^^{}::>5}"), input, 12); check(SV("^^[::0x0]^^^"), SV("{:^^{}::>{}}"), input, 12, 5); - check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 12); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>5}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 12); } template @@ -753,34 +766,34 @@ check(SV(R"(__["Hello", "world"]___)"), SV("{:_^{}}"), input, 23); check(SV(R"(#####["Hello", "world"])"), SV("{:#>{}}"), input, 23); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV(R"(_"Hello", "world"_)"), SV("{:_^18n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV(R"([Hello , world ])"), SV("{::8}"), input); @@ -793,31 +806,31 @@ check(SV(R"([_Hello__, _world__])"), SV("{::_^{}}"), input, 8); check(SV(R"([:::Hello, :::world])"), SV("{:::>{}}"), input, 8); - check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); + check_exception("The width option should not have a leading zero", SV("{::05}"), input); // *** precision *** check(SV(R"([Hel, wor])"), SV("{::.3}"), input); check(SV(R"([Hel, wor])"), SV("{::.{}}"), input, 3); - check_exception("The format-spec precision field doesn't contain a value or arg-id", SV("{::.}"), input); + check_exception("The precision option does not contain a value or argument index", 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?")) - check_exception("The format-spec type has a type not supported for a string argument", fmt, input); + check_exception("The type option contains an invalid value for a string formatting argument", fmt, input); // ***** Both have a format-spec check(SV(R"(^^[:::Hello, :::world]^^^)"), SV("{:^^25::>8}"), input); @@ -828,8 +841,10 @@ check(SV(R"(^^[:::Hello, :::world]^^^)"), SV("{:^^{}::>8}"), input, 25); check(SV(R"(^^[:::Hello, :::world]^^^)"), SV("{:^^{}::>{}}"), input, 25, 8); - check_exception("Argument index out of bounds", SV("{:^^{}::>8}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 25); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>8}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 25); } template @@ -862,41 +877,41 @@ check(SV("__[0xaaaa, 0x5555, 0xaa55]___"), SV("{:_^{}}"), input, 29); check(SV("#####[0xaaaa, 0x5555, 0xaa55]"), SV("{:#>{}}"), input, 29); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__0xaaaa, 0x5555, 0xaa55___"), SV("{:_^27n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec - check_exception("The format-spec type has a type not supported for a status argument", SV("{::*<7}"), input); + check_exception("The type option contains an invalid value for a status formatting argument", SV("{::*<7}"), input); for (std::basic_string_view fmt : fmt_invalid_nested_types("sxX")) - check_exception("The format-spec type has a type not supported for a status argument", fmt, input); + check_exception("The type option contains an invalid value for a status formatting argument", fmt, input); check(SV("[0xaaaa, 0x5555, 0xaa55]"), SV("{::x}"), input); check(SV("[0XAAAA, 0X5555, 0XAA55]"), SV("{::X}"), input); @@ -906,7 +921,8 @@ check(SV("^^[0XAAAA, 0X5555, 0XAA55]^^^"), SV("{:^^29:X}"), input); check(SV("^^[0XAAAA, 0X5555, 0XAA55]^^^"), SV("{:^^{}:X}"), input, 29); - check_exception("Argument index out of bounds", SV("{:^^{}:X}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:X}"), input); } // @@ -943,26 +959,26 @@ check(SV("__[(1, 'a'), (42, '*')]___"), SV("{:_^{}}"), input, 26); check(SV("#####[(1, 'a'), (42, '*')]"), SV("{:#>{}}"), input, 26); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__(1, 'a'), (42, '*')___"), SV("{:_^24n}"), input); @@ -970,10 +986,10 @@ // *** type *** check(SV("__{(1, 'a'), (42, '*')}___"), SV("{:_^26m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("[(1, 'a') , (42, '*') ]"), SV("{::11}"), input); @@ -986,32 +1002,32 @@ check(SV("[_(1, 'a')__, _(42, '*')_]"), SV("{::_^{}}"), input, 11); check(SV("[###(1, 'a'), ##(42, '*')]"), SV("{::#>{}}"), input, 11); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{:::<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{::05}"), 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 *** check(SV("[1: 'a', 42: '*']"), SV("{::m}"), input); check(SV("[1, 'a', 42, '*']"), SV("{::n}"), input); for (std::basic_string_view fmt : fmt_invalid_nested_types("")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Both have a format-spec check(SV("^^[###(1, 'a'), ##(42, '*')]^^^"), SV("{:^^31:#>11}"), input); @@ -1019,8 +1035,10 @@ check(SV("^^[###(1, 'a'), ##(42, '*')]^^^"), SV("{:^^{}:#>11}"), input, 31); check(SV("^^[###(1, 'a'), ##(42, '*')]^^^"), SV("{:^^{}:#>{}}"), input, 31, 11); - check_exception("Argument index out of bounds", SV("{:^^{}:#>5}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 31); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>5}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 31); check(SV("1: 'a', 42: '*'"), SV("{:n:m}"), input); check(SV("1, 'a', 42, '*'"), SV("{:n:n}"), input); @@ -1059,36 +1077,36 @@ check(SV("__[(42), (99)]___"), SV("{:_^{}}"), input, 17); check(SV("#####[(42), (99)]"), SV("{:#>{}}"), input, 17); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__(42), (99)___"), SV("{:_^15n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("[(42) , (99) ]"), SV("{::7}"), input); @@ -1101,31 +1119,31 @@ check(SV("[_(42)__, _(99)__]"), SV("{::_^{}}"), input, 7); check(SV("[###(42), ###(99)]"), SV("{::#>{}}"), input, 7); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{:::<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{::05}"), 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 *** check(SV("[42, 99]"), SV("{::n}"), input); for (std::basic_string_view fmt : fmt_invalid_nested_types("")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Both have a format-spec check(SV("^^[###(42), ###(99)]^^^"), SV("{:^^23:#>7}"), input); @@ -1133,8 +1151,10 @@ check(SV("^^[###(42), ###(99)]^^^"), SV("{:^^{}:#>7}"), input, 23); check(SV("^^[###(42), ###(99)]^^^"), SV("{:^^{}:#>{}}"), input, 23, 7); - check_exception("Argument index out of bounds", SV("{:^^{}:#>5}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 23); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>5}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 23); } // @@ -1160,36 +1180,36 @@ check(SV("__[(42, 99, 0), (1, 10, 100)]___"), SV("{:_^{}}"), input, 32); check(SV("#####[(42, 99, 0), (1, 10, 100)]"), SV("{:#>{}}"), input, 32); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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); // *** n check(SV("__(42, 99, 0), (1, 10, 100)___"), SV("{:_^30n}"), input); // *** type *** - check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input); - check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input); - check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); + check_exception("Type s requires character type as formatting argument", SV("{:s}"), input); + check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input); for (std::basic_string_view fmt : fmt_invalid_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Only underlying has a format-spec check(SV("[(42, 99, 0) , (1, 10, 100) ]"), SV("{::14}"), input); @@ -1202,31 +1222,31 @@ check(SV("[_(42, 99, 0)__, _(1, 10, 100)_]"), SV("{::_^{}}"), input, 14); check(SV("[###(42, 99, 0), ##(1, 10, 100)]"), SV("{::#>{}}"), input, 14); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input); + check_exception("The fill option contains an invalid value", SV("{:::<}"), input); + check_exception("The fill option contains an invalid value", SV("{::}<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{::05}"), 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 *** check(SV("[42, 99, 0, 1, 10, 100]"), SV("{::n}"), input); for (std::basic_string_view fmt : fmt_invalid_nested_types("s")) - check_exception("The format-spec should consume the input or end with a '}'", fmt, input); + check_exception("The format specifier should consume the input or end with a '}'", fmt, input); // ***** Both have a format-spec check(SV("^^[###(42, 99, 0), ##(1, 10, 100)]^^^"), SV("{:^^37:#>14}"), input); @@ -1234,8 +1254,10 @@ check(SV("^^[###(42, 99, 0), ##(1, 10, 100)]^^^"), SV("{:^^{}:#>14}"), input, 37); check(SV("^^[###(42, 99, 0), ##(1, 10, 100)]^^^"), SV("{:^^{}:#>{}}"), input, 37, 14); - check_exception("Argument index out of bounds", SV("{:^^{}:#>5}"), input); - check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 37); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>5}"), input); + check_exception( + "The argument index value is too larger for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 37); } // diff --git a/libcxx/test/std/utilities/format/format.tuple/format.functions.tests.h b/libcxx/test/std/utilities/format/format.tuple/format.functions.tests.h --- a/libcxx/test/std/utilities/format/format.tuple/format.functions.tests.h +++ b/libcxx/test/std/utilities/format/format.tuple/format.functions.tests.h @@ -42,33 +42,33 @@ check(SV("__(42, 99)___"), SV("{:_^{}}"), input, 13); check(SV("#####(42, 99)"), SV("{:#>{}}"), input, 13); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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 *** check(SV("__42: 99___"), SV("{:_^11m}"), input); check(SV("__42, 99___"), SV("{:_^11n}"), input); for (CharT c : SV("aAbBcdeEfFgGopsxX?")) { - check_exception("The format-spec should consume the input or end with a '}'", + check_exception("The format specifier should consume the input or end with a '}'", std::basic_string_view{STR("{:") + c + STR("}")}, input); } @@ -89,33 +89,33 @@ check(SV("__(42, \"hello\")___"), SV("{:_^{}}"), input, 18); check(SV("#####(42, \"hello\")"), SV("{:#>{}}"), input, 18); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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 *** check(SV("__42: \"hello\"___"), SV("{:_^16m}"), input); check(SV("__42, \"hello\"___"), SV("{:_^16n}"), input); for (CharT c : SV("aAbBcdeEfFgGopsxX?")) { - check_exception("The format-spec should consume the input or end with a '}'", + check_exception("The format specifier should consume the input or end with a '}'", std::basic_string_view{STR("{:") + c + STR("}")}, input); } @@ -179,33 +179,33 @@ check(SV("__(42)___"), SV("{:_^{}}"), input, 9); check(SV("#####(42)"), SV("{:#>{}}"), input, 9); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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 *** - check_exception("The format specifier m requires a pair or a two-element tuple", SV("{:m}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); check(SV("__42___"), SV("{:_^7n}"), input); for (CharT c : SV("aAbBcdeEfFgGopsxX?")) { - check_exception("The format-spec should consume the input or end with a '}'", + check_exception("The format specifier should consume the input or end with a '}'", std::basic_string_view{STR("{:") + c + STR("}")}, input); } @@ -228,33 +228,33 @@ check(SV("__(42, \"hello\", \"red\")___"), SV("{:_^{}}"), input, 25); check(SV("#####(42, \"hello\", \"red\")"), SV("{:#>{}}"), input, 25); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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 *** - check_exception("The format specifier m requires a pair or a two-element tuple", SV("{:m}"), input); + check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input); check(SV("__42, \"hello\", \"red\"___"), SV("{:_^23n}"), input); for (CharT c : SV("aAbBcdeEfFgGopsxX?")) { - check_exception("The format-spec should consume the input or end with a '}'", + check_exception("The format specifier should consume the input or end with a '}'", std::basic_string_view{STR("{:") + c + STR("}")}, input); } @@ -301,33 +301,33 @@ check(SV("__(42, (\"hello\", \"red\"))___"), SV("{:_^{}}"), input, 27); check(SV("#####(42, (\"hello\", \"red\"))"), SV("{:#>{}}"), input, 27); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input); - check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input); + check_exception("The fill option contains an invalid value", SV("{:}<}"), input); + check_exception("The fill option contains an invalid value", SV("{:{<}"), input); + check_exception("The fill option contains an invalid value", 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); - 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); + check_exception("The format specifier 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); + check_exception("The width option should not have a leading zero", SV("{:0}"), 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 *** check(SV("__42: (\"hello\", \"red\")___"), SV("{:_^25m}"), input); check(SV("__42, (\"hello\", \"red\")___"), SV("{:_^25n}"), input); for (CharT c : SV("aAbBcdeEfFgGopsxX?")) { - check_exception("The format-spec should consume the input or end with a '}'", + check_exception("The format specifier should consume the input or end with a '}'", std::basic_string_view{STR("{:") + c + STR("}")}, input); } diff --git a/libcxx/test/support/format.functions.common.h b/libcxx/test/support/format.functions.common.h --- a/libcxx/test/support/format.functions.common.h +++ b/libcxx/test/support/format.functions.common.h @@ -76,12 +76,12 @@ case CharT('}'): return begin; default: - throw_format_error("The format-spec type has a type not supported for a status argument"); + throw_format_error("The type option contains an invalid value for a status formatting argument"); } ++begin; if (begin != end && *begin != CharT('}')) - throw_format_error("The format-spec should consume the input or end with a '}'"); + throw_format_error("The format specifier should consume the input or end with a '}'"); return begin; }