1## urltestdata.json 2 3These tests are for browsers, but the data for 4`a-element.html`, `url-constructor.html`, `a-element-xhtml.xhtml`, and `failure.html` 5is in `resources/urltestdata.json` and can be re-used by non-browser implementations. 6This file contains a JSON array of comments as strings and test cases as objects. 7The keys for each test case are: 8 9* `base`: an absolute URL as a string whose [parsing] without a base of its own must succeed. 10 This key is always present, 11 and may have a value like `"about:blank"` when `input` is an absolute URL. 12* `input`: an URL as a string to be [parsed][parsing] with `base` as its base URL. 13* Either: 14 * `failure` with the value `true`, indicating that parsing `input` should return failure, 15 * or `href`, `origin`, `protocol`, `username`, `password`, `host`, `hostname`, `port`, 16 `pathname`, `search`, and `hash` with string values; 17 indicating that parsing `input` should return an URL record 18 and that the getters of each corresponding attribute in that URL’s [API] 19 should return the corresponding value. 20 21 The `origin` key may be missing. 22 In that case, the API’s `origin` attribute is not tested. 23 24In addition to testing that parsing `input` against `base` gives the result, a test harness for the 25`URL` constructor (or similar APIs) should additionally test the following pattern: if `failure` is 26true, parsing `about:blank` against `input` must give failure. This tests that the logic for 27converting base URLs into strings properly fails the whole parsing algorithm if the base URL cannot 28be parsed. 29 30## setters_tests.json 31 32`resources/setters_tests.json` is self-documented. 33 34## toascii.json 35 36`resources/toascii.json` is a JSON resource containing an array where each item is an object 37consisting of an optional `comment` field and mandatory `input` and `output` fields. `input` is the 38domain to be parsed according to the rules of UTS #46 (as stipulated by the URL Standard). `output` 39gives the expected output of the parser after serialization. An `output` of `null` means parsing is 40expected to fail. 41 42## URL parser's encoding argument 43 44Tests in `/encoding` and `/html/infrastructure/urls/resolving-urls/query-encoding/` cover the 45encoding argument to the URL parser. 46 47## Specification 48 49The tests in this directory assert conformance with [the URL Standard][URL]. 50 51[parsing]: https://url.spec.whatwg.org/#concept-basic-url-parser 52[API]: https://url.spec.whatwg.org/#api 53[URL]: https://url.spec.whatwg.org/ 54