1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/test262/ch08/8.7/S8.7_A1.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,30 @@ 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 + * Multiple Variables should Referring to a Single Object 1.9 + * 1.10 + * @path ch08/8.7/S8.7_A1.js 1.11 + * @description Create object and refers to the other object, modify a property in the original object. 1.12 + * We now see that that change is represented in both variables 1.13 + */ 1.14 + 1.15 +////////////////////////////////////////////////////////////////////////////// 1.16 +//CHECK# 1.17 +// Set obj to an empty object 1.18 +// 1.19 +var obj = new Object(); 1.20 +// objRef now refers to the other object 1.21 +// 1.22 +var objRef = obj; 1.23 +// Modify a property in the original object 1.24 +objRef.oneProperty = -1; 1.25 +obj.oneProperty = true; 1.26 +// We now see that that change is represented in both variables 1.27 +// (Since they both refer to the same object) 1.28 +if(objRef.oneProperty !== true){ 1.29 + $ERROR('#1: var obj = new Object(); var objRef = obj; objRef.oneProperty = -1; obj.oneProperty = true; objRef.oneProperty === true. Actual: ' + (objRef.oneProperty)); 1.30 +}; 1.31 +// 1.32 +////////////////////////////////////////////////////////////////////////////// 1.33 +