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
d30e98df
Commit
d30e98df
authored
9 years ago
by
Leonardo Balter
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for Subclassing the built-in Promise Objects
parent
85ee704a
No related branches found
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/Promise/regular-subclassing.js
+34
-0
34 additions, 0 deletions
test/language/subclassing/Promise/regular-subclassing.js
test/language/subclassing/Promise/super-must-be-called.js
+33
-0
33 additions, 0 deletions
test/language/subclassing/Promise/super-must-be-called.js
with
67 additions
and
0 deletions
test/language/subclassing/Promise/regular-subclassing.js
0 → 100644
+
34
−
0
View file @
d30e98df
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 25.4.3
description: Subclassing the Promise object
info: >
25.4.3 The Promise Constructor
...
The Promise constructor is designed to be subclassable. It may be used as the
value in an extends clause of a class definition. Subclass constructors that
intend to inherit the specified Promise behaviour must include a super call
to the Promise constructor to create and initialize the subclass instance with
the internal state necessary to support the Promise and Promise.prototype
built-in methods.
---*/
class
Prom
extends
Promise
{}
assert
.
throws
(
TypeError
,
function
()
{
new
Prom
();
});
var
calledExecutor
=
false
;
var
prom1
=
new
Prom
(
function
(
resolve
)
{
calledExecutor
=
true
;
assert
.
sameValue
(
arguments
.
length
,
2
);
assert
(
arguments
[
0
]
===
Promise
.
resolve
);
assert
(
arguments
[
1
]
===
Promise
.
reject
);
});
assert
(
calledExecutor
);
This diff is collapsed.
Click to expand it.
test/language/subclassing/Promise/super-must-be-called.js
0 → 100644
+
33
−
0
View file @
d30e98df
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 25.4.3
description: Super need to be called to initialize internals
info: >
25.4.3 The Promise Constructor
...
The Promise constructor is designed to be subclassable. It may be used as the
value in an extends clause of a class definition. Subclass constructors that
intend to inherit the specified Promise behaviour must include a super call
to the Promise constructor to create and initialize the subclass instance with
the internal state necessary to support the Promise and Promise.prototype
built-in methods.
---*/
class
Prom1
extends
Promise
{
constructor
()
{}
}
assert
.
throws
(
ReferenceError
,
function
()
{
new
Prom1
();
});
class
Prom2
extends
Promise
{
constructor
(
exec
)
{
super
(
exec
);
}
}
new
Prom2
(
function
()
{});
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