undefined-newtarget-throws.js (847B)
1 // Copyright 2016 Mozilla Corporation. All rights reserved. 2 // This code is governed by the license found in the LICENSE file. 3 4 /*--- 5 esid: sec-Intl.PluralRules 6 description: Tests that PluralRules throws when called as a function 7 author: Zibi Braniecki 8 includes: [testIntl.js] 9 ---*/ 10 11 assert.throws(TypeError, function() { 12 Intl.PluralRules(); 13 }, "Intl.PluralRules throws when called as a function"); 14 15 assert.throws(TypeError, function() { 16 Intl.PluralRules.call(undefined); 17 }, "Intl.PluralRules throws when called as a function with |undefined| as this-value"); 18 19 testWithIntlConstructors(function (Constructor) { 20 var obj = new Constructor(); 21 22 assert.throws(TypeError, function() { 23 Intl.PluralRules.call(obj) 24 }, "Intl.PluralRules throws when called as a function with an Intl-object as this-value"); 25 }); 26 27 reportCompare(0, 0);