These tests are for browsers, but the data for
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 should 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.
annevk/url hosts some other files that might be of
interest if you want to create additional tests.
a-element.html it would be trivial to add more tests for other objects that
expose links (e.g. URL and
<area>). There's also room for enhancement and bits that
require independent tests:
- The encoding part of the URL parser
- The state override part of the URL parser (setting individual properties of a URL)
- Origin serialization