summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/Calendar/prototype/fields/non-string-element-throws.js
blob: c7627ff747db47a42e26bc5b3f10e169ca938f15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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);