mirror of
https://github.com/tc39/test262.git
synced 2025-07-20 20:44:43 +02:00
Fixup Intl.* this-value tests (delete dups, add proper esid)
This commit is contained in:
parent
ab3a86d9b3
commit
873a7241c3
@ -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;
|
|
||||||
});
|
|
@ -2,7 +2,7 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
es5id: 12.1.1_1
|
esid: sec-intl-datetimeformat-constructor
|
||||||
description: >
|
description: >
|
||||||
Tests that the this-value is ignored in DateTimeFormat, if the this-value
|
Tests that the this-value is ignored in DateTimeFormat, if the this-value
|
||||||
isn't a DateTimeFormat instance.
|
isn't a DateTimeFormat instance.
|
||||||
|
@ -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;
|
|
||||||
});
|
|
@ -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
|
|
||||||
}));
|
|
@ -2,7 +2,7 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
es5id: 11.1.1_1
|
esid: sec-intl-numberformat-constructor
|
||||||
description: >
|
description: >
|
||||||
Tests that the this-value is ignored in NumberFormat, if the this-value
|
Tests that the this-value is ignored in NumberFormat, if the this-value
|
||||||
isn't a NumberFormat instance.
|
isn't a NumberFormat instance.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user