Debian Codegraph @

rhino/testsrc/tests/js1_7/geniter/regress-345855.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 = 'regress-345855.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 345855;
9 var summary = 'Blank yield expressions are not syntax errors';
10 var actual = '';
11 var expect = 'No Error';
12
13
14 //-----------------------------------------------------------------------------
15 test();
16 //-----------------------------------------------------------------------------
17
18 function test()
19 {
20 enterFunc ('test');
21 printBugNumber(BUGNUMBER);
22 printStatus (summary);
23
24 expect = 'SyntaxError: syntax error';
25 try
26 {
27 eval('(function() {x = 12 + yield;})');
28 actual = 'No Error';
29 }
30 catch(ex)
31 {
32 actual = ex + '';
33 }
34 reportCompare(expect, actual, summary + ': function() {x = 12 + yield;}');
35
36 expect = 'SyntaxError: syntax error';
37 try
38 {
39 eval('(function() {x = 12 + yield 42})');
40 actual = 'No Error';
41 }
42 catch(ex)
43 {
44 actual = ex + '';
45 }
46 reportCompare(expect, actual, summary + ': function() {x = 12 + yield 42}');
47
48 expect = 'No Error';
49 try
50 {
51 eval('(function() {x = 12 + (yield);})');
52 actual = 'No Error';
53 }
54 catch(ex)
55 {
56 actual = ex + '';
57 }
58 reportCompare(expect, actual, summary + ': function() {x = 12 + (yield);}');
59
60 try
61 {
62 eval('(function () {foo((yield))})');
63 actual = 'No Error';
64 }
65 catch(ex)
66 {
67 actual = ex + '';
68 }
69 reportCompare(expect, actual, summary + ': function () {foo((yield))}');
70
71 try
72 {
73 eval('(function() {x = 12 + (yield 42)})');
74 actual = 'No Error';
75 }
76 catch(ex)
77 {
78 actual = ex + '';
79 }
80 reportCompare(expect, actual, summary + ': function() {x = 12 + (yield 42)}');
81
82 try
83 {
84 eval('(function (){foo((yield 42))})');
85 actual = 'No Error';
86 }
87 catch(ex)
88 {
89 actual = ex + '';
90 }
91 reportCompare(expect, actual, summary + ': function (){foo((yield 42))}');
92
93 exitFunc ('test');
94 }