RegExpStrictDelete.js 1.0 KB

1234567891011121314151617181920212223242526
  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. "use strict";
  7. var props = Object.getOwnPropertyNames(RegExp);
  8. props.sort();
  9. for (var i = 0, len = props.length; i < len; i++) {
  10. var prop = props[i];
  11. if (prop === 'prototype')
  12. continue;
  13. try {
  14. WScript.Echo("Testing: delete RegExp[" + prop + "]");
  15. var result = delete RegExp[prop];
  16. if (result === false)
  17. WScript.Echo("Error: strict delete returned false");
  18. }
  19. catch (err) {
  20. if (!(err instanceof TypeError))
  21. WScript.Echo("Error: strict delete threw a non-TypeError: " + err);
  22. }
  23. }