aboutsummaryrefslogtreecommitdiffstats
path: root/test/suite/intl402/ch11/11.1/11.1.1_19.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/suite/intl402/ch11/11.1/11.1.1_19.js')
-rw-r--r--test/suite/intl402/ch11/11.1/11.1.1_19.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/suite/intl402/ch11/11.1/11.1.1_19.js b/test/suite/intl402/ch11/11.1/11.1.1_19.js
new file mode 100644
index 000000000..e41ca5bec
--- /dev/null
+++ b/test/suite/intl402/ch11/11.1/11.1.1_19.js
@@ -0,0 +1,31 @@
+// Copyright 2012 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * @description Tests that the currency style can not be used without a specified currency.
+ * @author Norbert Lindenberg
+ */
+
+var defaultLocale = new Intl.NumberFormat().resolvedOptions().locale;
+
+function expectError(f) {
+ var error;
+ try {
+ f();
+ } catch (e) {
+ error = e;
+ }
+ if (error === undefined) {
+ $ERROR("Invalid currency value " + value + " was not rejected.");
+ } else if (error.name !== "TypeError") {
+ $ERROR("Invalid currency value " + value + " was rejected with wrong error " + error.name + ".");
+ }
+}
+
+expectError(function () {
+ return new Intl.NumberFormat([defaultLocale], {style: "currency"});
+});
+expectError(function () {
+ return new Intl.NumberFormat([defaultLocale + "-u-cu-krw"], {style: "currency"});
+});
+