ES6NewTarget_bugfixes.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. WScript.LoadScriptFile("..\\UnitTestFramework\\UnitTestFramework.js");
  6. var tests = [
  7. {
  8. name: "OS4497597: ScopeInfo::FromScope() should increment scope symbol count to accomodate 'new.target'",
  9. body: function () {
  10. (function (){
  11. function f() {}
  12. eval("");
  13. () =>new.target;
  14. })();
  15. // Repro:
  16. // ASSERTION : (jscript\core\lib\Runtime\ByteCode\ScopeInfo.h, line 68)
  17. // Failure: (i >= 0 && i < symbolCount)
  18. }
  19. },
  20. {
  21. name: "OS5427497: Parser mistakes 'new.target' as in global function under -forceundodefer",
  22. body: function () {
  23. new.target; // bug repro: SyntaxError: Invalid use of the 'new.target' keyword
  24. }
  25. },
  26. {
  27. name: "OS8806229: eval in default parameter of arrow function",
  28. body: function() {
  29. assert.doesNotThrow(()=>(function() { (a = eval(undefined)) => {}; }));
  30. }
  31. },
  32. {
  33. name: "[MSRC35208] parameter type confusion in eval",
  34. body: function ()
  35. {
  36. var proxy = new Proxy(eval, {});
  37. assert.areEqual(0, proxy("Math.sin(0)"));
  38. }
  39. },
  40. ];
  41. testRunner.runTests(tests, { verbose: WScript.Arguments[0] != "summary" });