From f8063d51d7e83ab6d5c7cfcadc37ed6b4f6d8ef5 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Mon, 16 Oct 2017 22:31:52 -0700 Subject: [PATCH] benchmark: fix punycode test for --without-intl PR-URL: https://github.com/nodejs/node/pull/16251 Reviewed-By: Anna Henningsen Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- benchmark/misc/punycode.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/benchmark/misc/punycode.js b/benchmark/misc/punycode.js index 630aea3195f..40bcd703020 100644 --- a/benchmark/misc/punycode.js +++ b/benchmark/misc/punycode.js @@ -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', @@ -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'); }