js/src/tests/test262/ch13/13.2/S13.2.2_A6_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_A6_T2.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,41 @@
     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 not Object then return passed as this into [[Call]] object
    1.13 + *
    1.14 + * @path ch13/13.2/S13.2.2_A6_T2.js
    1.15 + * @description Declaring a function with "function __func (arg)"
    1.16 + */
    1.17 +
    1.18 +var __FOO="fooValue";
    1.19 +var __BAR="barValue";
    1.20 +
    1.21 +function __func (arg){
    1.22 +	this.foo=arg;
    1.23 +    return true;
    1.24 +	this.bar=arguments[1];
    1.25 +};
    1.26 +
    1.27 +var __obj = new __func(__FOO, __BAR);
    1.28 +
    1.29 +//////////////////////////////////////////////////////////////////////////////
    1.30 +//CHECK#1
    1.31 +if (__obj.foo!==__FOO) {
    1.32 +	$ERROR('#1: __obj.foo === __FOO. Actual: __obj.foo==='+__obj.foo);
    1.33 +}
    1.34 +//
    1.35 +//////////////////////////////////////////////////////////////////////////////
    1.36 +
    1.37 +//////////////////////////////////////////////////////////////////////////////
    1.38 +//CHECK#2
    1.39 +if (__obj.bar!==undefined) {
    1.40 +	$ERROR('#2: __obj.bar === undefined. Actual: __obj.bar==='+__obj.bar);
    1.41 +}
    1.42 +//
    1.43 +//////////////////////////////////////////////////////////////////////////////
    1.44 +

mercurial