Skip to content

Commit

Permalink
benchmark: fix punycode test for --without-intl
Browse files Browse the repository at this point in the history
PR-URL: #16251
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
TimothyGu committed Oct 20, 2017
1 parent 2146c88 commit f8063d5
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions benchmark/misc/punycode.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
'use strict';

const common = require('../common.js');
const icu = process.binding('icu');
let icu;
try {
icu = process.binding('icu');
} catch (err) {}
const punycode = require('punycode');

const bench = common.createBenchmark(main, {
method: ['punycode', 'icu'],
method: ['punycode'].concat(icu !== undefined ? ['icu'] : []),
n: [1024],
val: [
'افغانستا.icom.museum',
Expand Down Expand Up @@ -69,8 +72,11 @@ function main(conf) {
runPunycode(n, val);
break;
case 'icu':
runICU(n, val);
break;
if (icu !== undefined) {
runICU(n, val);
break;
}
// fallthrough
default:
throw new Error('Unexpected method');
}
Expand Down

0 comments on commit f8063d5

Please sign in to comment.