1 // Any copyright is dedicated to the Public Domain.
2 // http://creativecommons.org/licenses/publicdomain/
4 //-----------------------------------------------------------------------------
5 var BUGNUMBER
= 514568;
6 var summary
= "eval in all its myriad flavors";
8 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);
97 "function actY(action)" +
110 " try { return eval('delete y'); }" +
111 " catch (e) { return e.name; }" +
116 try { var local0
= y
; } catch (e
) { local0
= e
.name
; }
120 var inner1
= f("get");
121 try { var local1
= y
; } catch (e
) { local1
= e
.name
; }
124 var inner2
= f("get");
128 var inner3
= f("get");
131 var del
= f("delete");
132 try { var inner4
= f("get"); } catch (e
) { inner4
= e
.name
; }
133 try { var local4
= y
; } catch (e
) { local4
= e
.name
; }
136 try { var inner5
= f("get"); } catch (e
) { inner5
= e
.name
; }
137 try { var local5
= y
; } catch (e
) { local5
= e
.name
; }
142 inner1
: inner1
, local1
: local1
,
143 inner2
: inner2
, local2
: local2
,
144 inner3
: inner3
, local3
: local3
,
146 inner4
: inner4
, local4
: local4
,
147 inner5
: inner5
, local5
: local5
,
150 assertEq(resultsY
.local0
, "ReferenceError");
152 assertEq(resultsY
.inner1
, 5);
153 assertEq(resultsY
.local1
, "ReferenceError");
155 assertEq(resultsY
.inner2
, 5);
156 assertEq(resultsY
.local2
, 8);
158 assertEq(resultsY
.inner3
, 2);
159 assertEq(resultsY
.local3
, 8);
161 assertEq(resultsY
.del
, "SyntaxError");
163 assertEq(resultsY
.inner4
, 2);
164 assertEq(resultsY
.local4
, 8);
166 assertEq(resultsY
.inner5
, 71);
167 assertEq(resultsY
.local5
, 8);
169 /******************************************************************************/
171 if (typeof reportCompare
=== "function")
172 reportCompare(true, true);
174 print("Tests complete!");
176 var successfullyParsed
= true;