mirror of
https://github.com/tc39/test262.git
synced 2025-07-12 08:34:41 +02:00
This copies over the tests that previously existed in the tc39/proposal-temporal repository. For context, see thread starting at: https://github.com/tc39/test262/issues/3002#issuecomment-926234480 In service of https://github.com/tc39/test262/issues/3002
20 lines
616 B
JavaScript
20 lines
616 B
JavaScript
// Copyright (C) 2020 Igalia, S.L. All rights reserved.
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
/*---
|
|
esid: sec-temporal.duration.from
|
|
description: Property bag is converted to Duration; Duration is copied
|
|
features: [Temporal]
|
|
---*/
|
|
|
|
const d1 = Temporal.Duration.from({ milliseconds: 1000 });
|
|
assert.sameValue(d1.seconds, 0);
|
|
assert.sameValue(d1.milliseconds, 1000);
|
|
|
|
const d2 = Temporal.Duration.from(d1);
|
|
assert.notSameValue(d1, d2);
|
|
assert.sameValue(d1.seconds, 0);
|
|
assert.sameValue(d1.milliseconds, 1000);
|
|
assert.sameValue(d2.seconds, 0);
|
|
assert.sameValue(d2.milliseconds, 1000);
|