summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/TypedArray/invoked.js
blob: 2af6656365bbe22d431aef4cc8b2bf16f62c20b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// |reftest| shell-option(--enable-float16array)
// 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);