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/
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.
11 * The Original Code is Mozilla Communicator client code, released March
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
24 ECMA Section: 7.1 White Space
25 Description: - readability
27 - otherwise should be insignificant
28 - in strings, white space characters are significant
29 - cannot appear within any other kind of token
31 white space characters are:
32 unicode name formal name string representation
34 \u000B veritical tab <VT> ??
35 \U000C form feed <FF> \f
38 Author: christine@netscape.com
39 Date: 11 september 1997
42 var SECTION = "7.1-3";
43 var VERSION = "ECMA_1";
45 var TITLE = "White Space";
47 writeHeaderToLog( SECTION + " "+ TITLE);
49 var testcases = getTestCases();
53 function getTestCases() {
54 var array = new Array();
56 array[item++] = new TestCase( SECTION, "'var'+'\u000B'+'MYVAR1=10;MYVAR1'", 10, eval('var'+'\u000B'+'MYVAR1=10;MYVAR1') );
57 array[item++] = new TestCase( SECTION, "'var'+'\u0009'+'MYVAR2=10;MYVAR2'", 10, eval('var'+'\u0009'+'MYVAR2=10;MYVAR2') );
58 array[item++] = new TestCase( SECTION, "'var'+'\u000C'+'MYVAR3=10;MYVAR3'", 10, eval('var'+'\u000C'+'MYVAR3=10;MYVAR3') );
59 array[item++] = new TestCase( SECTION, "'var'+'\u0020'+'MYVAR4=10;MYVAR4'", 10, eval('var'+'\u0020'+'MYVAR4=10;MYVAR4') );
61 // +<white space>+ should be interpreted as the unary + operator twice, not as a post or prefix increment operator
63 array[item++] = new TestCase( SECTION,
64 "var VAR = 12345; + + VAR",
66 eval("var VAR = 12345; + + VAR") );
68 array[item++] = new TestCase( SECTION,
69 "var VAR = 12345;VAR+ + VAR",
71 eval("var VAR = 12345;VAR+ +VAR") );
72 array[item++] = new TestCase( SECTION,
73 "var VAR = 12345;VAR - - VAR",
75 eval("var VAR = 12345;VAR- -VAR") );
81 for ( tc=0; tc < testcases.length; tc++ ) {
82 testcases[tc].passed = writeTestCaseResult(
85 testcases[tc].description +" = "+
86 testcases[tc].actual );
88 testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";