summaryrefslogtreecommitdiff
path: root/test/built-ins/Reflect/construct/use-arguments-list.js
blob: fd4a2f63628aca4410bfc0e25c7867bfb0f9b44f (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
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 26.1.2
description: >
  Construct with given argumentsList
info: |
  26.1.2 Reflect.construct ( target, argumentsList [, newTarget] )

  ...
  2. If newTarget is not present, let newTarget be target.
  ...
  6. Return Construct(target, args, newTarget).
---*/

function fn() {
  this.args = arguments;
}

var result = Reflect.construct(fn, [42, 'Mike', 'Leo']);

assert.sameValue(result.args.length, 3, 'result.args.length');
assert.sameValue(result.args[0], 42);
assert.sameValue(result.args[1], 'Mike');
assert.sameValue(result.args[2], 'Leo');