js/src/tests/test262/ch13/13.2/S13.2.2_A15_T3.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_A15_T3.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,45 @@
     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 + * and the object created in the function is returned, the object (declared with "this" within a function) will be strong and healthy
    1.10 + *
    1.11 + * @path ch13/13.2/S13.2.2_A15_T3.js
    1.12 + * @description Function declared at the end of the program and "obj" property is declared with "var obj = {}"
    1.13 + */
    1.14 +
    1.15 +__FACTORY = function (){
    1.16 +    this.prop = 1;
    1.17 +    var obj = {};
    1.18 +    obj.prop = "A";
    1.19 +    obj.slot = this;
    1.20 +    return obj;
    1.21 +}
    1.22 +
    1.23 +__obj = new __FACTORY();
    1.24 +
    1.25 +//////////////////////////////////////////////////////////////////////////////
    1.26 +//CHECK#1
    1.27 +if (typeof obj !== "undefined") {
    1.28 +	$ERROR('#1: typeof obj === "undefined". Actual: typeof obj ==='+typeof obj);
    1.29 +}
    1.30 +//
    1.31 +//////////////////////////////////////////////////////////////////////////////
    1.32 +
    1.33 +//////////////////////////////////////////////////////////////////////////////
    1.34 +//CHECK#2
    1.35 +if (__obj.prop !== "A") {
    1.36 +	$ERROR('#2: __obj.prop === "A". Actual: __obj.prop ==='+__obj.prop);
    1.37 +}
    1.38 +//
    1.39 +//////////////////////////////////////////////////////////////////////////////
    1.40 +
    1.41 +//////////////////////////////////////////////////////////////////////////////
    1.42 +//CHECK#3
    1.43 +if (__obj.slot.prop !==1) {
    1.44 +	$ERROR('#3: __obj.slot.prop ===1. Actual: __obj.slot.prop ==='+__obj.slot.prop);
    1.45 +}
    1.46 +//
    1.47 +//////////////////////////////////////////////////////////////////////////////
    1.48 +

mercurial