Adds custom inspect method for URL (#3241)

This commit is contained in:
Sven Nicolai Viig 2019-10-31 19:55:54 +01:00 committed by Ry Dahl
parent 4f8c936974
commit d7a5aed511
2 changed files with 29 additions and 0 deletions

View file

@ -179,3 +179,11 @@ test(function sortingNonExistentParamRemovesQuestionMarkFromURL(): void {
assertEquals(url.href, "http://example.com/");
assertEquals(url.search, "");
});
test(function customInspectFunction(): void {
const url = new URL("http://example.com/?");
assertEquals(
Deno.inspect(url),
'URL { href: "http://example.com/?", origin: "http://example.com", protocol: "http:", username: "", password: "", host: "example.com", hostname: "example.com", port: "", pathname: "/", hash: "", search: "?" }'
);
});