cuelang.org/go@v0.13.0/encoding/jsonschema/testdata/external/tests/draft2020-12/optional/ecmascript-regex.json (about) 1 [ 2 { 3 "description": "ECMA 262 regex $ does not match trailing newline", 4 "schema": { 5 "$schema": "https://json-schema.org/draft/2020-12/schema", 6 "type": "string", 7 "pattern": "^abc$" 8 }, 9 "tests": [ 10 { 11 "description": "matches in Python, but not in ECMA 262", 12 "data": "abc\\n", 13 "valid": false 14 }, 15 { 16 "description": "matches", 17 "data": "abc", 18 "valid": true 19 } 20 ] 21 }, 22 { 23 "description": "ECMA 262 regex converts \\t to horizontal tab", 24 "schema": { 25 "$schema": "https://json-schema.org/draft/2020-12/schema", 26 "type": "string", 27 "pattern": "^\\t$" 28 }, 29 "tests": [ 30 { 31 "description": "does not match", 32 "data": "\\t", 33 "valid": false 34 }, 35 { 36 "description": "matches", 37 "data": "\t", 38 "valid": true 39 } 40 ] 41 }, 42 { 43 "description": "ECMA 262 regex escapes control codes with \\c and upper letter", 44 "schema": { 45 "$schema": "https://json-schema.org/draft/2020-12/schema", 46 "type": "string", 47 "pattern": "^\\cC$" 48 }, 49 "skip": { 50 "v2": "extract error: invalid regexp \"^\\\\cC$\": error parsing regexp: invalid escape sequence: `\\c`", 51 "v3": "extract error: invalid regexp \"^\\\\cC$\": error parsing regexp: invalid escape sequence: `\\c`" 52 }, 53 "tests": [ 54 { 55 "description": "does not match", 56 "data": "\\cC", 57 "valid": false, 58 "skip": { 59 "v2": "could not compile schema", 60 "v3": "could not compile schema" 61 } 62 }, 63 { 64 "description": "matches", 65 "data": "\u0003", 66 "valid": true, 67 "skip": { 68 "v2": "could not compile schema", 69 "v3": "could not compile schema" 70 } 71 } 72 ] 73 }, 74 { 75 "description": "ECMA 262 regex escapes control codes with \\c and lower letter", 76 "schema": { 77 "$schema": "https://json-schema.org/draft/2020-12/schema", 78 "type": "string", 79 "pattern": "^\\cc$" 80 }, 81 "skip": { 82 "v2": "extract error: invalid regexp \"^\\\\cc$\": error parsing regexp: invalid escape sequence: `\\c`", 83 "v3": "extract error: invalid regexp \"^\\\\cc$\": error parsing regexp: invalid escape sequence: `\\c`" 84 }, 85 "tests": [ 86 { 87 "description": "does not match", 88 "data": "\\cc", 89 "valid": false, 90 "skip": { 91 "v2": "could not compile schema", 92 "v3": "could not compile schema" 93 } 94 }, 95 { 96 "description": "matches", 97 "data": "\u0003", 98 "valid": true, 99 "skip": { 100 "v2": "could not compile schema", 101 "v3": "could not compile schema" 102 } 103 } 104 ] 105 }, 106 { 107 "description": "ECMA 262 \\d matches ascii digits only", 108 "schema": { 109 "$schema": "https://json-schema.org/draft/2020-12/schema", 110 "type": "string", 111 "pattern": "^\\d$" 112 }, 113 "tests": [ 114 { 115 "description": "ASCII zero matches", 116 "data": "0", 117 "valid": true 118 }, 119 { 120 "description": "NKO DIGIT ZERO does not match (unlike e.g. Python)", 121 "data": "߀", 122 "valid": false 123 }, 124 { 125 "description": "NKO DIGIT ZERO (as \\u escape) does not match", 126 "data": "߀", 127 "valid": false 128 } 129 ] 130 }, 131 { 132 "description": "ECMA 262 \\D matches everything but ascii digits", 133 "schema": { 134 "$schema": "https://json-schema.org/draft/2020-12/schema", 135 "type": "string", 136 "pattern": "^\\D$" 137 }, 138 "tests": [ 139 { 140 "description": "ASCII zero does not match", 141 "data": "0", 142 "valid": false 143 }, 144 { 145 "description": "NKO DIGIT ZERO matches (unlike e.g. Python)", 146 "data": "߀", 147 "valid": true 148 }, 149 { 150 "description": "NKO DIGIT ZERO (as \\u escape) matches", 151 "data": "߀", 152 "valid": true 153 } 154 ] 155 }, 156 { 157 "description": "ECMA 262 \\w matches ascii letters only", 158 "schema": { 159 "$schema": "https://json-schema.org/draft/2020-12/schema", 160 "type": "string", 161 "pattern": "^\\w$" 162 }, 163 "tests": [ 164 { 165 "description": "ASCII 'a' matches", 166 "data": "a", 167 "valid": true 168 }, 169 { 170 "description": "latin-1 e-acute does not match (unlike e.g. Python)", 171 "data": "é", 172 "valid": false 173 } 174 ] 175 }, 176 { 177 "description": "ECMA 262 \\W matches everything but ascii letters", 178 "schema": { 179 "$schema": "https://json-schema.org/draft/2020-12/schema", 180 "type": "string", 181 "pattern": "^\\W$" 182 }, 183 "tests": [ 184 { 185 "description": "ASCII 'a' does not match", 186 "data": "a", 187 "valid": false 188 }, 189 { 190 "description": "latin-1 e-acute matches (unlike e.g. Python)", 191 "data": "é", 192 "valid": true 193 } 194 ] 195 }, 196 { 197 "description": "ECMA 262 \\s matches whitespace", 198 "schema": { 199 "$schema": "https://json-schema.org/draft/2020-12/schema", 200 "type": "string", 201 "pattern": "^\\s$" 202 }, 203 "tests": [ 204 { 205 "description": "ASCII space matches", 206 "data": " ", 207 "valid": true 208 }, 209 { 210 "description": "Character tabulation matches", 211 "data": "\t", 212 "valid": true 213 }, 214 { 215 "description": "Line tabulation matches", 216 "data": "\u000b", 217 "valid": true, 218 "skip": { 219 "v2": "invalid value \"\\v\" (out of bound =~\"^\\\\s$\"):\n generated.cue:3:1\n generated.cue:1:1\n instance.json:1:1\n", 220 "v3": "invalid value \"\\v\" (out of bound =~\"^\\\\s$\"):\n generated.cue:3:1\n generated.cue:1:1\n instance.json:1:1\n" 221 } 222 }, 223 { 224 "description": "Form feed matches", 225 "data": "\f", 226 "valid": true 227 }, 228 { 229 "description": "latin-1 non-breaking-space matches", 230 "data": " ", 231 "valid": true, 232 "skip": { 233 "v2": "invalid value \"\\u00a0\" (out of bound =~\"^\\\\s$\"):\n generated.cue:3:1\n generated.cue:1:1\n instance.json:1:1\n", 234 "v3": "invalid value \"\\u00a0\" (out of bound =~\"^\\\\s$\"):\n generated.cue:3:1\n generated.cue:1:1\n instance.json:1:1\n" 235 } 236 }, 237 { 238 "description": "zero-width whitespace matches", 239 "data": "\ufeff", 240 "valid": true, 241 "skip": { 242 "v2": "invalid value \"\\ufeff\" (out of bound =~\"^\\\\s$\"):\n generated.cue:3:1\n generated.cue:1:1\n instance.json:1:1\n", 243 "v3": "invalid value \"\\ufeff\" (out of bound =~\"^\\\\s$\"):\n generated.cue:3:1\n generated.cue:1:1\n instance.json:1:1\n" 244 } 245 }, 246 { 247 "description": "line feed matches (line terminator)", 248 "data": "\n", 249 "valid": true 250 }, 251 { 252 "description": "paragraph separator matches (line terminator)", 253 "data": "\u2029", 254 "valid": true, 255 "skip": { 256 "v2": "invalid value \"\\u2029\" (out of bound =~\"^\\\\s$\"):\n generated.cue:3:1\n generated.cue:1:1\n instance.json:1:1\n", 257 "v3": "invalid value \"\\u2029\" (out of bound =~\"^\\\\s$\"):\n generated.cue:3:1\n generated.cue:1:1\n instance.json:1:1\n" 258 } 259 }, 260 { 261 "description": "EM SPACE matches (Space_Separator)", 262 "data": " ", 263 "valid": true, 264 "skip": { 265 "v2": "invalid value \"\\u2003\" (out of bound =~\"^\\\\s$\"):\n generated.cue:3:1\n generated.cue:1:1\n instance.json:1:1\n", 266 "v3": "invalid value \"\\u2003\" (out of bound =~\"^\\\\s$\"):\n generated.cue:3:1\n generated.cue:1:1\n instance.json:1:1\n" 267 } 268 }, 269 { 270 "description": "Non-whitespace control does not match", 271 "data": "\u0001", 272 "valid": false 273 }, 274 { 275 "description": "Non-whitespace does not match", 276 "data": "–", 277 "valid": false 278 } 279 ] 280 }, 281 { 282 "description": "ECMA 262 \\S matches everything but whitespace", 283 "schema": { 284 "$schema": "https://json-schema.org/draft/2020-12/schema", 285 "type": "string", 286 "pattern": "^\\S$" 287 }, 288 "tests": [ 289 { 290 "description": "ASCII space does not match", 291 "data": " ", 292 "valid": false 293 }, 294 { 295 "description": "Character tabulation does not match", 296 "data": "\t", 297 "valid": false 298 }, 299 { 300 "description": "Line tabulation does not match", 301 "data": "\u000b", 302 "valid": false, 303 "skip": { 304 "v2": "unexpected success", 305 "v3": "unexpected success" 306 } 307 }, 308 { 309 "description": "Form feed does not match", 310 "data": "\f", 311 "valid": false 312 }, 313 { 314 "description": "latin-1 non-breaking-space does not match", 315 "data": " ", 316 "valid": false, 317 "skip": { 318 "v2": "unexpected success", 319 "v3": "unexpected success" 320 } 321 }, 322 { 323 "description": "zero-width whitespace does not match", 324 "data": "\ufeff", 325 "valid": false, 326 "skip": { 327 "v2": "unexpected success", 328 "v3": "unexpected success" 329 } 330 }, 331 { 332 "description": "line feed does not match (line terminator)", 333 "data": "\n", 334 "valid": false 335 }, 336 { 337 "description": "paragraph separator does not match (line terminator)", 338 "data": "\u2029", 339 "valid": false, 340 "skip": { 341 "v2": "unexpected success", 342 "v3": "unexpected success" 343 } 344 }, 345 { 346 "description": "EM SPACE does not match (Space_Separator)", 347 "data": " ", 348 "valid": false, 349 "skip": { 350 "v2": "unexpected success", 351 "v3": "unexpected success" 352 } 353 }, 354 { 355 "description": "Non-whitespace control matches", 356 "data": "\u0001", 357 "valid": true 358 }, 359 { 360 "description": "Non-whitespace matches", 361 "data": "–", 362 "valid": true 363 } 364 ] 365 }, 366 { 367 "description": "patterns always use unicode semantics with pattern", 368 "schema": { 369 "$schema": "https://json-schema.org/draft/2020-12/schema", 370 "pattern": "\\p{Letter}cole" 371 }, 372 "skip": { 373 "v2": "extract error: unsupported regexp character class in \"\\\\p{Letter}cole\": error parsing regexp: invalid character class range: `\\p{Letter}`", 374 "v3": "extract error: unsupported regexp character class in \"\\\\p{Letter}cole\": error parsing regexp: invalid character class range: `\\p{Letter}`" 375 }, 376 "tests": [ 377 { 378 "description": "ascii character in json string", 379 "data": "Les hivers de mon enfance etaient des saisons longues, longues. Nous vivions en trois lieux: l'ecole, l'eglise et la patinoire; mais la vraie vie etait sur la patinoire.", 380 "valid": true, 381 "skip": { 382 "v2": "could not compile schema", 383 "v3": "could not compile schema" 384 } 385 }, 386 { 387 "description": "literal unicode character in json string", 388 "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'école, l'église et la patinoire; mais la vraie vie était sur la patinoire.", 389 "valid": true, 390 "skip": { 391 "v2": "could not compile schema", 392 "v3": "could not compile schema" 393 } 394 }, 395 { 396 "description": "unicode character in hex format in string", 397 "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'école, l'église et la patinoire; mais la vraie vie était sur la patinoire.", 398 "valid": true, 399 "skip": { 400 "v2": "could not compile schema", 401 "v3": "could not compile schema" 402 } 403 }, 404 { 405 "description": "unicode matching is case-sensitive", 406 "data": "LES HIVERS DE MON ENFANCE ÉTAIENT DES SAISONS LONGUES, LONGUES. NOUS VIVIONS EN TROIS LIEUX: L'ÉCOLE, L'ÉGLISE ET LA PATINOIRE; MAIS LA VRAIE VIE ÉTAIT SUR LA PATINOIRE.", 407 "valid": false, 408 "skip": { 409 "v2": "could not compile schema", 410 "v3": "could not compile schema" 411 } 412 } 413 ] 414 }, 415 { 416 "description": "\\w in patterns matches [A-Za-z0-9_], not unicode letters", 417 "schema": { 418 "$schema": "https://json-schema.org/draft/2020-12/schema", 419 "pattern": "\\wcole" 420 }, 421 "tests": [ 422 { 423 "description": "ascii character in json string", 424 "data": "Les hivers de mon enfance etaient des saisons longues, longues. Nous vivions en trois lieux: l'ecole, l'eglise et la patinoire; mais la vraie vie etait sur la patinoire.", 425 "valid": true 426 }, 427 { 428 "description": "literal unicode character in json string", 429 "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'école, l'église et la patinoire; mais la vraie vie était sur la patinoire.", 430 "valid": false 431 }, 432 { 433 "description": "unicode character in hex format in string", 434 "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'école, l'église et la patinoire; mais la vraie vie était sur la patinoire.", 435 "valid": false 436 }, 437 { 438 "description": "unicode matching is case-sensitive", 439 "data": "LES HIVERS DE MON ENFANCE ÉTAIENT DES SAISONS LONGUES, LONGUES. NOUS VIVIONS EN TROIS LIEUX: L'ÉCOLE, L'ÉGLISE ET LA PATINOIRE; MAIS LA VRAIE VIE ÉTAIT SUR LA PATINOIRE.", 440 "valid": false 441 } 442 ] 443 }, 444 { 445 "description": "pattern with ASCII ranges", 446 "schema": { 447 "$schema": "https://json-schema.org/draft/2020-12/schema", 448 "pattern": "[a-z]cole" 449 }, 450 "tests": [ 451 { 452 "description": "literal unicode character in json string", 453 "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'école, l'église et la patinoire; mais la vraie vie était sur la patinoire.", 454 "valid": false 455 }, 456 { 457 "description": "unicode character in hex format in string", 458 "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'école, l'église et la patinoire; mais la vraie vie était sur la patinoire.", 459 "valid": false 460 }, 461 { 462 "description": "ascii characters match", 463 "data": "Les hivers de mon enfance etaient des saisons longues, longues. Nous vivions en trois lieux: l'ecole, l'eglise et la patinoire; mais la vraie vie etait sur la patinoire.", 464 "valid": true 465 } 466 ] 467 }, 468 { 469 "description": "\\d in pattern matches [0-9], not unicode digits", 470 "schema": { 471 "$schema": "https://json-schema.org/draft/2020-12/schema", 472 "pattern": "^\\d+$" 473 }, 474 "tests": [ 475 { 476 "description": "ascii digits", 477 "data": "42", 478 "valid": true 479 }, 480 { 481 "description": "ascii non-digits", 482 "data": "-%#", 483 "valid": false 484 }, 485 { 486 "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", 487 "data": "৪২", 488 "valid": false 489 } 490 ] 491 }, 492 { 493 "description": "\\a is not an ECMA 262 control escape", 494 "schema": { 495 "$schema": "https://json-schema.org/draft/2020-12/schema", 496 "format": "regex" 497 }, 498 "tests": [ 499 { 500 "description": "when used as a pattern", 501 "data": "\\a", 502 "valid": false, 503 "skip": { 504 "v2": "unexpected success", 505 "v3": "unexpected success" 506 } 507 } 508 ] 509 }, 510 { 511 "description": "pattern with non-ASCII digits", 512 "schema": { 513 "$schema": "https://json-schema.org/draft/2020-12/schema", 514 "pattern": "^\\p{digit}+$" 515 }, 516 "skip": { 517 "v2": "extract error: unsupported regexp character class in \"^\\\\p{digit}+$\": error parsing regexp: invalid character class range: `\\p{digit}`", 518 "v3": "extract error: unsupported regexp character class in \"^\\\\p{digit}+$\": error parsing regexp: invalid character class range: `\\p{digit}`" 519 }, 520 "tests": [ 521 { 522 "description": "ascii digits", 523 "data": "42", 524 "valid": true, 525 "skip": { 526 "v2": "could not compile schema", 527 "v3": "could not compile schema" 528 } 529 }, 530 { 531 "description": "ascii non-digits", 532 "data": "-%#", 533 "valid": false, 534 "skip": { 535 "v2": "could not compile schema", 536 "v3": "could not compile schema" 537 } 538 }, 539 { 540 "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", 541 "data": "৪২", 542 "valid": true, 543 "skip": { 544 "v2": "could not compile schema", 545 "v3": "could not compile schema" 546 } 547 } 548 ] 549 }, 550 { 551 "description": "patterns always use unicode semantics with patternProperties", 552 "schema": { 553 "$schema": "https://json-schema.org/draft/2020-12/schema", 554 "type": "object", 555 "patternProperties": { 556 "\\p{Letter}cole": true 557 }, 558 "additionalProperties": false 559 }, 560 "skip": { 561 "v2": "extract error: unsupported regexp character class in \"\\\\p{Letter}cole\": error parsing regexp: invalid character class range: `\\p{Letter}`", 562 "v3": "extract error: unsupported regexp character class in \"\\\\p{Letter}cole\": error parsing regexp: invalid character class range: `\\p{Letter}`" 563 }, 564 "tests": [ 565 { 566 "description": "ascii character in json string", 567 "data": { 568 "l'ecole": "pas de vraie vie" 569 }, 570 "valid": true, 571 "skip": { 572 "v2": "could not compile schema", 573 "v3": "could not compile schema" 574 } 575 }, 576 { 577 "description": "literal unicode character in json string", 578 "data": { 579 "l'école": "pas de vraie vie" 580 }, 581 "valid": true, 582 "skip": { 583 "v2": "could not compile schema", 584 "v3": "could not compile schema" 585 } 586 }, 587 { 588 "description": "unicode character in hex format in string", 589 "data": { 590 "l'école": "pas de vraie vie" 591 }, 592 "valid": true, 593 "skip": { 594 "v2": "could not compile schema", 595 "v3": "could not compile schema" 596 } 597 }, 598 { 599 "description": "unicode matching is case-sensitive", 600 "data": { 601 "L'ÉCOLE": "PAS DE VRAIE VIE" 602 }, 603 "valid": false, 604 "skip": { 605 "v2": "could not compile schema", 606 "v3": "could not compile schema" 607 } 608 } 609 ] 610 }, 611 { 612 "description": "\\w in patternProperties matches [A-Za-z0-9_], not unicode letters", 613 "schema": { 614 "$schema": "https://json-schema.org/draft/2020-12/schema", 615 "type": "object", 616 "patternProperties": { 617 "\\wcole": true 618 }, 619 "additionalProperties": false 620 }, 621 "tests": [ 622 { 623 "description": "ascii character in json string", 624 "data": { 625 "l'ecole": "pas de vraie vie" 626 }, 627 "valid": true 628 }, 629 { 630 "description": "literal unicode character in json string", 631 "data": { 632 "l'école": "pas de vraie vie" 633 }, 634 "valid": false 635 }, 636 { 637 "description": "unicode character in hex format in string", 638 "data": { 639 "l'école": "pas de vraie vie" 640 }, 641 "valid": false 642 }, 643 { 644 "description": "unicode matching is case-sensitive", 645 "data": { 646 "L'ÉCOLE": "PAS DE VRAIE VIE" 647 }, 648 "valid": false 649 } 650 ] 651 }, 652 { 653 "description": "patternProperties with ASCII ranges", 654 "schema": { 655 "$schema": "https://json-schema.org/draft/2020-12/schema", 656 "type": "object", 657 "patternProperties": { 658 "[a-z]cole": true 659 }, 660 "additionalProperties": false 661 }, 662 "tests": [ 663 { 664 "description": "literal unicode character in json string", 665 "data": { 666 "l'école": "pas de vraie vie" 667 }, 668 "valid": false 669 }, 670 { 671 "description": "unicode character in hex format in string", 672 "data": { 673 "l'école": "pas de vraie vie" 674 }, 675 "valid": false 676 }, 677 { 678 "description": "ascii characters match", 679 "data": { 680 "l'ecole": "pas de vraie vie" 681 }, 682 "valid": true 683 } 684 ] 685 }, 686 { 687 "description": "\\d in patternProperties matches [0-9], not unicode digits", 688 "schema": { 689 "$schema": "https://json-schema.org/draft/2020-12/schema", 690 "type": "object", 691 "patternProperties": { 692 "^\\d+$": true 693 }, 694 "additionalProperties": false 695 }, 696 "tests": [ 697 { 698 "description": "ascii digits", 699 "data": { 700 "42": "life, the universe, and everything" 701 }, 702 "valid": true 703 }, 704 { 705 "description": "ascii non-digits", 706 "data": { 707 "-%#": "spending the year dead for tax reasons" 708 }, 709 "valid": false 710 }, 711 { 712 "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", 713 "data": { 714 "৪২": "khajit has wares if you have coin" 715 }, 716 "valid": false 717 } 718 ] 719 }, 720 { 721 "description": "patternProperties with non-ASCII digits", 722 "schema": { 723 "$schema": "https://json-schema.org/draft/2020-12/schema", 724 "type": "object", 725 "patternProperties": { 726 "^\\p{digit}+$": true 727 }, 728 "additionalProperties": false 729 }, 730 "skip": { 731 "v2": "extract error: unsupported regexp character class in \"^\\\\p{digit}+$\": error parsing regexp: invalid character class range: `\\p{digit}`", 732 "v3": "extract error: unsupported regexp character class in \"^\\\\p{digit}+$\": error parsing regexp: invalid character class range: `\\p{digit}`" 733 }, 734 "tests": [ 735 { 736 "description": "ascii digits", 737 "data": { 738 "42": "life, the universe, and everything" 739 }, 740 "valid": true, 741 "skip": { 742 "v2": "could not compile schema", 743 "v3": "could not compile schema" 744 } 745 }, 746 { 747 "description": "ascii non-digits", 748 "data": { 749 "-%#": "spending the year dead for tax reasons" 750 }, 751 "valid": false, 752 "skip": { 753 "v2": "could not compile schema", 754 "v3": "could not compile schema" 755 } 756 }, 757 { 758 "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", 759 "data": { 760 "৪২": "khajit has wares if you have coin" 761 }, 762 "valid": true, 763 "skip": { 764 "v2": "could not compile schema", 765 "v3": "could not compile schema" 766 } 767 } 768 ] 769 } 770 ]