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
47faa3ec
Commit
47faa3ec
authored
9 years ago
by
Leonardo Balter
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for Subclassing the built-in Boolean Object
parent
1bcc0569
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/Boolean/regular-subclassing.js
+23
-0
23 additions, 0 deletions
test/language/subclassing/Boolean/regular-subclassing.js
test/language/subclassing/Boolean/super-must-be-called.js
+31
-0
31 additions, 0 deletions
test/language/subclassing/Boolean/super-must-be-called.js
with
54 additions
and
0 deletions
test/language/subclassing/Boolean/regular-subclassing.js
0 → 100644
+
23
−
0
View file @
47faa3ec
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.3.1
description: Subclassing Function
info: >
19.3.1 The Boolean Constructor
The Boolean constructor is designed to be subclassable. It may be used as the
value of an extends clause of a class definition.
...
---*/
class
Bln
extends
Boolean
{}
var
b1
=
new
Bln
(
1
);
assert
.
notSameValue
(
b1
,
true
,
'
b1 is an Boolean object
'
);
assert
.
sameValue
(
b1
.
valueOf
(),
true
);
var
b2
=
new
Bln
(
0
);
assert
.
notSameValue
(
b2
,
false
,
'
bln is an Boolean object
'
);
assert
.
sameValue
(
b2
.
valueOf
(),
false
);
This diff is collapsed.
Click to expand it.
test/language/subclassing/Boolean/super-must-be-called.js
0 → 100644
+
31
−
0
View file @
47faa3ec
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.3.1
description: Super need to be called to initialize Boolean internals
info: >
19.3.1 The Boolean Constructor
...
Subclass constructors that intend to inherit the specified Boolean behaviour
must include a super call to the Boolean constructor to create and initialize
the subclass instance with a [[BooleanData]] internal slot.
---*/
class
Bln
extends
Boolean
{
constructor
()
{}
}
// Boolean internals are not initialized
assert
.
throws
(
ReferenceError
,
function
()
{
new
Bln
(
1
);
});
class
Bln2
extends
Boolean
{
constructor
()
{
super
();
}
}
var
b
=
new
Bln2
(
1
);
assert
(
b
instanceof
Boolean
);
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