mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
2d2986ae72
* Make common.skip() exit. Also add common.printSkipMessage() for partial skips. * Don't make needless things before skip PR-URL: https://github.com/nodejs/node/pull/14021 Fixes: https://github.com/nodejs/node/issues/14016 Reviewed-By: Refael Ackermann <refack@gmail.com>
67 lines
1.7 KiB
JavaScript
67 lines
1.7 KiB
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasIntl) {
|
|
// A handful of the tests fail when ICU is not included.
|
|
common.skip('missing Intl');
|
|
}
|
|
|
|
const util = require('util');
|
|
const URL = require('url').URL;
|
|
const assert = require('assert');
|
|
|
|
// Tests below are not from WPT.
|
|
const url = new URL('https://username:password@host.name:8080/path/name/?que=ry#hash');
|
|
|
|
assert.strictEqual(
|
|
util.inspect(url),
|
|
`URL {
|
|
href: 'https://username:password@host.name:8080/path/name/?que=ry#hash',
|
|
origin: 'https://host.name:8080',
|
|
protocol: 'https:',
|
|
username: 'username',
|
|
password: 'password',
|
|
host: 'host.name:8080',
|
|
hostname: 'host.name',
|
|
port: '8080',
|
|
pathname: '/path/name/',
|
|
search: '?que=ry',
|
|
searchParams: URLSearchParams { 'que' => 'ry' },
|
|
hash: '#hash' }`);
|
|
|
|
assert.strictEqual(
|
|
util.inspect(url, { showHidden: true }),
|
|
`URL {
|
|
href: 'https://username:password@host.name:8080/path/name/?que=ry#hash',
|
|
origin: 'https://host.name:8080',
|
|
protocol: 'https:',
|
|
username: 'username',
|
|
password: 'password',
|
|
host: 'host.name:8080',
|
|
hostname: 'host.name',
|
|
port: '8080',
|
|
pathname: '/path/name/',
|
|
search: '?que=ry',
|
|
searchParams: URLSearchParams { 'que' => 'ry' },
|
|
hash: '#hash',
|
|
cannotBeBase: false,
|
|
special: true,
|
|
[Symbol(context)]:\x20
|
|
URLContext {
|
|
flags: 2032,
|
|
scheme: 'https:',
|
|
username: 'username',
|
|
password: 'password',
|
|
host: 'host.name',
|
|
port: 8080,
|
|
path: [ 'path', 'name', '', [length]: 3 ],
|
|
query: 'que=ry',
|
|
fragment: 'hash' } }`);
|
|
|
|
assert.strictEqual(
|
|
util.inspect({ a: url }, { depth: 0 }),
|
|
'{ a: [Object] }');
|
|
|
|
class MyURL extends URL {}
|
|
assert(util.inspect(new MyURL(url.href)).startsWith('MyURL {'));
|