Debian Codegraph @

rhino/testsrc/tests/ecma/LexicalConventions/7.1-3.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 gTestfile = '7.1-3.js';
7
8 /**
9 File Name: 7.1-3.js
10 ECMA Section: 7.1 White Space
11 Description: - readability
12 - separate tokens
13 - otherwise should be insignificant
14 - in strings, white space characters are significant
15 - cannot appear within any other kind of token
16
17 white space characters are:
18 unicode name formal name string representation
19 \u0009 tab <TAB> \t
20 \u000B veritical tab <VT> ??
21 \U000C form feed <FF> \f
22 \u0020 space <SP> " "
23
24 Author: [email protected]
25 Date: 11 september 1997
26 */
27
28 var SECTION = "7.1-3";
29 var VERSION = "ECMA_1";
30 startTest();
31 var TITLE = "White Space";
32
33 writeHeaderToLog( SECTION + " "+ TITLE);
34
35 new TestCase( SECTION, "'var'+'\u000B'+'MYVAR1=10;MYVAR1'", 10, eval('var'+'\u000B'+'MYVAR1=10;MYVAR1') );
36 new TestCase( SECTION, "'var'+'\u0009'+'MYVAR2=10;MYVAR2'", 10, eval('var'+'\u0009'+'MYVAR2=10;MYVAR2') );
37 new TestCase( SECTION, "'var'+'\u000C'+'MYVAR3=10;MYVAR3'", 10, eval('var'+'\u000C'+'MYVAR3=10;MYVAR3') );
38 new TestCase( SECTION, "'var'+'\u0020'+'MYVAR4=10;MYVAR4'", 10, eval('var'+'\u0020'+'MYVAR4=10;MYVAR4') );
39
40 // +<white space>+ should be interpreted as the unary + operator twice, not as a post or prefix increment operator
41
42 new TestCase( SECTION,
43 "var VAR = 12345; + + VAR",
44 12345,
45 eval("var VAR = 12345; + + VAR") );
46
47 new TestCase( SECTION,
48 "var VAR = 12345;VAR+ + VAR",
49 24690,
50 eval("var VAR = 12345;VAR+ +VAR") );
51 new TestCase( SECTION,
52 "var VAR = 12345;VAR - - VAR",
53 24690,
54 eval("var VAR = 12345;VAR- -VAR") );
55
56 test();