michael@0: // Copyright 2009 the Sputnik authors. All rights reserved. michael@0: // This code is governed by the BSD license found in the LICENSE file. michael@0: michael@0: /** michael@0: * Assignment to string literals calls String constructor michael@0: * michael@0: * @path ch08/8.4/S8.4_A9_T2.js michael@0: * @description Compare empty string variable, object String('') and object String() michael@0: */ michael@0: michael@0: var str=""; michael@0: var strObj=new String(""); michael@0: var strObj_=new String(); michael@0: michael@0: //////////////////////////////////////////////////////////// michael@0: // CHECK#1 michael@0: if (str.constructor !== strObj.constructor){ michael@0: $ERROR('#1: "".constructor === new String("").constructor'); michael@0: } michael@0: // michael@0: ///////////////////////////////////////////////////////////// michael@0: michael@0: //////////////////////////////////////////////////////////// michael@0: // CHECK#2 michael@0: if (str.constructor !== strObj_.constructor){ michael@0: $ERROR('#2: "".constructor === new String().constructor'); michael@0: } michael@0: // michael@0: ///////////////////////////////////////////////////////////// michael@0: michael@0: //////////////////////////////////////////////////////////// michael@0: // CHECK#3 michael@0: if (str != strObj){ michael@0: $ERROR('#3: values of str=""; and strObj=new String(""); are equal'); michael@0: } michael@0: // michael@0: ///////////////////////////////////////////////////////////// michael@0: michael@0: //////////////////////////////////////////////////////////// michael@0: // CHECK#4 michael@0: if (str === strObj){ michael@0: $ERROR('#4: objects of str=""; and strObj=new String(""); are different'); michael@0: } michael@0: // michael@0: ///////////////////////////////////////////////////////////// michael@0: michael@0: //////////////////////////////////////////////////////////// michael@0: // CHECK#5 michael@0: if (str != strObj_){ michael@0: $ERROR('#5: values of str=""; and strObj=new String(); are equal'); michael@0: } michael@0: // michael@0: ///////////////////////////////////////////////////////////// michael@0: michael@0: //////////////////////////////////////////////////////////// michael@0: // CHECK#6 michael@0: if (str === strObj_){ michael@0: $ERROR('#6: objects of str=""; and strObj=new String(); are different'); michael@0: } michael@0: // michael@0: ///////////////////////////////////////////////////////////// michael@0: