11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common.js'); 31cb0ef41Sopenharmony_ciconst url = require('url'); 41cb0ef41Sopenharmony_ciconst URL = url.URL; 51cb0ef41Sopenharmony_ciconst assert = require('assert'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ciconst bench = common.createBenchmark(main, { 81cb0ef41Sopenharmony_ci type: common.urlDataTypes, 91cb0ef41Sopenharmony_ci e: [1], 101cb0ef41Sopenharmony_ci}); 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_cifunction main({ type, e }) { 131cb0ef41Sopenharmony_ci const data = common.bakeUrlData(type, e, false, true); 141cb0ef41Sopenharmony_ci const obj = new URL(data[0]); 151cb0ef41Sopenharmony_ci const noDead = { 161cb0ef41Sopenharmony_ci protocol: obj.protocol, 171cb0ef41Sopenharmony_ci auth: `${obj.username}:${obj.password}`, 181cb0ef41Sopenharmony_ci host: obj.host, 191cb0ef41Sopenharmony_ci hostname: obj.hostname, 201cb0ef41Sopenharmony_ci port: obj.port, 211cb0ef41Sopenharmony_ci pathname: obj.pathname, 221cb0ef41Sopenharmony_ci search: obj.search, 231cb0ef41Sopenharmony_ci hash: obj.hash, 241cb0ef41Sopenharmony_ci }; 251cb0ef41Sopenharmony_ci const len = data.length; 261cb0ef41Sopenharmony_ci bench.start(); 271cb0ef41Sopenharmony_ci for (let i = 0; i < len; i++) { 281cb0ef41Sopenharmony_ci const obj = data[i]; 291cb0ef41Sopenharmony_ci noDead.protocol = obj.protocol; 301cb0ef41Sopenharmony_ci noDead.auth = `${obj.username}:${obj.password}`; 311cb0ef41Sopenharmony_ci noDead.host = obj.host; 321cb0ef41Sopenharmony_ci noDead.hostname = obj.hostname; 331cb0ef41Sopenharmony_ci noDead.port = obj.port; 341cb0ef41Sopenharmony_ci noDead.pathname = obj.pathname; 351cb0ef41Sopenharmony_ci noDead.search = obj.search; 361cb0ef41Sopenharmony_ci noDead.hash = obj.hash; 371cb0ef41Sopenharmony_ci } 381cb0ef41Sopenharmony_ci bench.end(len); 391cb0ef41Sopenharmony_ci assert.ok(noDead); 401cb0ef41Sopenharmony_ci} 41