1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/test262/ch13/13.2/S13.2.2_A8_T1.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,54 @@ 1.4 +// Copyright 2009 the Sputnik authors. All rights reserved. 1.5 +// This code is governed by the BSD license found in the LICENSE file. 1.6 + 1.7 +/** 1.8 + * When the [[Construct]] property for a Function object F is called: 1.9 + * A new native ECMAScript object is created. 1.10 + * Invoke the [[Call]] property of F, providing just created native ECMAScript object as the this value and providing the argument 1.11 + * list passed into [[Construct]] as the argument values. 1.12 + * If Type( [[Call]] returned) is an Function then return this just as obtained function 1.13 + * 1.14 + * @path ch13/13.2/S13.2.2_A8_T1.js 1.15 + * @description Creating a function whose prototype contains "return" followed by declaration of another function 1.16 + */ 1.17 + 1.18 +var __FRST="one"; 1.19 +var __SCND="two"; 1.20 + 1.21 +var __func = function(arg1, arg2){ 1.22 + this.first=arg1; 1.23 + 1.24 + __gunc.prop=arg2; 1.25 + return __gunc; 1.26 + // function declaration 1.27 + function __gunc(arg){return ++arg}; 1.28 + 1.29 +}; 1.30 + 1.31 +var __instance = new __func(__FRST, __SCND); 1.32 + 1.33 +////////////////////////////////////////////////////////////////////////////// 1.34 +//CHECK#1 1.35 +if (__instance.first !== undefined) { 1.36 + $ERROR('#1: __instance.first === undefined. Actual: __instance.first ==='+__instance.first); 1.37 +} 1.38 +// 1.39 +////////////////////////////////////////////////////////////////////////////// 1.40 + 1.41 +////////////////////////////////////////////////////////////////////////////// 1.42 +//CHECK#2 1.43 +if (__instance.prop!==__SCND) { 1.44 + $ERROR('#2: __instance.prop === __SCND. Actual: __instance.prop ==='+__instance.prop); 1.45 +} 1.46 +// 1.47 +////////////////////////////////////////////////////////////////////////////// 1.48 + 1.49 +////////////////////////////////////////////////////////////////////////////// 1.50 +//CHECK#3 1.51 +if (__instance(1)!== 2) { 1.52 + $ERROR('#2: __instance(1)=== 2. Actual: __instance(1) ==='+__instance(1)); 1.53 +} 1.54 +// 1.55 +////////////////////////////////////////////////////////////////////////////// 1.56 + 1.57 +