S13_A4_T4.js (2075B)
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 The production FunctionDeclaration: "function Identifier ( 7 FormalParameterList_opt ) { FunctionBody }" is processed by function 8 declarations 9 es5id: 13_A4_T4 10 description: > 11 Declaring a function that uses strings concatenaion opeator within 12 its "return" Expression 13 ---*/ 14 15 function __func(){return arguments[0].name + " " + arguments[0].surname;}; 16 17 ////////////////////////////////////////////////////////////////////////////// 18 //CHECK#1 19 if (typeof __func !== "function") { 20 throw new Test262Error('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func); 21 } 22 // 23 ////////////////////////////////////////////////////////////////////////////// 24 25 ////////////////////////////////////////////////////////////////////////////// 26 //CHECK#2 27 if (__func({name:'fox', surname:'malder'}) !== "fox malder") { 28 throw new Test262Error('#2: __func({name:\'fox\', surname:\'malder\'}) === "fox malder". Actual: __func({name:\'fox\', surname:\'malder\'}) ==='+__func({name:'fox', surname:'malder'})); 29 } 30 // 31 ////////////////////////////////////////////////////////////////////////////// 32 33 function func__(arg){return arg.name + " " + arg.surname;}; 34 35 ////////////////////////////////////////////////////////////////////////////// 36 //CHECK#3 37 if (typeof func__ !== "function") { 38 throw new Test262Error('#3: typeof func__ === "function". Actual: typeof __func ==='+typeof __func); 39 } 40 // 41 ////////////////////////////////////////////////////////////////////////////// 42 43 ////////////////////////////////////////////////////////////////////////////// 44 //CHECK#4 45 if (func__({name:'john', surname:'lennon'}) !== "john lennon") { 46 throw new Test262Error('#4: func__({name:\'john\', surname:\'lennon\'}) === "john lennon". Actual: __func({name:\'john\', surname:\'lennon\'}) ==='+__func({name:'john', surname:'lennon'})); 47 } 48 // 49 ////////////////////////////////////////////////////////////////////////////// 50 51 reportCompare(0, 0);