js/src/tests/test262/ch13/13.2/S13.2.2_A8_T2.js

changeset 0
6474c204b198
     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_T2.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,52 @@
     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_T2.js
    1.15 + * @description Creating a function whose prototype contains declaration of another function declared as a variable
    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 +	var __gunc = function(arg){return arg+="BA"};
    1.24 +	__gunc.prop=arg2;
    1.25 +    return __gunc;
    1.26 +	
    1.27 +};
    1.28 +
    1.29 +var __instance = new __func(__FRST, __SCND);
    1.30 +
    1.31 +//////////////////////////////////////////////////////////////////////////////
    1.32 +//CHECK#1
    1.33 +if (__instance.first !== undefined) {
    1.34 +	$ERROR('#1: __instance.first === undefined. Actual: __instance.first ==='+__instance.first);
    1.35 +}
    1.36 +//
    1.37 +//////////////////////////////////////////////////////////////////////////////
    1.38 +
    1.39 +//////////////////////////////////////////////////////////////////////////////
    1.40 +//CHECK#2
    1.41 +if (__instance.prop!==__SCND) {
    1.42 +	$ERROR('#2: __instance.prop === __SCND. Actual: __instance.prop ==='+__instance.prop);
    1.43 +}
    1.44 +//
    1.45 +//////////////////////////////////////////////////////////////////////////////
    1.46 +
    1.47 +//////////////////////////////////////////////////////////////////////////////
    1.48 +//CHECK#3
    1.49 +if (__instance("SAM")!== "SAMBA") {
    1.50 +	$ERROR('#2: __instance("SAM") === "SAMBA". Actual: __instance("SAM") ==='+__instance("SAM"));
    1.51 +}
    1.52 +//
    1.53 +//////////////////////////////////////////////////////////////////////////////
    1.54 +
    1.55 +

mercurial