summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/Calendar/prototype/fields/non-string-element-throws.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Temporal/Calendar/prototype/fields/non-string-element-throws.js')
-rw-r--r--js/src/tests/test262/built-ins/Temporal/Calendar/prototype/fields/non-string-element-throws.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Temporal/Calendar/prototype/fields/non-string-element-throws.js b/js/src/tests/test262/built-ins/Temporal/Calendar/prototype/fields/non-string-element-throws.js
new file mode 100644
index 0000000000..c7627ff747
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Temporal/Calendar/prototype/fields/non-string-element-throws.js
@@ -0,0 +1,20 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// Copyright (C) 2021 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-temporal.calendar.prototype.fields
+description: TypeError thrown if the input iterable yields a non-String value
+info: |
+ sec-temporal.calendar.prototype.fields step 5:
+ 5. For each element _fieldName_ of _fieldNames_, do
+ a. If Type(_fieldName_) is not String, throw a *TypeError* exception.
+features: [Temporal]
+---*/
+
+const calendar = new Temporal.Calendar("iso8601");
+[true, 3, 3n, {}, () => {}, Symbol(), undefined, null].forEach((element) => {
+ assert.throws(TypeError, () => calendar.fields([element]), "bad input to calendar.fields()");
+});
+
+reportCompare(0, 0);