Add missing surface tests for %TypedArray%.prototype.includes

This commit is contained in:
Leonardo Balter 2016-03-01 17:42:54 -05:00
parent 83b27c9beb
commit 7499d3c208
5 changed files with 129 additions and 0 deletions

View File

@ -0,0 +1,28 @@
// 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%.prototype.includes
description: Throws a TypeError exception when invoked as a function
info: >
22.2.3.14 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] )
This function is not generic. ValidateTypedArray is applied to the this value
prior to evaluating the algorithm. If its result is an abrupt completion that
exception is thrown instead of evaluating the algorithm.
22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
1. If Type(O) is not Object, throw a TypeError exception.
2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
exception.
...
includes: [testTypedArray.js]
---*/
var includes = TypedArray.prototype.includes;
assert.sameValue(typeof includes, "function");
assert.throws(TypeError, function() {
includes();
});

View File

@ -0,0 +1,28 @@
// 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%.prototype.includes
description: Requires a [[TypedArrayName]] internal slot.
info: >
22.2.3.14 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] )
This function is not generic. ValidateTypedArray is applied to the this value
prior to evaluating the algorithm. If its result is an abrupt completion that
exception is thrown instead of evaluating the algorithm.
22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
1. If Type(O) is not Object, throw a TypeError exception.
2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
exception.
...
includes: [testTypedArray.js]
---*/
var TypedArrayPrototype = TypedArray.prototype;
assert.sameValue(typeof TypedArrayPrototype.includes, "function");
assert.throws(TypeError, function() {
TypedArrayPrototype.includes();
});

View File

@ -0,0 +1,29 @@
// 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%.prototype.includes
description: >
%TypedArray%.prototype.includes.length is 1.
info: >
%TypedArray%.prototype.includes ( searchElement [ , fromIndex ] )
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, has a length
property whose value is an integer. Unless otherwise specified, this
value is equal to the largest number of named arguments shown in the
subclause headings for the function description, including optional
parameters. However, rest parameters shown using the form ...name
are not included in the default argument count.
Unless otherwise specified, the length property of a built-in Function
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
---*/
assert.sameValue(TypedArray.prototype.includes.length, 1);
verifyNotEnumerable(TypedArray.prototype.includes, "length");
verifyNotWritable(TypedArray.prototype.includes, "length");
verifyConfigurable(TypedArray.prototype.includes, "length");

View File

@ -0,0 +1,26 @@
// 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%.prototype.includes
description: >
%TypedArray%.prototype.includes.name is "includes".
info: >
%TypedArray%.prototype.includes (searchElement [ , fromIndex ] )
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value
is a String.
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js, testTypedArray.js]
---*/
assert.sameValue(TypedArray.prototype.includes.name, "includes");
verifyNotEnumerable(TypedArray.prototype.includes, "name");
verifyNotWritable(TypedArray.prototype.includes, "name");
verifyConfigurable(TypedArray.prototype.includes, "name");

View File

@ -0,0 +1,18 @@
// 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%.prototype.includes
description: >
"includes" property of TypedArrayPrototype
info: >
ES6 section 17: Every other data property described in clauses 18 through 26
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js, testTypedArray.js]
---*/
var TypedArrayPrototype = TypedArray.prototype;
verifyNotEnumerable(TypedArrayPrototype, "includes");
verifyWritable(TypedArrayPrototype, "includes");
verifyConfigurable(TypedArrayPrototype, "includes");