Debian Codegraph @

js/src/tests/test262/built-ins/Function/S15.3.2.1_A2_T4.js

raw
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 info: |
6 It is permissible but not necessary to have one argument for each formal
7 parameter to be specified
8 es5id: 15.3.2.1_A2_T4
9 description: >
10 Values of the function constructor arguments are "return"-s of
11 various results
12 ---*/
13
14 var i = 0;
15
16 var p = {
17 toString: function() {
18 return "arg" + (++i);
19 }
20 };
21
22 try {
23 var f = Function(p, p, p, "return arg1+arg2+arg3;");
24 } catch (e) {
25 throw new Test262Error('#1: test failed');
26 }
27
28 assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true');
29 assert.sameValue(f(4, "2", "QUESTION"), "42QUESTION", 'f(4, 2, QUESTION) must return "42QUESTION"');
30
31 reportCompare(0, 0);