Gautam Arora
8 years ago
committed by
Refael Ackermann
No known key found for this signature in database
GPG Key ID: CD704BD80FDDDB64
20 changed files with
59 additions and
39 deletions
doc/guides/writing-tests.md
test/fixtures/url-setter-tests.js
test/fixtures/url-tests.js
test/fixtures/url-toascii.js
test/parallel/test-whatwg-url-constructor.js
test/parallel/test-whatwg-url-historical.js
test/parallel/test-whatwg-url-origin.js
test/parallel/test-whatwg-url-searchparams-append.js
test/parallel/test-whatwg-url-searchparams-constructor.js
test/parallel/test-whatwg-url-searchparams-delete.js
test/parallel/test-whatwg-url-searchparams-foreach.js
test/parallel/test-whatwg-url-searchparams-get.js
test/parallel/test-whatwg-url-searchparams-getall.js
test/parallel/test-whatwg-url-searchparams-has.js
test/parallel/test-whatwg-url-searchparams-set.js
test/parallel/test-whatwg-url-searchparams-sort.js
test/parallel/test-whatwg-url-searchparams-stringifier.js
test/parallel/test-whatwg-url-setters.js
test/parallel/test-whatwg-url-toascii.js
test/parallel/test-whatwg-url-tojson.js
@ -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
@ -1,6 +1,7 @@
'use strict' ;
/ * W P T R e f s :
/ * T h e f o l l o w i n g t e s t s a r e c o p i e d f r o m W P T . M o d i f i c a t i o n s t o t h e m s h o u l d b e
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
* /
@ -1,6 +1,7 @@
'use strict' ;
/ * W P T R e f s :
/ * T h e f o l l o w i n g t e s t s a r e c o p i e d f r o m W P T . M o d i f i c a t i o n s t o t h e m s h o u l d b e
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
* /
@ -1,6 +1,7 @@
'use strict' ;
/ * W P T R e f s :
/ * T h e f o l l o w i n g t e s t s a r e c o p i e d f r o m W P T . M o d i f i c a t i o n s t o t h e m s h o u l d b e
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
* /
@ -14,11 +14,12 @@ const request = {
response : require ( path . join ( common . fixturesDir , 'url-tests' ) )
} ;
/* eslint-disable */
/ * W P T R e f s :
/ * T h e f o l l o w i n g t e s t s a r e c o p i e d f r o m W P T . M o d i f i c a t i o n s t o t h e m s h o u l d b e
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() {
@ -8,11 +8,12 @@ if (!common.hasIntl) {
const URL = require ( 'url' ) . URL ;
const { test , assert_equals , assert_throws } = require ( '../common/wpt' ) ;
/* eslint-disable */
/ * W P T R e f s :
/ * T h e f o l l o w i n g t e s t s a r e c o p i e d f r o m W P T . M o d i f i c a t i o n s t o t h e m s h o u l d b e
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"],
@ -13,11 +13,12 @@ const request = {
response : require ( path . join ( common . fixturesDir , 'url-tests' ) )
} ;
/* eslint-disable */
/ * W P T R e f s :
/ * T h e f o l l o w i n g t e s t s a r e c o p i e d f r o m W P T . M o d i f i c a t i o n s t o t h e m s h o u l d b e
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() {
@ -5,11 +5,12 @@ const assert = require('assert');
const URLSearchParams = require ( 'url' ) . URLSearchParams ;
const { test , assert_equals , assert_true } = require ( '../common/wpt' ) ;
/* eslint-disable */
/ * W P T R e f s :
/ * T h e f o l l o w i n g t e s t s a r e c o p i e d f r o m W P T . M o d i f i c a t i o n s t o t h e m s h o u l d b e
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' ) ;
@ -8,12 +8,13 @@ const {
assert_false , assert_throws , assert_array_equals
} = require ( '../common/wpt' ) ;
/* eslint-disable */
var params ; // Strict mode fix for WPT.
/ * W P T R e f s :
/ * T h e f o l l o w i n g t e s t s a r e c o p i e d f r o m W P T . M o d i f i c a t i o n s t o t h e m s h o u l d b e
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 + '' , '' ) ;
@ -6,11 +6,12 @@ const { URL, URLSearchParams } = require('url');
const { test , assert_equals , assert_true , assert_false } =
require ( '../common/wpt' ) ;
/* eslint-disable */
/ * W P T R e f s :
/ * T h e f o l l o w i n g t e s t s a r e c o p i e d f r o m W P T . M o d i f i c a t i o n s t o t h e m s h o u l d b e
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' ) ;
@ -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.
/ * W P T R e f s :
/ * T h e f o l l o w i n g t e s t s a r e c o p i e d f r o m W P T . M o d i f i c a t i o n s t o t h e m s h o u l d b e
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 = [ ] ;
@ -5,11 +5,12 @@ const assert = require('assert');
const URLSearchParams = require ( 'url' ) . URLSearchParams ;
const { test , assert_equals , assert_true } = require ( '../common/wpt' ) ;
/* eslint-disable */
/ * W P T R e f s :
/ * T h e f o l l o w i n g t e s t s a r e c o p i e d f r o m W P T . M o d i f i c a t i o n s t o t h e m s h o u l d b e
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' ) ;
@ -6,11 +6,12 @@ const URLSearchParams = require('url').URLSearchParams;
const { test , assert_equals , assert_true , assert_array_equals } =
require ( '../common/wpt' ) ;
/* eslint-disable */
/ * W P T R e f s :
/ * T h e f o l l o w i n g t e s t s a r e c o p i e d f r o m W P T . M o d i f i c a t i o n s t o t h e m s h o u l d b e
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' ] ) ;
@ -5,11 +5,12 @@ const assert = require('assert');
const URLSearchParams = require ( 'url' ) . URLSearchParams ;
const { test , assert_false , assert_true } = require ( '../common/wpt' ) ;
/* eslint-disable */
/ * W P T R e f s :
/ * T h e f o l l o w i n g t e s t s a r e c o p i e d f r o m W P T . M o d i f i c a t i o n s t o t h e m s h o u l d b e
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' ) ) ;
@ -5,11 +5,12 @@ const assert = require('assert');
const URLSearchParams = require ( 'url' ) . URLSearchParams ;
const { test , assert_equals , assert_true } = require ( '../common/wpt' ) ;
/* eslint-disable */
/ * W P T R e f s :
/ * T h e f o l l o w i n g t e s t s a r e c o p i e d f r o m W P T . M o d i f i c a t i o n s t o t h e m s h o u l d b e
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' ) ;
@ -4,11 +4,12 @@ require('../common');
const { URL , URLSearchParams } = require ( 'url' ) ;
const { test , assert_array_equals } = require ( '../common/wpt' ) ;
/* eslint-disable */
/ * W P T R e f s :
/ * T h e f o l l o w i n g t e s t s a r e c o p i e d f r o m W P T . M o d i f i c a t i o n s t o t h e m s h o u l d b e
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" ,
@ -5,11 +5,12 @@ const assert = require('assert');
const URLSearchParams = require ( 'url' ) . URLSearchParams ;
const { test , assert_equals } = require ( '../common/wpt' ) ;
/* eslint-disable */
/ * W P T R e f s :
/ * T h e f o l l o w i n g t e s t s a r e c o p i e d f r o m W P T . M o d i f i c a t i o n s t o t h e m s h o u l d b e
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' ) ;
@ -17,11 +17,12 @@ const request = {
response : require ( path . join ( common . fixturesDir , 'url-setter-tests' ) )
} ;
/* eslint-disable */
/ * W P T R e f s :
/ * T h e f o l l o w i n g t e s t s a r e c o p i e d f r o m W P T . M o d i f i c a t i o n s t o t h e m s h o u l d b e
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() {
@ -13,11 +13,12 @@ const request = {
response : require ( path . join ( common . fixturesDir , 'url-toascii' ) )
} ;
/* eslint-disable */
/ * W P T R e f s :
/ * T h e f o l l o w i n g t e s t s a r e c o p i e d f r o m W P T . M o d i f i c a t i o n s t o t h e m s h o u l d b e
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")
@ -4,11 +4,12 @@ require('../common');
const URL = require ( 'url' ) . URL ;
const { test , assert_equals } = require ( '../common/wpt' ) ;
/* eslint-disable */
/ * W P T R e f s :
/ * T h e f o l l o w i n g t e s t s a r e c o p i e d f r o m W P T . M o d i f i c a t i o n s t o t h e m s h o u l d b e
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/\"" )