js/src/tests/test262/ch08/8.7/S8.7_A3.js

branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
equal deleted inserted replaced
-1:000000000000 0:f2858d80def7
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /**
5 * Changing the Reference of an Object While Maintaining Integrity
6 *
7 * @path ch08/8.7/S8.7_A3.js
8 * @description Create a reference to the array, and redefine original array with new array
9 */
10
11 //////////////////////////////////////////////////////////////////////////////
12 //CHECK#
13 // Set items to an array (object) of strings
14 var items = new Array( "one", "two", "three" );
15 // Set itemsRef to a reference to items
16 //
17 var itemsRef = items;
18 // Set items to equal a new object
19 //
20 items = new Array( "new", "array" );
21 // items and itemsRef now point to different objects.
22 // items points to new Array( "new", "array" )
23 // itemsRef points to new Array( "one", "two", "three" )
24 if( items == itemsRef ){
25 $ERROR('#1: var items = new Array( "one", "two", "three" ); var itemsRef = items; items = new Array( "new", "array" ); items != itemsRef');
26 };
27 //
28 //////////////////////////////////////////////////////////////////////////////
29

mercurial