|
1 | 1 | [ |
2 | 2 | { |
3 | 3 | "description": "unicode semantics should be used for all pattern matching", |
4 | | - "schema": { "pattern": "\\wcole" }, |
| 4 | + "schema": { "pattern": "\\p{Letter}cole" }, |
5 | 5 | "tests": [ |
| 6 | + { |
| 7 | + "description": "ascii character in json string", |
| 8 | + "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.", |
| 9 | + "valid": true |
| 10 | + }, |
6 | 11 | { |
7 | 12 | "description": "literal unicode character in json string", |
8 | 13 | "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.", |
|
20 | 25 | } |
21 | 26 | ] |
22 | 27 | }, |
| 28 | + { |
| 29 | + "description": "\\w in patterns matches [A-Za-z0-9_], not unicode letters", |
| 30 | + "schema": { "pattern": "\\wcole" }, |
| 31 | + "tests": [ |
| 32 | + { |
| 33 | + "description": "ascii character in json string", |
| 34 | + "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.", |
| 35 | + "valid": true |
| 36 | + }, |
| 37 | + { |
| 38 | + "description": "literal unicode character in json string", |
| 39 | + "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.", |
| 40 | + "valid": false |
| 41 | + }, |
| 42 | + { |
| 43 | + "description": "unicode character in hex format in string", |
| 44 | + "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.", |
| 45 | + "valid": false |
| 46 | + }, |
| 47 | + { |
| 48 | + "description": "unicode matching is case-sensitive", |
| 49 | + "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.", |
| 50 | + "valid": false |
| 51 | + } |
| 52 | + ] |
| 53 | + }, |
23 | 54 | { |
24 | 55 | "description": "unicode characters do not match ascii ranges", |
25 | 56 | "schema": { "pattern": "[a-z]cole" }, |
|
42 | 73 | ] |
43 | 74 | }, |
44 | 75 | { |
45 | | - "description": "unicode digits are more than 0 through 9", |
| 76 | + "description": "\\d in pattern matches [0-9], not unicode digits", |
46 | 77 | "schema": { "pattern": "^\\d+$" }, |
| 78 | + "tests": [ |
| 79 | + { |
| 80 | + "description": "ascii digits", |
| 81 | + "data": "42", |
| 82 | + "valid": true |
| 83 | + }, |
| 84 | + { |
| 85 | + "description": "ascii non-digits", |
| 86 | + "data": "-%#", |
| 87 | + "valid": false |
| 88 | + }, |
| 89 | + { |
| 90 | + "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", |
| 91 | + "data": "৪২", |
| 92 | + "valid": false |
| 93 | + } |
| 94 | + ] |
| 95 | + }, |
| 96 | + { |
| 97 | + "description": "unicode digits are more than 0 through 9", |
| 98 | + "schema": { "pattern": "^\\p{digit}+$" }, |
47 | 99 | "tests": [ |
48 | 100 | { |
49 | 101 | "description": "ascii digits", |
|
67 | 119 | "schema": { |
68 | 120 | "type": "object", |
69 | 121 | "patternProperties": { |
70 | | - "\\wcole": true |
| 122 | + "\\p{Letter}cole": true |
71 | 123 | }, |
72 | 124 | "additionalProperties": false |
73 | 125 | }, |
74 | 126 | "tests": [ |
| 127 | + { |
| 128 | + "description": "ascii character in json string", |
| 129 | + "data": { "l'ecole": "pas de vraie vie" }, |
| 130 | + "valid": true |
| 131 | + }, |
75 | 132 | { |
76 | 133 | "description": "literal unicode character in json string", |
77 | 134 | "data": { "l'école": "pas de vraie vie" }, |
|
89 | 146 | } |
90 | 147 | ] |
91 | 148 | }, |
| 149 | + { |
| 150 | + "description": "\\w in patternProperties matches [A-Za-z0-9_], not unicode letters", |
| 151 | + "schema": { |
| 152 | + "type": "object", |
| 153 | + "patternProperties": { |
| 154 | + "\\wcole": true |
| 155 | + }, |
| 156 | + "additionalProperties": false |
| 157 | + }, |
| 158 | + "tests": [ |
| 159 | + { |
| 160 | + "description": "ascii character in json string", |
| 161 | + "data": { "l'ecole": "pas de vraie vie" }, |
| 162 | + "valid": true |
| 163 | + }, |
| 164 | + { |
| 165 | + "description": "literal unicode character in json string", |
| 166 | + "data": { "l'école": "pas de vraie vie" }, |
| 167 | + "valid": false |
| 168 | + }, |
| 169 | + { |
| 170 | + "description": "unicode character in hex format in string", |
| 171 | + "data": { "l'\u00e9cole": "pas de vraie vie" }, |
| 172 | + "valid": false |
| 173 | + }, |
| 174 | + { |
| 175 | + "description": "unicode matching is case-sensitive", |
| 176 | + "data": { "L'ÉCOLE": "PAS DE VRAIE VIE" }, |
| 177 | + "valid": false |
| 178 | + } |
| 179 | + ] |
| 180 | + }, |
92 | 181 | { |
93 | 182 | "description": "unicode characters do not match ascii ranges", |
94 | 183 | "schema": { |
|
117 | 206 | ] |
118 | 207 | }, |
119 | 208 | { |
120 | | - "description": "unicode digits are more than 0 through 9", |
| 209 | + "description": "\\d in patternProperties matches [0-9], not unicode digits", |
121 | 210 | "schema": { |
122 | 211 | "type": "object", |
123 | 212 | "patternProperties": { |
124 | 213 | "^\\d+$": true |
125 | 214 | }, |
126 | 215 | "additionalProperties": false |
127 | 216 | }, |
| 217 | + "tests": [ |
| 218 | + { |
| 219 | + "description": "ascii digits", |
| 220 | + "data": { "42": "life, the universe, and everything" }, |
| 221 | + "valid": true |
| 222 | + }, |
| 223 | + { |
| 224 | + "description": "ascii non-digits", |
| 225 | + "data": { "-%#": "spending the year dead for tax reasons" }, |
| 226 | + "valid": false |
| 227 | + }, |
| 228 | + { |
| 229 | + "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)", |
| 230 | + "data": { "৪২": "khajit has wares if you have coin" }, |
| 231 | + "valid": false |
| 232 | + } |
| 233 | + ] |
| 234 | + }, |
| 235 | + { |
| 236 | + "description": "unicode digits are more than 0 through 9", |
| 237 | + "schema": { |
| 238 | + "type": "object", |
| 239 | + "patternProperties": { |
| 240 | + "^\\p{digit}+$": true |
| 241 | + }, |
| 242 | + "additionalProperties": false |
| 243 | + }, |
128 | 244 | "tests": [ |
129 | 245 | { |
130 | 246 | "description": "ascii digits", |
|
0 commit comments