same-compartment.js (1041B)
1 // |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.wrapWithProto) 2 3 var locale = "en"; 4 var list = ["a", "b", "c"]; 5 6 var listFormat = new Intl.ListFormat(locale); 7 var scwListFormat = wrapWithProto(listFormat, Intl.ListFormat.prototype); 8 9 // Intl.ListFormat.prototype.format 10 { 11 var fn = Intl.ListFormat.prototype.format; 12 13 var expectedValue = fn.call(listFormat, list); 14 var actualValue = fn.call(scwListFormat, list); 15 16 assertEq(actualValue, expectedValue); 17 } 18 19 // Intl.ListFormat.prototype.formatToParts 20 { 21 var fn = Intl.ListFormat.prototype.formatToParts; 22 23 var expectedValue = fn.call(listFormat, list); 24 var actualValue = fn.call(scwListFormat, list); 25 26 assertDeepEq(actualValue, expectedValue); 27 } 28 29 // Intl.ListFormat.prototype.resolvedOptions 30 { 31 var fn = Intl.ListFormat.prototype.resolvedOptions; 32 33 var expectedValue = fn.call(listFormat); 34 var actualValue = fn.call(scwListFormat); 35 36 assertDeepEq(actualValue, expectedValue); 37 } 38 39 if (typeof reportCompare === "function") 40 reportCompare(0, 0);