Skip to content

Commit db77e13

Browse files
TimothyGuMylesBorins
authored andcommitted
benchmark: fix punycode test for --without-intl
PR-URL: #16251 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent ce751b1 commit db77e13

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

benchmark/misc/punycode.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
'use strict';
22

33
const common = require('../common.js');
4-
const icu = process.binding('icu');
4+
let icu;
5+
try {
6+
icu = process.binding('icu');
7+
} catch (err) {}
58
const punycode = require('punycode');
69

710
const bench = common.createBenchmark(main, {
8-
method: ['punycode', 'icu'],
11+
method: ['punycode'].concat(icu !== undefined ? ['icu'] : []),
912
n: [1024],
1013
val: [
1114
'افغانستا.icom.museum',
@@ -69,8 +72,11 @@ function main(conf) {
6972
runPunycode(n, val);
7073
break;
7174
case 'icu':
72-
runICU(n, val);
73-
break;
75+
if (icu !== undefined) {
76+
runICU(n, val);
77+
break;
78+
}
79+
// fallthrough
7480
default:
7581
throw new Error('Unexpected method');
7682
}

0 commit comments

Comments
 (0)