1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/js1_7/lexical/regress-346642-03.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,136 @@ 1.4 +// |reftest| skip -- obsolete test 1.5 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +//----------------------------------------------------------------------------- 1.11 +var BUGNUMBER = 346642; 1.12 +var summary = 'decompilation of destructuring assignment'; 1.13 +var actual = ''; 1.14 +var expect = ''; 1.15 + 1.16 + 1.17 +//----------------------------------------------------------------------------- 1.18 +test(); 1.19 +//----------------------------------------------------------------------------- 1.20 + 1.21 +function test() 1.22 +{ 1.23 + enterFunc ('test'); 1.24 + printBugNumber(BUGNUMBER); 1.25 + printStatus (summary); 1.26 + 1.27 + expect = 'TypeError: NaN is not a constructor'; 1.28 + actual = 'No Crash'; 1.29 + try 1.30 + { 1.31 + try { throw 1; } catch(e1 if 0) { } catch(e2 if (new NaN)) { } 1.32 + } 1.33 + catch(ex) 1.34 + { 1.35 + actual = ex + ''; 1.36 + } 1.37 + reportCompare(expect, actual, summary + ': 1'); 1.38 + 1.39 + expect = /TypeError: x.t (has no properties|is undefined)/; 1.40 + actual = 'No Crash'; 1.41 + try 1.42 + { 1.43 + z = [1]; 1.44 + let (x = (undefined ? 3 : z)) { x.t.g } 1.45 + } 1.46 + catch(ex) 1.47 + { 1.48 + actual = ex + ''; 1.49 + } 1.50 + reportMatch(expect, actual, summary + ': 2'); 1.51 + 1.52 + expect = /TypeError: x.t (has no properties|is undefined)/; 1.53 + actual = 'No Crash'; 1.54 + try 1.55 + { 1.56 + z = [1]; 1.57 + new Function("let (x = (undefined ? 3 : z)) { x.t.g }")() 1.58 + } 1.59 + catch(ex) 1.60 + { 1.61 + actual = ex + ''; 1.62 + } 1.63 + reportMatch(expect, actual, summary + ': 3'); 1.64 + 1.65 + expect = 'TypeError: b is not a constructor'; 1.66 + actual = 'No Crash'; 1.67 + try 1.68 + { 1.69 + with({x: (new (b = 1))}) (2).x 1.70 + } 1.71 + catch(ex) 1.72 + { 1.73 + actual = ex + ''; 1.74 + } 1.75 + reportCompare(expect, actual, summary + ': 4'); 1.76 + 1.77 + expect = /TypeError: this.zzz (has no properties|is undefined)/; 1.78 + actual = 'No Crash'; 1.79 + try 1.80 + { 1.81 + (function(){try { } catch(f) { return; } finally { this.zzz.zzz }})(); 1.82 + } 1.83 + catch(ex) 1.84 + { 1.85 + actual = ex + ''; 1.86 + } 1.87 + reportMatch(expect, actual, summary + ': 5'); 1.88 + 1.89 + expect = 'TypeError: p.z = <x><y/></x> ? 3 : 4 is not a function'; 1.90 + actual = 'No Crash'; 1.91 + try 1.92 + { 1.93 + (new Function("if(\n({y:5, p: (print).r})) { p={}; (p.z = <x\n><y/></x> ? 3 : 4)(5) }"))(); 1.94 + } 1.95 + catch(ex) 1.96 + { 1.97 + actual = ex + ''; 1.98 + } 1.99 + reportCompare(expect, actual, summary + ': 6'); 1.100 + 1.101 + expect = 'TypeError: xx is not a function'; 1.102 + actual = 'No Crash'; 1.103 + try 1.104 + { 1.105 + switch(xx) { case 3: case (new ([3].map)): } const xx; 1.106 + } 1.107 + catch(ex) 1.108 + { 1.109 + actual = ex + ''; 1.110 + } 1.111 + reportCompare(expect, actual, summary + ': 7'); 1.112 + 1.113 + expect = 'TypeError: ++x is not a function'; 1.114 + actual = 'No Crash'; 1.115 + try 1.116 + { 1.117 + let (x=3) ((++x)()) 1.118 + } 1.119 + catch(ex) 1.120 + { 1.121 + actual = ex + ''; 1.122 + } 1.123 + reportCompare(expect, actual, summary + ': 8'); 1.124 + 1.125 + expect = 'ReferenceError: x.y is not defined'; 1.126 + actual = 'No Crash'; 1.127 + try 1.128 + { 1.129 + x = {}; 1.130 + import x.y; 1.131 + } 1.132 + catch(ex) 1.133 + { 1.134 + actual = ex + ''; 1.135 + } 1.136 + reportCompare(expect, actual, summary + ': 9'); 1.137 + 1.138 + exitFunc ('test'); 1.139 +}