From 9e1907e5f7d856688334485f0b302d0b3a2f4cc9 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Wed, 2 Nov 2022 15:59:55 -0700 Subject: [PATCH] Unicode case-folding tests Adds a test similar to the one in #3697, but in the main tree. The six code points in this test have an "F" for full case mapping in CaseFolding.txt, and so they should not be considered in the Canonicalize operation. Current versions of SpiderMonkey and V8 fail this test, others pass. --- .../RegExp/unicode_full_case_folding.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/built-ins/RegExp/unicode_full_case_folding.js diff --git a/test/built-ins/RegExp/unicode_full_case_folding.js b/test/built-ins/RegExp/unicode_full_case_folding.js new file mode 100644 index 0000000000..ac4ecd5fb0 --- /dev/null +++ b/test/built-ins/RegExp/unicode_full_case_folding.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-runtime-semantics-canonicalize-ch +description: > + Case-insensitive Unicode RegExps should not apply full case folding mappings +info: | + Canonicalize ( _rer_, _ch_ ) + 1. If _rer_.[[Unicode]] is *true* and _rer_.[[IgnoreCase]] is *true*, then + a. If the file `CaseFolding.txt` of the Unicode Character Database provides + a simple or common case folding mapping for _ch_, return the result of + applying that mapping to _ch_. + b. Return _ch_. + + See https://unicode.org/Public/UCD/latest/ucd/CaseFolding.txt for the case + folding mappings. +---*/ + +assert(!/[\u0390]/ui.test("\u1fd3"), "\\u0390 does not match \\u1fd3"); +assert(!/[\u1fd3]/ui.test("\u0390"), "\\u1fd3 does not match \\u0390"); +assert(!/[\u03b0]/ui.test("\u1fe3"), "\\u03b0 does not match \\u1fe3"); +assert(!/[\u1fe3]/ui.test("\u03b0"), "\\u1fe3 does not match \\u03b0"); +assert(!/[\ufb05]/ui.test("\ufb06"), "\\ufb05 does not match \\ufb06"); +assert(!/[\ufb06]/ui.test("\ufb05"), "\\ufb06 does not match \\ufb05");