1 // Any copyright is dedicated to the Public Domain.
2 // http://creativecommons.org/licenses/publicdomain/
5 //-----------------------------------------------------------------------------
6 var BUGNUMBER
= 514568;
7 var summary
= "eval in all its myriad flavors";
9 print(BUGNUMBER
+ ": " + summary
);
21 "function actX(action)" +
34 " try { return eval('delete x'); }" +
35 " catch (e) { return e.name; }" +
44 var inner1
= f("get");
48 var inner2
= f("get");
52 var inner3
= f("get");
55 var del
= f("delete");
56 var inner4
= f("get");
60 var inner5
= f("get");
66 inner1
: inner1
, local1
: local1
,
67 inner2
: inner2
, local2
: local2
,
68 inner3
: inner3
, local3
: local3
,
70 inner4
: inner4
, local4
: local4
,
71 inner5
: inner5
, local5
: local5
,
74 assertEq(resultsX
.local0
, 17);
76 assertEq(resultsX
.inner1
, 4);
77 assertEq(resultsX
.local1
, 17);
79 assertEq(resultsX
.inner2
, 4);
80 assertEq(resultsX
.local2
, 7);
82 assertEq(resultsX
.inner3
, 9);
83 assertEq(resultsX
.local3
, 7);
85 assertEq(resultsX
.del
, "SyntaxError");
87 assertEq(resultsX
.inner4
, 9);
88 assertEq(resultsX
.local4
, 7);
90 assertEq(resultsX
.inner5
, 23);
91 assertEq(resultsX
.local5
, 7);
96 "function actY(action)" +
109 " try { return eval('delete y'); }" +
110 " catch (e) { return e.name; }" +
115 try { var local0
= y
; } catch (e
) { local0
= e
.name
; }
119 var inner1
= f("get");
120 try { var local1
= y
; } catch (e
) { local1
= e
.name
; }
122 try { y
= 8; } catch (e
) { assertEq(e
.name
, "ReferenceError"); }
123 var inner2
= f("get");
124 try { var local2
= y
; } catch (e
) { local2
= e
.name
; }
127 var inner3
= f("get");
128 try { var local3
= y
; } catch (e
) { local3
= e
.name
; }
130 var del
= f("delete");
131 try { var inner4
= f("get"); } catch (e
) { inner4
= e
.name
; }
132 try { var local4
= y
; } catch (e
) { local4
= e
.name
; }
135 try { var inner5
= f("get"); } catch (e
) { inner5
= e
.name
; }
136 try { var local5
= y
; } catch (e
) { local5
= e
.name
; }
141 inner1
: inner1
, local1
: local1
,
142 inner2
: inner2
, local2
: local2
,
143 inner3
: inner3
, local3
: local3
,
145 inner4
: inner4
, local4
: local4
,
146 inner5
: inner5
, local5
: local5
,
149 assertEq(resultsY
.local0
, "ReferenceError");
151 assertEq(resultsY
.inner1
, 5);
152 assertEq(resultsY
.local1
, "ReferenceError");
154 assertEq(resultsY
.inner2
, 5);
155 assertEq(resultsY
.local2
, "ReferenceError");
157 assertEq(resultsY
.inner3
, 2);
158 assertEq(resultsY
.local3
, "ReferenceError");
160 assertEq(resultsY
.del
, "SyntaxError");
162 assertEq(resultsY
.inner4
, 2);
163 assertEq(resultsY
.local4
, "ReferenceError");
165 assertEq(resultsY
.inner5
, 71);
166 assertEq(resultsY
.local5
, "ReferenceError");
168 /******************************************************************************/
170 if (typeof reportCompare
=== "function")
171 reportCompare(true, true);
173 print("Tests complete!");
175 var successfullyParsed
= true;