mirror of https://github.com/tc39/test262.git
Revalidate basic call tests for ES2016 %TypedArray% constructor
This commit is contained in:
parent
d549225f91
commit
7d715a4ef1
|
@ -1,30 +0,0 @@
|
||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
es7id: pending
|
|
||||||
description: TypedArray(length) cannot be direclty invoked as a constructor
|
|
||||||
info: >
|
|
||||||
22.2.1.1 %TypedArray%()#
|
|
||||||
|
|
||||||
1. If NewTarget is undefined, throw a TypeError exception.
|
|
||||||
2. Let here be the active function object.
|
|
||||||
3. If SameValue(NewTarget, here) is true, throw a TypeError exception.
|
|
||||||
...
|
|
||||||
|
|
||||||
Note: there's a breaking change from ES2015's 22.2.1.2 step 7 where calling
|
|
||||||
the %TypedArray% constructor with a floating number as the argument throws a
|
|
||||||
RangeError exception before checking `SameValue(NewTarget, here)`.
|
|
||||||
includes: [testTypedArray.js]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
new TypedArray(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
new TypedArray({});
|
|
||||||
});
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
new TypedArray(1.1);
|
|
||||||
});
|
|
|
@ -1,17 +0,0 @@
|
||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
es6id: 22.2.1.2.1
|
|
||||||
description: TypedArray cannot be invoked as a constructor
|
|
||||||
info: >
|
|
||||||
22.2.1.2.1 Runtime Semantics: AllocateTypedArray (newTarget, length )
|
|
||||||
|
|
||||||
...
|
|
||||||
2. If SameValue(%TypedArray%, newTarget) is true, throw a TypeError exception.
|
|
||||||
...
|
|
||||||
includes: [testTypedArray.js]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
new TypedArray();
|
|
||||||
});
|
|
|
@ -1,16 +0,0 @@
|
||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
es6id: 22.2.1.1
|
|
||||||
description: If NewTarget is undefined, throw a TypeError exception.
|
|
||||||
info: >
|
|
||||||
22.2.1.1 %TypedArray% ( )
|
|
||||||
|
|
||||||
1. If NewTarget is undefined, throw a TypeError exception.
|
|
||||||
...
|
|
||||||
includes: [testTypedArray.js]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
TypedArray();
|
|
||||||
});
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
es7id: pending
|
||||||
|
description: Throw a TypeError exception if directly invoked.
|
||||||
|
info: >
|
||||||
|
22.2.1.1 %TypedArray% ( )
|
||||||
|
|
||||||
|
1. Throw a TypeError Exception
|
||||||
|
...
|
||||||
|
|
||||||
|
Note: ES2016 replaces all the references for the %TypedArray% constructor to a
|
||||||
|
single chapter covering all arguments cases.
|
||||||
|
includes: [testTypedArray.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
TypedArray();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
new TypedArray();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
TypedArray(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
new TypedArray(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
TypedArray(1.1);
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
new TypedArray(1.1);
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
TypedArray({});
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
new TypedArray({});
|
||||||
|
});
|
||||||
|
|
||||||
|
var typedArray = new Int8Array(4);
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
TypedArray(typedArray);
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
new TypedArray(typedArray);
|
||||||
|
});
|
||||||
|
|
||||||
|
var buffer = new ArrayBuffer(4);
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
TypedArray(buffer);
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
new TypedArray(buffer);
|
||||||
|
});
|
Loading…
Reference in New Issue