Skip to content

Commit

Permalink
test: add comments for whatwg-url tests
Browse files Browse the repository at this point in the history
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: #14355
Fixes: #12793
Refs: https://github.com/nodejs/node/blob/master/doc/guides/writing-tests.md
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Timothy Gu <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
gautamarora authored and addaleax committed Jul 21, 2017
1 parent fba94d3 commit a34ac21
Show file tree
Hide file tree
Showing 20 changed files with 59 additions and 39 deletions.
5 changes: 3 additions & 2 deletions doc/guides/writing-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/url-setter-tests.js
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/url-tests.js
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/url-toascii.js
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down
5 changes: 3 additions & 2 deletions test/parallel/test-whatwg-url-constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
5 changes: 3 additions & 2 deletions test/parallel/test-whatwg-url-historical.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
5 changes: 3 additions & 2 deletions test/parallel/test-whatwg-url-origin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
5 changes: 3 additions & 2 deletions test/parallel/test-whatwg-url-searchparams-append.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
7 changes: 4 additions & 3 deletions test/parallel/test-whatwg-url-searchparams-constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 + '', '');
Expand Down
5 changes: 3 additions & 2 deletions test/parallel/test-whatwg-url-searchparams-delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
7 changes: 4 additions & 3 deletions test/parallel/test-whatwg-url-searchparams-foreach.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down
5 changes: 3 additions & 2 deletions test/parallel/test-whatwg-url-searchparams-get.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
5 changes: 3 additions & 2 deletions test/parallel/test-whatwg-url-searchparams-getall.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down
5 changes: 3 additions & 2 deletions test/parallel/test-whatwg-url-searchparams-has.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
5 changes: 3 additions & 2 deletions test/parallel/test-whatwg-url-searchparams-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
5 changes: 3 additions & 2 deletions test/parallel/test-whatwg-url-searchparams-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions test/parallel/test-whatwg-url-searchparams-stringifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
5 changes: 3 additions & 2 deletions test/parallel/test-whatwg-url-setters.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
5 changes: 3 additions & 2 deletions test/parallel/test-whatwg-url-toascii.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
5 changes: 3 additions & 2 deletions test/parallel/test-whatwg-url-tojson.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/\"")
Expand Down

0 comments on commit a34ac21

Please sign in to comment.