1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/test262/ch08/8.7/S8.7_A4.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,28 @@ 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 + * Object Modification Resulting in a New Object for Not a Self-Modified Object leads to loss of integrity 1.9 + * 1.10 + * @path ch08/8.7/S8.7_A4.js 1.11 + * @description Create a reference to the string, and Concatenate some new text onto the string object 1.12 + */ 1.13 + 1.14 +////////////////////////////////////////////////////////////////////////////// 1.15 +//CHECK# 1.16 +// Set item equal to a new string object 1.17 +var item = new String("test"); 1.18 +// itemRef now refers to the same string object 1.19 +var itemRef = item; 1.20 +// Concatenate some new text onto the string object 1.21 +// NOTE: This creates a new object, and does not modify 1.22 +// the original object. 1.23 +item += "ing"; 1.24 +// The values of item and itemRef are NOT equal, as a whole 1.25 +// new string object has been created 1.26 +if( item == itemRef ){ 1.27 + $ERROR('#1: var item = new String("test"); var itemRef = item; item += "ing"; item != itemRef'); 1.28 +}; 1.29 +// 1.30 +////////////////////////////////////////////////////////////////////////////// 1.31 +