non-string-object.js (827B)
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 info: If x is not a string value, return x 6 es5id: 15.1.2.1_A1.1_T2 7 description: Checking all object 8 ---*/ 9 10 //CHECK#1 11 var x = {}; 12 if (eval(x) !== x) { 13 throw new Test262Error('#1: x = {}; eval(x) === x. Actual: ' + (eval(x))); 14 } 15 16 //CHECK#2 17 x = new Number(1); 18 if (eval(x) !== x) { 19 throw new Test262Error('#2: x = new Number(1); eval(x) === x. Actual: ' + (eval(x))); 20 } 21 22 //CHECK#3 23 x = new Boolean(true); 24 if (eval(x) !== x) { 25 throw new Test262Error('#3: x = new Boolean(true); eval(x) === x. Actual: ' + (eval(x))); 26 } 27 28 //CHECK#4 29 x = new String("1+1"); 30 if (eval(x) !== x) { 31 throw new Test262Error('#4: x = new String("1"); eval(x) === x. Actual: ' + (eval(x))); 32 } 33 34 reportCompare(0, 0);