These tests are for browsers, but the data for
resources/urltestdata.json and can be re-used by non-browser implementations.
This file contains a JSON array of comments as strings and test cases as objects.
The keys for each test case are:
base: an absolute URL as a string whose parsing without a base of its own must succeed. This key is always present, and may have a value like
inputis an absolute URL.
input: an URL as a string to be parsed with
baseas its base URL.
failurewith the value
true, indicating that parsing
inputshould return failure,
hashwith string values; indicating that parsing
inputshould return an URL record and that the getters of each corresponding attribute in that URL’s API should return the corresponding value.
originkey may be missing. In that case, the API’s
originattribute is not tested.
In addition to testing that parsing
base gives the result, a test harness for the
URL constructor (or similar APIs) should additionally test the following pattern: if
input must give failure. This tests that the logic for
converting base URLs into strings properly fails the whole parsing algorithm if the base URL cannot
resources/setters_tests.json is self-documented.
resources/toascii.json is a JSON resource containing an array where each item is an object
consisting of an optional
comment field and mandatory
input is the
domain to be parsed according to the rules of UTS #46 (as stipulated by the URL Standard).
gives the expected output of the parser after serialization. An
null means parsing is
expected to fail.
URL parser's encoding argument
/html/infrastructure/urls/resolving-urls/query-encoding/ cover the
encoding argument to the URL parser.
The tests in this directory assert conformance with the URL Standard.