summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Object/subclass-object-arg.js
blob: e4eab7b92e27e631bc4a067a8f7af4612430e31d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// 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%").
  [...]
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, undefined);
assert.sameValue(o2.b, undefined);

assert.sameValue(Object.getPrototypeOf(o1), O.prototype);
assert.sameValue(Object.getPrototypeOf(o2), O.prototype);

reportCompare(0, 0);