tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

S15.3.2.1_A2_T6.js (878B)


      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_T6
      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, p), "1arg4", 'f(, 1, {toString: function() {return "arg" + (++i)}}) must return "1arg4"');
     30 
     31 reportCompare(0, 0);