1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // UNSUPPORTED: c++03, c++11, c++14, c++17 10 // UNSUPPORTED: no-localization 11 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME 12 13 // TODO FMT This test should not require std::to_chars(floating-point) 14 // XFAIL: availability-fp_to_chars-missing 15 16 // REQUIRES: locale.fr_FR.UTF-8 17 // REQUIRES: locale.ja_JP.UTF-8 18 19 // <chrono> 20 21 // template<class charT> struct formatter<chrono::month_day_last, charT>; 22 23 #include <chrono> 24 #include <format> 25 26 #include <cassert> 27 #include <concepts> 28 #include <locale> 29 #include <iostream> 30 #include <type_traits> 31 32 #include "formatter_tests.h" 33 #include "make_string.h" 34 #include "platform_support.h" // locale name macros 35 #include "string_literal.h" 36 #include "test_macros.h" 37 38 template <class CharT> 39 static void test_no_chrono_specs() { 40 // Valid month 41 check(SV("Jan/last"), SV("{}"), std::chrono::month_day_last{std::chrono::month{1}}); 42 check(SV("*Jan/last*"), SV("{:*^10}"), std::chrono::month_day_last{std::chrono::month{1}}); 43 check(SV("*Jan/last"), SV("{:*>9}"), std::chrono::month_day_last{std::chrono::month{1}}); 44 45 // Invalid month 46 check(SV("0 is not a valid month/last"), SV("{}"), std::chrono::month_day_last{std::chrono::month{0}}); 47 check(SV("*0 is not a valid month/last*"), SV("{:*^29}"), std::chrono::month_day_last{std::chrono::month{0}}); 48 } 49 50 template <class CharT> 51 static void test_valid_values() { 52 // Test that %b, %h, and %B throw an exception. 53 check_exception("Formatting a month name from an invalid month number", 54 SV("{:%b}"), 55 std::chrono::month_day_last{std::chrono::month{200}}); 56 check_exception("Formatting a month name from an invalid month number", 57 SV("{:%b}"), 58 std::chrono::month_day_last{std::chrono::month{13}}); 59 check_exception("Formatting a month name from an invalid month number", 60 SV("{:%b}"), 61 std::chrono::month_day_last{std::chrono::month{255}}); 62 63 check_exception("Formatting a month name from an invalid month number", 64 SV("{:%h}"), 65 std::chrono::month_day_last{std::chrono::month{0}}); 66 check_exception("Formatting a month name from an invalid month number", 67 SV("{:%h}"), 68 std::chrono::month_day_last{std::chrono::month{13}}); 69 check_exception("Formatting a month name from an invalid month number", 70 SV("{:%h}"), 71 std::chrono::month_day_last{std::chrono::month{255}}); 72 73 check_exception("Formatting a month name from an invalid month number", 74 SV("{:%B}"), 75 std::chrono::month_day_last{std::chrono::month{0}}); 76 check_exception("Formatting a month name from an invalid month number", 77 SV("{:%B}"), 78 std::chrono::month_day_last{std::chrono::month{13}}); 79 check_exception("Formatting a month name from an invalid month number", 80 SV("{:%B}"), 81 std::chrono::month_day_last{std::chrono::month{255}}); 82 83 constexpr std::basic_string_view<CharT> fmt = SV("{:%%b='%b'%t%%B='%B'%t%%h='%h'%t%%m='%m'%t%%Om='%Om'%n}"); 84 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%b='%b'%t%%B='%B'%t%%h='%h'%t%%m='%m'%t%%Om='%Om'%n}"); 85 86 const std::locale loc(LOCALE_ja_JP_UTF_8); 87 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8)); 88 89 // Non localized output using C-locale 90 check(SV("%b='Jan'\t%B='January'\t%h='Jan'\t%m='01'\t%Om='01'\n"), 91 fmt, 92 std::chrono::month_day_last{std::chrono::January}); 93 check(SV("%b='Feb'\t%B='February'\t%h='Feb'\t%m='02'\t%Om='02'\n"), 94 fmt, 95 std::chrono::month_day_last{std::chrono::February}); 96 check( 97 SV("%b='Mar'\t%B='March'\t%h='Mar'\t%m='03'\t%Om='03'\n"), fmt, std::chrono::month_day_last{std::chrono::March}); 98 check( 99 SV("%b='Apr'\t%B='April'\t%h='Apr'\t%m='04'\t%Om='04'\n"), fmt, std::chrono::month_day_last{std::chrono::April}); 100 check(SV("%b='May'\t%B='May'\t%h='May'\t%m='05'\t%Om='05'\n"), fmt, std::chrono::month_day_last{std::chrono::May}); 101 check(SV("%b='Jun'\t%B='June'\t%h='Jun'\t%m='06'\t%Om='06'\n"), fmt, std::chrono::month_day_last{std::chrono::June}); 102 check(SV("%b='Jul'\t%B='July'\t%h='Jul'\t%m='07'\t%Om='07'\n"), fmt, std::chrono::month_day_last{std::chrono::July}); 103 check(SV("%b='Aug'\t%B='August'\t%h='Aug'\t%m='08'\t%Om='08'\n"), 104 fmt, 105 std::chrono::month_day_last{std::chrono::August}); 106 check(SV("%b='Sep'\t%B='September'\t%h='Sep'\t%m='09'\t%Om='09'\n"), 107 fmt, 108 std::chrono::month_day_last{std::chrono::September}); 109 check(SV("%b='Oct'\t%B='October'\t%h='Oct'\t%m='10'\t%Om='10'\n"), 110 fmt, 111 std::chrono::month_day_last{std::chrono::October}); 112 check(SV("%b='Nov'\t%B='November'\t%h='Nov'\t%m='11'\t%Om='11'\n"), 113 fmt, 114 std::chrono::month_day_last{std::chrono::November}); 115 check(SV("%b='Dec'\t%B='December'\t%h='Dec'\t%m='12'\t%Om='12'\n"), 116 fmt, 117 std::chrono::month_day_last{std::chrono::December}); 118 119 // Use the global locale (fr_FR) 120 #if defined(__APPLE__) 121 check(SV("%b='jan'\t%B='janvier'\t%h='jan'\t%m='01'\t%Om='01'\n"), 122 lfmt, 123 std::chrono::month_day_last{std::chrono::January}); 124 check(SV("%b='fév'\t%B='février'\t%h='fév'\t%m='02'\t%Om='02'\n"), 125 lfmt, 126 std::chrono::month_day_last{std::chrono::February}); 127 check( 128 SV("%b='mar'\t%B='mars'\t%h='mar'\t%m='03'\t%Om='03'\n"), lfmt, std::chrono::month_day_last{std::chrono::March}); 129 check( 130 SV("%b='avr'\t%B='avril'\t%h='avr'\t%m='04'\t%Om='04'\n"), lfmt, std::chrono::month_day_last{std::chrono::April}); 131 check(SV("%b='mai'\t%B='mai'\t%h='mai'\t%m='05'\t%Om='05'\n"), lfmt, std::chrono::month_day_last{std::chrono::May}); 132 check(SV("%b='jui'\t%B='juin'\t%h='jui'\t%m='06'\t%Om='06'\n"), lfmt, std::chrono::month_day_last{std::chrono::June}); 133 check(SV("%b='jul'\t%B='juillet'\t%h='jul'\t%m='07'\t%Om='07'\n"), 134 lfmt, 135 std::chrono::month_day_last{std::chrono::July}); 136 check( 137 SV("%b='aoû'\t%B='août'\t%h='aoû'\t%m='08'\t%Om='08'\n"), lfmt, std::chrono::month_day_last{std::chrono::August}); 138 check(SV("%b='sep'\t%B='septembre'\t%h='sep'\t%m='09'\t%Om='09'\n"), 139 lfmt, 140 std::chrono::month_day_last{std::chrono::September}); 141 check(SV("%b='oct'\t%B='octobre'\t%h='oct'\t%m='10'\t%Om='10'\n"), 142 lfmt, 143 std::chrono::month_day_last{std::chrono::October}); 144 check(SV("%b='nov'\t%B='novembre'\t%h='nov'\t%m='11'\t%Om='11'\n"), 145 lfmt, 146 std::chrono::month_day_last{std::chrono::November}); 147 check(SV("%b='déc'\t%B='décembre'\t%h='déc'\t%m='12'\t%Om='12'\n"), 148 lfmt, 149 std::chrono::month_day_last{std::chrono::December}); 150 #else // defined(__APPLE__) 151 check(SV("%b='janv.'\t%B='janvier'\t%h='janv.'\t%m='01'\t%Om='01'\n"), 152 lfmt, 153 std::chrono::month_day_last{std::chrono::January}); 154 check(SV("%b='févr.'\t%B='février'\t%h='févr.'\t%m='02'\t%Om='02'\n"), 155 lfmt, 156 std::chrono::month_day_last{std::chrono::February}); 157 check(SV("%b='mars'\t%B='mars'\t%h='mars'\t%m='03'\t%Om='03'\n"), 158 lfmt, 159 std::chrono::month_day_last{std::chrono::March}); 160 check( 161 # if defined(_WIN32) || defined(_AIX) || defined(__FreeBSD__) 162 SV("%b='avr.'\t%B='avril'\t%h='avr.'\t%m='04'\t%Om='04'\n"), 163 # else // defined(_WIN32) || defined(_AIX) || defined(__FreeBSD__) 164 SV("%b='avril'\t%B='avril'\t%h='avril'\t%m='04'\t%Om='04'\n"), 165 # endif // defined(_WIN32) || defined(_AIX) || defined(__FreeBSD__) 166 lfmt, 167 std::chrono::month_day_last{std::chrono::April}); 168 check(SV("%b='mai'\t%B='mai'\t%h='mai'\t%m='05'\t%Om='05'\n"), lfmt, std::chrono::month_day_last{std::chrono::May}); 169 check( 170 SV("%b='juin'\t%B='juin'\t%h='juin'\t%m='06'\t%Om='06'\n"), lfmt, std::chrono::month_day_last{std::chrono::June}); 171 check(SV("%b='juil.'\t%B='juillet'\t%h='juil.'\t%m='07'\t%Om='07'\n"), 172 lfmt, 173 std::chrono::month_day_last{std::chrono::July}); 174 check(SV("%b='août'\t%B='août'\t%h='août'\t%m='08'\t%Om='08'\n"), 175 lfmt, 176 std::chrono::month_day_last{std::chrono::August}); 177 check(SV("%b='sept.'\t%B='septembre'\t%h='sept.'\t%m='09'\t%Om='09'\n"), 178 lfmt, 179 std::chrono::month_day_last{std::chrono::September}); 180 check(SV("%b='oct.'\t%B='octobre'\t%h='oct.'\t%m='10'\t%Om='10'\n"), 181 lfmt, 182 std::chrono::month_day_last{std::chrono::October}); 183 check(SV("%b='nov.'\t%B='novembre'\t%h='nov.'\t%m='11'\t%Om='11'\n"), 184 lfmt, 185 std::chrono::month_day_last{std::chrono::November}); 186 check(SV("%b='déc.'\t%B='décembre'\t%h='déc.'\t%m='12'\t%Om='12'\n"), 187 lfmt, 188 std::chrono::month_day_last{std::chrono::December}); 189 #endif // defined(__APPLE__) 190 191 // Use supplied locale (ja_JP) 192 #ifdef _WIN32 193 check(loc, 194 SV("%b='1'\t%B='1月'\t%h='1'\t%m='01'\t%Om='01'\n"), 195 lfmt, 196 std::chrono::month_day_last{std::chrono::January}); 197 check(loc, 198 SV("%b='2'\t%B='2月'\t%h='2'\t%m='02'\t%Om='02'\n"), 199 lfmt, 200 std::chrono::month_day_last{std::chrono::February}); 201 check( 202 loc, SV("%b='3'\t%B='3月'\t%h='3'\t%m='03'\t%Om='03'\n"), lfmt, std::chrono::month_day_last{std::chrono::March}); 203 check( 204 loc, SV("%b='4'\t%B='4月'\t%h='4'\t%m='04'\t%Om='04'\n"), lfmt, std::chrono::month_day_last{std::chrono::April}); 205 check(loc, SV("%b='5'\t%B='5月'\t%h='5'\t%m='05'\t%Om='05'\n"), lfmt, std::chrono::month_day_last{std::chrono::May}); 206 check(loc, SV("%b='6'\t%B='6月'\t%h='6'\t%m='06'\t%Om='06'\n"), lfmt, std::chrono::month_day_last{std::chrono::June}); 207 check(loc, SV("%b='7'\t%B='7月'\t%h='7'\t%m='07'\t%Om='07'\n"), lfmt, std::chrono::month_day_last{std::chrono::July}); 208 check( 209 loc, SV("%b='8'\t%B='8月'\t%h='8'\t%m='08'\t%Om='08'\n"), lfmt, std::chrono::month_day_last{std::chrono::August}); 210 check(loc, 211 SV("%b='9'\t%B='9月'\t%h='9'\t%m='09'\t%Om='09'\n"), 212 lfmt, 213 std::chrono::month_day_last{std::chrono::September}); 214 check(loc, 215 SV("%b='10'\t%B='10月'\t%h='10'\t%m='10'\t%Om='10'\n"), 216 lfmt, 217 std::chrono::month_day_last{std::chrono::October}); 218 check(loc, 219 SV("%b='11'\t%B='11月'\t%h='11'\t%m='11'\t%Om='11'\n"), 220 lfmt, 221 std::chrono::month_day_last{std::chrono::November}); 222 check(loc, 223 SV("%b='12'\t%B='12月'\t%h='12'\t%m='12'\t%Om='12'\n"), 224 lfmt, 225 std::chrono::month_day_last{std::chrono::December}); 226 #elif defined(__APPLE__) // defined(_WIN32) 227 check(loc, 228 SV("%b=' 1'\t%B='1月'\t%h=' 1'\t%m='01'\t%Om='01'\n"), 229 lfmt, 230 std::chrono::month_day_last{std::chrono::January}); 231 check(loc, 232 SV("%b=' 2'\t%B='2月'\t%h=' 2'\t%m='02'\t%Om='02'\n"), 233 lfmt, 234 std::chrono::month_day_last{std::chrono::February}); 235 check(loc, 236 SV("%b=' 3'\t%B='3月'\t%h=' 3'\t%m='03'\t%Om='03'\n"), 237 lfmt, 238 std::chrono::month_day_last{std::chrono::March}); 239 check(loc, 240 SV("%b=' 4'\t%B='4月'\t%h=' 4'\t%m='04'\t%Om='04'\n"), 241 lfmt, 242 std::chrono::month_day_last{std::chrono::April}); 243 check( 244 loc, SV("%b=' 5'\t%B='5月'\t%h=' 5'\t%m='05'\t%Om='05'\n"), lfmt, std::chrono::month_day_last{std::chrono::May}); 245 check( 246 loc, SV("%b=' 6'\t%B='6月'\t%h=' 6'\t%m='06'\t%Om='06'\n"), lfmt, std::chrono::month_day_last{std::chrono::June}); 247 check( 248 loc, SV("%b=' 7'\t%B='7月'\t%h=' 7'\t%m='07'\t%Om='07'\n"), lfmt, std::chrono::month_day_last{std::chrono::July}); 249 check(loc, 250 SV("%b=' 8'\t%B='8月'\t%h=' 8'\t%m='08'\t%Om='08'\n"), 251 lfmt, 252 std::chrono::month_day_last{std::chrono::August}); 253 check(loc, 254 SV("%b=' 9'\t%B='9月'\t%h=' 9'\t%m='09'\t%Om='09'\n"), 255 lfmt, 256 std::chrono::month_day_last{std::chrono::September}); 257 check(loc, 258 SV("%b='10'\t%B='10月'\t%h='10'\t%m='10'\t%Om='10'\n"), 259 lfmt, 260 std::chrono::month_day_last{std::chrono::October}); 261 check(loc, 262 SV("%b='11'\t%B='11月'\t%h='11'\t%m='11'\t%Om='11'\n"), 263 lfmt, 264 std::chrono::month_day_last{std::chrono::November}); 265 check(loc, 266 SV("%b='12'\t%B='12月'\t%h='12'\t%m='12'\t%Om='12'\n"), 267 lfmt, 268 std::chrono::month_day_last{std::chrono::December}); 269 #elif defined(_AIX) // defined(_WIN32) 270 check(loc, 271 SV("%b='1月'\t%B='1月'\t%h='1月'\t%m='01'\t%Om='01'\n"), 272 lfmt, 273 std::chrono::month_day_last{std::chrono::January}); 274 check(loc, 275 SV("%b='2月'\t%B='2月'\t%h='2月'\t%m='02'\t%Om='02'\n"), 276 lfmt, 277 std::chrono::month_day_last{std::chrono::February}); 278 check(loc, 279 SV("%b='3月'\t%B='3月'\t%h='3月'\t%m='03'\t%Om='03'\n"), 280 lfmt, 281 std::chrono::month_day_last{std::chrono::March}); 282 check(loc, 283 SV("%b='4月'\t%B='4月'\t%h='4月'\t%m='04'\t%Om='04'\n"), 284 lfmt, 285 std::chrono::month_day_last{std::chrono::April}); 286 check(loc, 287 SV("%b='5月'\t%B='5月'\t%h='5月'\t%m='05'\t%Om='05'\n"), 288 lfmt, 289 std::chrono::month_day_last{std::chrono::May}); 290 check(loc, 291 SV("%b='6月'\t%B='6月'\t%h='6月'\t%m='06'\t%Om='06'\n"), 292 lfmt, 293 std::chrono::month_day_last{std::chrono::June}); 294 check(loc, 295 SV("%b='7月'\t%B='7月'\t%h='7月'\t%m='07'\t%Om='07'\n"), 296 lfmt, 297 std::chrono::month_day_last{std::chrono::July}); 298 check(loc, 299 SV("%b='8月'\t%B='8月'\t%h='8月'\t%m='08'\t%Om='08'\n"), 300 lfmt, 301 std::chrono::month_day_last{std::chrono::August}); 302 check(loc, 303 SV("%b='9月'\t%B='9月'\t%h='9月'\t%m='09'\t%Om='09'\n"), 304 lfmt, 305 std::chrono::month_day_last{std::chrono::September}); 306 check(loc, 307 SV("%b='10月'\t%B='10月'\t%h='10月'\t%m='10'\t%Om='10'\n"), 308 lfmt, 309 std::chrono::month_day_last{std::chrono::October}); 310 check(loc, 311 SV("%b='11月'\t%B='11月'\t%h='11月'\t%m='11'\t%Om='11'\n"), 312 lfmt, 313 std::chrono::month_day_last{std::chrono::November}); 314 check(loc, 315 SV("%b='12月'\t%B='12月'\t%h='12月'\t%m='12'\t%Om='12'\n"), 316 lfmt, 317 std::chrono::month_day_last{std::chrono::December}); 318 #elif defined(__FreeBSD__) // defined(_WIN32) 319 check(loc, 320 SV("%b=' 1月'\t%B='1月'\t%h=' 1月'\t%m='01'\t%Om='01'\n"), 321 lfmt, 322 std::chrono::month_day_last{std::chrono::January}); 323 check(loc, 324 SV("%b=' 2月'\t%B='2月'\t%h=' 2月'\t%m='02'\t%Om='02'\n"), 325 lfmt, 326 std::chrono::month_day_last{std::chrono::February}); 327 check(loc, 328 SV("%b=' 3月'\t%B='3月'\t%h=' 3月'\t%m='03'\t%Om='03'\n"), 329 lfmt, 330 std::chrono::month_day_last{std::chrono::March}); 331 check(loc, 332 SV("%b=' 4月'\t%B='4月'\t%h=' 4月'\t%m='04'\t%Om='04'\n"), 333 lfmt, 334 std::chrono::month_day_last{std::chrono::April}); 335 check(loc, 336 SV("%b=' 5月'\t%B='5月'\t%h=' 5月'\t%m='05'\t%Om='05'\n"), 337 lfmt, 338 std::chrono::month_day_last{std::chrono::May}); 339 check(loc, 340 SV("%b=' 6月'\t%B='6月'\t%h=' 6月'\t%m='06'\t%Om='06'\n"), 341 lfmt, 342 std::chrono::month_day_last{std::chrono::June}); 343 check(loc, 344 SV("%b=' 7月'\t%B='7月'\t%h=' 7月'\t%m='07'\t%Om='07'\n"), 345 lfmt, 346 std::chrono::month_day_last{std::chrono::July}); 347 check(loc, 348 SV("%b=' 8月'\t%B='8月'\t%h=' 8月'\t%m='08'\t%Om='08'\n"), 349 lfmt, 350 std::chrono::month_day_last{std::chrono::August}); 351 check(loc, 352 SV("%b=' 9月'\t%B='9月'\t%h=' 9月'\t%m='09'\t%Om='09'\n"), 353 lfmt, 354 std::chrono::month_day_last{std::chrono::September}); 355 check(loc, 356 SV("%b='10月'\t%B='10月'\t%h='10月'\t%m='10'\t%Om='10'\n"), 357 lfmt, 358 std::chrono::month_day_last{std::chrono::October}); 359 check(loc, 360 SV("%b='11月'\t%B='11月'\t%h='11月'\t%m='11'\t%Om='11'\n"), 361 lfmt, 362 std::chrono::month_day_last{std::chrono::November}); 363 check(loc, 364 SV("%b='12月'\t%B='12月'\t%h='12月'\t%m='12'\t%Om='12'\n"), 365 lfmt, 366 std::chrono::month_day_last{std::chrono::December}); 367 #else // defined(_WIN32) 368 check(loc, 369 SV("%b=' 1月'\t%B='1月'\t%h=' 1月'\t%m='01'\t%Om='一'\n"), 370 lfmt, 371 std::chrono::month_day_last{std::chrono::January}); 372 check(loc, 373 SV("%b=' 2月'\t%B='2月'\t%h=' 2月'\t%m='02'\t%Om='二'\n"), 374 lfmt, 375 std::chrono::month_day_last{std::chrono::February}); 376 check(loc, 377 SV("%b=' 3月'\t%B='3月'\t%h=' 3月'\t%m='03'\t%Om='三'\n"), 378 lfmt, 379 std::chrono::month_day_last{std::chrono::March}); 380 check(loc, 381 SV("%b=' 4月'\t%B='4月'\t%h=' 4月'\t%m='04'\t%Om='四'\n"), 382 lfmt, 383 std::chrono::month_day_last{std::chrono::April}); 384 check(loc, 385 SV("%b=' 5月'\t%B='5月'\t%h=' 5月'\t%m='05'\t%Om='五'\n"), 386 lfmt, 387 std::chrono::month_day_last{std::chrono::May}); 388 check(loc, 389 SV("%b=' 6月'\t%B='6月'\t%h=' 6月'\t%m='06'\t%Om='六'\n"), 390 lfmt, 391 std::chrono::month_day_last{std::chrono::June}); 392 check(loc, 393 SV("%b=' 7月'\t%B='7月'\t%h=' 7月'\t%m='07'\t%Om='七'\n"), 394 lfmt, 395 std::chrono::month_day_last{std::chrono::July}); 396 check(loc, 397 SV("%b=' 8月'\t%B='8月'\t%h=' 8月'\t%m='08'\t%Om='八'\n"), 398 lfmt, 399 std::chrono::month_day_last{std::chrono::August}); 400 check(loc, 401 SV("%b=' 9月'\t%B='9月'\t%h=' 9月'\t%m='09'\t%Om='九'\n"), 402 lfmt, 403 std::chrono::month_day_last{std::chrono::September}); 404 check(loc, 405 SV("%b='10月'\t%B='10月'\t%h='10月'\t%m='10'\t%Om='十'\n"), 406 lfmt, 407 std::chrono::month_day_last{std::chrono::October}); 408 check(loc, 409 SV("%b='11月'\t%B='11月'\t%h='11月'\t%m='11'\t%Om='十一'\n"), 410 lfmt, 411 std::chrono::month_day_last{std::chrono::November}); 412 check(loc, 413 SV("%b='12月'\t%B='12月'\t%h='12月'\t%m='12'\t%Om='十二'\n"), 414 lfmt, 415 std::chrono::month_day_last{std::chrono::December}); 416 #endif // defined(_WIN32) 417 418 std::locale::global(std::locale::classic()); 419 } 420 421 template <class CharT> 422 static void test() { 423 test_no_chrono_specs<CharT>(); 424 test_valid_values<CharT>(); 425 check_invalid_types<CharT>( 426 {SV("b"), SV("B"), SV("h"), SV("m"), SV("Om")}, std::chrono::month_day_last{std::chrono::January}); 427 428 check_exception( 429 "The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::month_day_last{std::chrono::January}); 430 check_exception( 431 "The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::month_day_last{std::chrono::January}); 432 check_exception("End of input while parsing a conversion specifier", 433 SV("{:%"), 434 std::chrono::month_day_last{std::chrono::January}); 435 check_exception( 436 "End of input while parsing the modifier E", SV("{:%E"), std::chrono::month_day_last{std::chrono::January}); 437 check_exception( 438 "End of input while parsing the modifier O", SV("{:%O"), std::chrono::month_day_last{std::chrono::January}); 439 440 // Precision not allowed 441 check_exception( 442 "The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::month_day_last{std::chrono::January}); 443 } 444 445 int main(int, char**) { 446 test<char>(); 447 448 #ifndef TEST_HAS_NO_WIDE_CHARACTERS 449 test<wchar_t>(); 450 #endif 451 452 return 0; 453 } 454