Debian Codegraph @

rhino/testsrc/tests/ecma_3/extensions/7.9.1.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 var gTestfile = '7.9.1.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 402386;
9 var summary = 'Automatic Semicolon insertion in restricted statements';
10 var actual = '';
11 var expect = '';
12
13
14 //-----------------------------------------------------------------------------
15 test();
16 //-----------------------------------------------------------------------------
17
18 function test()
19 {
20 enterFunc ('test');
21 printBugNumber(BUGNUMBER);
22 printStatus (summary);
23
24 var code;
25
26 code = '(function() { label1: for (;;) { continue \n label1; }})';
27 expect = '(function() { label1: for (;;) { continue ; label1; }})';
28 actual = uneval(eval(code));
29 compareSource(expect, actual, summary + ': ' + code);
30
31 code = '(function() { label2: for (;;) { break \n label2; }})';
32 expect = '(function() { label2: for (;;) { break ; label2; }})';
33 actual = uneval(eval(code));
34 compareSource(expect, actual, summary + ': ' + code);
35
36 code = '(function() { return \n x++; })';
37 expect = '(function() { return ; x++; })';
38 actual = uneval(eval(code));
39 compareSource(expect, actual, summary + ': ' + code);
40
41 print('see bug 256617');
42 code = '(function() { throw \n x++; })';
43 // expect = '(function() { throw ; x++; })';
44 expect = 'SyntaxError: syntax error';
45 try { uneval(eval(code)); } catch(ex) { actual = ex + ''; };
46 // compareSource(expect, actual, summary + ': ' + code);
47 reportCompare(expect, actual, summary + ': ' + code);
48
49 exitFunc ('test');
50 }
51