[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: Jakob Kummerow <jkummerow@chromium.org> Cr-Commit-Position: refs/heads/master@{#64027}
This commit is contained in:
parent
5134ca885f
commit
7dedd92998
@ -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++;
|
||||
}
|
||||
}
|
||||
|
15
test/intl/regress-9731.js
Normal file
15
test/intl/regress-9731.js
Normal file
@ -0,0 +1,15 @@
|
||||
// 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'));
|
Loading…
Reference in New Issue
Block a user