diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-object-insufficient-data.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-object-insufficient-data.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-object-insufficient-data.js b/js/src/tests/test262/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-object-insufficient-data.js new file mode 100644 index 0000000000..e7d7859da5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-object-insufficient-data.js @@ -0,0 +1,38 @@ +// |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.plaindatetime.prototype.withplaindate +description: Unrecognized properties of plain object ignored +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const dt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30); + +assert.throws( + TypeError, + () => dt.withPlainDate({}), + "empty object not acceptable" +); + +assert.throws( + TypeError, + () => dt.withPlainDate({ months: 12 }), // should be "month" + "no recognized properties (look like it might work)" +); + +assert.throws( + TypeError, + () => dt.with({nonsense: true}), + "no recognized properties (clearly won't work)" +); + +TemporalHelpers.assertPlainDateTime( + dt.withPlainDate({ year: 2000, month: 6, day: 1, months: 123 }), // 'months' unrecognized; see above + 2000, 6, "M06", 1, 3, 24, 30, 0, 0, 0, + "unrecognized properties ignored & does not throw if recognized properties present)" +); + +reportCompare(0, 0); |