michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: /** michael@0: File Name: 7.1-3.js michael@0: ECMA Section: 7.1 White Space michael@0: Description: - readability michael@0: - separate tokens michael@0: - otherwise should be insignificant michael@0: - in strings, white space characters are significant michael@0: - cannot appear within any other kind of token michael@0: michael@0: white space characters are: michael@0: unicode name formal name string representation michael@0: \u0009 tab \t michael@0: \u000B veritical tab ?? michael@0: \U000C form feed \f michael@0: \u0020 space " " michael@0: michael@0: Author: christine@netscape.com michael@0: Date: 11 september 1997 michael@0: */ michael@0: michael@0: var SECTION = "7.1-3"; michael@0: var VERSION = "ECMA_1"; michael@0: startTest(); michael@0: var TITLE = "White Space"; michael@0: michael@0: writeHeaderToLog( SECTION + " "+ TITLE); michael@0: michael@0: new TestCase( SECTION, "'var'+'\u000B'+'MYVAR1=10;MYVAR1'", 10, eval('var'+'\u000B'+'MYVAR1=10;MYVAR1') ); michael@0: new TestCase( SECTION, "'var'+'\u0009'+'MYVAR2=10;MYVAR2'", 10, eval('var'+'\u0009'+'MYVAR2=10;MYVAR2') ); michael@0: new TestCase( SECTION, "'var'+'\u000C'+'MYVAR3=10;MYVAR3'", 10, eval('var'+'\u000C'+'MYVAR3=10;MYVAR3') ); michael@0: new TestCase( SECTION, "'var'+'\u0020'+'MYVAR4=10;MYVAR4'", 10, eval('var'+'\u0020'+'MYVAR4=10;MYVAR4') ); michael@0: michael@0: // ++ should be interpreted as the unary + operator twice, not as a post or prefix increment operator michael@0: michael@0: new TestCase( SECTION, michael@0: "var VAR = 12345; + + VAR", michael@0: 12345, michael@0: eval("var VAR = 12345; + + VAR") ); michael@0: michael@0: new TestCase( SECTION, michael@0: "var VAR = 12345;VAR+ + VAR", michael@0: 24690, michael@0: eval("var VAR = 12345;VAR+ +VAR") ); michael@0: new TestCase( SECTION, michael@0: "var VAR = 12345;VAR - - VAR", michael@0: 24690, michael@0: eval("var VAR = 12345;VAR- -VAR") ); michael@0: michael@0: test();