summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/DateTimeFormat/prototype/formatRange/this-bad-object.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/intl402/DateTimeFormat/prototype/formatRange/this-bad-object.js')
-rw-r--r--js/src/tests/test262/intl402/DateTimeFormat/prototype/formatRange/this-bad-object.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/DateTimeFormat/prototype/formatRange/this-bad-object.js b/js/src/tests/test262/intl402/DateTimeFormat/prototype/formatRange/this-bad-object.js
new file mode 100644
index 0000000000..e669dc4421
--- /dev/null
+++ b/js/src/tests/test262/intl402/DateTimeFormat/prototype/formatRange/this-bad-object.js
@@ -0,0 +1,28 @@
+// Copyright 2019 Igalia, S.L. All rights reserved.
+// This code is governed by the license found in the LICENSE file.
+
+/*---
+description: >
+ Throws a TypeError if this is not a DateTimeFormat object
+features: [Intl.DateTimeFormat-formatRange]
+---*/
+
+const formatRange = Intl.DateTimeFormat.prototype.formatRange;
+
+assert.throws(TypeError, function() {
+ formatRange.call({});
+}, "{}");
+
+assert.throws(TypeError, function() {
+ formatRange.call(new Date());
+}, "new Date()");
+
+assert.throws(TypeError, function() {
+ formatRange.call(Intl.DateTimeFormat);
+}, "Intl.DateTimeFormat");
+
+assert.throws(TypeError, function() {
+ formatRange.call(Intl.DateTimeFormat.prototype);
+}, "Intl.DateTimeFormat.prototype");
+
+reportCompare(0, 0);