js/src/tests/ecma/Boolean/15.6.1.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 /**
     8    File Name:      15.6.1.js
     9    ECMA Section:   15.6.1 The Boolean Function
    10    15.6.1.1 Boolean( value )
    11    15.6.1.2 Boolean ()
    12    Description:    Boolean( value ) should return a Boolean value
    13    not a Boolean object) computed by
    14    Boolean.toBooleanValue( value)
    16    15.6.1.2 Boolean() returns false
    18    Author:         christine@netscape.com
    19    Date:           27 jun 1997
    22    Data File Fields:
    23    VALUE       Argument passed to the Boolean function
    24    TYPE        typeof VALUE (not used, but helpful in understanding
    25    the data file)
    26    E_RETURN    Expected return value of Boolean( VALUE )
    27 */
    28 var SECTION = "15.6.1";
    29 var VERSION = "ECMA_1";
    30 startTest();
    31 var TITLE   = "The Boolean constructor called as a function: Boolean( value ) and Boolean()";
    33 writeHeaderToLog( SECTION + " "+ TITLE);
    35 var array = new Array();
    36 var item = 0;
    38 new TestCase( SECTION,   "Boolean(1)",         true,   Boolean(1) );
    39 new TestCase( SECTION,   "Boolean(0)",         false,  Boolean(0) );
    40 new TestCase( SECTION,   "Boolean(-1)",        true,   Boolean(-1) );
    41 new TestCase( SECTION,   "Boolean('1')",       true,   Boolean("1") );
    42 new TestCase( SECTION,   "Boolean('0')",       true,   Boolean("0") );
    43 new TestCase( SECTION,   "Boolean('-1')",      true,   Boolean("-1") );
    44 new TestCase( SECTION,   "Boolean(true)",      true,   Boolean(true) );
    45 new TestCase( SECTION,   "Boolean(false)",     false,  Boolean(false) );
    47 new TestCase( SECTION,   "Boolean('true')",    true,   Boolean("true") );
    48 new TestCase( SECTION,   "Boolean('false')",   true,   Boolean("false") );
    49 new TestCase( SECTION,   "Boolean(null)",      false,  Boolean(null) );
    51 new TestCase( SECTION,   "Boolean(-Infinity)", true,   Boolean(Number.NEGATIVE_INFINITY) );
    52 new TestCase( SECTION,   "Boolean(NaN)",       false,  Boolean(Number.NaN) );
    53 new TestCase( SECTION,   "Boolean(void(0))",   false,  Boolean( void(0) ) );
    54 new TestCase( SECTION,   "Boolean(x=0)",       false,  Boolean( x=0 ) );
    55 new TestCase( SECTION,   "Boolean(x=1)",       true,   Boolean( x=1 ) );
    56 new TestCase( SECTION,   "Boolean(x=false)",   false,  Boolean( x=false ) );
    57 new TestCase( SECTION,   "Boolean(x=true)",    true,   Boolean( x=true ) );
    58 new TestCase( SECTION,   "Boolean(x=null)",    false,  Boolean( x=null ) );
    59 new TestCase( SECTION,   "Boolean()",          false,  Boolean() );
    60 //    array[item++] = new TestCase( SECTION,   "Boolean(var someVar)",     false,  Boolean( someVar ) );
    62 test();

mercurial