PageRenderTime 20ms CodeModel.GetById 17ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/js/src/jit-test/tests/arguments/strict-eval-mutation.js

http://github.com/zpao/v8monkey
JavaScript | 24 lines | 16 code | 4 blank | 4 comment | 1 complexity | 02beb064e6fdb8b43473b59de95ef8f0 MD5 | raw file
 1/*
 2 * Any copyright is dedicated to the Public Domain.
 3 * http://creativecommons.org/licenses/publicdomain/
 4 */
 5load(libdir + 'array-compare.js');
 6
 7var obj = {};
 8
 9function strictEvalMutation(code)
10{
11  "use strict";
12  return eval(code);
13}
14
15var a1, a2;
16for (var i = 0; i < 5; i++)
17{
18  a1 = strictEvalMutation("code = 17; arguments");
19  a2 = strictEvalMutation("arguments[0] = 17; arguments");
20  assertEq(strictEvalMutation("arguments[0] = 17; code"), "arguments[0] = 17; code");
21}
22
23assertEq(arraysEqual(a1, ["code = 17; arguments"]), true);
24assertEq(arraysEqual(a2, [17]), true);