diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2018-08-22 03:27:56 +0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2018-08-25 08:57:23 +0800 |
commit | 6dd694c1257ded6d8a9f3b48e8c9027c3986a285 (patch) | |
tree | 4c37b2936495c352676be7caaff33c9cb89c7ab8 /test/parallel/test-whatwg-url-setters.js | |
parent | 16cffb0d4890bf4b4ff8ad0bbd7731105fabe845 (diff) | |
download | android-node-v8-6dd694c1257ded6d8a9f3b48e8c9027c3986a285.tar.gz android-node-v8-6dd694c1257ded6d8a9f3b48e8c9027c3986a285.tar.bz2 android-node-v8-6dd694c1257ded6d8a9f3b48e8c9027c3986a285.zip |
test: move custom WHATWG URL tests into separate files
To enable automatic update of WPT, move all our custom
WHATWG URL tests that are not present in the upstream into
files starting with `test-whatwg-url-custom-`, so it's easier
to identify test cases that can be upstreamed and test cases
that should be rolled into our repo (possibly with automation).
PR-URL: https://github.com/nodejs/node/pull/22442
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Diffstat (limited to 'test/parallel/test-whatwg-url-setters.js')
-rw-r--r-- | test/parallel/test-whatwg-url-setters.js | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/test/parallel/test-whatwg-url-setters.js b/test/parallel/test-whatwg-url-setters.js index 7655e4a257..a04b6c93ec 100644 --- a/test/parallel/test-whatwg-url-setters.js +++ b/test/parallel/test-whatwg-url-setters.js @@ -6,14 +6,10 @@ if (!common.hasIntl) { common.skip('missing Intl'); } -const assert = require('assert'); const URL = require('url').URL; const { test, assert_equals } = require('../common/wpt'); const fixtures = require('../common/fixtures'); -const additionalTestCases = - require(fixtures.path('url-setter-tests-additional.js')); - const request = { response: require(fixtures.path('url-setter-tests')) }; @@ -80,48 +76,3 @@ function runURLSettersTests(all_test_cases) { startURLSettersTests() /* eslint-enable */ - -// Tests below are not from WPT. - -{ - for (const attributeToBeSet in additionalTestCases) { - if (attributeToBeSet === 'comment') { - continue; - } - const testCases = additionalTestCases[attributeToBeSet]; - for (const testCase of testCases) { - let name = `Setting <${testCase.href}>.${attributeToBeSet}` + - ` = "${testCase.new_value}"`; - if ('comment' in testCase) { - name += ` ${testCase.comment}`; - } - test(function() { - const url = new URL(testCase.href); - url[attributeToBeSet] = testCase.new_value; - for (const attribute in testCase.expected) { - assert_equals(url[attribute], testCase.expected[attribute]); - } - }, `URL: ${name}`); - } - } -} - -{ - const url = new URL('http://example.com/'); - const obj = { - toString() { throw new Error('toString'); }, - valueOf() { throw new Error('valueOf'); } - }; - const sym = Symbol(); - const props = Object.getOwnPropertyDescriptors(Object.getPrototypeOf(url)); - for (const [name, { set }] of Object.entries(props)) { - if (set) { - assert.throws(() => url[name] = obj, - /^Error: toString$/, - `url.${name} = { toString() { throw ... } }`); - assert.throws(() => url[name] = sym, - /^TypeError: Cannot convert a Symbol value to a string$/, - `url.${name} = ${String(sym)}`); - } - } -} |