resources/urltestdata.json contains URL parsing tests suitable for any URL parser implementation.
It's used as a source of tests by
other test files in this directory.
The format of
resources/urltestdata.json is a JSON array of comments as strings and test cases as
objects. The keys for each test case are:
input: a string to be parsed as URL.
base: null or a serialized URL (i.e., does not fail parsing).
failurewhose value is
true, indicating that parsing
relativeTowhose value is "
non-opaque-path-base" (input does parse against a non-null base URL without an opaque path) or "
any-base" (input parses against any non-null base URL), or is omitted in its entirety (input never parses successfully)
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.
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.
There's also limited coverage in
resources/percent-encoding.json for percent-encode after encoding
with percentEncodeSet set to special-query percent-encode set and spaceAsPlus set to false.
(Improvements to expand coverage here are welcome.)
The tests in this directory assert conformance with the URL Standard.