summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/this-is-not-object.js
blob: 182647f76f1b66c14c86b28bfd79a6064b8af55d (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
// |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.setfloat16
description: Throws a TypeError if this is not Object
features: [Float16Array, Symbol]
---*/

var setFloat16 = DataView.prototype.setFloat16;

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

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

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

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

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

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

var s = Symbol("1");
assert.throws(TypeError, function() {
  setFloat16.call(s);
}, "symbol");

reportCompare(0, 0);