regexflags-disabled-features.js 1.1 KB

1234567891011121314151617181920212223
  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. [['sticky', 'y'],
  8. ['unicode', 'u']].map(function ([propertyName, flag]) {
  9. return {
  10. name: "RegExp.prototype.flags should not include the '" + propertyName + "' flag when the feature is disabled",
  11. body: function () {
  12. var object = {};
  13. object[propertyName] = true;
  14. var getFlags = Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags').get;
  15. var flags = getFlags.call(object);
  16. assert.isFalse(flags.includes(flag));
  17. }
  18. };
  19. });
  20. testRunner.runTests(tests, { verbose: WScript.Arguments[0] != "summary" });