js/src/tests/ecma/LexicalConventions/7.1-1.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma/LexicalConventions/7.1-1.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,48 @@
     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:          7.1-1.js
    1.12 +   ECMA Section:       7.1 White Space
    1.13 +   Description:        - readability
    1.14 +   - separate tokens
    1.15 +   - otherwise should be insignificant
    1.16 +   - in strings, white space characters are significant
    1.17 +   - cannot appear within any other kind of token
    1.18 +
    1.19 +   white space characters are:
    1.20 +   unicode     name            formal name     string representation
    1.21 +   \u0009      tab             <TAB>           \t
    1.22 +   \u000B      veritical tab   <VT>            \v
    1.23 +   \U000C      form feed       <FF>            \f
    1.24 +   \u0020      space           <SP>            " "
    1.25 +
    1.26 +   Author:             christine@netscape.com
    1.27 +   Date:               11 september 1997
    1.28 +*/
    1.29 +
    1.30 +var SECTION = "7.1-1";
    1.31 +var VERSION = "ECMA_1";
    1.32 +startTest();
    1.33 +var TITLE   = "White Space";
    1.34 +
    1.35 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.36 +
    1.37 +// whitespace between var keyword and identifier
    1.38 +
    1.39 +new TestCase( SECTION,  'var'+'\t'+'MYVAR1=10;MYVAR1',   10, eval('var'+'\t'+'MYVAR1=10;MYVAR1') );
    1.40 +new TestCase( SECTION,  'var'+'\f'+'MYVAR2=10;MYVAR2',   10, eval('var'+'\f'+'MYVAR2=10;MYVAR2') );
    1.41 +new TestCase( SECTION,  'var'+'\v'+'MYVAR2=10;MYVAR2',   10, eval('var'+'\v'+'MYVAR2=10;MYVAR2') );
    1.42 +new TestCase( SECTION,  'var'+'\ '+'MYVAR2=10;MYVAR2',   10, eval('var'+'\ '+'MYVAR2=10;MYVAR2') );
    1.43 +
    1.44 +// use whitespace between tokens object name, dot operator, and object property
    1.45 +
    1.46 +new TestCase( SECTION,
    1.47 +	      "var a = new Array(12345); a\t\v\f .\\u0009\\000B\\u000C\\u0020length",
    1.48 +	      12345,
    1.49 +	      eval("var a = new Array(12345); a\t\v\f .\u0009\u0020\u000C\u000Blength") );
    1.50 +
    1.51 +test();

mercurial