• Home
Name Date Size #Lines LOC

..--

resources/06-Mar-2025-21,93621,909

IdnaTestV2.window.jsD06-Mar-20251.5 KiB4234

META.ymlD06-Mar-2025120 87

README.mdD06-Mar-20252.4 KiB5638

a-element-origin-xhtml.xhtmlD06-Mar-2025448 1614

a-element-origin.htmlD06-Mar-2025281 97

a-element-xhtml.xhtmlD06-Mar-2025732 2119

a-element.htmlD06-Mar-2025541 1412

data-uri-fragment.htmlD06-Mar-20251.2 KiB3529

failure.htmlD06-Mar-20252.1 KiB5748

historical.any.jsD06-Mar-20251.5 KiB4738

idlharness-shadowrealm.window.jsD06-Mar-202588 31

idlharness.any.jsD06-Mar-2025290 1410

javascript-urls.window.jsD06-Mar-20252.8 KiB6449

percent-encoding.window.jsD06-Mar-20251.4 KiB3426

toascii.window.jsD06-Mar-20251.8 KiB5552

url-constructor.any.jsD06-Mar-20251.9 KiB5440

url-constructor.htmlD06-Mar-20251.6 KiB4540

url-origin.any.jsD06-Mar-2025632 1712

url-origin.htmlD06-Mar-2025784 2521

url-searchparams.any.jsD06-Mar-20252.5 KiB7357

url-setters-a-area.window.jsD06-Mar-20251.6 KiB4434

url-setters-stripping.any.jsD06-Mar-20255.8 KiB126107

url-setters.any.jsD06-Mar-20251.3 KiB3525

url-statics-canparse.any.jsD06-Mar-2025760 4341

url-tojson.any.jsD06-Mar-2025123 54

urlencoded-parser.any.jsD06-Mar-20252.9 KiB6966

urlsearchparams-append.any.jsD06-Mar-20251.4 KiB4036

urlsearchparams-constructor.any.jsD06-Mar-20259.7 KiB225192

urlsearchparams-delete.any.jsD06-Mar-20252.8 KiB7366

urlsearchparams-foreach.any.jsD06-Mar-20252.3 KiB7767

urlsearchparams-get.any.jsD06-Mar-20251 KiB2220

urlsearchparams-getall.any.jsD06-Mar-20251.3 KiB2624

urlsearchparams-has.any.jsD06-Mar-20251.4 KiB3835

urlsearchparams-set.any.jsD06-Mar-2025986 2321

urlsearchparams-size.any.jsD06-Mar-2025985 3526

urlsearchparams-sort.any.jsD06-Mar-20251.8 KiB6360

urlsearchparams-stringifier.any.jsD06-Mar-20254.4 KiB146122

README.md

1## urltestdata.json
2
3`resources/urltestdata.json` contains URL parsing tests suitable for any URL parser implementation.
4
5It's used as a source of tests by `a-element.html`, `failure.html`, `url-constructor.any.js`, and
6other test files in this directory.
7
8The format of `resources/urltestdata.json` is a JSON array of comments as strings and test cases as
9objects. The keys for each test case are:
10
11* `input`: a string to be parsed as URL.
12* `base`: null or a serialized URL (i.e., does not fail parsing).
13* Then either
14
15  * `failure` whose value is `true`, indicating that parsing `input` relative to `base` returns
16    failure
17  * `relativeTo` whose value is "`non-opaque-path-base`" (input does parse against a non-null base
18    URL without an opaque path) or "`any-base`" (input parses against any non-null base URL), or is
19    omitted in its entirety (input never parses successfully)
20
21  or `href`, `origin`, `protocol`, `username`, `password`, `host`, `hostname`, `port`,
22  `pathname`, `search`, and `hash` with string values; indicating that parsing `input` should return
23  an URL record and that the getters of each corresponding attribute in that URL’s [API] should
24  return the corresponding value.
25
26  The `origin` key may be missing. In that case, the API’s `origin` attribute is not tested.
27
28## setters_tests.json
29
30`resources/setters_tests.json` is self-documented.
31
32## toascii.json
33
34`resources/toascii.json` is a JSON resource containing an array where each item is an object
35consisting of an optional `comment` field and mandatory `input` and `output` fields. `input` is the
36domain to be parsed according to the rules of UTS #46 (as stipulated by the URL Standard). `output`
37gives the expected output of the parser after serialization. An `output` of `null` means parsing is
38expected to fail.
39
40## URL parser's encoding argument
41
42Tests in `/encoding` and `/html/infrastructure/urls/resolving-urls/query-encoding/` cover the
43encoding argument to the URL parser.
44
45There's also limited coverage in `resources/percent-encoding.json` for percent-encode after encoding
46with _percentEncodeSet_ set to special-query percent-encode set and _spaceAsPlus_ set to false.
47(Improvements to expand coverage here are welcome.)
48
49## Specification
50
51The tests in this directory assert conformance with [the URL Standard][URL].
52
53[parsing]: https://url.spec.whatwg.org/#concept-basic-url-parser
54[API]: https://url.spec.whatwg.org/#api
55[URL]: https://url.spec.whatwg.org/
56