argument-duration.js (755B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2022 Igalia, S.L. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-temporal.duration.from 7 description: A Duration object is copied, not returned directly 8 includes: [temporalHelpers.js] 9 features: [Temporal] 10 ---*/ 11 12 const orig = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 987, 654, 321); 13 const result = Temporal.Duration.from(orig); 14 15 TemporalHelpers.assertDuration( 16 result, 17 1, 2, 3, 4, 5, 6, 7, 987, 654, 321, 18 "Duration is copied" 19 ); 20 21 assert.notSameValue( 22 result, 23 orig, 24 "When a Duration is given, the returned value is not the original Duration" 25 ); 26 27 reportCompare(0, 0);