non-string-primitive.js (873B)
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_T1 7 description: Checking all primitive 8 ---*/ 9 10 //CHECK#1 11 var x = 1; 12 if (eval(x) !== x) { 13 throw new Test262Error('#1: x = 1; eval(x) === x. Actual: ' + (eval(x))); 14 } 15 16 //CHECK#2 17 if (eval(1) !== 1) { 18 throw new Test262Error('#2: eval(1) === 1. Actual: ' + (eval(1))); 19 } 20 21 //CHECK#3 22 if (eval(true) !== true) { 23 throw new Test262Error('#3: eval(true) === true. Actual: ' + (eval(true))); 24 } 25 26 //CHECK#4 27 if (eval(null) !== null) { 28 throw new Test262Error('#4: eval(null) === null. Actual: ' + (eval(null))); 29 } 30 31 //CHECK#5 32 if (eval(undefined) !== undefined) { 33 throw new Test262Error('#5: eval(undefined) === undefined. Actual: ' + (eval(undefined))); 34 } 35 36 reportCompare(0, 0);