Home | History | Annotate | Download | only in Expressions
      1 /* The contents of this file are subject to the Netscape Public
      2  * License Version 1.1 (the "License"); you may not use this file
      3  * except in compliance with the License. You may obtain a copy of
      4  * the License at http://www.mozilla.org/NPL/
      5  *
      6  * Software distributed under the License is distributed on an "AS
      7  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
      8  * implied. See the License for the specific language governing
      9  * rights and limitations under the License.
     10  *
     11  * The Original Code is Mozilla Communicator client code, released March
     12  * 31, 1998.
     13  *
     14  * The Initial Developer of the Original Code is Netscape Communications
     15  * Corporation. Portions created by Netscape are
     16  * Copyright (C) 1998 Netscape Communications Corporation. All
     17  * Rights Reserved.
     18  *
     19  * Contributor(s):
     20  *
     21  */
     22 /**
     23     File Name:          11.4.2.js
     24     ECMA Section:       11.4.2 the Void Operator
     25     Description:        always returns undefined (?)
     26     Author:             christine (at) netscape.com
     27     Date:               7 july 1997
     28 
     29 */
     30     var SECTION = "11.4.2";
     31     var VERSION = "ECMA_1";
     32     startTest();
     33     var TITLE   = "The void operator";
     34 
     35     writeHeaderToLog( SECTION + " "+ TITLE);
     36 
     37     var testcases = getTestCases();
     38 
     39     test();
     40 
     41 function getTestCases() {
     42     var array = new Array();
     43     var item = 0;
     44 
     45     array[item++] = new TestCase( SECTION,   "void(new String('string object'))",      void 0,  void(new String( 'string object' )) );
     46     array[item++] = new TestCase( SECTION,   "void('string primitive')",               void 0,  void("string primitive") );
     47     array[item++] = new TestCase( SECTION,   "void(Number.NaN)",                       void 0,  void(Number.NaN) );
     48     array[item++] = new TestCase( SECTION,   "void(Number.POSITIVE_INFINITY)",         void 0,  void(Number.POSITIVE_INFINITY) );
     49     array[item++] = new TestCase( SECTION,   "void(1)",                                void 0,  void(1) );
     50     array[item++] = new TestCase( SECTION,   "void(0)",                                void 0,  void(0) );
     51     array[item++] = new TestCase( SECTION,   "void(-1)",                               void 0,  void(-1) );
     52     array[item++] = new TestCase( SECTION,   "void(Number.NEGATIVE_INFINITY)",         void 0,  void(Number.NEGATIVE_INFINITY) );
     53     array[item++] = new TestCase( SECTION,   "void(Math.PI)",                          void 0,  void(Math.PI) );
     54     array[item++] = new TestCase( SECTION,   "void(true)",                             void 0,  void(true) );
     55     array[item++] = new TestCase( SECTION,   "void(false)",                            void 0,  void(false) );
     56     array[item++] = new TestCase( SECTION,   "void(null)",                             void 0,  void(null) );
     57     array[item++] = new TestCase( SECTION,   "void new String('string object')",      void 0,  void new String( 'string object' ) );
     58     array[item++] = new TestCase( SECTION,   "void 'string primitive'",               void 0,  void "string primitive" );
     59     array[item++] = new TestCase( SECTION,   "void Number.NaN",                       void 0,  void Number.NaN );
     60     array[item++] = new TestCase( SECTION,   "void Number.POSITIVE_INFINITY",         void 0,  void Number.POSITIVE_INFINITY );
     61     array[item++] = new TestCase( SECTION,   "void 1",                                void 0,  void 1 );
     62     array[item++] = new TestCase( SECTION,   "void 0",                                void 0,  void 0 );
     63     array[item++] = new TestCase( SECTION,   "void -1",                               void 0,  void -1 );
     64     array[item++] = new TestCase( SECTION,   "void Number.NEGATIVE_INFINITY",         void 0,  void Number.NEGATIVE_INFINITY );
     65     array[item++] = new TestCase( SECTION,   "void Math.PI",                          void 0,  void Math.PI );
     66     array[item++] = new TestCase( SECTION,   "void true",                             void 0,  void true );
     67     array[item++] = new TestCase( SECTION,   "void false",                            void 0,  void false );
     68     array[item++] = new TestCase( SECTION,   "void null",                             void 0,  void null );
     69 
     70 //     array[item++] = new TestCase( SECTION,   "void()",                                 void 0,  void() );
     71 
     72     return ( array );
     73 }
     74 
     75 function test() {
     76     for ( i = 0; i < testcases.length; i++ ) {
     77             testcases[i].passed = writeTestCaseResult(
     78                     testcases[i].expect,
     79                     testcases[i].actual,
     80                     testcases[i].description +" = "+ testcases[i].actual );
     81             testcases[i].reason += ( testcases[i].passed ) ? "" : "wrong value "
     82     }
     83     stopTest();
     84     return ( testcases );
     85 }
     86