Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / TypedArray / prototype / join / this-is-not-object.js
blobff4ef67fd1948a0433ed767305ec3809ad5d6c60
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-%typedarray%.prototype.join
5 description: Throws a TypeError exception when `this` is not Object
6 info: |
7   22.2.3.15 %TypedArray%.prototype.join ( separator )
9   This function is not generic. ValidateTypedArray is applied to the this value
10   prior to evaluating the algorithm. If its result is an abrupt completion that
11   exception is thrown instead of evaluating the algorithm.
13   22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
15   1. If Type(O) is not Object, throw a TypeError exception.
16   ...
17 includes: [testTypedArray.js]
18 features: [Symbol, TypedArray]
19 ---*/
21 var join = TypedArray.prototype.join;
23 assert.throws(TypeError, function() {
24   join.call(undefined, "");
25 }, "this is undefined");
27 assert.throws(TypeError, function() {
28   join.call(null, "");
29 }, "this is null");
31 assert.throws(TypeError, function() {
32   join.call(42, "");
33 }, "this is 42");
35 assert.throws(TypeError, function() {
36   join.call("1", "");
37 }, "this is a string");
39 assert.throws(TypeError, function() {
40   join.call(true, "");
41 }, "this is true");
43 assert.throws(TypeError, function() {
44   join.call(false, "");
45 }, "this is false");
47 var s = Symbol("s");
48 assert.throws(TypeError, function() {
49   join.call(s, "");
50 }, "this is a Symbol");
52 reportCompare(0, 0);