js/src/tests/js1_3/Boolean/boolean-001.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/js1_3/Boolean/boolean-001.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,43 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +
    1.10 +/**
    1.11 + *  File Name:          boolean-001.js
    1.12 + *  Description:
    1.13 + *
    1.14 + *  In JavaScript 1.2, new Boolean(false) evaluates to false.
    1.15 + *
    1.16 + *  Author:             christine@netscape.com
    1.17 + *  Date:               11 August 1998
    1.18 + */
    1.19 +var SECTION = "boolean-001.js";
    1.20 +var VERSION = "JS_1.3";
    1.21 +var TITLE   = "new Boolean(false) should evaluate to false";
    1.22 +
    1.23 +startTest();
    1.24 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.25 +
    1.26 +BooleanTest( "new Boolean(true)",  new Boolean(true),  true );
    1.27 +BooleanTest( "new Boolean(false)", new Boolean(false), true );
    1.28 +BooleanTest( "true",               true,               true );
    1.29 +BooleanTest( "false",              false,              false );
    1.30 +
    1.31 +test();
    1.32 +
    1.33 +function BooleanTest( string, object, expect ) {
    1.34 +  if ( object ) {
    1.35 +    result = true;
    1.36 +  } else {
    1.37 +    result = false;
    1.38 +  }
    1.39 +
    1.40 +  new TestCase(
    1.41 +    SECTION,
    1.42 +    string,
    1.43 +    expect,
    1.44 +    result );
    1.45 +}
    1.46 +

mercurial