mirror of
https://github.com/tc39/test262.git
synced 2025-12-02 11:33:15 +01:00
These tests confirm that Temporal-object-like property bags have the correct default values for their optional properties. This provides coverage for a V8 bug: https://issues.chromium.org/issues/446728405
31 lines
848 B
JavaScript
31 lines
848 B
JavaScript
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
/*---
|
|
esid: sec-temporal.duration.prototype.from
|
|
description: >
|
|
A property bag missing optional properties is equivalent to a property bag
|
|
with all the optional properties having their default values
|
|
includes: [temporalHelpers.js]
|
|
features: [Temporal]
|
|
---*/
|
|
|
|
const oneProperty = {
|
|
hours: 1,
|
|
};
|
|
const allProperties = {
|
|
years: 0,
|
|
months: 0,
|
|
weeks: 0,
|
|
days: 0,
|
|
hours: 1,
|
|
minutes: 0,
|
|
seconds: 0,
|
|
milliseconds: 0,
|
|
microseconds: 0,
|
|
nanoseconds: 0,
|
|
};
|
|
const resultWithout = Temporal.Duration.from(oneProperty);
|
|
const resultWith = Temporal.Duration.from(allProperties);
|
|
TemporalHelpers.assertDurationsEqual(resultWithout, resultWith, "results should be the same with and without optional properties");
|