summaryrefslogtreecommitdiff
path: root/test/parallel/test-intl-v8BreakIterator.js
diff options
context:
space:
mode:
authorSteven R. Loomis <srloomis@us.ibm.com>2016-04-15 21:35:53 -0700
committerSteven R. Loomis <srloomis@us.ibm.com>2016-05-04 15:02:25 -0700
commitcd752e8463fad7c4805951d9ba47cd2f39691f2d (patch)
tree3bdaaa4bc465b0a3fa00b519496cdf0aec729480 /test/parallel/test-intl-v8BreakIterator.js
parentbc8b525440c306470330450536743b993700d328 (diff)
downloadandroid-node-v8-cd752e8463fad7c4805951d9ba47cd2f39691f2d.tar.gz
android-node-v8-cd752e8463fad7c4805951d9ba47cd2f39691f2d.tar.bz2
android-node-v8-cd752e8463fad7c4805951d9ba47cd2f39691f2d.zip
intl: Don't crash if v8BreakIterator not available
If the undocumented v8BreakIterator does not have data available, monkeypatch it to throw an error instead of crashing. Fixes: https://github.com/nodejs/node/issues/3111 PR-URL: https://github.com/nodejs/node/pull/4253 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'test/parallel/test-intl-v8BreakIterator.js')
-rw-r--r--test/parallel/test-intl-v8BreakIterator.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/parallel/test-intl-v8BreakIterator.js b/test/parallel/test-intl-v8BreakIterator.js
new file mode 100644
index 0000000000..6e25c32cd7
--- /dev/null
+++ b/test/parallel/test-intl-v8BreakIterator.js
@@ -0,0 +1,15 @@
+'use strict';
+require('../common');
+const assert = require('assert');
+
+if (global.Intl === undefined || Intl.v8BreakIterator === undefined) {
+ return console.log('1..0 # Skipped: no Intl');
+}
+
+try {
+ new Intl.v8BreakIterator();
+ // May succeed if data is available - OK
+} catch (e) {
+ // May throw this error if ICU data is not available - OK
+ assert.throws(() => new Intl.v8BreakIterator(), /ICU data/);
+}