|
379 | 379 | {
|
380 | 380 | "pattern": [{ "pathname": "/foo/:bar?" }],
|
381 | 381 | "inputs": [{ "pathname": "/foo" }],
|
| 382 | + "//": "The `null` below is translated to undefined in the test harness.", |
382 | 383 | "expected_match": {
|
383 |
| - "pathname": { "input": "/foo", "groups": {} } |
| 384 | + "pathname": { "input": "/foo", "groups": { "bar": null } } |
384 | 385 | }
|
385 | 386 | },
|
386 | 387 | {
|
|
444 | 445 | {
|
445 | 446 | "pattern": [{ "pathname": "/foo/:bar*" }],
|
446 | 447 | "inputs": [{ "pathname": "/foo" }],
|
| 448 | + "//": "The `null` below is translated to undefined in the test harness.", |
447 | 449 | "expected_match": {
|
448 |
| - "pathname": { "input": "/foo", "groups": {} } |
| 450 | + "pathname": { "input": "/foo", "groups": { "bar": null } } |
449 | 451 | }
|
450 | 452 | },
|
451 | 453 | {
|
|
498 | 500 | "expected_obj": {
|
499 | 501 | "pathname": "/foo/*?"
|
500 | 502 | },
|
| 503 | + "//": "The `null` below is translated to undefined in the test harness.", |
501 | 504 | "expected_match": {
|
502 |
| - "pathname": { "input": "/foo", "groups": {} } |
| 505 | + "pathname": { "input": "/foo", "groups": { "0": null } } |
503 | 506 | }
|
504 | 507 | },
|
505 | 508 | {
|
506 | 509 | "pattern": [{ "pathname": "/foo/*?" }],
|
507 | 510 | "inputs": [{ "pathname": "/foo" }],
|
| 511 | + "//": "The `null` below is translated to undefined in the test harness.", |
508 | 512 | "expected_match": {
|
509 |
| - "pathname": { "input": "/foo", "groups": {} } |
| 513 | + "pathname": { "input": "/foo", "groups": { "0": null } } |
510 | 514 | }
|
511 | 515 | },
|
512 | 516 | {
|
|
682 | 686 | "expected_obj": {
|
683 | 687 | "pathname": "/foo/**"
|
684 | 688 | },
|
| 689 | + "//": "The `null` below is translated to undefined in the test harness.", |
685 | 690 | "expected_match": {
|
686 |
| - "pathname": { "input": "/foo", "groups": {} } |
| 691 | + "pathname": { "input": "/foo", "groups": { "0": null } } |
687 | 692 | }
|
688 | 693 | },
|
689 | 694 | {
|
690 | 695 | "pattern": [{ "pathname": "/foo/**" }],
|
691 | 696 | "inputs": [{ "pathname": "/foo" }],
|
| 697 | + "//": "The `null` below is translated to undefined in the test harness.", |
692 | 698 | "expected_match": {
|
693 |
| - "pathname": { "input": "/foo", "groups": {} } |
| 699 | + "pathname": { "input": "/foo", "groups": { "0": null } } |
694 | 700 | }
|
695 | 701 | },
|
696 | 702 | {
|
|
1115 | 1121 | "hostname": { "input": "xn--caf-dma.com", "groups": {}}
|
1116 | 1122 | }
|
1117 | 1123 | },
|
| 1124 | + { |
| 1125 | + "pattern": ["http://\uD83D\uDEB2.com/"], |
| 1126 | + "inputs": ["http://\uD83D\uDEB2.com/"], |
| 1127 | + "exactly_empty_components": [ "port" ], |
| 1128 | + "expected_obj": { |
| 1129 | + "protocol": "http", |
| 1130 | + "hostname": "xn--h78h.com", |
| 1131 | + "pathname": "/" |
| 1132 | + }, |
| 1133 | + "expected_match": { |
| 1134 | + "protocol": { "input": "http", "groups": {}}, |
| 1135 | + "hostname": { "input": "xn--h78h.com", "groups": {}}, |
| 1136 | + "pathname": { "input": "/", "groups": {}} |
| 1137 | + } |
| 1138 | + }, |
| 1139 | + { |
| 1140 | + "pattern": ["http://\uD83D \uDEB2"], |
| 1141 | + "expected_obj": "error" |
| 1142 | + }, |
| 1143 | + { |
| 1144 | + "pattern": [{"hostname":"\uD83D \uDEB2"}], |
| 1145 | + "expected_obj": "error" |
| 1146 | + }, |
| 1147 | + { |
| 1148 | + "pattern": [{"pathname":"\uD83D \uDEB2"}], |
| 1149 | + "inputs": [], |
| 1150 | + "expected_obj": { |
| 1151 | + "pathname": "%EF%BF%BD%20%EF%BF%BD" |
| 1152 | + }, |
| 1153 | + "expected_match": null |
| 1154 | + }, |
| 1155 | + { |
| 1156 | + "pattern": [{"pathname":":\uD83D \uDEB2"}], |
| 1157 | + "expected_obj": "error" |
| 1158 | + }, |
| 1159 | + { |
| 1160 | + "pattern": [{"pathname":":a\uDB40\uDD00b"}], |
| 1161 | + "inputs": [], |
| 1162 | + "expected_obj": { |
| 1163 | + "pathname": ":a\uDB40\uDD00b" |
| 1164 | + }, |
| 1165 | + "expected_match": null |
| 1166 | + }, |
| 1167 | + { |
| 1168 | + "pattern": [{"pathname":"test/:a\uD801\uDC50b"}], |
| 1169 | + "inputs": [{"pathname":"test/foo"}], |
| 1170 | + "expected_obj": { |
| 1171 | + "pathname": "test/:a\uD801\uDC50b" |
| 1172 | + }, |
| 1173 | + "expected_match": { |
| 1174 | + "pathname": { "input": "test/foo", "groups": { "a\uD801\uDC50b": "foo" }} |
| 1175 | + } |
| 1176 | + }, |
| 1177 | + { |
| 1178 | + "pattern": [{"pathname":":\uD83D\uDEB2"}], |
| 1179 | + "expected_obj": "error" |
| 1180 | + }, |
1118 | 1181 | {
|
1119 | 1182 | "pattern": [{ "port": "" }],
|
1120 | 1183 | "inputs": [{ "protocol": "http", "port": "80" }],
|
|
1139 | 1202 | {
|
1140 | 1203 | "pattern": [{ "protocol": "http", "port": "80 " }],
|
1141 | 1204 | "inputs": [{ "protocol": "http", "port": "80" }],
|
1142 |
| - "exactly_empty_components": ["port"], |
1143 |
| - "expected_match": { |
1144 |
| - "protocol": { "input": "http", "groups": {} } |
1145 |
| - } |
1146 |
| - }, |
1147 |
| - { |
1148 |
| - "pattern": [{ "protocol": "http", "port": "100000" }], |
1149 | 1205 | "expected_obj": "error"
|
1150 | 1206 | },
|
1151 | 1207 | {
|
|
1381 | 1437 | "pathname": { "input": "8675309", "groups": { "number": "8675309" }}
|
1382 | 1438 | }
|
1383 | 1439 | },
|
| 1440 | + { |
| 1441 | + "pattern": [{ "pathname": "/(\\m)" }], |
| 1442 | + "expected_obj": "error" |
| 1443 | + }, |
1384 | 1444 | {
|
1385 | 1445 | "pattern": [{ "pathname": "/foo!" }],
|
1386 | 1446 | "inputs": [{ "pathname": "/foo!" }],
|
|
1803 | 1863 | "pathname": { "input": "/foo", "groups": {} }
|
1804 | 1864 | }
|
1805 | 1865 | },
|
| 1866 | + { |
| 1867 | + "pattern": [ "https://{sub.}?example{.com/}foo" ], |
| 1868 | + "inputs": [ "https://example.com/foo" ], |
| 1869 | + "expected_obj": "error" |
| 1870 | + }, |
1806 | 1871 | {
|
1807 | 1872 | "pattern": [ "{https://}example.com/foo" ],
|
1808 | 1873 | "inputs": [ "https://example.com/foo" ],
|
|
1817 | 1882 | "hostname": "(sub.)?example.com",
|
1818 | 1883 | "pathname": "/foo"
|
1819 | 1884 | },
|
| 1885 | + "//": "The `null` below is translated to undefined in the test harness.", |
1820 | 1886 | "expected_match": {
|
1821 | 1887 | "protocol": { "input": "https", "groups": {} },
|
1822 |
| - "hostname": { "input": "example.com", "groups": {} }, |
| 1888 | + "hostname": { "input": "example.com", "groups": { "0": null } }, |
1823 | 1889 | "pathname": { "input": "/foo", "groups": {} }
|
1824 | 1890 | }
|
1825 | 1891 | },
|
|
1853 | 1919 | "hostname": "(sub(?:.))?example.com",
|
1854 | 1920 | "pathname": "/foo"
|
1855 | 1921 | },
|
| 1922 | + "//": "The `null` below is translated to undefined in the test harness.", |
1856 | 1923 | "expected_match": {
|
1857 | 1924 | "protocol": { "input": "https", "groups": {} },
|
1858 |
| - "hostname": { "input": "example.com", "groups": {} }, |
| 1925 | + "hostname": { "input": "example.com", "groups": { "0": null } }, |
1859 | 1926 | "pathname": { "input": "/foo", "groups": {} }
|
1860 | 1927 | }
|
1861 | 1928 | },
|
|
2287 | 2354 | "protocol": "data",
|
2288 | 2355 | "pathname": "text/javascript,let x = 100/:tens?5;"
|
2289 | 2356 | },
|
| 2357 | + "//": "The `null` below is translated to undefined in the test harness.", |
2290 | 2358 | "expected_match": {
|
2291 | 2359 | "protocol": { "input": "data", "groups": {} },
|
2292 |
| - "pathname": { "input": "text/javascript,let x = 100/5;", "groups": {} } |
| 2360 | + "pathname": { "input": "text/javascript,let x = 100/5;", "groups": { "tens": null } } |
2293 | 2361 | }
|
2294 | 2362 | },
|
2295 | 2363 | {
|
|
2356 | 2424 | },
|
2357 | 2425 | {
|
2358 | 2426 | "pattern": [{ "hostname": "bad#hostname" }],
|
2359 |
| - "inputs": [{ "hostname": "bad" }], |
2360 |
| - "expected_match": { |
2361 |
| - "hostname": { "input": "bad", "groups": {} } |
2362 |
| - } |
| 2427 | + "expected_obj": "error" |
2363 | 2428 | },
|
2364 | 2429 | {
|
2365 | 2430 | "pattern": [{ "hostname": "bad%hostname" }],
|
2366 | 2431 | "expected_obj": "error"
|
2367 | 2432 | },
|
2368 | 2433 | {
|
2369 | 2434 | "pattern": [{ "hostname": "bad/hostname" }],
|
2370 |
| - "inputs": [{ "hostname": "bad" }], |
2371 |
| - "expected_match": { |
2372 |
| - "hostname": { "input": "bad", "groups": {} } |
2373 |
| - } |
| 2435 | + "expected_obj": "error" |
2374 | 2436 | },
|
2375 | 2437 | {
|
2376 | 2438 | "pattern": [{ "hostname": "bad\\:hostname" }],
|
|
2400 | 2462 | "pattern": [{ "hostname": "bad]hostname" }],
|
2401 | 2463 | "expected_obj": "error"
|
2402 | 2464 | },
|
| 2465 | + { |
| 2466 | + "pattern": [{ "hostname": "bad\\\\hostname" }], |
| 2467 | + "expected_obj": "error" |
| 2468 | + }, |
2403 | 2469 | {
|
2404 | 2470 | "pattern": [{ "hostname": "bad^hostname" }],
|
2405 | 2471 | "expected_obj": "error"
|
|
2408 | 2474 | "pattern": [{ "hostname": "bad|hostname" }],
|
2409 | 2475 | "expected_obj": "error"
|
2410 | 2476 | },
|
| 2477 | + { |
| 2478 | + "pattern": [{ "hostname": "bad\nhostname" }], |
| 2479 | + "expected_obj": "error" |
| 2480 | + }, |
| 2481 | + { |
| 2482 | + "pattern": [{ "hostname": "bad\rhostname" }], |
| 2483 | + "expected_obj": "error" |
| 2484 | + }, |
| 2485 | + { |
| 2486 | + "pattern": [{ "hostname": "bad\thostname" }], |
| 2487 | + "expected_obj": "error" |
| 2488 | + }, |
2411 | 2489 | {
|
2412 | 2490 | "pattern": [{}],
|
2413 | 2491 | "inputs": ["https://example.com/"],
|
|
2593 | 2671 | "pathname": { "input": "foobar", "groups": { "foo": "foo" }}
|
2594 | 2672 | }
|
2595 | 2673 | },
|
| 2674 | + { |
| 2675 | + "pattern": [{ "pathname": "*{}**?" }], |
| 2676 | + "inputs": [{ "pathname": "foobar" }], |
| 2677 | + "expected_obj": { |
| 2678 | + "pathname": "*(.*)?" |
| 2679 | + }, |
| 2680 | + "//": "The `null` below is translated to undefined in the test harness.", |
| 2681 | + "expected_match": { |
| 2682 | + "pathname": { "input": "foobar", "groups": { "0": "foobar", "1": null }} |
| 2683 | + } |
| 2684 | + }, |
2596 | 2685 | {
|
2597 | 2686 | "pattern": [{ "pathname": ":foo(baz)(.*)" }],
|
2598 | 2687 | "inputs": [{ "pathname": "bazbar" }],
|
|
2797 | 2886 | "search": { "input": "q=*&v=?&hmm={}&umm=()", "groups": {} },
|
2798 | 2887 | "hash": { "input": "foo", "groups": {} }
|
2799 | 2888 | }
|
| 2889 | + }, |
| 2890 | + { |
| 2891 | + "pattern": [{ "pathname": "/([[a-z]--a])" }], |
| 2892 | + "inputs": [{ "pathname": "/a" }], |
| 2893 | + "expected_match": null |
| 2894 | + }, |
| 2895 | + { |
| 2896 | + "pattern": [{ "pathname": "/([[a-z]--a])" }], |
| 2897 | + "inputs": [{ "pathname": "/z" }], |
| 2898 | + "expected_match": { |
| 2899 | + "pathname": { "input": "/z", "groups": { "0": "z" } } |
| 2900 | + } |
| 2901 | + }, |
| 2902 | + { |
| 2903 | + "pattern": [{ "pathname": "/([\\d&&[0-1]])" }], |
| 2904 | + "inputs": [{ "pathname": "/0" }], |
| 2905 | + "expected_match": { |
| 2906 | + "pathname": { "input": "/0", "groups": { "0": "0" } } |
| 2907 | + } |
| 2908 | + }, |
| 2909 | + { |
| 2910 | + "pattern": [{ "pathname": "/([\\d&&[0-1]])" }], |
| 2911 | + "inputs": [{ "pathname": "/3" }], |
| 2912 | + "expected_match": null |
2800 | 2913 | }
|
2801 | 2914 | ]
|
0 commit comments