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