From 1adb08ee92d88accdcf5f470f77f907b6b1b8194 Mon Sep 17 00:00:00 2001 From: Daijiro Wachi Date: Mon, 3 Apr 2017 17:47:46 +0900 Subject: [PATCH] test: synchronize WPT url test data PR-URL: https://github.com/nodejs/node/pull/12507 Refs: https://github.com/w3c/web-platform-tests/pull/4586 Refs: https://github.com/nodejs/node/pull/11887 Reviewed-By: James M Snell --- test/fixtures/url-setter-tests.js | 59 ++++++++++++++++----- test/fixtures/url-tests.js | 86 +++++++++++++++---------------- 2 files changed, 90 insertions(+), 55 deletions(-) diff --git a/test/fixtures/url-setter-tests.js b/test/fixtures/url-setter-tests.js index 9b39d0bed67bfc..8c15a3cc5ac885 100644 --- a/test/fixtures/url-setter-tests.js +++ b/test/fixtures/url-setter-tests.js @@ -34,7 +34,7 @@ module.exports = "href": "a://example.net", "new_value": "", "expected": { - "href": "a://example.net/", + "href": "a://example.net", "protocol": "a:" } }, @@ -42,7 +42,7 @@ module.exports = "href": "a://example.net", "new_value": "b", "expected": { - "href": "b://example.net/", + "href": "b://example.net", "protocol": "b:" } }, @@ -59,7 +59,7 @@ module.exports = "href": "a://example.net", "new_value": "B", "expected": { - "href": "b://example.net/", + "href": "b://example.net", "protocol": "b:" } }, @@ -68,7 +68,7 @@ module.exports = "href": "a://example.net", "new_value": "é", "expected": { - "href": "a://example.net/", + "href": "a://example.net", "protocol": "a:" } }, @@ -77,7 +77,7 @@ module.exports = "href": "a://example.net", "new_value": "0b", "expected": { - "href": "a://example.net/", + "href": "a://example.net", "protocol": "a:" } }, @@ -86,7 +86,7 @@ module.exports = "href": "a://example.net", "new_value": "+b", "expected": { - "href": "a://example.net/", + "href": "a://example.net", "protocol": "a:" } }, @@ -94,7 +94,7 @@ module.exports = "href": "a://example.net", "new_value": "bC0+-.", "expected": { - "href": "bc0+-.://example.net/", + "href": "bc0+-.://example.net", "protocol": "bc0+-.:" } }, @@ -103,7 +103,7 @@ module.exports = "href": "a://example.net", "new_value": "b,c", "expected": { - "href": "a://example.net/", + "href": "a://example.net", "protocol": "a:" } }, @@ -112,7 +112,7 @@ module.exports = "href": "a://example.net", "new_value": "bé", "expected": { - "href": "a://example.net/", + "href": "a://example.net", "protocol": "a:" } }, @@ -213,7 +213,7 @@ module.exports = "href": "ssh://me@example.net", "new_value": "http", "expected": { - "href": "ssh://me@example.net/", + "href": "ssh://me@example.net", "protocol": "ssh:" } }, @@ -221,7 +221,7 @@ module.exports = "href": "ssh://me@example.net", "new_value": "gopher", "expected": { - "href": "ssh://me@example.net/", + "href": "ssh://me@example.net", "protocol": "ssh:" } }, @@ -229,7 +229,15 @@ module.exports = "href": "ssh://me@example.net", "new_value": "file", "expected": { - "href": "ssh://me@example.net/", + "href": "ssh://me@example.net", + "protocol": "ssh:" + } + }, + { + "href": "ssh://example.net", + "new_value": "file", + "expected": { + "href": "ssh://example.net", "protocol": "ssh:" } }, @@ -1585,6 +1593,33 @@ module.exports = "href": "http://example.net/%3F", "pathname": "/%3F" } + }, + { + "comment": "# needs to be encoded", + "href": "http://example.net", + "new_value": "#", + "expected": { + "href": "http://example.net/%23", + "pathname": "/%23" + } + }, + { + "comment": "? needs to be encoded, non-special scheme", + "href": "sc://example.net", + "new_value": "?", + "expected": { + "href": "sc://example.net/%3F", + "pathname": "/%3F" + } + }, + { + "comment": "# needs to be encoded, non-special scheme", + "href": "sc://example.net", + "new_value": "#", + "expected": { + "href": "sc://example.net/%23", + "pathname": "/%23" + } } ], "search": [ diff --git a/test/fixtures/url-tests.js b/test/fixtures/url-tests.js index a4e7de9f26b199..c7e63f50331c3b 100644 --- a/test/fixtures/url-tests.js +++ b/test/fixtures/url-tests.js @@ -571,21 +571,21 @@ module.exports = "search": "", "hash": "" }, - // { - // "input": "foo://", - // "base": "http://example.org/foo/bar", - // "href": "foo://", - // "origin": "null", - // "protocol": "foo:", - // "username": "", - // "password": "", - // "host": "", - // "hostname": "", - // "port": "", - // "pathname": "", - // "search": "", - // "hash": "" - // }, + { + "input": "foo://", + "base": "http://example.org/foo/bar", + "href": "foo://", + "origin": "null", + "protocol": "foo:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "", + "search": "", + "hash": "" + }, { "input": "http://a:b@c:29/d", "base": "http://example.org/foo/bar", @@ -5338,34 +5338,34 @@ module.exports = "search": "", "hash": "" }, - // { - // "input": "////", - // "base": "sc://x/", - // "href": "sc:////", - // "protocol": "sc:", - // "username": "", - // "password": "", - // "host": "", - // "hostname": "", - // "port": "", - // "pathname": "//", - // "search": "", - // "hash": "" - // }, - // { - // "input": "////x/", - // "base": "sc://x/", - // "href": "sc:////x/", - // "protocol": "sc:", - // "username": "", - // "password": "", - // "host": "", - // "hostname": "", - // "port": "", - // "pathname": "//x/", - // "search": "", - // "hash": "" - // }, + { + "input": "////", + "base": "sc://x/", + "href": "sc:////", + "protocol": "sc:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "//", + "search": "", + "hash": "" + }, + { + "input": "////x/", + "base": "sc://x/", + "href": "sc:////x/", + "protocol": "sc:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "//x/", + "search": "", + "hash": "" + }, { "input": "tftp://foobar.com/someconfig;mode=netascii", "base": "about:blank",