Debian Codegraph @

js/src/tests/test262/built-ins/Reflect/construct/use-arguments-list.js

raw
1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 es6id: 26.1.2
5 description: >
6 Construct with given argumentsList
7 info: |
8 26.1.2 Reflect.construct ( target, argumentsList [, newTarget] )
9
10 ...
11 2. If newTarget is not present, let newTarget be target.
12 ...
13 6. Return Construct(target, args, newTarget).
14 features: [Reflect, Reflect.construct]
15 ---*/
16
17 function fn() {
18 this.args = arguments;
19 }
20
21 var result = Reflect.construct(fn, [42, 'Mike', 'Leo']);
22
23 assert.sameValue(result.args.length, 3, 'result.args.length');
24 assert.sameValue(result.args[0], 42);
25 assert.sameValue(result.args[1], 'Mike');
26 assert.sameValue(result.args[2], 'Leo');
27
28 reportCompare(0, 0);