Debian Codegraph @

js/src/tests/non262/Intl/DurationFormat/same-compartment.js

raw
1 // |reftest| skip-if(!this.hasOwnProperty('Intl')||!Intl.hasOwnProperty("DurationFormat")||!this.wrapWithProto)
2
3 var locale = "en";
4 var duration = {years: 123};
5
6 var durationFormat = new Intl.DurationFormat(locale);
7 var scwDurationFormat = wrapWithProto(durationFormat, Intl.DurationFormat.prototype);
8
9 // Intl.DurationFormat.prototype.format
10 {
11 var fn = Intl.DurationFormat.prototype.format;
12
13 var expectedValue = fn.call(durationFormat, duration);
14 var actualValue = fn.call(scwDurationFormat, duration);
15
16 assertEq(actualValue, expectedValue);
17 }
18
19 // Intl.DurationFormat.prototype.formatToParts
20 {
21 var fn = Intl.DurationFormat.prototype.formatToParts;
22
23 var expectedValue = fn.call(durationFormat, duration);
24 var actualValue = fn.call(scwDurationFormat, duration);
25
26 assertDeepEq(actualValue, expectedValue);
27 }
28
29 // Intl.DurationFormat.prototype.resolvedOptions
30 {
31 var fn = Intl.DurationFormat.prototype.resolvedOptions;
32
33 var expectedValue = fn.call(durationFormat);
34 var actualValue = fn.call(scwDurationFormat);
35
36 assertDeepEq(actualValue, expectedValue);
37 }
38
39 if (typeof reportCompare === "function")
40 reportCompare(0, 0);