Skip to content
Snippets Groups Projects
Commit 42edfd6e authored by André Bargull's avatar André Bargull
Browse files

Add missing tests for "length" and "name" properties of %TypedArray% built-in functions

parent ca61d9b8
No related branches found
No related tags found
No related merge requests found
Showing
with 539 additions and 0 deletions
...@@ -16,6 +16,11 @@ var typedArrayConstructors = [ ...@@ -16,6 +16,11 @@ var typedArrayConstructors = [
Uint8ClampedArray, Uint8ClampedArray,
]; ];
/**
* The %TypedArray% intrinsic constructor function.
*/
var TypedArray = Object.getPrototypeOf(Int8Array);
/** /**
* Callback for testing a typed array constructor. * Callback for testing a typed array constructor.
* *
......
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.2.2.4
description: >
get %TypedArray% [ @@species ].length is 0.
info: >
get %TypedArray% [ @@species ]
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]
features: [Symbol.species]
---*/
var desc = Object.getOwnPropertyDescriptor(TypedArray, Symbol.species);
assert.sameValue(desc.get.length, 0);
verifyNotEnumerable(desc.get, "length");
verifyNotWritable(desc.get, "length");
verifyConfigurable(desc.get, "length");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.2.2.4
description: >
get %TypedArray% [ @@species ].name is "get [Symbol.species]".
info: >
get %TypedArray% [ @@species ]
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]
features: [Symbol.species]
---*/
var desc = Object.getOwnPropertyDescriptor(TypedArray, Symbol.species);
assert.sameValue(desc.get.name, "get [Symbol.species]");
verifyNotEnumerable(desc.get, "name");
verifyNotWritable(desc.get, "name");
verifyConfigurable(desc.get, "name");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.2.2.1
description: >
%TypedArray%.from.length is 1.
info: >
%TypedArray%.from ( source [ , mapfn [ , thisArg ] ] )
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.from.length, 1);
verifyNotEnumerable(TypedArray.from, "length");
verifyNotWritable(TypedArray.from, "length");
verifyConfigurable(TypedArray.from, "length");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.2.2.1
description: >
%TypedArray%.from.name is "from".
info: >
%TypedArray%.from ( source [ , mapfn [ , thisArg ] ] )
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.from.name, "from");
verifyNotEnumerable(TypedArray.from, "name");
verifyNotWritable(TypedArray.from, "name");
verifyConfigurable(TypedArray.from, "name");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.2.2.2
description: >
%TypedArray%.of.length is 0.
info: >
%TypedArray%.of ( ...items )
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.of.length, 0);
verifyNotEnumerable(TypedArray.of, "length");
verifyNotWritable(TypedArray.of, "length");
verifyConfigurable(TypedArray.of, "length");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.2.2.2
description: >
%TypedArray%.of.name is "of".
info: >
%TypedArray%.of ( ...items )
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.of.name, "of");
verifyNotEnumerable(TypedArray.of, "name");
verifyNotWritable(TypedArray.of, "name");
verifyConfigurable(TypedArray.of, "name");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.2.3.30
description: >
Initial state of the Symbol.iterator property
info: >
The initial value of the @@iterator property is the same function object
as the initial value of the %TypedArray%.prototype.values property.
Per ES6 section 17, the method should exist on the %TypedArray% prototype, and it
should be writable and configurable, but not enumerable.
includes: [propertyHelper.js, testTypedArray.js]
features: [Symbol.iterator]
---*/
assert.sameValue(TypedArray.prototype[Symbol.iterator], TypedArray.prototype.values);
verifyNotEnumerable(TypedArray.prototype, Symbol.iterator);
verifyWritable(TypedArray.prototype, Symbol.iterator);
verifyConfigurable(TypedArray.prototype, Symbol.iterator);
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.2.3.31
description: >
get %TypedArray%.prototype [ @@toStringTag ].length is 0.
info: >
get %TypedArray%.prototype [ @@toStringTag ]
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]
---*/
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, Symbol.toStringTag);
assert.sameValue(desc.get.length, 0);
verifyNotEnumerable(desc.get, "length");
verifyNotWritable(desc.get, "length");
verifyConfigurable(desc.get, "length");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.2.3.31
description: >
get %TypedArray%.prototype [ @@toStringTag ].name is "get [Symbol.toStringTag]".
info: >
get %TypedArray%.prototype [ @@toStringTag ]
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]
features: [Symbol.toStringTag]
---*/
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, Symbol.toStringTag);
assert.sameValue(desc.get.name, "get [Symbol.toStringTag]");
verifyNotEnumerable(desc.get, "name");
verifyNotWritable(desc.get, "name");
verifyConfigurable(desc.get, "name");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.2.3.1
description: >
get %TypedArray%.prototype.buffer.length is 0.
info: >
get %TypedArray%.prototype.buffer
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]
---*/
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "buffer");
assert.sameValue(desc.get.length, 0);
verifyNotEnumerable(desc.get, "length");
verifyNotWritable(desc.get, "length");
verifyConfigurable(desc.get, "length");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.2.3.1
description: >
get %TypedArray%.prototype.buffer.name is "get buffer".
info: >
get %TypedArray%.prototype.buffer
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]
---*/
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "buffer");
assert.sameValue(desc.get.name, "get buffer");
verifyNotEnumerable(desc.get, "name");
verifyNotWritable(desc.get, "name");
verifyConfigurable(desc.get, "name");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.2.3.2
description: >
get %TypedArray%.prototype.byteLength.length is 0.
info: >
get %TypedArray%.prototype.byteLength
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]
---*/
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "byteLength");
assert.sameValue(desc.get.length, 0);
verifyNotEnumerable(desc.get, "length");
verifyNotWritable(desc.get, "length");
verifyConfigurable(desc.get, "length");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.2.3.2
description: >
get %TypedArray%.prototype.byteLength.name is "get byteLength".
info: >
get %TypedArray%.prototype.byteLength
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]
---*/
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "byteLength");
assert.sameValue(desc.get.name, "get byteLength");
verifyNotEnumerable(desc.get, "name");
verifyNotWritable(desc.get, "name");
verifyConfigurable(desc.get, "name");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.2.3.3
description: >
get %TypedArray%.prototype.byteOffset.length is 0.
info: >
get %TypedArray%.prototype.byteOffset
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]
---*/
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "byteOffset");
assert.sameValue(desc.get.length, 0);
verifyNotEnumerable(desc.get, "length");
verifyNotWritable(desc.get, "length");
verifyConfigurable(desc.get, "length");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.2.3.3
description: >
get %TypedArray%.prototype.byteOffset.name is "get byteOffset".
info: >
get %TypedArray%.prototype.byteOffset
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]
---*/
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "byteOffset");
assert.sameValue(desc.get.name, "get byteOffset");
verifyNotEnumerable(desc.get, "name");
verifyNotWritable(desc.get, "name");
verifyConfigurable(desc.get, "name");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.2.3.4
description: >
Initial state of the constructor property
info: >
The initial value of %TypedArray%.prototype.constructor is the %TypedArray% intrinsic object.
Per ES6 section 17, the method should exist on the %TypedArray% prototype, and it
should be writable and configurable, but not enumerable.
includes: [propertyHelper.js, testTypedArray.js]
---*/
assert.sameValue(TypedArray.prototype.constructor, TypedArray);
verifyNotEnumerable(TypedArray.prototype, "constructor");
verifyWritable(TypedArray.prototype, "constructor");
verifyConfigurable(TypedArray.prototype, "constructor");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.2.3.5
description: >
%TypedArray%.prototype.copyWithin.length is 2.
info: >
%TypedArray%.prototype.copyWithin (target, start [, end ] )
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.copyWithin.length, 2);
verifyNotEnumerable(TypedArray.prototype.copyWithin, "length");
verifyNotWritable(TypedArray.prototype.copyWithin, "length");
verifyConfigurable(TypedArray.prototype.copyWithin, "length");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.2.3.5
description: >
%TypedArray%.prototype.copyWithin.name is "copyWithin".
info: >
%TypedArray%.prototype.copyWithin (target, start [, end ] )
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.copyWithin.name, "copyWithin");
verifyNotEnumerable(TypedArray.prototype.copyWithin, "name");
verifyNotWritable(TypedArray.prototype.copyWithin, "name");
verifyConfigurable(TypedArray.prototype.copyWithin, "name");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.2.3.6
description: >
%TypedArray%.prototype.entries.length is 0.
info: >
%TypedArray%.prototype.entries ( )
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.entries.length, 0);
verifyNotEnumerable(TypedArray.prototype.entries, "length");
verifyNotWritable(TypedArray.prototype.entries, "length");
verifyConfigurable(TypedArray.prototype.entries, "length");
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment