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