|
1 // |reftest| skip -- obsolete test |
|
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
3 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 //----------------------------------------------------------------------------- |
|
8 var BUGNUMBER = 346642; |
|
9 var summary = 'decompilation of destructuring assignment'; |
|
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 expect = 'TypeError: NaN is not a constructor'; |
|
25 actual = 'No Crash'; |
|
26 try |
|
27 { |
|
28 try { throw 1; } catch(e1 if 0) { } catch(e2 if (new NaN)) { } |
|
29 } |
|
30 catch(ex) |
|
31 { |
|
32 actual = ex + ''; |
|
33 } |
|
34 reportCompare(expect, actual, summary + ': 1'); |
|
35 |
|
36 expect = /TypeError: x.t (has no properties|is undefined)/; |
|
37 actual = 'No Crash'; |
|
38 try |
|
39 { |
|
40 z = [1]; |
|
41 let (x = (undefined ? 3 : z)) { x.t.g } |
|
42 } |
|
43 catch(ex) |
|
44 { |
|
45 actual = ex + ''; |
|
46 } |
|
47 reportMatch(expect, actual, summary + ': 2'); |
|
48 |
|
49 expect = /TypeError: x.t (has no properties|is undefined)/; |
|
50 actual = 'No Crash'; |
|
51 try |
|
52 { |
|
53 z = [1]; |
|
54 new Function("let (x = (undefined ? 3 : z)) { x.t.g }")() |
|
55 } |
|
56 catch(ex) |
|
57 { |
|
58 actual = ex + ''; |
|
59 } |
|
60 reportMatch(expect, actual, summary + ': 3'); |
|
61 |
|
62 expect = 'TypeError: b is not a constructor'; |
|
63 actual = 'No Crash'; |
|
64 try |
|
65 { |
|
66 with({x: (new (b = 1))}) (2).x |
|
67 } |
|
68 catch(ex) |
|
69 { |
|
70 actual = ex + ''; |
|
71 } |
|
72 reportCompare(expect, actual, summary + ': 4'); |
|
73 |
|
74 expect = /TypeError: this.zzz (has no properties|is undefined)/; |
|
75 actual = 'No Crash'; |
|
76 try |
|
77 { |
|
78 (function(){try { } catch(f) { return; } finally { this.zzz.zzz }})(); |
|
79 } |
|
80 catch(ex) |
|
81 { |
|
82 actual = ex + ''; |
|
83 } |
|
84 reportMatch(expect, actual, summary + ': 5'); |
|
85 |
|
86 expect = 'TypeError: p.z = <x><y/></x> ? 3 : 4 is not a function'; |
|
87 actual = 'No Crash'; |
|
88 try |
|
89 { |
|
90 (new Function("if(\n({y:5, p: (print).r})) { p={}; (p.z = <x\n><y/></x> ? 3 : 4)(5) }"))(); |
|
91 } |
|
92 catch(ex) |
|
93 { |
|
94 actual = ex + ''; |
|
95 } |
|
96 reportCompare(expect, actual, summary + ': 6'); |
|
97 |
|
98 expect = 'TypeError: xx is not a function'; |
|
99 actual = 'No Crash'; |
|
100 try |
|
101 { |
|
102 switch(xx) { case 3: case (new ([3].map)): } const xx; |
|
103 } |
|
104 catch(ex) |
|
105 { |
|
106 actual = ex + ''; |
|
107 } |
|
108 reportCompare(expect, actual, summary + ': 7'); |
|
109 |
|
110 expect = 'TypeError: ++x is not a function'; |
|
111 actual = 'No Crash'; |
|
112 try |
|
113 { |
|
114 let (x=3) ((++x)()) |
|
115 } |
|
116 catch(ex) |
|
117 { |
|
118 actual = ex + ''; |
|
119 } |
|
120 reportCompare(expect, actual, summary + ': 8'); |
|
121 |
|
122 expect = 'ReferenceError: x.y is not defined'; |
|
123 actual = 'No Crash'; |
|
124 try |
|
125 { |
|
126 x = {}; |
|
127 import x.y; |
|
128 } |
|
129 catch(ex) |
|
130 { |
|
131 actual = ex + ''; |
|
132 } |
|
133 reportCompare(expect, actual, summary + ': 9'); |
|
134 |
|
135 exitFunc ('test'); |
|
136 } |