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:          7.1-1.js
24    ECMA Section:       7.1 White Space
25    Description:        - readability
26                        - separate tokens
27                        - otherwise should be insignificant
28                        - in strings, white space characters are significant
29                        - cannot appear within any other kind of token
30
31                        white space characters are:
32                        unicode     name            formal name     string representation
33                        \u0009      tab             <TAB>           \t
34                        \u000B      veritical tab   <VT>            \v
35                        \U000C      form feed       <FF>            \f
36                        \u0020      space           <SP>            " "
37
38    Author:             christine@netscape.com
39    Date:               11 september 1997
40*/
41
42    var SECTION = "7.1-1";
43    var VERSION = "ECMA_1";
44    startTest();
45    var TITLE   = "White Space";
46
47    writeHeaderToLog( SECTION + " "+ TITLE);
48
49    var testcases = getTestCases();
50    test();
51
52
53function getTestCases() {
54    var array = new Array();
55    var item = 0;
56
57    // whitespace between var keyword and identifier
58
59    array[item++] = new TestCase( SECTION,  'var'+'\t'+'MYVAR1=10;MYVAR1',   10, eval('var'+'\t'+'MYVAR1=10;MYVAR1') );
60    array[item++] = new TestCase( SECTION,  'var'+'\f'+'MYVAR2=10;MYVAR2',   10, eval('var'+'\f'+'MYVAR2=10;MYVAR2') );
61    array[item++] = new TestCase( SECTION,  'var'+'\v'+'MYVAR2=10;MYVAR2',   10, eval('var'+'\v'+'MYVAR2=10;MYVAR2') );
62    array[item++] = new TestCase( SECTION,  'var'+'\ '+'MYVAR2=10;MYVAR2',   10, eval('var'+'\ '+'MYVAR2=10;MYVAR2') );
63
64    // use whitespace between tokens object name, dot operator, and object property
65
66    array[item++] = new TestCase( SECTION,
67                                  "var a = new Array(12345); a\t\v\f .\\u0009\\000B\\u000C\\u0020length",
68                                  12345,
69                                  eval("var a = new Array(12345); a\t\v\f .\u0009\u0020\u000C\u000Blength") );
70
71
72    return ( array );
73}
74function test() {
75    for ( tc=0; tc < testcases.length; tc++ ) {
76        testcases[tc].passed = writeTestCaseResult(
77                            testcases[tc].expect,
78                            testcases[tc].actual,
79                            testcases[tc].description +" = "+
80                            testcases[tc].actual );
81
82        testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
83    }
84    stopTest();
85    return ( testcases );
86}