Fixup Intl.* this-value tests (delete dups, add proper esid)

This commit is contained in:
Rick Waldron 2020-09-09 15:32:44 -04:00
parent ab3a86d9b3
commit 873a7241c3
5 changed files with 2 additions and 89 deletions

View File

@ -1,35 +0,0 @@
// Copyright 2012 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 12.1.1_1
description: Tests that the this-value is ignored in DateTimeFormat.
author: Norbert Lindenberg
includes: [testIntl.js]
---*/
testWithIntlConstructors(function (Constructor) {
var obj, newObj;
if (Constructor === Intl.DateTimeFormat) {
obj = new Constructor();
newObj = Intl.DateTimeFormat.call(obj);
if (obj !== newObj) {
$ERROR("Should have modified existing object.");
}
var key = Object.getOwnPropertySymbols(newObj)[0];
if (!(newObj[key] instanceof Intl.DateTimeFormat)) {
$ERROR("Should have installed a DateTimeFormat instance.");
}
return true;
}
// variant 1: use constructor in a "new" expression
obj = new Constructor();
newObj = Intl.DateTimeFormat.call(obj);
if (obj === newObj) {
$ERROR("DateTimeFormat object created with \"new\" was not ignored as this-value.");
}
return true;
});

View File

@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 12.1.1_1
esid: sec-intl-datetimeformat-constructor
description: >
Tests that the this-value is ignored in DateTimeFormat, if the this-value
isn't a DateTimeFormat instance.

View File

@ -1,35 +0,0 @@
// Copyright 2012 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.1.1_1
description: Tests that the this-value is ignored in NumberFormat.
author: Norbert Lindenberg
includes: [testIntl.js]
---*/
testWithIntlConstructors(function (Constructor) {
var obj, newObj;
if (Constructor === Intl.NumberFormat) {
obj = new Constructor();
newObj = Intl.NumberFormat.call(obj);
if (obj !== newObj) {
$ERROR("Should have modified existing object.");
}
var key = Object.getOwnPropertySymbols(newObj)[0];
if (!(newObj[key] instanceof Intl.NumberFormat)) {
$ERROR("Should have installed a NumberFormat instance.");
}
return true;
}
// variant 1: use constructor in a "new" expression
obj = new Constructor();
newObj = Intl.NumberFormat.call(obj);
if (obj === newObj) {
$ERROR("NumberFormat object created with \"new\" was not ignored as this-value.");
}
return true;
});

View File

@ -1,17 +0,0 @@
// Copyright 2017 the V8 project authors. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: ECMA-402 #sec-setnfdigitoptions
description: >
When a currency is used in Intl.NumberFormat and minimumFractionDigits is
not provided, maximumFractionDigits should be range-checked against it.
include: [assert.js]
---*/
assert.throws(RangeError,
() => new Intl.NumberFormat('en', {
style: 'currency',
currency: 'USD',
maximumFractionDigits: 1
}));

View File

@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.1.1_1
esid: sec-intl-numberformat-constructor
description: >
Tests that the this-value is ignored in NumberFormat, if the this-value
isn't a NumberFormat instance.