From 9e4ab6c2065229c5f79b6cc663d554f9de16f703 Mon Sep 17 00:00:00 2001 From: Gautam Arora Date: Tue, 18 Jul 2017 20:41:00 -0400 Subject: [PATCH] test: add comments for whatwg-url tests Added comments to whatwg-url tests that they should not be changed until modifications are merged upstream as per "Web Platform Tests" guidelines PR-URL: https://github.com/nodejs/node/pull/14355 Fixes: https://github.com/nodejs/node/issues/12793 Refs: https://github.com/nodejs/node/blob/master/doc/guides/writing-tests.md Reviewed-By: Refael Ackermann Reviewed-By: Gibson Fahnestock Reviewed-By: Timothy Gu Reviewed-By: Vse Mozhet Byt Reviewed-By: Joyee Cheung Reviewed-By: Luigi Pinca Reviewed-By: Yuta Hiroto Reviewed-By: James M Snell --- doc/guides/writing-tests.md | 5 +++-- test/fixtures/url-setter-tests.js | 3 ++- test/fixtures/url-tests.js | 3 ++- test/fixtures/url-toascii.js | 3 ++- test/parallel/test-whatwg-url-constructor.js | 5 +++-- test/parallel/test-whatwg-url-historical.js | 5 +++-- test/parallel/test-whatwg-url-origin.js | 5 +++-- test/parallel/test-whatwg-url-searchparams-append.js | 5 +++-- test/parallel/test-whatwg-url-searchparams-constructor.js | 7 ++++--- test/parallel/test-whatwg-url-searchparams-delete.js | 5 +++-- test/parallel/test-whatwg-url-searchparams-foreach.js | 7 ++++--- test/parallel/test-whatwg-url-searchparams-get.js | 5 +++-- test/parallel/test-whatwg-url-searchparams-getall.js | 5 +++-- test/parallel/test-whatwg-url-searchparams-has.js | 5 +++-- test/parallel/test-whatwg-url-searchparams-set.js | 5 +++-- test/parallel/test-whatwg-url-searchparams-sort.js | 5 +++-- test/parallel/test-whatwg-url-searchparams-stringifier.js | 5 +++-- test/parallel/test-whatwg-url-setters.js | 5 +++-- test/parallel/test-whatwg-url-toascii.js | 5 +++-- test/parallel/test-whatwg-url-tojson.js | 5 +++-- 20 files changed, 59 insertions(+), 39 deletions(-) diff --git a/doc/guides/writing-tests.md b/doc/guides/writing-tests.md index 9d226da6e804a9..8c5c2b74556447 100644 --- a/doc/guides/writing-tests.md +++ b/doc/guides/writing-tests.md @@ -263,11 +263,12 @@ Some of the tests for the WHATWG URL implementation (named These imported tests will be wrapped like this: ```js -/* eslint-disable */ -/* WPT Refs: +/* The following tests are copied from WPT. Modifications to them should be + upstreamed first. Refs: https://github.com/w3c/web-platform-tests/blob/8791bed/url/urlsearchparams-stringifier.html License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html */ +/* eslint-disable */ // Test code diff --git a/test/fixtures/url-setter-tests.js b/test/fixtures/url-setter-tests.js index 923110d9364132..6f769eaec7543d 100644 --- a/test/fixtures/url-setter-tests.js +++ b/test/fixtures/url-setter-tests.js @@ -1,6 +1,7 @@ 'use strict'; -/* WPT Refs: +/* The following tests are copied from WPT. Modifications to them should be + upstreamed first. Refs: https://github.com/w3c/web-platform-tests/blob/b30abaecf4/url/setters_tests.json License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html */ diff --git a/test/fixtures/url-tests.js b/test/fixtures/url-tests.js index 00643f961321df..b36e2be3e49ed6 100644 --- a/test/fixtures/url-tests.js +++ b/test/fixtures/url-tests.js @@ -1,6 +1,7 @@ 'use strict'; -/* WPT Refs: +/* The following tests are copied from WPT. Modifications to them should be + upstreamed first. Refs: https://github.com/w3c/web-platform-tests/blob/8df7c9c215/url/urltestdata.json License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html */ diff --git a/test/fixtures/url-toascii.js b/test/fixtures/url-toascii.js index ea5e0f22ba1b5f..59b76330f867f2 100644 --- a/test/fixtures/url-toascii.js +++ b/test/fixtures/url-toascii.js @@ -1,6 +1,7 @@ 'use strict'; -/* WPT Refs: +/* The following tests are copied from WPT. Modifications to them should be + upstreamed first. Refs: https://github.com/w3c/web-platform-tests/blob/4839a0a804/url/toascii.json License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html */ diff --git a/test/parallel/test-whatwg-url-constructor.js b/test/parallel/test-whatwg-url-constructor.js index 290f9266b54f41..38be3a293b9fcf 100644 --- a/test/parallel/test-whatwg-url-constructor.js +++ b/test/parallel/test-whatwg-url-constructor.js @@ -14,11 +14,12 @@ const request = { response: require(path.join(common.fixturesDir, 'url-tests')) }; -/* eslint-disable */ -/* WPT Refs: +/* The following tests are copied from WPT. Modifications to them should be + upstreamed first. Refs: https://github.com/w3c/web-platform-tests/blob/8791bed/url/url-constructor.html License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html */ +/* eslint-disable */ function runURLConstructorTests() { // var setup = async_test("Loading data…") // setup.step(function() { diff --git a/test/parallel/test-whatwg-url-historical.js b/test/parallel/test-whatwg-url-historical.js index 7848b1c1873a70..466949cd322d37 100644 --- a/test/parallel/test-whatwg-url-historical.js +++ b/test/parallel/test-whatwg-url-historical.js @@ -8,11 +8,12 @@ if (!common.hasIntl) { const URL = require('url').URL; const { test, assert_equals, assert_throws } = require('../common/wpt'); -/* eslint-disable */ -/* WPT Refs: +/* The following tests are copied from WPT. Modifications to them should be + upstreamed first. Refs: https://github.com/w3c/web-platform-tests/blob/8791bed/url/historical.html License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html */ +/* eslint-disable */ // var objects = [ // [function() { return window.location }, "location object"], // [function() { return document.createElement("a") }, "a element"], diff --git a/test/parallel/test-whatwg-url-origin.js b/test/parallel/test-whatwg-url-origin.js index 732100e142a509..274de420bebbf3 100644 --- a/test/parallel/test-whatwg-url-origin.js +++ b/test/parallel/test-whatwg-url-origin.js @@ -13,11 +13,12 @@ const request = { response: require(path.join(common.fixturesDir, 'url-tests')) }; -/* eslint-disable */ -/* WPT Refs: +/* The following tests are copied from WPT. Modifications to them should be + upstreamed first. Refs: https://github.com/w3c/web-platform-tests/blob/8791bed/url/url-origin.html License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html */ +/* eslint-disable */ function runURLOriginTests() { // var setup = async_test("Loading data…") // setup.step(function() { diff --git a/test/parallel/test-whatwg-url-searchparams-append.js b/test/parallel/test-whatwg-url-searchparams-append.js index d9534a2209ddfe..fc9f5bd75d160b 100644 --- a/test/parallel/test-whatwg-url-searchparams-append.js +++ b/test/parallel/test-whatwg-url-searchparams-append.js @@ -5,11 +5,12 @@ const assert = require('assert'); const URLSearchParams = require('url').URLSearchParams; const { test, assert_equals, assert_true } = require('../common/wpt'); -/* eslint-disable */ -/* WPT Refs: +/* The following tests are copied from WPT. Modifications to them should be + upstreamed first. Refs: https://github.com/w3c/web-platform-tests/blob/8791bed/url/urlsearchparams-append.html License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html */ +/* eslint-disable */ test(function() { var params = new URLSearchParams(); params.append('a', 'b'); diff --git a/test/parallel/test-whatwg-url-searchparams-constructor.js b/test/parallel/test-whatwg-url-searchparams-constructor.js index 4a549c842b1942..b6e720cc7fb04c 100644 --- a/test/parallel/test-whatwg-url-searchparams-constructor.js +++ b/test/parallel/test-whatwg-url-searchparams-constructor.js @@ -8,12 +8,13 @@ const { assert_false, assert_throws, assert_array_equals } = require('../common/wpt'); -/* eslint-disable */ -var params; // Strict mode fix for WPT. -/* WPT Refs: +/* The following tests are copied from WPT. Modifications to them should be + upstreamed first. Refs: https://github.com/w3c/web-platform-tests/blob/54c3502d7b/url/urlsearchparams-constructor.html License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html */ +/* eslint-disable */ +var params; // Strict mode fix for WPT. test(function() { var params = new URLSearchParams(); assert_equals(params + '', ''); diff --git a/test/parallel/test-whatwg-url-searchparams-delete.js b/test/parallel/test-whatwg-url-searchparams-delete.js index dae0b338ddae55..6e733fd94466c4 100644 --- a/test/parallel/test-whatwg-url-searchparams-delete.js +++ b/test/parallel/test-whatwg-url-searchparams-delete.js @@ -6,11 +6,12 @@ const { URL, URLSearchParams } = require('url'); const { test, assert_equals, assert_true, assert_false } = require('../common/wpt'); -/* eslint-disable */ -/* WPT Refs: +/* The following tests are copied from WPT. Modifications to them should be + upstreamed first. Refs: https://github.com/w3c/web-platform-tests/blob/8791bed/url/urlsearchparams-delete.html License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html */ +/* eslint-disable */ test(function() { var params = new URLSearchParams('a=b&c=d'); params.delete('a'); diff --git a/test/parallel/test-whatwg-url-searchparams-foreach.js b/test/parallel/test-whatwg-url-searchparams-foreach.js index 6135f356387289..0147418ff21f07 100644 --- a/test/parallel/test-whatwg-url-searchparams-foreach.js +++ b/test/parallel/test-whatwg-url-searchparams-foreach.js @@ -6,12 +6,13 @@ const { URL, URLSearchParams } = require('url'); const { test, assert_array_equals, assert_unreached } = require('../common/wpt'); -/* eslint-disable */ -var i; // Strict mode fix for WPT. -/* WPT Refs: +/* The following tests are copied from WPT. Modifications to them should be + upstreamed first. Refs: https://github.com/w3c/web-platform-tests/blob/a8b2b1e/url/urlsearchparams-foreach.html License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html */ +/* eslint-disable */ +var i; // Strict mode fix for WPT. test(function() { var params = new URLSearchParams('a=1&b=2&c=3'); var keys = []; diff --git a/test/parallel/test-whatwg-url-searchparams-get.js b/test/parallel/test-whatwg-url-searchparams-get.js index a49cc2c2b0d0c0..2e7d22c998bf02 100644 --- a/test/parallel/test-whatwg-url-searchparams-get.js +++ b/test/parallel/test-whatwg-url-searchparams-get.js @@ -5,11 +5,12 @@ const assert = require('assert'); const URLSearchParams = require('url').URLSearchParams; const { test, assert_equals, assert_true } = require('../common/wpt'); -/* eslint-disable */ -/* WPT Refs: +/* The following tests are copied from WPT. Modifications to them should be + upstreamed first. Refs: https://github.com/w3c/web-platform-tests/blob/8791bed/url/urlsearchparams-get.html License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html */ +/* eslint-disable */ test(function() { var params = new URLSearchParams('a=b&c=d'); assert_equals(params.get('a'), 'b'); diff --git a/test/parallel/test-whatwg-url-searchparams-getall.js b/test/parallel/test-whatwg-url-searchparams-getall.js index bf287d52a01cd8..3a8bf347ff1f3f 100644 --- a/test/parallel/test-whatwg-url-searchparams-getall.js +++ b/test/parallel/test-whatwg-url-searchparams-getall.js @@ -6,11 +6,12 @@ const URLSearchParams = require('url').URLSearchParams; const { test, assert_equals, assert_true, assert_array_equals } = require('../common/wpt'); -/* eslint-disable */ -/* WPT Refs: +/* The following tests are copied from WPT. Modifications to them should be + upstreamed first. Refs: https://github.com/w3c/web-platform-tests/blob/8791bed/url/urlsearchparams-getall.html License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html */ +/* eslint-disable */ test(function() { var params = new URLSearchParams('a=b&c=d'); assert_array_equals(params.getAll('a'), ['b']); diff --git a/test/parallel/test-whatwg-url-searchparams-has.js b/test/parallel/test-whatwg-url-searchparams-has.js index 127e1a8329bffc..dcdf585dcdf76d 100644 --- a/test/parallel/test-whatwg-url-searchparams-has.js +++ b/test/parallel/test-whatwg-url-searchparams-has.js @@ -5,11 +5,12 @@ const assert = require('assert'); const URLSearchParams = require('url').URLSearchParams; const { test, assert_false, assert_true } = require('../common/wpt'); -/* eslint-disable */ -/* WPT Refs: +/* The following tests are copied from WPT. Modifications to them should be + upstreamed first. Refs: https://github.com/w3c/web-platform-tests/blob/8791bed/url/urlsearchparams-has.html License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html */ +/* eslint-disable */ test(function() { var params = new URLSearchParams('a=b&c=d'); assert_true(params.has('a')); diff --git a/test/parallel/test-whatwg-url-searchparams-set.js b/test/parallel/test-whatwg-url-searchparams-set.js index f7620c05d12e6e..46414ff23aba14 100644 --- a/test/parallel/test-whatwg-url-searchparams-set.js +++ b/test/parallel/test-whatwg-url-searchparams-set.js @@ -5,11 +5,12 @@ const assert = require('assert'); const URLSearchParams = require('url').URLSearchParams; const { test, assert_equals, assert_true } = require('../common/wpt'); -/* eslint-disable */ -/* WPT Refs: +/* The following tests are copied from WPT. Modifications to them should be + upstreamed first. Refs: https://github.com/w3c/web-platform-tests/blob/8791bed/url/urlsearchparams-set.html License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html */ +/* eslint-disable */ test(function() { var params = new URLSearchParams('a=b&c=d'); params.set('a', 'B'); diff --git a/test/parallel/test-whatwg-url-searchparams-sort.js b/test/parallel/test-whatwg-url-searchparams-sort.js index adc34976047522..712dbc5636d81b 100644 --- a/test/parallel/test-whatwg-url-searchparams-sort.js +++ b/test/parallel/test-whatwg-url-searchparams-sort.js @@ -4,11 +4,12 @@ require('../common'); const { URL, URLSearchParams } = require('url'); const { test, assert_array_equals } = require('../common/wpt'); -/* eslint-disable */ -/* WPT Refs: +/* The following tests are copied from WPT. Modifications to them should be + upstreamed first. Refs: https://github.com/w3c/web-platform-tests/blob/5903e00e77e85f8bcb21c73d1d7819fcd04763bd/url/urlsearchparams-sort.html License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html */ +/* eslint-disable */ [ { "input": "z=b&a=b&z=a&a=a", diff --git a/test/parallel/test-whatwg-url-searchparams-stringifier.js b/test/parallel/test-whatwg-url-searchparams-stringifier.js index 7162932546f233..e2f73d262e590b 100644 --- a/test/parallel/test-whatwg-url-searchparams-stringifier.js +++ b/test/parallel/test-whatwg-url-searchparams-stringifier.js @@ -5,11 +5,12 @@ const assert = require('assert'); const URLSearchParams = require('url').URLSearchParams; const { test, assert_equals } = require('../common/wpt'); -/* eslint-disable */ -/* WPT Refs: +/* The following tests are copied from WPT. Modifications to them should be + upstreamed first. Refs: https://github.com/w3c/web-platform-tests/blob/8791bed/url/urlsearchparams-stringifier.html License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html */ +/* eslint-disable */ test(function() { var params = new URLSearchParams(); params.append('a', 'b c'); diff --git a/test/parallel/test-whatwg-url-setters.js b/test/parallel/test-whatwg-url-setters.js index 938c2aa2538765..7e69bc4edce321 100644 --- a/test/parallel/test-whatwg-url-setters.js +++ b/test/parallel/test-whatwg-url-setters.js @@ -17,11 +17,12 @@ const request = { response: require(path.join(common.fixturesDir, 'url-setter-tests')) }; -/* eslint-disable */ -/* WPT Refs: +/* The following tests are copied from WPT. Modifications to them should be + upstreamed first. Refs: https://github.com/w3c/web-platform-tests/blob/8791bed/url/url-setters.html License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html */ +/* eslint-disable */ function startURLSettersTests() { // var setup = async_test("Loading data…") // setup.step(function() { diff --git a/test/parallel/test-whatwg-url-toascii.js b/test/parallel/test-whatwg-url-toascii.js index 851240ce650a70..5a34b0396495fa 100644 --- a/test/parallel/test-whatwg-url-toascii.js +++ b/test/parallel/test-whatwg-url-toascii.js @@ -13,11 +13,12 @@ const request = { response: require(path.join(common.fixturesDir, 'url-toascii')) }; -/* eslint-disable */ -/* WPT Refs: +/* The following tests are copied from WPT. Modifications to them should be + upstreamed first. Refs: https://github.com/w3c/web-platform-tests/blob/4839a0a804/url/toascii.window.js License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html */ +/* eslint-disable */ // async_test(t => { // const request = new XMLHttpRequest() // request.open("GET", "toascii.json") diff --git a/test/parallel/test-whatwg-url-tojson.js b/test/parallel/test-whatwg-url-tojson.js index 5a90fdd27f3978..8e9a30c7e017e4 100644 --- a/test/parallel/test-whatwg-url-tojson.js +++ b/test/parallel/test-whatwg-url-tojson.js @@ -4,11 +4,12 @@ require('../common'); const URL = require('url').URL; const { test, assert_equals } = require('../common/wpt'); -/* eslint-disable */ -/* WPT Refs: +/* The following tests are copied from WPT. Modifications to them should be + upstreamed first. Refs: https://github.com/w3c/web-platform-tests/blob/02585db/url/url-tojson.html License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html */ +/* eslint-disable */ test(() => { const a = new URL("https://example.com/") assert_equals(JSON.stringify(a), "\"https://example.com/\"")