repeatBug.js 665 B

123456789101112131415161718192021
  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. try
  6. {
  7. var str = "+".repeat(0x80000000);
  8. str = str.replace(str, "+");
  9. WScript.Echo("FAIL: Was expecting Out of Memory exception.");
  10. }
  11. catch (e)
  12. {
  13. if(e.number == -2146828281) //Out of Memory
  14. WScript.Echo("PASS");
  15. else
  16. WScript.Echo("FAIL: Got the wrong exception code.");
  17. }