summaryrefslogtreecommitdiff
path: root/test/suite/intl402/ch12/12.1/12.1.2.1_4.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/suite/intl402/ch12/12.1/12.1.2.1_4.js')
-rw-r--r--test/suite/intl402/ch12/12.1/12.1.2.1_4.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/suite/intl402/ch12/12.1/12.1.2.1_4.js b/test/suite/intl402/ch12/12.1/12.1.2.1_4.js
new file mode 100644
index 000000000..cb22be8f9
--- /dev/null
+++ b/test/suite/intl402/ch12/12.1/12.1.2.1_4.js
@@ -0,0 +1,21 @@
+// Copyright 2012 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * @description Tests that for non-object values passed as this to DateTimeFormat a
+ * wrapper object will be initialized and returned.
+ * @author Norbert Lindenberg
+ */
+
+var thisValues = [true, 42, "国際化"];
+
+thisValues.forEach(function (value) {
+ var format = Intl.DateTimeFormat.call(value);
+ // check that the returned object functions as a date-time format
+ var referenceFormat = new Intl.DateTimeFormat();
+ if (Intl.DateTimeFormat.prototype.format.call(format, new Date(111111111)) !== referenceFormat.format(new Date(111111111))) {
+ $ERROR("DateTimeFormat initialized from " + value + " doesn't behave like normal date-time format.");
+ }
+ return true;
+});
+