mirror of
https://github.com/tc39/test262.git
synced 2025-07-01 03:04:42 +02:00
Add Object subclass test (#2177)
This commit is contained in:
parent
079b004ac4
commit
430ee14d90
24
test/built-ins/Object/subclass-object-arg.js
Normal file
24
test/built-ins/Object/subclass-object-arg.js
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-object-value
|
||||||
|
author: Matthew Phillips <matthew@matthewphillips.info>
|
||||||
|
description: >
|
||||||
|
NewTarget is active function and subclass of Object
|
||||||
|
info: |
|
||||||
|
Object ( [ value ] )
|
||||||
|
|
||||||
|
1. If NewTarget is neither undefined nor the active function, then
|
||||||
|
a. Return ? OrdinaryCreateFromConstructor(NewTarget, "%ObjectPrototype%").
|
||||||
|
[...]
|
||||||
|
3. Return ! ToObject(value).
|
||||||
|
features: [class, Reflect, Reflect.construct]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
class O extends Object {}
|
||||||
|
|
||||||
|
var o1 = new O({a: 1});
|
||||||
|
var o2 = Reflect.construct(Object, [{b: 2}], O);
|
||||||
|
|
||||||
|
assert.sameValue(o1.a, 1);
|
||||||
|
assert.sameValue(o2.b, 2);
|
Loading…
x
Reference in New Issue
Block a user