Debian Codegraph @

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

raw
1 // |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.wrapWithProto)
2
3 var tag = "de-Latn-AT-u-ca-gregory-nu-latn-co-phonebk-kf-false-kn-hc-h23";
4 var locale = new Intl.Locale(tag);
5 var scwLocale = wrapWithProto(locale, Intl.Locale.prototype);
6
7 for (var [key, {get, value = get}] of Object.entries(Object.getOwnPropertyDescriptors(Intl.Locale.prototype))) {
8 if (typeof value === "function") {
9 if (key !== "constructor") {
10 var expectedValue = value.call(locale);
11
12 if (typeof expectedValue === "string" || typeof expectedValue === "boolean") {
13 assertEq(value.call(scwLocale), expectedValue, key);
14 } else if (expectedValue instanceof Intl.Locale) {
15 assertEq(value.call(scwLocale).toString(), expectedValue.toString(), key);
16 } else {
17 throw new Error("unexpected result value");
18 }
19 } else {
20 assertEq(new value(scwLocale).toString(), new value(locale).toString(), key);
21 }
22 }
23 }
24
25 if (typeof reportCompare === "function")
26 reportCompare(0, 0);