summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/TypedArray/invoked.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/TypedArray/invoked.js')
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/invoked.js68
1 files changed, 68 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/TypedArray/invoked.js b/js/src/tests/test262/built-ins/TypedArray/invoked.js
new file mode 100644
index 0000000000..3dca11ff4c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/invoked.js
@@ -0,0 +1,68 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%
+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]
+features: [TypedArray]
+---*/
+
+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);
+});
+
+reportCompare(0, 0);