Add tests for proposal to make Intl prototypes not instances (#1079)

This proposal was started in https://github.com/tc39/ecma402/issues/122,
and specified in https://github.com/tc39/ecma402/pull/148
This commit is contained in:
Daniel Ehrenberg 2017-09-06 19:58:03 +02:00 committed by Leo Balter
parent 443b15e43e
commit 8e5ffb66bf
3 changed files with 15 additions and 12 deletions

View File

@ -2,12 +2,13 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 10.3_a
esid: sec-properties-of-the-intl-collator-prototype-object
description: >
Tests that Intl.Collator.prototype is an object that has been
Tests that Intl.Collator.prototype is not an object that has been
initialized as an Intl.Collator.
---*/
// test by calling a function that would fail if "this" were not an object
// test by calling a function that should fail as "this" is not an object
// initialized as an Intl.Collator
assert.sameValue(Intl.Collator.prototype.compare("aаあ아", "aаあ아"), 0, "Intl.Collator.prototype is not an object that has been initialized as an Intl.Collator.");
assert.throws(TypeError, () => Intl.Collator.prototype.compare("aаあ아", "aаあ아"),
"Intl.Collator.prototype is not an object that has been initialized as an Intl.Collator.");

View File

@ -2,13 +2,14 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 12.3_a
esid: sec-properties-of-intl-datetimeformat-prototype-object
description: >
Tests that Intl.DateTimeFormat.prototype is an object that has
Tests that Intl.DateTimeFormat.prototype is not an object that has
been initialized as an Intl.DateTimeFormat.
author: Roozbeh Pournader
---*/
// test by calling a function that would fail if "this" were not an object
// test by calling a function that should fail as "this" is not an object
// initialized as an Intl.DateTimeFormat
assert.sameValue(typeof Intl.DateTimeFormat.prototype.format(0), "string", "Intl.DateTimeFormat's prototype is not an object that has been initialized as an Intl.DateTimeFormat");
assert.throws(TypeError, () => Intl.DateTimeFormat.prototype.format(0),
"Intl.DateTimeFormat's prototype is not an object that has been initialized as an Intl.DateTimeFormat");

View File

@ -2,13 +2,14 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.3_a
esid: sec-properties-of-intl-numberformat-prototype-object
description: >
Tests that Intl.NumberFormat.prototype is an object that has been
Tests that Intl.NumberFormat.prototype is not an object that has been
initialized as an Intl.NumberFormat.
author: Roozbeh Pournader
---*/
// test by calling a function that would fail if "this" were not an object
// test by calling a function that should fail as "this" is not an object
// initialized as an Intl.NumberFormat
assert.sameValue(typeof Intl.NumberFormat.prototype.format(0), "string", "Intl.NumberFormat's prototype is not an object that has been initialized as an Intl.NumberFormat");
assert.throws(TypeError, () => Intl.NumberFormat.prototype.format(0),
"Intl.NumberFormat's prototype is not an object that has been initialized as an Intl.NumberFormat");