diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Temporal/PlainDate/from/argument-object-valid.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Temporal/PlainDate/from/argument-object-valid.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Temporal/PlainDate/from/argument-object-valid.js b/js/src/tests/test262/built-ins/Temporal/PlainDate/from/argument-object-valid.js new file mode 100644 index 0000000000..c02ee292b4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Temporal/PlainDate/from/argument-object-valid.js @@ -0,0 +1,36 @@ +// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.from +description: Property bag is correctly converted into PlainDate +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const valid = [ + [ + { year: 2019, month: 10, monthCode: "M10", day: 1, hour: 14, minute: 20, second: 36 }, + 2019, 10, "M10", 1 + ], + [ + { year: 1976, month: 11, day: 18 }, + 1976, 11, "M11", 18 + ], + [ + { year: 1976, monthCode: "M11", day: 18 }, + 1976, 11, "M11", 18 + ], + [ + { year: 1976, month: 11, day: 18, days: 15 }, + 1976, 11, "M11", 18 + ], +]; + +for (const [dateTimeFields, ...expected] of valid) { + const plainDate = Temporal.PlainDate.from(dateTimeFields); + TemporalHelpers.assertPlainDate(plainDate, ...expected, `from(${JSON.stringify(dateTimeFields)}`); +} + +reportCompare(0, 0); |