Debian Codegraph @

js/src/tests/non262/Intl/fallback-symbol.js

raw
1 // |reftest| skip-if(!this.hasOwnProperty('Intl'))
2
3 function IntlFallbackSymbol(constructor) {
4 return Object.getOwnPropertySymbols(constructor.call(Object.create(constructor.prototype)))[0];
5 }
6
7 const dateTimeFormatIntlFallbackSymbol = IntlFallbackSymbol(Intl.DateTimeFormat);
8 const numberFormatIntlFallbackSymbol = IntlFallbackSymbol(Intl.NumberFormat);
9
10 // Intl.DateTimeFormat and Intl.NumberFormat both use the same fallback symbol.
11 assertEq(dateTimeFormatIntlFallbackSymbol, numberFormatIntlFallbackSymbol);
12
13 const intlFallbackSymbol = dateTimeFormatIntlFallbackSymbol;
14
15 // The fallback symbol is a Symbol value.
16 assertEq(typeof intlFallbackSymbol, "symbol");
17
18 // Test the description of the fallback symbol.
19 assertEq(Symbol.prototype.toString.call(intlFallbackSymbol), "Symbol(IntlLegacyConstructedSymbol)");
20
21 if (typeof reportCompare === "function")
22 reportCompare(true, true);