bug_OS14326981.js 988 B

123456789101112131415161718192021222324252627
  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: "Verify cached scope is invalidated",
  9. body: function () {
  10. function foo() {
  11. var x = 100;
  12. //create a stack allocated func
  13. function bar() {
  14. return x;
  15. }
  16. eval("count = bar;");
  17. }
  18. var count = {};
  19. foo();
  20. assert.areEqual(100, count(), "Function leaked from cached scope should cause cached scope to be invalidated");
  21. }
  22. },
  23. ];
  24. testRunner.runTests(tests, { verbose: WScript.Arguments[0] != "summary" });