From f1f3a2d54215d1e209e398f0295dbb15dbcf0c45 Mon Sep 17 00:00:00 2001 From: Frank Yung-Fong Tang Date: Tue, 13 Jul 2021 16:39:07 -0700 Subject: [PATCH] Add test for 12.4.21 of Temporal (#3036) * Add test for 12.4.21 of Temporal 12.4.21 Temporal.Calendar.prototype.fields ( fields ) https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.fields @sffc @Ms2ger @ryzokuken @ljharb * move to the right file * remove from wrong place --- .../Calendar/prototype/fields/long-input.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 test/built-ins/Temporal/Calendar/prototype/fields/long-input.js diff --git a/test/built-ins/Temporal/Calendar/prototype/fields/long-input.js b/test/built-ins/Temporal/Calendar/prototype/fields/long-input.js new file mode 100644 index 0000000000..afb7207d02 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/fields/long-input.js @@ -0,0 +1,27 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.fields +description: Temporal.Calendar.prototype.fields will take iterable of any size and any string + and return Array of the same content. +info: | + ## 12.4.21 Temporal.Calendar.prototype.fields ( fields ) + 1. Let calendar be the this value. + 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). + 3. Assert: calendar.[[Identifier]] is "iso8601". + 4. Let fieldNames be ? IterableToListOfType(fields, « String »). + 5. Return ! CreateArrayFromList(fieldNames). +features: [Temporal] +includes: [compareArray.js] +---*/ +let cal = new Temporal.Calendar("iso8601") +const fields = { + *[Symbol.iterator]() { + let i = 0; + while (i++ < 1000001) { + yield "garbage " + i; + } + } +} +assert(compareArray(cal.fields(fields), Array.from(fields)));