|
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 | {
|
|
1139 | 1145 | {
|
1140 | 1146 | "pattern": [{ "protocol": "http", "port": "80 " }],
|
1141 | 1147 | "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 | 1148 | "expected_obj": "error"
|
1150 | 1149 | },
|
1151 | 1150 | {
|
|
1381 | 1380 | "pathname": { "input": "8675309", "groups": { "number": "8675309" }}
|
1382 | 1381 | }
|
1383 | 1382 | },
|
| 1383 | + { |
| 1384 | + "pattern": [{ "pathname": "/(\\m)" }], |
| 1385 | + "expected_obj": "error" |
| 1386 | + }, |
1384 | 1387 | {
|
1385 | 1388 | "pattern": [{ "pathname": "/foo!" }],
|
1386 | 1389 | "inputs": [{ "pathname": "/foo!" }],
|
|
1803 | 1806 | "pathname": { "input": "/foo", "groups": {} }
|
1804 | 1807 | }
|
1805 | 1808 | },
|
| 1809 | + { |
| 1810 | + "pattern": [ "https://{sub.}?example{.com/}foo" ], |
| 1811 | + "inputs": [ "https://example.com/foo" ], |
| 1812 | + "expected_obj": "error" |
| 1813 | + }, |
1806 | 1814 | {
|
1807 | 1815 | "pattern": [ "{https://}example.com/foo" ],
|
1808 | 1816 | "inputs": [ "https://example.com/foo" ],
|
|
1817 | 1825 | "hostname": "(sub.)?example.com",
|
1818 | 1826 | "pathname": "/foo"
|
1819 | 1827 | },
|
| 1828 | + "//": "The `null` below is translated to undefined in the test harness.", |
1820 | 1829 | "expected_match": {
|
1821 | 1830 | "protocol": { "input": "https", "groups": {} },
|
1822 |
| - "hostname": { "input": "example.com", "groups": {} }, |
| 1831 | + "hostname": { "input": "example.com", "groups": { "0": null } }, |
1823 | 1832 | "pathname": { "input": "/foo", "groups": {} }
|
1824 | 1833 | }
|
1825 | 1834 | },
|
|
1853 | 1862 | "hostname": "(sub(?:.))?example.com",
|
1854 | 1863 | "pathname": "/foo"
|
1855 | 1864 | },
|
| 1865 | + "//": "The `null` below is translated to undefined in the test harness.", |
1856 | 1866 | "expected_match": {
|
1857 | 1867 | "protocol": { "input": "https", "groups": {} },
|
1858 |
| - "hostname": { "input": "example.com", "groups": {} }, |
| 1868 | + "hostname": { "input": "example.com", "groups": { "0": null } }, |
1859 | 1869 | "pathname": { "input": "/foo", "groups": {} }
|
1860 | 1870 | }
|
1861 | 1871 | },
|
|
2287 | 2297 | "protocol": "data",
|
2288 | 2298 | "pathname": "text/javascript,let x = 100/:tens?5;"
|
2289 | 2299 | },
|
| 2300 | + "//": "The `null` below is translated to undefined in the test harness.", |
2290 | 2301 | "expected_match": {
|
2291 | 2302 | "protocol": { "input": "data", "groups": {} },
|
2292 |
| - "pathname": { "input": "text/javascript,let x = 100/5;", "groups": {} } |
| 2303 | + "pathname": { "input": "text/javascript,let x = 100/5;", "groups": { "tens": null } } |
2293 | 2304 | }
|
2294 | 2305 | },
|
2295 | 2306 | {
|
|
2356 | 2367 | },
|
2357 | 2368 | {
|
2358 | 2369 | "pattern": [{ "hostname": "bad#hostname" }],
|
2359 |
| - "inputs": [{ "hostname": "bad" }], |
2360 |
| - "expected_match": { |
2361 |
| - "hostname": { "input": "bad", "groups": {} } |
2362 |
| - } |
| 2370 | + "expected_obj": "error" |
2363 | 2371 | },
|
2364 | 2372 | {
|
2365 | 2373 | "pattern": [{ "hostname": "bad%hostname" }],
|
2366 | 2374 | "expected_obj": "error"
|
2367 | 2375 | },
|
2368 | 2376 | {
|
2369 | 2377 | "pattern": [{ "hostname": "bad/hostname" }],
|
2370 |
| - "inputs": [{ "hostname": "bad" }], |
2371 |
| - "expected_match": { |
2372 |
| - "hostname": { "input": "bad", "groups": {} } |
2373 |
| - } |
| 2378 | + "expected_obj": "error" |
2374 | 2379 | },
|
2375 | 2380 | {
|
2376 | 2381 | "pattern": [{ "hostname": "bad\\:hostname" }],
|
|
2400 | 2405 | "pattern": [{ "hostname": "bad]hostname" }],
|
2401 | 2406 | "expected_obj": "error"
|
2402 | 2407 | },
|
| 2408 | + { |
| 2409 | + "pattern": [{ "hostname": "bad\\\\hostname" }], |
| 2410 | + "expected_obj": "error" |
| 2411 | + }, |
2403 | 2412 | {
|
2404 | 2413 | "pattern": [{ "hostname": "bad^hostname" }],
|
2405 | 2414 | "expected_obj": "error"
|
|
2408 | 2417 | "pattern": [{ "hostname": "bad|hostname" }],
|
2409 | 2418 | "expected_obj": "error"
|
2410 | 2419 | },
|
| 2420 | + { |
| 2421 | + "pattern": [{ "hostname": "bad\nhostname" }], |
| 2422 | + "expected_obj": "error" |
| 2423 | + }, |
| 2424 | + { |
| 2425 | + "pattern": [{ "hostname": "bad\rhostname" }], |
| 2426 | + "expected_obj": "error" |
| 2427 | + }, |
| 2428 | + { |
| 2429 | + "pattern": [{ "hostname": "bad\thostname" }], |
| 2430 | + "expected_obj": "error" |
| 2431 | + }, |
2411 | 2432 | {
|
2412 | 2433 | "pattern": [{}],
|
2413 | 2434 | "inputs": ["https://example.com/"],
|
|
2593 | 2614 | "pathname": { "input": "foobar", "groups": { "foo": "foo" }}
|
2594 | 2615 | }
|
2595 | 2616 | },
|
| 2617 | + { |
| 2618 | + "pattern": [{ "pathname": "*{}**?" }], |
| 2619 | + "inputs": [{ "pathname": "foobar" }], |
| 2620 | + "expected_obj": { |
| 2621 | + "pathname": "*(.*)?" |
| 2622 | + }, |
| 2623 | + "//": "The `null` below is translated to undefined in the test harness.", |
| 2624 | + "expected_match": { |
| 2625 | + "pathname": { "input": "foobar", "groups": { "0": "foobar", "1": null }} |
| 2626 | + } |
| 2627 | + }, |
2596 | 2628 | {
|
2597 | 2629 | "pattern": [{ "pathname": ":foo(baz)(.*)" }],
|
2598 | 2630 | "inputs": [{ "pathname": "bazbar" }],
|
|
2797 | 2829 | "search": { "input": "q=*&v=?&hmm={}&umm=()", "groups": {} },
|
2798 | 2830 | "hash": { "input": "foo", "groups": {} }
|
2799 | 2831 | }
|
| 2832 | + }, |
| 2833 | + { |
| 2834 | + "pattern": [{ "pathname": "/([[a-z]--a])" }], |
| 2835 | + "inputs": [{ "pathname": "/a" }], |
| 2836 | + "expected_match": null |
| 2837 | + }, |
| 2838 | + { |
| 2839 | + "pattern": [{ "pathname": "/([[a-z]--a])" }], |
| 2840 | + "inputs": [{ "pathname": "/z" }], |
| 2841 | + "expected_match": { |
| 2842 | + "pathname": { "input": "/z", "groups": { "0": "z" } } |
| 2843 | + } |
| 2844 | + }, |
| 2845 | + { |
| 2846 | + "pattern": [{ "pathname": "/([\\d&&[0-1]])" }], |
| 2847 | + "inputs": [{ "pathname": "/0" }], |
| 2848 | + "expected_match": { |
| 2849 | + "pathname": { "input": "/0", "groups": { "0": "0" } } |
| 2850 | + } |
| 2851 | + }, |
| 2852 | + { |
| 2853 | + "pattern": [{ "pathname": "/([\\d&&[0-1]])" }], |
| 2854 | + "inputs": [{ "pathname": "/3" }], |
| 2855 | + "expected_match": null |
2800 | 2856 | }
|
2801 | 2857 | ]
|
0 commit comments