Commit 7dedd929 authored by Frank Tang's avatar Frank Tang Committed by Commit Bot

[Intl] Fix /k/i.test('\u212A')

Add logic stated in

Bug: v8:9731
Change-Id: I0b3468bbad11a178f36d682febd0e44214646de8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1828279
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64027}
parent 5134ca88
......@@ -736,7 +736,14 @@ static int GetCaseIndependentLetters(Isolate* isolate, uc16 character,
CHECK(end - start + items <= letter_length);
while (start <= end) {
if (one_byte_subject && start > String::kMaxOneByteCharCode) break;
letters[items++] = (unibrow::uchar)(start);
// Only add to the output if character is not in ASCII range
// or the case equivalent character is in ASCII range.
// #sec-runtime-semantics-canonicalize-ch
// 3.g If the numeric value of ch ≥ 128 and the numeric value of cu < 128,
// return ch.
if (!((start >= 128) && (character < 128))) {
letters[items++] = (unibrow::uchar)(start);
}
start++;
}
}
......
// Copyright 2019 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.
assertFalse(/k/i.test('\u212A'));
assertTrue(/k/i.test('K'));
assertTrue(/k/i.test('k'));
assertFalse(/K/i.test('\u212A'));
assertTrue(/K/i.test('K'));
assertTrue(/K/i.test('k'));
assertTrue(/\u212A/i.test('\u212A'));
assertFalse(/\u212A/i.test('k'));
assertFalse(/\u212A/i.test('K'));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment