11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ci// Tests below are not from WPT. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ciconst common = require('../common'); 61cb0ef41Sopenharmony_ciif (!common.hasIntl) { 71cb0ef41Sopenharmony_ci // A handful of the tests fail when ICU is not included. 81cb0ef41Sopenharmony_ci common.skip('missing Intl'); 91cb0ef41Sopenharmony_ci} 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ciconst util = require('util'); 121cb0ef41Sopenharmony_ciconst assert = require('assert'); 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ciconst url = new URL('https://username:password@host.name:8080/path/name/?que=ry#hash'); 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ciassert.strictEqual( 171cb0ef41Sopenharmony_ci util.inspect(url), 181cb0ef41Sopenharmony_ci `URL { 191cb0ef41Sopenharmony_ci href: 'https://username:password@host.name:8080/path/name/?que=ry#hash', 201cb0ef41Sopenharmony_ci origin: 'https://host.name:8080', 211cb0ef41Sopenharmony_ci protocol: 'https:', 221cb0ef41Sopenharmony_ci username: 'username', 231cb0ef41Sopenharmony_ci password: 'password', 241cb0ef41Sopenharmony_ci host: 'host.name:8080', 251cb0ef41Sopenharmony_ci hostname: 'host.name', 261cb0ef41Sopenharmony_ci port: '8080', 271cb0ef41Sopenharmony_ci pathname: '/path/name/', 281cb0ef41Sopenharmony_ci search: '?que=ry', 291cb0ef41Sopenharmony_ci searchParams: URLSearchParams { 'que' => 'ry' }, 301cb0ef41Sopenharmony_ci hash: '#hash' 311cb0ef41Sopenharmony_ci}`); 321cb0ef41Sopenharmony_ci 331cb0ef41Sopenharmony_ciassert.strictEqual( 341cb0ef41Sopenharmony_ci util.inspect(url, { showHidden: true }), 351cb0ef41Sopenharmony_ci `URL { 361cb0ef41Sopenharmony_ci href: 'https://username:password@host.name:8080/path/name/?que=ry#hash', 371cb0ef41Sopenharmony_ci origin: 'https://host.name:8080', 381cb0ef41Sopenharmony_ci protocol: 'https:', 391cb0ef41Sopenharmony_ci username: 'username', 401cb0ef41Sopenharmony_ci password: 'password', 411cb0ef41Sopenharmony_ci host: 'host.name:8080', 421cb0ef41Sopenharmony_ci hostname: 'host.name', 431cb0ef41Sopenharmony_ci port: '8080', 441cb0ef41Sopenharmony_ci pathname: '/path/name/', 451cb0ef41Sopenharmony_ci search: '?que=ry', 461cb0ef41Sopenharmony_ci searchParams: URLSearchParams { 'que' => 'ry' }, 471cb0ef41Sopenharmony_ci hash: '#hash', 481cb0ef41Sopenharmony_ci [Symbol(context)]: URLContext { 491cb0ef41Sopenharmony_ci href: 'https://username:password@host.name:8080/path/name/?que=ry#hash', 501cb0ef41Sopenharmony_ci protocol_end: 6, 511cb0ef41Sopenharmony_ci username_end: 16, 521cb0ef41Sopenharmony_ci host_start: 25, 531cb0ef41Sopenharmony_ci host_end: 35, 541cb0ef41Sopenharmony_ci pathname_start: 40, 551cb0ef41Sopenharmony_ci search_start: 51, 561cb0ef41Sopenharmony_ci hash_start: 58, 571cb0ef41Sopenharmony_ci port: 8080, 581cb0ef41Sopenharmony_ci scheme_type: 2, 591cb0ef41Sopenharmony_ci [hasPort]: [Getter], 601cb0ef41Sopenharmony_ci [hasSearch]: [Getter], 611cb0ef41Sopenharmony_ci [hasHash]: [Getter] 621cb0ef41Sopenharmony_ci } 631cb0ef41Sopenharmony_ci}`); 641cb0ef41Sopenharmony_ci 651cb0ef41Sopenharmony_ciassert.strictEqual( 661cb0ef41Sopenharmony_ci util.inspect({ a: url }, { depth: 0 }), 671cb0ef41Sopenharmony_ci '{ a: [URL] }'); 681cb0ef41Sopenharmony_ci 691cb0ef41Sopenharmony_ciclass MyURL extends URL {} 701cb0ef41Sopenharmony_ciassert(util.inspect(new MyURL(url.href)).startsWith('MyURL {')); 71