Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/Duration/from/get-property-throws.js

raw
1 // |reftest| shell-option(--enable-temporal) skip-if(!this.hasOwnProperty('Temporal')||!xulRuntime.shell) -- Temporal is not enabled unconditionally, requires shell-options
2 // Copyright (C) 2024 André Bargull. 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: >
8 ToNumber conversion throws.
9 info: |
10 Temporal.Duration.from ( item )
11
12 1. Return ? ToTemporalDuration(item).
13
14 ToTemporalDuration ( item )
15
16 ...
17 4. Let partial be ? ToTemporalPartialDurationRecord(item).
18 ...
19
20 ToTemporalPartialDurationRecord ( temporalDurationLike )
21
22 ...
23 4. Let days be ? Get(temporalDurationLike, "days").
24 ...
25 6. Let hours be ? Get(temporalDurationLike, "hours").
26 ...
27 8. Let microseconds be ? Get(temporalDurationLike, "microseconds").
28 ...
29 10. Let milliseconds be ? Get(temporalDurationLike, "milliseconds").
30 11....
31 12. Let minutes be ? Get(temporalDurationLike, "minutes").
32 ...
33 14. Let months be ? Get(temporalDurationLike, "months").
34 ...
35 16. Let nanoseconds be ? Get(temporalDurationLike, "nanoseconds").
36 ...
37 18. Let seconds be ? Get(temporalDurationLike, "seconds").
38 ...
39 20. Let weeks be ? Get(temporalDurationLike, "weeks").
40 ...
41 22. Let years be ? Get(temporalDurationLike, "years").
42 ...
43
44 ToIntegerIfIntegral ( argument )
45
46 1. Let number be ? ToNumber(argument).
47 ...
48 features: [Temporal]
49 ---*/
50
51 for (var name of [
52 "years",
53 "months",
54 "weeks",
55 "days",
56 "hours",
57 "minutes",
58 "seconds",
59 "milliseconds",
60 "microseconds",
61 "nanoseconds",
62 ]) {
63 var item = {
64 get [name]() {
65 throw new Test262Error();
66 }
67 };
68 assert.throws(
69 Test262Error,
70 () => Temporal.Duration.from(item),
71 `name = ${name}`
72 );
73 }
74
75 reportCompare(0, 0);