v8/test/mjsunit/es6/unicode-regexp-ignore-case-noi18n.js
Jakob Gruber 069970e106 Reland "Update unicode-regexp-ignore-case-noi18n expectations"
This is a reland of c6c9d4bf1b

Original change's description:
> Update unicode-regexp-ignore-case-noi18n expectations
> 
> There appear to be one or several bugs in noi18n mode such that
> expectations in this test are no longer met. This CL updates
> expectations to the current behavior and re-enables the test so we at
> least preserve coverage in the other cases.
> 
> The behavior in question should be investigated in the future
> (low priority).
> 
> Bug: v8:10120
> Change-Id: Ib7c9a18133a386e6e39ee54d68ce4106d9b28c84
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2081815
> Commit-Queue: Jakob Gruber <jgruber@chromium.org>
> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#66524}

Bug: v8:10120
Change-Id: Ib2ee68e26c2aebe2eeab3ec9f7bc263fd79f3773
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2083291
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66550}
2020-03-03 07:30:07 +00:00

71 lines
2.3 KiB
JavaScript

// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Non-unicode use toUpperCase mappings.
assertFalse(/[\u00e5]/i.test("\u212b"));
assertFalse(/[\u212b]/i.test("\u00e5\u1234"));
assertFalse(/[\u212b]/i.test("\u00e5"));
assertTrue("\u212b".toLowerCase() == "\u00e5");
assertTrue("\u00c5".toLowerCase() == "\u00e5");
assertTrue("\u00e5".toUpperCase() == "\u00c5");
// Unicode uses case folding mappings.
assertFalse(/\u00e5/ui.test("\u212b"));
assertTrue(/\u00e5/ui.test("\u00c5"));
assertTrue(/\u00e5/ui.test("\u00e5"));
assertFalse(/\u00e5/ui.test("\u212b"));
assertTrue(/\u00c5/ui.test("\u00e5"));
assertFalse(/\u00c5/ui.test("\u212b"));
assertTrue(/\u00c5/ui.test("\u00c5"));
assertFalse(/\u212b/ui.test("\u00c5"));
assertFalse(/\u212b/ui.test("\u00e5"));
assertTrue(/\u212b/ui.test("\u212b"));
// Non-BMP.
assertFalse(/\u{10400}/i.test("\u{10428}"));
assertFalse(/\u{10400}/ui.test("\u{10428}"));
assertFalse(/\ud801\udc00/ui.test("\u{10428}"));
assertFalse(/[\u{10428}]/ui.test("\u{10400}"));
assertFalse(/[\ud801\udc28]/ui.test("\u{10400}"));
// TODO(v8:10120): Investigate why these don't behave as expected.
{
// assertEquals(["\uff21\u{10400}"],
// /[\uff40-\u{10428}]+/ui.exec("\uff21\u{10400}abc"));
assertEquals(["\u{10400}"],
/[\uff40-\u{10428}]+/ui.exec("\uff21\u{10400}abc"));
}
{
// assertEquals(["abc"], /[^\uff40-\u{10428}]+/ui.exec("\uff21\u{10400}abc\uff23"));
assertEquals(["\u{ff21}"], /[^\uff40-\u{10428}]+/ui.exec("\uff21\u{10400}abc\uff23"));
}
{
// assertEquals(["\uff53\u24bb"],
// /[\u24d5-\uff33]+/ui.exec("\uff54\uff53\u24bb\u24ba"));
assertEquals(null,
/[\u24d5-\uff33]+/ui.exec("\uff54\uff53\u24bb\u24ba"));
}
// Full mappings are ignored.
assertFalse(/\u00df/ui.test("SS"));
assertFalse(/\u1f8d/ui.test("\u1f05\u03b9"));
// Simple mappings.
assertFalse(/\u1f8d/ui.test("\u1f85"));
// Common mappings.
assertTrue(/\u1f6b/ui.test("\u1f63"));
// Back references.
assertNull(/(.)\1\1/ui.exec("\u00e5\u212b\u00c5"));
assertNull(/(.)\1/ui.exec("\u{118aa}\u{118ca}"));
// Non-Latin1 maps to Latin1.
assertNull(/^\u017F/ui.exec("s"));
assertNull(/^\u017F/ui.exec("s\u1234"));
assertNull(/^a[\u017F]/ui.exec("as"));
assertNull(/^a[\u017F]/ui.exec("as\u1234"));