summaryrefslogtreecommitdiff
path: root/test/suite/intl402/ch12/12.3/12.3.2_2.js
diff options
context:
space:
mode:
authorNebojsa Ciric <cira@google.com>2012-04-16 13:23:13 -0700
committerNebojsa Ciric <cira@google.com>2012-04-16 13:23:13 -0700
commit96c257264b4d2ad8e4ee94b91dee29d83ccb2f06 (patch)
tree9e19edead8add279f0ccbdf0678ade0e8c80fca8 /test/suite/intl402/ch12/12.3/12.3.2_2.js
parent538dd397e5e2afbfff412b4354d65991673c6fb6 (diff)
downloadtest262-96c257264b4d2ad8e4ee94b91dee29d83ccb2f06.tar.gz
Initial intl402 checkin.
Diffstat (limited to 'test/suite/intl402/ch12/12.3/12.3.2_2.js')
-rw-r--r--test/suite/intl402/ch12/12.3/12.3.2_2.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/suite/intl402/ch12/12.3/12.3.2_2.js b/test/suite/intl402/ch12/12.3/12.3.2_2.js
new file mode 100644
index 000000000..09fafe15d
--- /dev/null
+++ b/test/suite/intl402/ch12/12.3/12.3.2_2.js
@@ -0,0 +1,34 @@
+// Copyright 2012 Google Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * @path intl402/ch12/12.3/12.3.2_2.js
+ * @description Tests that Intl.NumberFormat.prototype.format
+ * converts other types to numbers.
+ * @author: Roozbeh Pournader
+ */
+
+var testcase = function() {
+ "use strict";
+
+ var formatter = new Intl.NumberFormat();
+ var testData = [undefined, null, true, '0.6666666'];
+ var number;
+ var i, input, correctResult, result;
+
+ for (i in testData) {
+ input = testData[i];
+ number = +input;
+ correctResult = formatter.format(number);
+
+ result = formatter.format(input);
+ if (result !== correctResult) {
+ $ERROR('Intl.NumberFormat does not convert other ' +
+ 'types to numbers. Input: "'+input+'" Output: "'+result+'" '+
+ 'Expected output: "'+correctResult+'"');
+ }
+ }
+
+ return true;
+}
+runTestCase(testcase);