diff options
author | 木杉 <zhmushan@qq.com> | 2019-11-13 02:45:48 +0800 |
---|---|---|
committer | Ry Dahl <ry@tinyclouds.org> | 2019-11-12 13:45:48 -0500 |
commit | 0f33bf68859c162eb3d65ab53a7c71092585e1d1 (patch) | |
tree | 3bc66ca44790bc668ef00510b7b763b16f86e8c9 /cli/js/url_test.ts | |
parent | 7ba42ee4a6f73c66736d88d30dd9f9b72b6edfff (diff) |
fix url parse bug (#3316)
Diffstat (limited to 'cli/js/url_test.ts')
-rw-r--r-- | cli/js/url_test.ts | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/cli/js/url_test.ts b/cli/js/url_test.ts index 23f9f5f4b..1f8e31999 100644 --- a/cli/js/url_test.ts +++ b/cli/js/url_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, assert, assertEquals } from "./test_util.ts"; +import { test, assert, assertEquals, assertThrows } from "./test_util.ts"; test(function urlParsing(): void { const url = new URL( @@ -187,3 +187,16 @@ test(function customInspectFunction(): void { 'URL { href: "http://example.com/?", origin: "http://example.com", protocol: "http:", username: "", password: "", host: "example.com", hostname: "example.com", port: "", pathname: "/", hash: "", search: "?" }' ); }); + +test(function protocolNotHttpOrFile() { + const url = new URL("about:blank"); + assertEquals(url.href, "about:blank"); + assertEquals(url.protocol, "about:"); + assertEquals(url.origin, "null"); +}); + +test(function createBadUrl(): void { + assertThrows(() => { + new URL("0.0.0.0:8080"); + }); +}); |