summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/this-has-no-dataview-internal.js
blob: 3b77b7f5b750ec52be81ebb9e29c8adf50a50697 (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
// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options
// Copyright (C) 2024 Kevin Gibbons. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-dataview.prototype.getfloat16
description: >
  Throws a TypeError if this does not have a [[DataView]] internal slot
features: [Float16Array, Int8Array]
---*/

var getFloat16 = DataView.prototype.getFloat16;

assert.throws(TypeError, function() {
  getFloat16.call({});
}, "{}");

assert.throws(TypeError, function() {
  getFloat16.call([]);
}, "[]");

var ab = new ArrayBuffer(1);
assert.throws(TypeError, function() {
  getFloat16.call(ab);
}, "ArrayBuffer");

var ta = new Int8Array();
assert.throws(TypeError, function() {
  getFloat16.call(ta);
}, "TypedArray");

reportCompare(0, 0);