newtest.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Copyright (c) ChakraCore Project Contributors. All rights reserved.
  4. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  5. //-------------------------------------------------------------------------------------------------------
  6. // Simpler mini-test harness to avoid any complicating factors when testing these jit bugs
  7. var results = 0;
  8. var test = 0;
  9. const verbose = WScript.Arguments[0] != "summary";
  10. function check(actual, expected) {
  11. if (actual != expected)
  12. throw new Error("Generator produced " + actual + " instead of " + expected);
  13. if (verbose)
  14. print('Result ' + ++results + ' Generator correctly produced ' + actual);
  15. }
  16. function title (name) {
  17. if (verbose) {
  18. print("Beginning Test " + ++test + ": " + name);
  19. results = 0;
  20. }
  21. }
  22. // Test 1 - Construction after self-reference in loop control
  23. title("Construction after self-reference in loop control");
  24. function testOne()
  25. {
  26. function* foo(a1,a2) {
  27. for (let i = a1; i < foo; i = i + a2)
  28. {
  29. yield 0;
  30. }
  31. function bar() {}
  32. var b = new bar();
  33. }
  34. foo().next()
  35. return true;
  36. }
  37. for (var i = 0; i < 30 ;++i){
  38. testOne();
  39. }
  40. print('pass')