Debian Codegraph @

js/src/tests/test262/built-ins/Function/S15.3.2.1_A2_T5.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_T5
9 description: >
10 Values of the function constructor arguments are "return"-s of
11 various results and a concotenation of strings
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("", 1, 2), "12", 'f(, 1, 2) must return "12"');
30
31 reportCompare(0, 0);