michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: /** michael@0: File Name: 15.1.2.1-1.js michael@0: ECMA Section: 15.1.2.1 eval(x) michael@0: michael@0: if x is not a string object, return x. michael@0: Description: michael@0: Author: christine@netscape.com michael@0: Date: 16 september 1997 michael@0: */ michael@0: var SECTION = "15.1.2.1-1"; michael@0: var VERSION = "ECMA_1"; michael@0: var TITLE = "eval(x)"; michael@0: var BUGNUMBER = "none"; michael@0: michael@0: startTest(); michael@0: michael@0: writeHeaderToLog( SECTION + " "+ TITLE); michael@0: michael@0: new TestCase( SECTION, "eval.length", 1, eval.length ); michael@0: new TestCase( SECTION, "delete eval.length", false, delete eval.length ); michael@0: new TestCase( SECTION, "var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS", "", eval("var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS") ); michael@0: new TestCase( SECTION, "eval.length = null; eval.length", 1, eval( "eval.length = null; eval.length") ); michael@0: // new TestCase( SECTION, "eval.__proto__", Function.prototype, eval.__proto__ ); michael@0: michael@0: // test cases where argument is not a string. should return the argument. michael@0: michael@0: new TestCase( SECTION, "eval()", void 0, eval() ); michael@0: new TestCase( SECTION, "eval(void 0)", void 0, eval( void 0) ); michael@0: new TestCase( SECTION, "eval(null)", null, eval( null ) ); michael@0: new TestCase( SECTION, "eval(true)", true, eval( true ) ); michael@0: new TestCase( SECTION, "eval(false)", false, eval( false ) ); michael@0: michael@0: new TestCase( SECTION, "typeof eval(new String('Infinity/-0')", "object", typeof eval(new String('Infinity/-0')) ); michael@0: michael@0: new TestCase( SECTION, "eval([1,2,3,4,5,6])", "1,2,3,4,5,6", ""+eval([1,2,3,4,5,6]) ); michael@0: new TestCase( SECTION, "eval(new Array(0,1,2,3)", "1,2,3", ""+ eval(new Array(1,2,3)) ); michael@0: new TestCase( SECTION, "eval(1)", 1, eval(1) ); michael@0: new TestCase( SECTION, "eval(0)", 0, eval(0) ); michael@0: new TestCase( SECTION, "eval(-1)", -1, eval(-1) ); michael@0: new TestCase( SECTION, "eval(Number.NaN)", Number.NaN, eval(Number.NaN) ); michael@0: new TestCase( SECTION, "eval(Number.MIN_VALUE)", 5e-308, eval(Number.MIN_VALUE) ); michael@0: new TestCase( SECTION, "eval(-Number.MIN_VALUE)", -5e-308, eval(-Number.MIN_VALUE) ); michael@0: new TestCase( SECTION, "eval(Number.POSITIVE_INFINITY)", Number.POSITIVE_INFINITY, eval(Number.POSITIVE_INFINITY) ); michael@0: new TestCase( SECTION, "eval(Number.NEGATIVE_INFINITY)", Number.NEGATIVE_INFINITY, eval(Number.NEGATIVE_INFINITY) ); michael@0: new TestCase( SECTION, "eval( 4294967296 )", 4294967296, eval(4294967296) ); michael@0: new TestCase( SECTION, "eval( 2147483648 )", 2147483648, eval(2147483648) ); michael@0: michael@0: test();