js/src/tests/ecma_5/Global/eval-in-strict-eval-in-normal-function.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:c554f16104e7
1 // Any copyright is dedicated to the Public Domain.
2 // http://creativecommons.org/licenses/publicdomain/
3
4 //-----------------------------------------------------------------------------
5 var BUGNUMBER = 620130;
6 var summary =
7 "Calls to eval with same code + varying strict mode of script containing " +
8 "eval == fail";
9
10 print(BUGNUMBER + ": " + summary);
11
12 /**************
13 * BEGIN TEST *
14 **************/
15
16 function t(code) { return eval(code); }
17
18 assertEq(t("'use strict'; try { eval('with (5) 17'); } catch (e) { 'threw'; }"),
19 "threw");
20 assertEq(t("try { eval('with (5) 17'); } catch (e) { 'threw'; }"),
21 17);
22 assertEq(t("'use strict'; try { eval('with (5) 17'); } catch (e) { 'threw'; }"),
23 "threw");
24
25 /******************************************************************************/
26
27 if (typeof reportCompare === "function")
28 reportCompare(true, true);
29
30 print("All tests passed!");

mercurial