Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | |
michael@0 | 7 | /** |
michael@0 | 8 | File Name: 15.1.2.1-1.js |
michael@0 | 9 | ECMA Section: 15.1.2.1 eval(x) |
michael@0 | 10 | |
michael@0 | 11 | if x is not a string object, return x. |
michael@0 | 12 | Description: |
michael@0 | 13 | Author: christine@netscape.com |
michael@0 | 14 | Date: 16 september 1997 |
michael@0 | 15 | */ |
michael@0 | 16 | var SECTION = "15.1.2.1-1"; |
michael@0 | 17 | var VERSION = "ECMA_1"; |
michael@0 | 18 | var TITLE = "eval(x)"; |
michael@0 | 19 | var BUGNUMBER = "none"; |
michael@0 | 20 | |
michael@0 | 21 | startTest(); |
michael@0 | 22 | |
michael@0 | 23 | writeHeaderToLog( SECTION + " "+ TITLE); |
michael@0 | 24 | |
michael@0 | 25 | new TestCase( SECTION, "eval.length", 1, eval.length ); |
michael@0 | 26 | new TestCase( SECTION, "delete eval.length", false, delete eval.length ); |
michael@0 | 27 | new TestCase( SECTION, "var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS", "", eval("var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS") ); |
michael@0 | 28 | new TestCase( SECTION, "eval.length = null; eval.length", 1, eval( "eval.length = null; eval.length") ); |
michael@0 | 29 | // new TestCase( SECTION, "eval.__proto__", Function.prototype, eval.__proto__ ); |
michael@0 | 30 | |
michael@0 | 31 | // test cases where argument is not a string. should return the argument. |
michael@0 | 32 | |
michael@0 | 33 | new TestCase( SECTION, "eval()", void 0, eval() ); |
michael@0 | 34 | new TestCase( SECTION, "eval(void 0)", void 0, eval( void 0) ); |
michael@0 | 35 | new TestCase( SECTION, "eval(null)", null, eval( null ) ); |
michael@0 | 36 | new TestCase( SECTION, "eval(true)", true, eval( true ) ); |
michael@0 | 37 | new TestCase( SECTION, "eval(false)", false, eval( false ) ); |
michael@0 | 38 | |
michael@0 | 39 | new TestCase( SECTION, "typeof eval(new String('Infinity/-0')", "object", typeof eval(new String('Infinity/-0')) ); |
michael@0 | 40 | |
michael@0 | 41 | 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 | 42 | new TestCase( SECTION, "eval(new Array(0,1,2,3)", "1,2,3", ""+ eval(new Array(1,2,3)) ); |
michael@0 | 43 | new TestCase( SECTION, "eval(1)", 1, eval(1) ); |
michael@0 | 44 | new TestCase( SECTION, "eval(0)", 0, eval(0) ); |
michael@0 | 45 | new TestCase( SECTION, "eval(-1)", -1, eval(-1) ); |
michael@0 | 46 | new TestCase( SECTION, "eval(Number.NaN)", Number.NaN, eval(Number.NaN) ); |
michael@0 | 47 | new TestCase( SECTION, "eval(Number.MIN_VALUE)", 5e-308, eval(Number.MIN_VALUE) ); |
michael@0 | 48 | new TestCase( SECTION, "eval(-Number.MIN_VALUE)", -5e-308, eval(-Number.MIN_VALUE) ); |
michael@0 | 49 | new TestCase( SECTION, "eval(Number.POSITIVE_INFINITY)", Number.POSITIVE_INFINITY, eval(Number.POSITIVE_INFINITY) ); |
michael@0 | 50 | new TestCase( SECTION, "eval(Number.NEGATIVE_INFINITY)", Number.NEGATIVE_INFINITY, eval(Number.NEGATIVE_INFINITY) ); |
michael@0 | 51 | new TestCase( SECTION, "eval( 4294967296 )", 4294967296, eval(4294967296) ); |
michael@0 | 52 | new TestCase( SECTION, "eval( 2147483648 )", 2147483648, eval(2147483648) ); |
michael@0 | 53 | |
michael@0 | 54 | test(); |