dromaeo-core-eval-modern.js 426 B

1234567891011121314151617181920212223
  1. startTest("dromaeo-core-eval", 'efec1da2');
  2. // Try to force real results
  3. let ret, tmp;
  4. // The commands that we'll be evaling
  5. const cmd = 'var str="";for(var i=0;i<1000;i++){str += "a";}ret = str;';
  6. // TESTS: eval()
  7. const num = 4;
  8. prep(() => {
  9. tmp = cmd;
  10. for (let n = 0; n < num; n++)
  11. tmp += tmp;
  12. });
  13. test("Normal eval", () => eval(tmp));
  14. test("new Function", () => (new Function(tmp))());
  15. endTest();