|
| 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 should not in jsonschema", |
| 11 | + "data": "abc\n", |
| 12 | + "valid": false |
| 13 | + }, |
| 14 | + { |
| 15 | + "description": "should match", |
| 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": "\u0009", |
| 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 | + "tests": [ |
| 47 | + { |
| 48 | + "description": "does not match", |
| 49 | + "data": "\\cC", |
| 50 | + "valid": false |
| 51 | + }, |
| 52 | + { |
| 53 | + "description": "matches", |
| 54 | + "data": "\u0003", |
| 55 | + "valid": true |
| 56 | + } |
| 57 | + ] |
| 58 | + }, |
| 59 | + { |
| 60 | + "description": "ECMA 262 regex escapes control codes with \\c and lower letter", |
| 61 | + "schema": { |
| 62 | + "type": "string", |
| 63 | + "pattern": "^\\cc$" |
| 64 | + }, |
| 65 | + "tests": [ |
| 66 | + { |
| 67 | + "description": "does not match", |
| 68 | + "data": "\\cc", |
| 69 | + "valid": false |
| 70 | + }, |
| 71 | + { |
| 72 | + "description": "matches", |
| 73 | + "data": "\u0003", |
| 74 | + "valid": true |
| 75 | + } |
| 76 | + ] |
| 77 | + }, |
| 78 | + { |
| 79 | + "description": "ECMA 262 \\d matches ascii digits only", |
| 80 | + "schema": { |
| 81 | + "type": "string", |
| 82 | + "pattern": "^\\d$" |
| 83 | + }, |
| 84 | + "tests": [ |
| 85 | + { |
| 86 | + "description": "ASCII zero matches", |
| 87 | + "data": "0", |
| 88 | + "valid": true |
| 89 | + }, |
| 90 | + { |
| 91 | + "description": "NKO DIGIT ZERO does not match (unlike e.g. Python)", |
| 92 | + "data": "߀", |
| 93 | + "valid": false |
| 94 | + }, |
| 95 | + { |
| 96 | + "description": "NKO DIGIT ZERO (as \\u escape) does not match", |
| 97 | + "data": "\u07c0", |
| 98 | + "valid": false |
| 99 | + } |
| 100 | + ] |
| 101 | + }, |
| 102 | + { |
| 103 | + "description": "ECMA 262 \\D matches everything but ascii digits", |
| 104 | + "schema": { |
| 105 | + "type": "string", |
| 106 | + "pattern": "^\\D$" |
| 107 | + }, |
| 108 | + "tests": [ |
| 109 | + { |
| 110 | + "description": "ASCII zero does not match", |
| 111 | + "data": "0", |
| 112 | + "valid": false |
| 113 | + }, |
| 114 | + { |
| 115 | + "description": "NKO DIGIT ZERO matches (unlike e.g. Python)", |
| 116 | + "data": "߀", |
| 117 | + "valid": true |
| 118 | + }, |
| 119 | + { |
| 120 | + "description": "NKO DIGIT ZERO (as \\u escape) matches", |
| 121 | + "data": "\u07c0", |
| 122 | + "valid": true |
| 123 | + } |
| 124 | + ] |
| 125 | + }, |
| 126 | + { |
| 127 | + "description": "ECMA 262 \\w matches ascii letters only", |
| 128 | + "schema": { |
| 129 | + "type": "string", |
| 130 | + "pattern": "^\\w$" |
| 131 | + }, |
| 132 | + "tests": [ |
| 133 | + { |
| 134 | + "description": "ASCII 'a' matches", |
| 135 | + "data": "a", |
| 136 | + "valid": true |
| 137 | + }, |
| 138 | + { |
| 139 | + "description": "latin-1 e-acute does not match (unlike e.g. Python)", |
| 140 | + "data": "é", |
| 141 | + "valid": false |
| 142 | + } |
| 143 | + ] |
| 144 | + }, |
| 145 | + { |
| 146 | + "description": "ECMA 262 \\w matches everything but ascii letters", |
| 147 | + "schema": { |
| 148 | + "type": "string", |
| 149 | + "pattern": "^\\W$" |
| 150 | + }, |
| 151 | + "tests": [ |
| 152 | + { |
| 153 | + "description": "ASCII 'a' does not match", |
| 154 | + "data": "a", |
| 155 | + "valid": false |
| 156 | + }, |
| 157 | + { |
| 158 | + "description": "latin-1 e-acute matches (unlike e.g. Python)", |
| 159 | + "data": "é", |
| 160 | + "valid": true |
| 161 | + } |
| 162 | + ] |
| 163 | + }, |
| 164 | + { |
| 165 | + "description": "ECMA 262 \\s matches ascii whitespace only", |
| 166 | + "schema": { |
| 167 | + "type": "string", |
| 168 | + "pattern": "^\\s$" |
| 169 | + }, |
| 170 | + "tests": [ |
| 171 | + { |
| 172 | + "description": "ASCII space matches", |
| 173 | + "data": " ", |
| 174 | + "valid": true |
| 175 | + }, |
| 176 | + { |
| 177 | + "description": "latin-1 non-breaking-space does not match (unlike e.g. Python)", |
| 178 | + "data": "\u00a0", |
| 179 | + "valid": false |
| 180 | + } |
| 181 | + ] |
| 182 | + }, |
| 183 | + { |
| 184 | + "description": "ECMA 262 \\S matches everything but ascii whitespace", |
| 185 | + "schema": { |
| 186 | + "type": "string", |
| 187 | + "pattern": "^\\S$" |
| 188 | + }, |
| 189 | + "tests": [ |
| 190 | + { |
| 191 | + "description": "ASCII space does not match", |
| 192 | + "data": " ", |
| 193 | + "valid": false |
| 194 | + }, |
| 195 | + { |
| 196 | + "description": "latin-1 non-breaking-space matches (unlike e.g. Python)", |
| 197 | + "data": "\u00a0", |
| 198 | + "valid": true |
| 199 | + } |
| 200 | + ] |
| 201 | + } |
| 202 | +] |
| 203 | + |
0 commit comments