Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
test262
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pmaksimo
test262
Commits
6fdf6dd7
Commit
6fdf6dd7
authored
9 years ago
by
Leonardo Balter
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for Subclassing the built-in TypedArray Objects
parent
27764aa3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/language/subclassing/TypedArray/regular-subclassing.js
+35
-0
35 additions, 0 deletions
test/language/subclassing/TypedArray/regular-subclassing.js
test/language/subclassing/TypedArray/super-must-be-called.js
+45
-0
45 additions, 0 deletions
test/language/subclassing/TypedArray/super-must-be-called.js
with
80 additions
and
0 deletions
test/language/subclassing/TypedArray/regular-subclassing.js
0 → 100644
+
35
−
0
View file @
6fdf6dd7
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.2.4
description: Subclassing TypedArrays
info: >
22.2.4 The TypedArray Constructors
...
The TypedArray constructors are designed to be subclassable. They may be used
as the value of an extends clause of a class definition. Subclass constructors
that intend to inherit the specified TypedArray behaviour must include a super
call to the TypedArray constructor to create and initialize the subclass
instance with the internal state necessary to support the
%TypedArray%.prototype built-in methods.
---*/
[
Int8Array
,
Uint8Array
,
Uint8ClampedArray
,
Int16Array
,
Uint16Array
,
Int32Array
,
Uint32Array
,
Float32Array
,
Float64Array
].
forEach
(
function
(
Constructor
)
{
class
Typed
extends
Constructor
{}
var
arr
=
new
Typed
(
2
);
assert
.
sameValue
(
arr
.
length
,
2
);
});
This diff is collapsed.
Click to expand it.
test/language/subclassing/TypedArray/super-must-be-called.js
0 → 100644
+
45
−
0
View file @
6fdf6dd7
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.2.4
description: Super need to be called to initialize internals
info: >
22.2.4 The TypedArray Constructors
...
The TypedArray constructors are designed to be subclassable. They may be used
as the value of an extends clause of a class definition. Subclass constructors
that intend to inherit the specified TypedArray behaviour must include a super
call to the TypedArray constructor to create and initialize the subclass
instance with the internal state necessary to support the
%TypedArray%.prototype built-in methods.
---*/
[
Int8Array
,
Uint8Array
,
Uint8ClampedArray
,
Int16Array
,
Uint16Array
,
Int32Array
,
Uint32Array
,
Float32Array
,
Float64Array
].
forEach
(
function
(
Constructor
)
{
class
Typed
extends
Constructor
{
constructor
()
{}
}
assert
.
throws
(
ReferenceError
,
function
()
{
new
Typed
();
});
class
TypedWithSuper
extends
Constructor
{
constructor
()
{
super
();
}
}
new
TypedWithSuper
();
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment