|
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 | + }, |
1118 | 1159 | { |
1119 | 1160 | "pattern": [{"pathname":":a\uDB40\uDD00b"}], |
1120 | 1161 | "inputs": [], |
|
1404 | 1445 | "pathname": { "input": "8675309", "groups": { "number": "8675309" }} |
1405 | 1446 | } |
1406 | 1447 | }, |
| 1448 | + { |
| 1449 | + "pattern": [{ "pathname": "/(\\m)" }], |
| 1450 | + "expected_obj": "error" |
| 1451 | + }, |
1407 | 1452 | { |
1408 | 1453 | "pattern": [{ "pathname": "/foo!" }], |
1409 | 1454 | "inputs": [{ "pathname": "/foo!" }], |
|
1826 | 1871 | "pathname": { "input": "/foo", "groups": {} } |
1827 | 1872 | } |
1828 | 1873 | }, |
| 1874 | + { |
| 1875 | + "pattern": [ "https://{sub.}?example{.com/}foo" ], |
| 1876 | + "inputs": [ "https://example.com/foo" ], |
| 1877 | + "expected_obj": "error" |
| 1878 | + }, |
1829 | 1879 | { |
1830 | 1880 | "pattern": [ "{https://}example.com/foo" ], |
1831 | 1881 | "inputs": [ "https://example.com/foo" ], |
|
1840 | 1890 | "hostname": "(sub.)?example.com", |
1841 | 1891 | "pathname": "/foo" |
1842 | 1892 | }, |
| 1893 | + "//": "The `null` below is translated to undefined in the test harness.", |
1843 | 1894 | "expected_match": { |
1844 | 1895 | "protocol": { "input": "https", "groups": {} }, |
1845 | | - "hostname": { "input": "example.com", "groups": {} }, |
| 1896 | + "hostname": { "input": "example.com", "groups": { "0": null } }, |
1846 | 1897 | "pathname": { "input": "/foo", "groups": {} } |
1847 | 1898 | } |
1848 | 1899 | }, |
|
1876 | 1927 | "hostname": "(sub(?:.))?example.com", |
1877 | 1928 | "pathname": "/foo" |
1878 | 1929 | }, |
| 1930 | + "//": "The `null` below is translated to undefined in the test harness.", |
1879 | 1931 | "expected_match": { |
1880 | 1932 | "protocol": { "input": "https", "groups": {} }, |
1881 | | - "hostname": { "input": "example.com", "groups": {} }, |
| 1933 | + "hostname": { "input": "example.com", "groups": { "0": null } }, |
1882 | 1934 | "pathname": { "input": "/foo", "groups": {} } |
1883 | 1935 | } |
1884 | 1936 | }, |
|
2310 | 2362 | "protocol": "data", |
2311 | 2363 | "pathname": "text/javascript,let x = 100/:tens?5;" |
2312 | 2364 | }, |
| 2365 | + "//": "The `null` below is translated to undefined in the test harness.", |
2313 | 2366 | "expected_match": { |
2314 | 2367 | "protocol": { "input": "data", "groups": {} }, |
2315 | | - "pathname": { "input": "text/javascript,let x = 100/5;", "groups": {} } |
| 2368 | + "pathname": { "input": "text/javascript,let x = 100/5;", "groups": { "tens": null } } |
2316 | 2369 | } |
2317 | 2370 | }, |
2318 | 2371 | { |
|
2379 | 2432 | }, |
2380 | 2433 | { |
2381 | 2434 | "pattern": [{ "hostname": "bad#hostname" }], |
2382 | | - "inputs": [{ "hostname": "bad" }], |
| 2435 | + "inputs": [{ "hostname": "bad" }], |
| 2436 | + "expected_obj": { |
| 2437 | + "hostname": "bad" |
| 2438 | + }, |
2383 | 2439 | "expected_match": { |
2384 | 2440 | "hostname": { "input": "bad", "groups": {} } |
2385 | 2441 | } |
|
2391 | 2447 | { |
2392 | 2448 | "pattern": [{ "hostname": "bad/hostname" }], |
2393 | 2449 | "inputs": [{ "hostname": "bad" }], |
| 2450 | + "expected_obj": { |
| 2451 | + "hostname": "bad" |
| 2452 | + }, |
2394 | 2453 | "expected_match": { |
2395 | 2454 | "hostname": { "input": "bad", "groups": {} } |
2396 | 2455 | } |
|
2426 | 2485 | { |
2427 | 2486 | "pattern": [{ "hostname": "bad\\\\hostname" }], |
2428 | 2487 | "inputs": [{ "hostname": "badhostname" }], |
| 2488 | + "expected_obj": { |
| 2489 | + "hostname": "bad" |
| 2490 | + }, |
2429 | 2491 | "expected_match": null |
2430 | 2492 | }, |
2431 | 2493 | { |
|
2439 | 2501 | { |
2440 | 2502 | "pattern": [{ "hostname": "bad\nhostname" }], |
2441 | 2503 | "inputs": [{ "hostname": "badhostname" }], |
| 2504 | + "expected_obj": { |
| 2505 | + "hostname": "badhostname" |
| 2506 | + }, |
2442 | 2507 | "expected_match": { |
2443 | 2508 | "hostname": { "input": "badhostname", "groups": {} } |
2444 | 2509 | } |
2445 | 2510 | }, |
2446 | 2511 | { |
2447 | 2512 | "pattern": [{ "hostname": "bad\rhostname" }], |
2448 | 2513 | "inputs": [{ "hostname": "badhostname" }], |
| 2514 | + "expected_obj": { |
| 2515 | + "hostname": "badhostname" |
| 2516 | + }, |
2449 | 2517 | "expected_match": { |
2450 | 2518 | "hostname": { "input": "badhostname", "groups": {} } |
2451 | 2519 | } |
2452 | 2520 | }, |
2453 | 2521 | { |
2454 | 2522 | "pattern": [{ "hostname": "bad\thostname" }], |
2455 | 2523 | "inputs": [{ "hostname": "badhostname" }], |
| 2524 | + "expected_obj": { |
| 2525 | + "hostname": "badhostname" |
| 2526 | + }, |
2456 | 2527 | "expected_match": { |
2457 | 2528 | "hostname": { "input": "badhostname", "groups": {} } |
2458 | 2529 | } |
|
2642 | 2713 | "pathname": { "input": "foobar", "groups": { "foo": "foo" }} |
2643 | 2714 | } |
2644 | 2715 | }, |
| 2716 | + { |
| 2717 | + "pattern": [{ "pathname": "*{}**?" }], |
| 2718 | + "inputs": [{ "pathname": "foobar" }], |
| 2719 | + "expected_obj": { |
| 2720 | + "pathname": "*(.*)?" |
| 2721 | + }, |
| 2722 | + "//": "The `null` below is translated to undefined in the test harness.", |
| 2723 | + "expected_match": { |
| 2724 | + "pathname": { "input": "foobar", "groups": { "0": "foobar", "1": null }} |
| 2725 | + } |
| 2726 | + }, |
2645 | 2727 | { |
2646 | 2728 | "pattern": [{ "pathname": ":foo(baz)(.*)" }], |
2647 | 2729 | "inputs": [{ "pathname": "bazbar" }], |
|
2846 | 2928 | "search": { "input": "q=*&v=?&hmm={}&umm=()", "groups": {} }, |
2847 | 2929 | "hash": { "input": "foo", "groups": {} } |
2848 | 2930 | } |
| 2931 | + }, |
| 2932 | + { |
| 2933 | + "pattern": [{ "pathname": "/([[a-z]--a])" }], |
| 2934 | + "inputs": [{ "pathname": "/a" }], |
| 2935 | + "expected_match": null |
| 2936 | + }, |
| 2937 | + { |
| 2938 | + "pattern": [{ "pathname": "/([[a-z]--a])" }], |
| 2939 | + "inputs": [{ "pathname": "/z" }], |
| 2940 | + "expected_match": { |
| 2941 | + "pathname": { "input": "/z", "groups": { "0": "z" } } |
| 2942 | + } |
| 2943 | + }, |
| 2944 | + { |
| 2945 | + "pattern": [{ "pathname": "/([\\d&&[0-1]])" }], |
| 2946 | + "inputs": [{ "pathname": "/0" }], |
| 2947 | + "expected_match": { |
| 2948 | + "pathname": { "input": "/0", "groups": { "0": "0" } } |
| 2949 | + } |
| 2950 | + }, |
| 2951 | + { |
| 2952 | + "pattern": [{ "pathname": "/([\\d&&[0-1]])" }], |
| 2953 | + "inputs": [{ "pathname": "/3" }], |
| 2954 | + "expected_match": null |
2849 | 2955 | } |
2850 | 2956 | ] |
0 commit comments