cuelang.org/go@v0.13.0/encoding/jsonschema/testdata/external/tests/draft2019-09/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/2019-09/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/2019-09/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/2019-09/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/2019-09/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/2019-09/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/2019-09/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/2019-09/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/2019-09/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/2019-09/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/2019-09/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/2019-09/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/2019-09/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/2019-09/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/2019-09/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": "pattern with non-ASCII digits", 494 "schema": { 495 "$schema": "https://json-schema.org/draft/2019-09/schema", 496 "pattern": "^\\p{digit}+$" 497 }, 498 "skip": { 499 "v2": "extract error: unsupported regexp character class in \"^\\\\p{digit}+$\": error parsing regexp: invalid character class range: `\\p{digit}`", 500 "v3": "extract error: unsupported regexp character class in \"^\\\\p{digit}+$\": error parsing regexp: invalid character class range: `\\p{digit}`" 501 }, 502 "tests": [ 503 { 504 "description": "ascii digits", 505 "data": "42", 506 "valid": true, 507 "skip": { 508 "v2": "could not compile schema", 509 "v3": "could not compile schema" 510 } 511 }, 512 { 513 "description": "ascii non-digits", 514 "data": "-%#", 515 "valid": false, 516 "skip": { 517 "v2": "could not compile schema", 518 "v3": "could not compile schema" 519 } 520 }, 521 { 522 "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", 523 "data": "৪২", 524 "valid": true, 525 "skip": { 526 "v2": "could not compile schema", 527 "v3": "could not compile schema" 528 } 529 } 530 ] 531 }, 532 { 533 "description": "patterns always use unicode semantics with patternProperties", 534 "schema": { 535 "$schema": "https://json-schema.org/draft/2019-09/schema", 536 "type": "object", 537 "patternProperties": { 538 "\\p{Letter}cole": true 539 }, 540 "additionalProperties": false 541 }, 542 "skip": { 543 "v2": "extract error: unsupported regexp character class in \"\\\\p{Letter}cole\": error parsing regexp: invalid character class range: `\\p{Letter}`", 544 "v3": "extract error: unsupported regexp character class in \"\\\\p{Letter}cole\": error parsing regexp: invalid character class range: `\\p{Letter}`" 545 }, 546 "tests": [ 547 { 548 "description": "ascii character in json string", 549 "data": { 550 "l'ecole": "pas de vraie vie" 551 }, 552 "valid": true, 553 "skip": { 554 "v2": "could not compile schema", 555 "v3": "could not compile schema" 556 } 557 }, 558 { 559 "description": "literal unicode character in json string", 560 "data": { 561 "l'école": "pas de vraie vie" 562 }, 563 "valid": true, 564 "skip": { 565 "v2": "could not compile schema", 566 "v3": "could not compile schema" 567 } 568 }, 569 { 570 "description": "unicode character in hex format in string", 571 "data": { 572 "l'école": "pas de vraie vie" 573 }, 574 "valid": true, 575 "skip": { 576 "v2": "could not compile schema", 577 "v3": "could not compile schema" 578 } 579 }, 580 { 581 "description": "unicode matching is case-sensitive", 582 "data": { 583 "L'ÉCOLE": "PAS DE VRAIE VIE" 584 }, 585 "valid": false, 586 "skip": { 587 "v2": "could not compile schema", 588 "v3": "could not compile schema" 589 } 590 } 591 ] 592 }, 593 { 594 "description": "\\w in patternProperties matches [A-Za-z0-9_], not unicode letters", 595 "schema": { 596 "$schema": "https://json-schema.org/draft/2019-09/schema", 597 "type": "object", 598 "patternProperties": { 599 "\\wcole": true 600 }, 601 "additionalProperties": false 602 }, 603 "tests": [ 604 { 605 "description": "ascii character in json string", 606 "data": { 607 "l'ecole": "pas de vraie vie" 608 }, 609 "valid": true 610 }, 611 { 612 "description": "literal unicode character in json string", 613 "data": { 614 "l'école": "pas de vraie vie" 615 }, 616 "valid": false 617 }, 618 { 619 "description": "unicode character in hex format in string", 620 "data": { 621 "l'école": "pas de vraie vie" 622 }, 623 "valid": false 624 }, 625 { 626 "description": "unicode matching is case-sensitive", 627 "data": { 628 "L'ÉCOLE": "PAS DE VRAIE VIE" 629 }, 630 "valid": false 631 } 632 ] 633 }, 634 { 635 "description": "patternProperties with ASCII ranges", 636 "schema": { 637 "$schema": "https://json-schema.org/draft/2019-09/schema", 638 "type": "object", 639 "patternProperties": { 640 "[a-z]cole": true 641 }, 642 "additionalProperties": false 643 }, 644 "tests": [ 645 { 646 "description": "literal unicode character in json string", 647 "data": { 648 "l'école": "pas de vraie vie" 649 }, 650 "valid": false 651 }, 652 { 653 "description": "unicode character in hex format in string", 654 "data": { 655 "l'école": "pas de vraie vie" 656 }, 657 "valid": false 658 }, 659 { 660 "description": "ascii characters match", 661 "data": { 662 "l'ecole": "pas de vraie vie" 663 }, 664 "valid": true 665 } 666 ] 667 }, 668 { 669 "description": "\\d in patternProperties matches [0-9], not unicode digits", 670 "schema": { 671 "$schema": "https://json-schema.org/draft/2019-09/schema", 672 "type": "object", 673 "patternProperties": { 674 "^\\d+$": true 675 }, 676 "additionalProperties": false 677 }, 678 "tests": [ 679 { 680 "description": "ascii digits", 681 "data": { 682 "42": "life, the universe, and everything" 683 }, 684 "valid": true 685 }, 686 { 687 "description": "ascii non-digits", 688 "data": { 689 "-%#": "spending the year dead for tax reasons" 690 }, 691 "valid": false 692 }, 693 { 694 "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", 695 "data": { 696 "৪২": "khajit has wares if you have coin" 697 }, 698 "valid": false 699 } 700 ] 701 }, 702 { 703 "description": "patternProperties with non-ASCII digits", 704 "schema": { 705 "$schema": "https://json-schema.org/draft/2019-09/schema", 706 "type": "object", 707 "patternProperties": { 708 "^\\p{digit}+$": true 709 }, 710 "additionalProperties": false 711 }, 712 "skip": { 713 "v2": "extract error: unsupported regexp character class in \"^\\\\p{digit}+$\": error parsing regexp: invalid character class range: `\\p{digit}`", 714 "v3": "extract error: unsupported regexp character class in \"^\\\\p{digit}+$\": error parsing regexp: invalid character class range: `\\p{digit}`" 715 }, 716 "tests": [ 717 { 718 "description": "ascii digits", 719 "data": { 720 "42": "life, the universe, and everything" 721 }, 722 "valid": true, 723 "skip": { 724 "v2": "could not compile schema", 725 "v3": "could not compile schema" 726 } 727 }, 728 { 729 "description": "ascii non-digits", 730 "data": { 731 "-%#": "spending the year dead for tax reasons" 732 }, 733 "valid": false, 734 "skip": { 735 "v2": "could not compile schema", 736 "v3": "could not compile schema" 737 } 738 }, 739 { 740 "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", 741 "data": { 742 "৪২": "khajit has wares if you have coin" 743 }, 744 "valid": true, 745 "skip": { 746 "v2": "could not compile schema", 747 "v3": "could not compile schema" 748 } 749 } 750 ] 751 } 752 ]