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

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     1 // Copyright 2009 the Sputnik authors.  All rights reserved.
     2 // This code is governed by the BSD license found in the LICENSE file.
     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  */
    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 //////////////////////////////////////////////////////////////////////////////

mercurial