regex-code-point.js 1.1 KB

1234567891011121314151617181920
  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: "MatchGroupInst should parse code-points correctly",
  9. body: function () {
  10. assert.isTrue(/(\ud800)\1/u.test("\ud800\ud800"), "Partial surrogate pair");
  11. assert.isTrue(/(\u{10429})\1/u.test("\u{10429}\u{10429}"), "Equal sized code-point lists in both RegExp and string to match");
  12. assert.isTrue(/(\u{10429}a)\1/u.test("\u{10429}a\u{10429}ab"), "Shorter code-point list in RegExp");
  13. assert.isFalse(/(\u{10429}a)\1/u.test("\u{10429}a\u{10429}"), "Shorter code-point list in string to match");
  14. }
  15. },
  16. ];
  17. testRunner.runTests(tests, { verbose: WScript.Arguments[0] != "summary" });