mirror of https://github.com/tc39/test262.git
commit
cb58cbdd5a
|
@ -1,27 +0,0 @@
|
|||
// Copyright (C) 2017 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 23.1.1.1
|
||||
description: >
|
||||
The correct error is thrown `Map.prototype.set` throws an error and
|
||||
the IteratorClose throws an error.
|
||||
features: [Symbol.iterator]
|
||||
---*/
|
||||
|
||||
var count = 0;
|
||||
var iterable = {};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return {
|
||||
next: function() {
|
||||
return { value: [], done: false };
|
||||
},
|
||||
return: function() {
|
||||
throw new TypeError('ignore');
|
||||
}
|
||||
};
|
||||
};
|
||||
Map.prototype.set = function() { throw new Test262Error(); }
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
new Map(iterable);
|
||||
});
|
|
@ -1,45 +0,0 @@
|
|||
// Copyright 2017 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-%typedarray%.prototype.set-typedarray-offset
|
||||
description: >
|
||||
Uses typedArray's internal [[ByteOffset]]
|
||||
info: >
|
||||
22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] )
|
||||
1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not,
|
||||
the definition in 22.2.3.23.1 applies.
|
||||
...
|
||||
21. Let srcByteOffset be typedArray.[[ByteOffset]].
|
||||
...
|
||||
includes: [testTypedArray.js]
|
||||
---*/
|
||||
|
||||
var getCalls = 0;
|
||||
var desc = {
|
||||
get: function getLen() {
|
||||
getCalls++;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
Object.defineProperty(TypedArray.prototype, "byteOffset", desc);
|
||||
|
||||
testWithTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(2);
|
||||
var src = new TA([42, 43]);
|
||||
var differentTA = TA === Uint8Array ? Int8Array : Uint8Array;
|
||||
var src2 = new differentTA([42, 43]);
|
||||
var src3 = new differentTA(sample.buffer, 0, 2);
|
||||
|
||||
Object.defineProperty(TA.prototype, "byteOffset", desc);
|
||||
Object.defineProperty(src, "byteOffset", desc);
|
||||
Object.defineProperty(src2, "byteOffset", desc);
|
||||
Object.defineProperty(src3, "byteOffset", desc);
|
||||
|
||||
sample.set(src);
|
||||
sample.set(src2);
|
||||
sample.set(src3);
|
||||
|
||||
assert.sameValue(getCalls, 0, "ignores byteOffset properties");
|
||||
});
|
|
@ -1,44 +0,0 @@
|
|||
// Copyright 2017 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-%typedarray%.prototype.set-typedarray-offset
|
||||
description: >
|
||||
Uses target's internal [[ArrayLength]]
|
||||
info: >
|
||||
22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] )
|
||||
1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not,
|
||||
the definition in 22.2.3.23.1 applies.
|
||||
2. Let target be the this value.
|
||||
...
|
||||
16. Let targetByteOffset be target.[[ByteOffset]].
|
||||
...
|
||||
includes: [testTypedArray.js]
|
||||
---*/
|
||||
|
||||
var getCalls = 0;
|
||||
var desc = {
|
||||
get: function() {
|
||||
getCalls++;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
Object.defineProperty(TypedArray.prototype, "byteOffset", desc);
|
||||
|
||||
testWithTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(2);
|
||||
var src = new TA([42, 43]);
|
||||
var differentTA = TA === Uint8Array ? Int8Array : Uint8Array;
|
||||
var src2 = new differentTA([42, 43]);
|
||||
var src3 = new differentTA(sample.buffer, 0, 2);
|
||||
|
||||
Object.defineProperty(TA.prototype, "byteOffset", desc);
|
||||
Object.defineProperty(sample, "byteOffset", desc);
|
||||
|
||||
sample.set(src);
|
||||
sample.set(src2);
|
||||
sample.set(src3);
|
||||
|
||||
assert.sameValue(getCalls, 0, "ignores byteoffset properties");
|
||||
});
|
|
@ -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
|
||||
}));
|
|
@ -1,18 +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: >
|
||||
The maximum and minimum fraction digits properties should be read from
|
||||
the options bag exactly once from the NumberFormat constructor.
|
||||
Regression test for https://bugs.chromium.org/p/v8/issues/detail?id=6015
|
||||
include: [assert.js]
|
||||
---*/
|
||||
|
||||
var minCounter = 0;
|
||||
var maxCounter = 0;
|
||||
new Intl.NumberFormat("en", { get minimumFractionDigits() { minCounter++ },
|
||||
get maximumFractionDigits() { maxCounter++ } });
|
||||
assert.sameValue(1, minCounter);
|
||||
assert.sameValue(1, maxCounter);
|
Loading…
Reference in New Issue