| 1 |
[ |
| 2 |
{ |
| 3 |
"description": "ECMA 262 regex $ does not match trailing newline", |
| 4 |
"schema": { |
| 5 |
"$schema": "https://json-schema.org/v1", |
| 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/v1", |
| 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": "\u0009", |
| 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/v1", |
| 46 |
"type": "string", |
| 47 |
"pattern": "^\\cC$" |
| 48 |
}, |
| 49 |
"tests": [ |
| 50 |
{ |
| 51 |
"description": "does not match", |
| 52 |
"data": "\\cC", |
| 53 |
"valid": false |
| 54 |
}, |
| 55 |
{ |
| 56 |
"description": "matches", |
| 57 |
"data": "\u0003", |
| 58 |
"valid": true |
| 59 |
} |
| 60 |
] |
| 61 |
}, |
| 62 |
{ |
| 63 |
"description": "ECMA 262 regex escapes control codes with \\c and lower letter", |
| 64 |
"schema": { |
| 65 |
"$schema": "https://json-schema.org/v1", |
| 66 |
"type": "string", |
| 67 |
"pattern": "^\\cc$" |
| 68 |
}, |
| 69 |
"tests": [ |
| 70 |
{ |
| 71 |
"description": "does not match", |
| 72 |
"data": "\\cc", |
| 73 |
"valid": false |
| 74 |
}, |
| 75 |
{ |
| 76 |
"description": "matches", |
| 77 |
"data": "\u0003", |
| 78 |
"valid": true |
| 79 |
} |
| 80 |
] |
| 81 |
}, |
| 82 |
{ |
| 83 |
"description": "ECMA 262 \\d matches ascii digits only", |
| 84 |
"schema": { |
| 85 |
"$schema": "https://json-schema.org/v1", |
| 86 |
"type": "string", |
| 87 |
"pattern": "^\\d$" |
| 88 |
}, |
| 89 |
"tests": [ |
| 90 |
{ |
| 91 |
"description": "ASCII zero matches", |
| 92 |
"data": "0", |
| 93 |
"valid": true |
| 94 |
}, |
| 95 |
{ |
| 96 |
"description": "NKO DIGIT ZERO does not match (unlike e.g. Python)", |
| 97 |
"data": "߀", |
| 98 |
"valid": false |
| 99 |
}, |
| 100 |
{ |
| 101 |
"description": "NKO DIGIT ZERO (as \\u escape) does not match", |
| 102 |
"data": "\u07c0", |
| 103 |
"valid": false |
| 104 |
} |
| 105 |
] |
| 106 |
}, |
| 107 |
{ |
| 108 |
"description": "ECMA 262 \\D matches everything but ascii digits", |
| 109 |
"schema": { |
| 110 |
"$schema": "https://json-schema.org/v1", |
| 111 |
"type": "string", |
| 112 |
"pattern": "^\\D$" |
| 113 |
}, |
| 114 |
"tests": [ |
| 115 |
{ |
| 116 |
"description": "ASCII zero does not match", |
| 117 |
"data": "0", |
| 118 |
"valid": false |
| 119 |
}, |
| 120 |
{ |
| 121 |
"description": "NKO DIGIT ZERO matches (unlike e.g. Python)", |
| 122 |
"data": "߀", |
| 123 |
"valid": true |
| 124 |
}, |
| 125 |
{ |
| 126 |
"description": "NKO DIGIT ZERO (as \\u escape) matches", |
| 127 |
"data": "\u07c0", |
| 128 |
"valid": true |
| 129 |
} |
| 130 |
] |
| 131 |
}, |
| 132 |
{ |
| 133 |
"description": "ECMA 262 \\w matches ascii letters only", |
| 134 |
"schema": { |
| 135 |
"$schema": "https://json-schema.org/v1", |
| 136 |
"type": "string", |
| 137 |
"pattern": "^\\w$" |
| 138 |
}, |
| 139 |
"tests": [ |
| 140 |
{ |
| 141 |
"description": "ASCII 'a' matches", |
| 142 |
"data": "a", |
| 143 |
"valid": true |
| 144 |
}, |
| 145 |
{ |
| 146 |
"description": "latin-1 e-acute does not match (unlike e.g. Python)", |
| 147 |
"data": "é", |
| 148 |
"valid": false |
| 149 |
} |
| 150 |
] |
| 151 |
}, |
| 152 |
{ |
| 153 |
"description": "ECMA 262 \\W matches everything but ascii letters", |
| 154 |
"schema": { |
| 155 |
"$schema": "https://json-schema.org/v1", |
| 156 |
"type": "string", |
| 157 |
"pattern": "^\\W$" |
| 158 |
}, |
| 159 |
"tests": [ |
| 160 |
{ |
| 161 |
"description": "ASCII 'a' does not match", |
| 162 |
"data": "a", |
| 163 |
"valid": false |
| 164 |
}, |
| 165 |
{ |
| 166 |
"description": "latin-1 e-acute matches (unlike e.g. Python)", |
| 167 |
"data": "é", |
| 168 |
"valid": true |
| 169 |
} |
| 170 |
] |
| 171 |
}, |
| 172 |
{ |
| 173 |
"description": "ECMA 262 \\s matches whitespace", |
| 174 |
"schema": { |
| 175 |
"$schema": "https://json-schema.org/v1", |
| 176 |
"type": "string", |
| 177 |
"pattern": "^\\s$" |
| 178 |
}, |
| 179 |
"tests": [ |
| 180 |
{ |
| 181 |
"description": "ASCII space matches", |
| 182 |
"data": " ", |
| 183 |
"valid": true |
| 184 |
}, |
| 185 |
{ |
| 186 |
"description": "Character tabulation matches", |
| 187 |
"data": "\t", |
| 188 |
"valid": true |
| 189 |
}, |
| 190 |
{ |
| 191 |
"description": "Line tabulation matches", |
| 192 |
"data": "\u000b", |
| 193 |
"valid": true |
| 194 |
}, |
| 195 |
{ |
| 196 |
"description": "Form feed matches", |
| 197 |
"data": "\u000c", |
| 198 |
"valid": true |
| 199 |
}, |
| 200 |
{ |
| 201 |
"description": "latin-1 non-breaking-space matches", |
| 202 |
"data": "\u00a0", |
| 203 |
"valid": true |
| 204 |
}, |
| 205 |
{ |
| 206 |
"description": "zero-width whitespace matches", |
| 207 |
"data": "\ufeff", |
| 208 |
"valid": true |
| 209 |
}, |
| 210 |
{ |
| 211 |
"description": "line feed matches (line terminator)", |
| 212 |
"data": "\u000a", |
| 213 |
"valid": true |
| 214 |
}, |
| 215 |
{ |
| 216 |
"description": "paragraph separator matches (line terminator)", |
| 217 |
"data": "\u2029", |
| 218 |
"valid": true |
| 219 |
}, |
| 220 |
{ |
| 221 |
"description": "EM SPACE matches (Space_Separator)", |
| 222 |
"data": "\u2003", |
| 223 |
"valid": true |
| 224 |
}, |
| 225 |
{ |
| 226 |
"description": "Non-whitespace control does not match", |
| 227 |
"data": "\u0001", |
| 228 |
"valid": false |
| 229 |
}, |
| 230 |
{ |
| 231 |
"description": "Non-whitespace does not match", |
| 232 |
"data": "\u2013", |
| 233 |
"valid": false |
| 234 |
} |
| 235 |
] |
| 236 |
}, |
| 237 |
{ |
| 238 |
"description": "ECMA 262 \\S matches everything but whitespace", |
| 239 |
"schema": { |
| 240 |
"$schema": "https://json-schema.org/v1", |
| 241 |
"type": "string", |
| 242 |
"pattern": "^\\S$" |
| 243 |
}, |
| 244 |
"tests": [ |
| 245 |
{ |
| 246 |
"description": "ASCII space does not match", |
| 247 |
"data": " ", |
| 248 |
"valid": false |
| 249 |
}, |
| 250 |
{ |
| 251 |
"description": "Character tabulation does not match", |
| 252 |
"data": "\t", |
| 253 |
"valid": false |
| 254 |
}, |
| 255 |
{ |
| 256 |
"description": "Line tabulation does not match", |
| 257 |
"data": "\u000b", |
| 258 |
"valid": false |
| 259 |
}, |
| 260 |
{ |
| 261 |
"description": "Form feed does not match", |
| 262 |
"data": "\u000c", |
| 263 |
"valid": false |
| 264 |
}, |
| 265 |
{ |
| 266 |
"description": "latin-1 non-breaking-space does not match", |
| 267 |
"data": "\u00a0", |
| 268 |
"valid": false |
| 269 |
}, |
| 270 |
{ |
| 271 |
"description": "zero-width whitespace does not match", |
| 272 |
"data": "\ufeff", |
| 273 |
"valid": false |
| 274 |
}, |
| 275 |
{ |
| 276 |
"description": "line feed does not match (line terminator)", |
| 277 |
"data": "\u000a", |
| 278 |
"valid": false |
| 279 |
}, |
| 280 |
{ |
| 281 |
"description": "paragraph separator does not match (line terminator)", |
| 282 |
"data": "\u2029", |
| 283 |
"valid": false |
| 284 |
}, |
| 285 |
{ |
| 286 |
"description": "EM SPACE does not match (Space_Separator)", |
| 287 |
"data": "\u2003", |
| 288 |
"valid": false |
| 289 |
}, |
| 290 |
{ |
| 291 |
"description": "Non-whitespace control matches", |
| 292 |
"data": "\u0001", |
| 293 |
"valid": true |
| 294 |
}, |
| 295 |
{ |
| 296 |
"description": "Non-whitespace matches", |
| 297 |
"data": "\u2013", |
| 298 |
"valid": true |
| 299 |
} |
| 300 |
] |
| 301 |
}, |
| 302 |
{ |
| 303 |
"description": "patterns always use unicode semantics with pattern", |
| 304 |
"schema": { |
| 305 |
"$schema": "https://json-schema.org/v1", |
| 306 |
"pattern": "\\p{Letter}cole" |
| 307 |
}, |
| 308 |
"tests": [ |
| 309 |
{ |
| 310 |
"description": "ascii character in json string", |
| 311 |
"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.", |
| 312 |
"valid": true |
| 313 |
}, |
| 314 |
{ |
| 315 |
"description": "literal unicode character in json string", |
| 316 |
"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.", |
| 317 |
"valid": true |
| 318 |
}, |
| 319 |
{ |
| 320 |
"description": "unicode character in hex format in string", |
| 321 |
"data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'\u00e9cole, l'église et la patinoire; mais la vraie vie était sur la patinoire.", |
| 322 |
"valid": true |
| 323 |
}, |
| 324 |
{ |
| 325 |
"description": "unicode matching is case-sensitive", |
| 326 |
"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.", |
| 327 |
"valid": false |
| 328 |
} |
| 329 |
] |
| 330 |
}, |
| 331 |
{ |
| 332 |
"description": "\\w in patterns matches [A-Za-z0-9_], not unicode letters", |
| 333 |
"schema": { |
| 334 |
"$schema": "https://json-schema.org/v1", |
| 335 |
"pattern": "\\wcole" |
| 336 |
}, |
| 337 |
"tests": [ |
| 338 |
{ |
| 339 |
"description": "ascii character in json string", |
| 340 |
"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.", |
| 341 |
"valid": true |
| 342 |
}, |
| 343 |
{ |
| 344 |
"description": "literal unicode character in json string", |
| 345 |
"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.", |
| 346 |
"valid": false |
| 347 |
}, |
| 348 |
{ |
| 349 |
"description": "unicode character in hex format in string", |
| 350 |
"data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'\u00e9cole, l'église et la patinoire; mais la vraie vie était sur la patinoire.", |
| 351 |
"valid": false |
| 352 |
}, |
| 353 |
{ |
| 354 |
"description": "unicode matching is case-sensitive", |
| 355 |
"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.", |
| 356 |
"valid": false |
| 357 |
} |
| 358 |
] |
| 359 |
}, |
| 360 |
{ |
| 361 |
"description": "pattern with ASCII ranges", |
| 362 |
"schema": { |
| 363 |
"$schema": "https://json-schema.org/v1", |
| 364 |
"pattern": "[a-z]cole" |
| 365 |
}, |
| 366 |
"tests": [ |
| 367 |
{ |
| 368 |
"description": "literal unicode character in json string", |
| 369 |
"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.", |
| 370 |
"valid": false |
| 371 |
}, |
| 372 |
{ |
| 373 |
"description": "unicode character in hex format in string", |
| 374 |
"data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'\u00e9cole, l'église et la patinoire; mais la vraie vie était sur la patinoire.", |
| 375 |
"valid": false |
| 376 |
}, |
| 377 |
{ |
| 378 |
"description": "ascii characters match", |
| 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 |
} |
| 382 |
] |
| 383 |
}, |
| 384 |
{ |
| 385 |
"description": "\\d in pattern matches [0-9], not unicode digits", |
| 386 |
"schema": { |
| 387 |
"$schema": "https://json-schema.org/v1", |
| 388 |
"pattern": "^\\d+$" |
| 389 |
}, |
| 390 |
"tests": [ |
| 391 |
{ |
| 392 |
"description": "ascii digits", |
| 393 |
"data": "42", |
| 394 |
"valid": true |
| 395 |
}, |
| 396 |
{ |
| 397 |
"description": "ascii non-digits", |
| 398 |
"data": "-%#", |
| 399 |
"valid": false |
| 400 |
}, |
| 401 |
{ |
| 402 |
"description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", |
| 403 |
"data": "৪২", |
| 404 |
"valid": false |
| 405 |
} |
| 406 |
] |
| 407 |
}, |
| 408 |
{ |
| 409 |
"description": "pattern with non-ASCII digits", |
| 410 |
"schema": { |
| 411 |
"$schema": "https://json-schema.org/v1", |
| 412 |
"pattern": "^\\p{digit}+$" |
| 413 |
}, |
| 414 |
"tests": [ |
| 415 |
{ |
| 416 |
"description": "ascii digits", |
| 417 |
"data": "42", |
| 418 |
"valid": true |
| 419 |
}, |
| 420 |
{ |
| 421 |
"description": "ascii non-digits", |
| 422 |
"data": "-%#", |
| 423 |
"valid": false |
| 424 |
}, |
| 425 |
{ |
| 426 |
"description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", |
| 427 |
"data": "৪২", |
| 428 |
"valid": true |
| 429 |
} |
| 430 |
] |
| 431 |
}, |
| 432 |
{ |
| 433 |
"description": "patterns always use unicode semantics with patternProperties", |
| 434 |
"schema": { |
| 435 |
"$schema": "https://json-schema.org/v1", |
| 436 |
"type": "object", |
| 437 |
"patternProperties": { |
| 438 |
"\\p{Letter}cole": true |
| 439 |
}, |
| 440 |
"additionalProperties": false |
| 441 |
}, |
| 442 |
"tests": [ |
| 443 |
{ |
| 444 |
"description": "ascii character in json string", |
| 445 |
"data": { "l'ecole": "pas de vraie vie" }, |
| 446 |
"valid": true |
| 447 |
}, |
| 448 |
{ |
| 449 |
"description": "literal unicode character in json string", |
| 450 |
"data": { "l'école": "pas de vraie vie" }, |
| 451 |
"valid": true |
| 452 |
}, |
| 453 |
{ |
| 454 |
"description": "unicode character in hex format in string", |
| 455 |
"data": { "l'\u00e9cole": "pas de vraie vie" }, |
| 456 |
"valid": true |
| 457 |
}, |
| 458 |
{ |
| 459 |
"description": "unicode matching is case-sensitive", |
| 460 |
"data": { "L'ÉCOLE": "PAS DE VRAIE VIE" }, |
| 461 |
"valid": false |
| 462 |
} |
| 463 |
] |
| 464 |
}, |
| 465 |
{ |
| 466 |
"description": "\\w in patternProperties matches [A-Za-z0-9_], not unicode letters", |
| 467 |
"schema": { |
| 468 |
"$schema": "https://json-schema.org/v1", |
| 469 |
"type": "object", |
| 470 |
"patternProperties": { |
| 471 |
"\\wcole": true |
| 472 |
}, |
| 473 |
"additionalProperties": false |
| 474 |
}, |
| 475 |
"tests": [ |
| 476 |
{ |
| 477 |
"description": "ascii character in json string", |
| 478 |
"data": { "l'ecole": "pas de vraie vie" }, |
| 479 |
"valid": true |
| 480 |
}, |
| 481 |
{ |
| 482 |
"description": "literal unicode character in json string", |
| 483 |
"data": { "l'école": "pas de vraie vie" }, |
| 484 |
"valid": false |
| 485 |
}, |
| 486 |
{ |
| 487 |
"description": "unicode character in hex format in string", |
| 488 |
"data": { "l'\u00e9cole": "pas de vraie vie" }, |
| 489 |
"valid": false |
| 490 |
}, |
| 491 |
{ |
| 492 |
"description": "unicode matching is case-sensitive", |
| 493 |
"data": { "L'ÉCOLE": "PAS DE VRAIE VIE" }, |
| 494 |
"valid": false |
| 495 |
} |
| 496 |
] |
| 497 |
}, |
| 498 |
{ |
| 499 |
"description": "patternProperties with ASCII ranges", |
| 500 |
"schema": { |
| 501 |
"$schema": "https://json-schema.org/v1", |
| 502 |
"type": "object", |
| 503 |
"patternProperties": { |
| 504 |
"[a-z]cole": true |
| 505 |
}, |
| 506 |
"additionalProperties": false |
| 507 |
}, |
| 508 |
"tests": [ |
| 509 |
{ |
| 510 |
"description": "literal unicode character in json string", |
| 511 |
"data": { "l'école": "pas de vraie vie" }, |
| 512 |
"valid": false |
| 513 |
}, |
| 514 |
{ |
| 515 |
"description": "unicode character in hex format in string", |
| 516 |
"data": { "l'\u00e9cole": "pas de vraie vie" }, |
| 517 |
"valid": false |
| 518 |
}, |
| 519 |
{ |
| 520 |
"description": "ascii characters match", |
| 521 |
"data": { "l'ecole": "pas de vraie vie" }, |
| 522 |
"valid": true |
| 523 |
} |
| 524 |
] |
| 525 |
}, |
| 526 |
{ |
| 527 |
"description": "\\d in patternProperties matches [0-9], not unicode digits", |
| 528 |
"schema": { |
| 529 |
"$schema": "https://json-schema.org/v1", |
| 530 |
"type": "object", |
| 531 |
"patternProperties": { |
| 532 |
"^\\d+$": true |
| 533 |
}, |
| 534 |
"additionalProperties": false |
| 535 |
}, |
| 536 |
"tests": [ |
| 537 |
{ |
| 538 |
"description": "ascii digits", |
| 539 |
"data": { "42": "life, the universe, and everything" }, |
| 540 |
"valid": true |
| 541 |
}, |
| 542 |
{ |
| 543 |
"description": "ascii non-digits", |
| 544 |
"data": { "-%#": "spending the year dead for tax reasons" }, |
| 545 |
"valid": false |
| 546 |
}, |
| 547 |
{ |
| 548 |
"description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", |
| 549 |
"data": { "৪২": "khajit has wares if you have coin" }, |
| 550 |
"valid": false |
| 551 |
} |
| 552 |
] |
| 553 |
}, |
| 554 |
{ |
| 555 |
"description": "patternProperties with non-ASCII digits", |
| 556 |
"schema": { |
| 557 |
"$schema": "https://json-schema.org/v1", |
| 558 |
"type": "object", |
| 559 |
"patternProperties": { |
| 560 |
"^\\p{digit}+$": true |
| 561 |
}, |
| 562 |
"additionalProperties": false |
| 563 |
}, |
| 564 |
"tests": [ |
| 565 |
{ |
| 566 |
"description": "ascii digits", |
| 567 |
"data": { "42": "life, the universe, and everything" }, |
| 568 |
"valid": true |
| 569 |
}, |
| 570 |
{ |
| 571 |
"description": "ascii non-digits", |
| 572 |
"data": { "-%#": "spending the year dead for tax reasons" }, |
| 573 |
"valid": false |
| 574 |
}, |
| 575 |
{ |
| 576 |
"description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", |
| 577 |
"data": { "৪২": "khajit has wares if you have coin" }, |
| 578 |
"valid": true |
| 579 |
} |
| 580 |
] |
| 581 |
} |
| 582 |
] |