summaryrefslogtreecommitdiffstats
path: root/harmony-tests
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-05-03 18:03:19 -0700
committerElliott Hughes <enh@google.com>2013-05-03 18:03:19 -0700
commit5700a9718eef20f4228ed97d54a59cc70bf40753 (patch)
tree01be2480fef2d8f0b590f7125a896d6dab72894f /harmony-tests
parenta4f2eac75586df51bb508a78d00cb353fa019a45 (diff)
downloadlibcore-5700a9718eef20f4228ed97d54a59cc70bf40753.zip
libcore-5700a9718eef20f4228ed97d54a59cc70bf40753.tar.gz
libcore-5700a9718eef20f4228ed97d54a59cc70bf40753.tar.bz2
Various regex test fixes.
Mostly test changes and some duplication removal, but I did turn up a couple of small bugs. Change-Id: I46f99cdf0cdb8a67d358c0acc03079360fe5c333
Diffstat (limited to 'harmony-tests')
-rw-r--r--harmony-tests/src/test/java/org/apache/harmony/tests/java/util/regex/MatcherTest.java40
-rw-r--r--harmony-tests/src/test/java/org/apache/harmony/tests/java/util/regex/Pattern2Test.java234
-rw-r--r--harmony-tests/src/test/java/org/apache/harmony/tests/java/util/regex/PatternErrorTest.java6
-rw-r--r--harmony-tests/src/test/java/org/apache/harmony/tests/java/util/regex/PatternTest.java43
4 files changed, 120 insertions, 203 deletions
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/regex/MatcherTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/regex/MatcherTest.java
index bc87439..98450a4 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/regex/MatcherTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/regex/MatcherTest.java
@@ -607,16 +607,16 @@ public class MatcherTest extends TestCase {
assertTrue(matcher.matches());
}
- public void testAllCodePoints() {
+ public void testAllCodePoints_p() {
// Regression for HARMONY-3145
int[] codePoint = new int[1];
Pattern p = Pattern.compile("(\\p{all})+");
boolean res = true;
int cnt = 0;
- String s;
- for (int i = 0; i < 0x110000; i++) {
+ int step = 16; // Ideally 1, but devices are still too slow.
+ for (int i = 0; i < 0x110000; i += step) {
codePoint[0] = i;
- s = new String(codePoint, 0, 1);
+ String s = new String(codePoint, 0, 1);
if (!s.matches(p.toString())) {
cnt++;
res = false;
@@ -624,22 +624,25 @@ public class MatcherTest extends TestCase {
}
assertTrue(res);
assertEquals(0, cnt);
+ }
- p = Pattern.compile("(\\P{all})+");
- res = true;
- cnt = 0;
-
- for (int i = 0; i < 0x110000; i++) {
+ public void testAllCodePoints_P() {
+ // Regression for HARMONY-3145
+ int[] codePoint = new int[1];
+ Pattern p = Pattern.compile("(\\P{all})+");
+ boolean res = true;
+ int cnt = 0;
+ int step = 16; // Ideally 1, but devices are still too slow.
+ for (int i = 0; i < 0x110000; i += step) {
codePoint[0] = i;
- s = new String(codePoint, 0, 1);
+ String s = new String(codePoint, 0, 1);
if (!s.matches(p.toString())) {
cnt++;
res = false;
}
}
-
assertFalse(res);
- assertEquals(0x110000, cnt);
+ assertEquals(0x110000 / step, cnt);
}
/*
@@ -735,14 +738,13 @@ public class MatcherTest extends TestCase {
"----1 fish 2 fish red fish 5----", false);
}
- /*
- * Test if Matcher's toString conatain pattern information
- */
public void testToString() {
- String result = Pattern.compile("(\\d{1,3})").matcher(
- "aaaa123456789045").toString();
- assertTrue("The result doesn't contain pattern info", result
- .contains("(\\d{1,3})"));
+ Matcher m = Pattern.compile("(\\d{1,3})").matcher("aaaa666456789045");
+ assertEquals("java.util.regex.Matcher[pattern=(\\d{1,3}) region=0,16 lastmatch=]", m.toString());
+ assertTrue(m.find());
+ assertEquals("java.util.regex.Matcher[pattern=(\\d{1,3}) region=0,16 lastmatch=666]", m.toString());
+ m.region(4, 8);
+ assertEquals("java.util.regex.Matcher[pattern=(\\d{1,3}) region=4,8 lastmatch=]", m.toString());
}
private void hitEndTest(boolean callFind, String testNo, String regex,
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/regex/Pattern2Test.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/regex/Pattern2Test.java
index e2fec73..cf30fc6 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/regex/Pattern2Test.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/regex/Pattern2Test.java
@@ -287,16 +287,18 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
} catch (PatternSyntaxException e) {
}
+ // icu4c allows 1 to 6 hex digits in \x escapes.
+ p = Pattern.compile("\\xa");
+ p = Pattern.compile("\\xab");
+ p = Pattern.compile("\\xabc");
+ p = Pattern.compile("\\xabcd");
+ p = Pattern.compile("\\xabcde");
+ p = Pattern.compile("\\xabcdef");
+ // (Further digits would just be treated as characters after the escape.)
try {
- p = Pattern.compile("\\xa");
- fail("PatternSyntaxException expected");
- } catch (PatternSyntaxException e) {
- }
-
- try {
- p = Pattern.compile("\\xa;");
- fail("PatternSyntaxException expected");
- } catch (PatternSyntaxException e) {
+ p = Pattern.compile("\\xg");
+ fail();
+ } catch (PatternSyntaxException expected) {
}
// Test \0 (octal) sequences (1, 2 and 3 digit)
@@ -369,11 +371,18 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
}
// Test invalid control escapes
- try {
+ // icu4c 50 accepts this pattern, and treats it as a literal.
+ //try {
p = Pattern.compile("\\c");
- fail("PatternSyntaxException expected");
- } catch (PatternSyntaxException e) {
- }
+ assertTrue(p.matcher("x\\cy").find());
+ // fail(p.matcher("").toString());
+ //} catch (PatternSyntaxException e) {
+ //}
+
+ // But \cH works.
+ p = Pattern.compile("\\cH");
+ assertTrue(p.matcher("x\u0008y").find());
+ assertFalse(p.matcher("x\\cHy").find());
// originally contributed test did not check the result
// TODO: check what RI does here
@@ -467,15 +476,18 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
assertTrue(m.matches());
// Test ranges including the "-" character
- p = Pattern.compile("[\\*-/]_+[---]!+[--AP]");
- m = p.matcher("-_-!!A");
- assertTrue(m.matches());
- m = p.matcher("\u002b_-!!!-");
- assertTrue(m.matches());
- m = p.matcher("!_-!@");
- assertFalse(m.matches());
- m = p.matcher(",______-!!!!!!!P");
- assertTrue(m.matches());
+ // "---" collides with icu4c's "--" operator, and likely to be user error anyway.
+ if (false) {
+ p = Pattern.compile("[\\*-/]_+[---]!+[--AP]");
+ m = p.matcher("-_-!!A");
+ assertTrue(m.matches());
+ m = p.matcher("\u002b_-!!!-");
+ assertTrue(m.matches());
+ m = p.matcher("!_-!@");
+ assertFalse(m.matches());
+ m = p.matcher(",______-!!!!!!!P");
+ assertTrue(m.matches());
+ }
// Test nested ranges
p = Pattern.compile("[pm[t]][a-z]+[[r]lp]");
@@ -503,13 +515,16 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
assertTrue(m.matches());
// Test error cases with &&
- p = Pattern.compile("[&&[xyz]]");
- m = p.matcher("&");
- // System.out.println(m.matches());
- m = p.matcher("x");
- // System.out.println(m.matches());
- m = p.matcher("y");
- // System.out.println(m.matches());
+ // This is an RI bug that icu4c doesn't have.
+ if (false) {
+ p = Pattern.compile("[&&[xyz]]");
+ m = p.matcher("&");
+ // System.out.println(m.matches());
+ m = p.matcher("x");
+ // System.out.println(m.matches());
+ m = p.matcher("y");
+ // System.out.println(m.matches());
+ }
p = Pattern.compile("[[xyz]&[axy]]");
m = p.matcher("x");
// System.out.println(m.matches());
@@ -521,7 +536,10 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
m = p.matcher("a");
// System.out.println(m.matches());
- p = Pattern.compile("[[xyz]&&]");
+ // icu4c rightly considers a missing rhs to && a syntax error.
+ if (false) {
+ p = Pattern.compile("[[xyz]&&]");
+ }
p = Pattern.compile("[[abc]&]");
@@ -795,54 +813,6 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
// TODO
}
- public void testUnicodeCategories() throws PatternSyntaxException {
- // Test Unicode categories using \p and \P
- // One letter codes: L, M, N, P, S, Z, C
- // Two letter codes: Lu, Nd, Sc, Sm, ...
- // See java.lang.Character and Unicode standard for complete list
- // TODO
- // Test \p{L}
- // TODO
-
- // Test \p{N}
- // TODO
-
- // ... etc
-
- // Test two letter codes:
- // From unicode.org:
- // Lu
- // Ll
- // Lt
- // Lm
- // Lo
- // Mn
- // Mc
- // Me
- // Nd
- // Nl
- // No
- // Pc
- // Pd
- // Ps
- // Pe
- // Pi
- // Pf
- // Po
- // Sm
- // Sc
- // Sk
- // So
- // Zs
- // Zl
- // Zp
- // Cc
- // Cf
- // Cs
- // Co
- // Cn
- }
-
public void testUnicodeBlocks() throws PatternSyntaxException {
Pattern p;
Matcher m;
@@ -881,109 +851,34 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
if (UBlocks[i].low > 0) {
m = p.matcher(Character.toString((char) (UBlocks[i].low - 1)));
- assertFalse(m.matches());
+ assertFalse(UBlocks[i].name, m.matches());
}
for (j = UBlocks[i].low; j <= UBlocks[i].high; j++) {
m = p.matcher(Character.toString((char) j));
- assertTrue(m.matches());
+ assertTrue(UBlocks[i].name, m.matches());
}
if (UBlocks[i].high < 0xFFFF) {
m = p.matcher(Character.toString((char) (UBlocks[i].high + 1)));
- assertFalse(m.matches());
+ assertFalse(UBlocks[i].name, m.matches());
}
p = Pattern.compile("\\P{In" + UBlocks[i].name + "}");
if (UBlocks[i].low > 0) {
m = p.matcher(Character.toString((char) (UBlocks[i].low - 1)));
- assertTrue(m.matches());
+ assertTrue(UBlocks[i].name, m.matches());
}
for (j = UBlocks[i].low; j < UBlocks[i].high; j++) {
m = p.matcher(Character.toString((char) j));
- assertFalse(m.matches());
+ assertFalse(UBlocks[i].name, m.matches());
}
if (UBlocks[i].high < 0xFFFF) {
m = p.matcher(Character.toString((char) (UBlocks[i].high + 1)));
- assertTrue(m.matches());
+ assertTrue(UBlocks[i].name, m.matches());
}
}
}
- public void testCapturingGroups() throws PatternSyntaxException {
- // Test simple capturing groups
- // TODO
-
- // Test grouping without capture (?:...)
- // TODO
-
- // Test combination of grouping and capture
- // TODO
-
- // Test \<num> sequence with capturing and non-capturing groups
- // TODO
-
- // Test \<num> with <num> out of range
- // TODO
- }
-
- public void testRepeats() {
- // Test ?
- // TODO
-
- // Test *
- // TODO
-
- // Test +
- // TODO
-
- // Test {<num>}, including 0, 1 and more
- // TODO
-
- // Test {<num>,}, including 0, 1 and more
- // TODO
-
- // Test {<n1>,<n2>}, with n1 < n2, n1 = n2 and n1 > n2 (illegal?)
- // TODO
- }
-
- public void testAnchors() throws PatternSyntaxException {
- // Test ^, default and MULTILINE
- // TODO
-
- // Test $, default and MULTILINE
- // TODO
-
- // Test \b (word boundary)
- // TODO
-
- // Test \B (not a word boundary)
- // TODO
-
- // Test \A (beginning of string)
- // TODO
-
- // Test \Z (end of string)
- // TODO
-
- // Test \z (end of string)
- // TODO
-
- // Test \G
- // TODO
-
- // Test positive lookahead using (?=...)
- // TODO
-
- // Test negative lookahead using (?!...)
- // TODO
-
- // Test positive lookbehind using (?<=...)
- // TODO
-
- // Test negative lookbehind using (?<!...)
- // TODO
- }
-
public void testMisc() throws PatternSyntaxException {
Pattern p;
Matcher m;
@@ -1127,11 +1022,9 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
assertFalse(m.find());
m = p.matcher("");
- // FIXME: This matches the reference behaviour but is
- // inconsistent with matching "a" - ie. the end of the
- // target string should match against $ always but this
- // appears to work with the null string only when not in
- // multiline mode (see below)
+ // This differs from the RI behaviour but seems more correct.
+ assertTrue(m.find());
+ assertTrue(m.group().equals(""));
assertFalse(m.find());
p = Pattern.compile("^.*$");
@@ -1371,7 +1264,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
/* 3300; 33FF; CJK Compatibility */
new UBInfo(0x3300, 0x33FF, "CJKCompatibility"), // Character.UnicodeBlock.CJK_COMPATIBILITY
/* 3400; 4DB5; CJK Unified Ideographs Extension A */
- new UBInfo(0x3400, 0x4DB5, "CJKUnifiedIdeographsExtensionA"), // Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
+ new UBInfo(0x3400, 0x4DBF, "CJKUnifiedIdeographsExtensionA"), // Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
/* 4E00; 9FFF; CJK Unified Ideographs */
new UBInfo(0x4E00, 0x9FFF, "CJKUnifiedIdeographs"), // Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
/* A000; A48F; Yi Syllables */
@@ -1379,7 +1272,7 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
/* A490; A4CF; Yi Radicals */
new UBInfo(0xA490, 0xA4CF, "YiRadicals"), // Character.UnicodeBlock.YI_RADICALS
/* AC00; D7A3; Hangul Syllables */
- new UBInfo(0xAC00, 0xD7A3, "HangulSyllables"), // Character.UnicodeBlock.HANGUL_SYLLABLES
+ new UBInfo(0xAC00, 0xD7AF, "HangulSyllables"), // Character.UnicodeBlock.HANGUL_SYLLABLES
/* D800; DB7F; High Surrogates */
/* DB80; DBFF; High Private Use Surrogates */
/* DC00; DFFF; Low Surrogates */
@@ -1397,13 +1290,10 @@ p = Pattern.compile("([0-9]+)[\\u0020:\\x21];");
/* FE50; FE6F; Small Form Variants */
new UBInfo(0xFE50, 0xFE6F, "SmallFormVariants"), // Character.UnicodeBlock.SMALL_FORM_VARIANTS
/* FE70; FEFE; Arabic Presentation Forms-B */
- // new UBInfo (0xFE70,0xFEFE,"InArabicPresentationForms-B"), //
- // Character.UnicodeBlock.ARABIC_PRESENTATION_FORMS_B
- /* FEFF; FEFF; Specials */
- new UBInfo(0xFEFF, 0xFEFF, "Specials"), // Character.UnicodeBlock.SPECIALS
+ new UBInfo(0xFE70, 0xFEFF, "ArabicPresentationForms-B"), // Character.UnicodeBlock.ARABIC_PRESENTATION_FORMS_B
/* FF00; FFEF; Halfwidth and Fullwidth Forms */
new UBInfo(0xFF00, 0xFFEF, "HalfwidthandFullwidthForms"), // Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS
/* FFF0; FFFD; Specials */
- new UBInfo(0xFFF0, 0xFFFD, "Specials") // Character.UnicodeBlock.SPECIALS
+ new UBInfo(0xFFF0, 0xFFFF, "Specials") // Character.UnicodeBlock.SPECIALS
};
-} \ No newline at end of file
+}
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/regex/PatternErrorTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/regex/PatternErrorTest.java
index a8eef6d..4abb2a0 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/regex/PatternErrorTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/regex/PatternErrorTest.java
@@ -4,9 +4,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -50,11 +50,13 @@ public class PatternErrorTest extends TestCase {
flags |= Pattern.COMMENTS;
flags |= Pattern.DOTALL;
flags |= Pattern.UNICODE_CASE;
+ flags &= ~Pattern.CANON_EQ; // Android always throws given this flag.
Pattern.compile("foo", flags);
// add invalid flags - should get IllegalArgumentException
// regression test for HARMONY-4248
flags |= 0xFFFFFFFF;
+ flags &= ~Pattern.CANON_EQ; // Android always throws given this flag.
try {
Pattern.compile("foo", flags);
fail("Expected IllegalArgumentException to be thrown");
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/regex/PatternTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/regex/PatternTest.java
index 33da926..9977d91 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/regex/PatternTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/regex/PatternTest.java
@@ -277,6 +277,12 @@ public class PatternTest extends TestCase {
}
public void testFlagsMethod() {
+ // icu4c doesn't count inline flags that span the entire regex as being global flags.
+ // Android just returns those flags actually passed to Pattern.compile.
+ if (true) {
+ return;
+ }
+
String baseString;
Pattern pat;
@@ -507,16 +513,22 @@ public class PatternTest extends TestCase {
assertTrue(mat.matches());
}
- public void testRegressions() {
+ public void test_bug_181() {
// Bug 181
Pattern.compile("[\\t-\\r]");
+ }
+ public void test_bug_4472() {
// HARMONY-4472
Pattern.compile("a*.+");
+ }
+ public void test_bug_187() {
// Bug187
- Pattern
- .compile("|(?idmsux-idmsux)|(?idmsux-idmsux)|[^|\\[-\\0274|\\,-\\\\[^|W\\}\\nq\\x65\\002\\xFE\\05\\06\\00\\x66\\x47i\\,\\xF2\\=\\06\\u0EA4\\x9B\\x3C\\f\\|\\{\\xE5\\05\\r\\u944A\\xCA\\e|\\x19\\04\\x07\\04\\u607B\\023\\0073\\x91Tr\\0150\\x83]]?(?idmsux-idmsux:\\p{Alpha}{7}?)||(?<=[^\\uEC47\\01\\02\\u3421\\a\\f\\a\\013q\\035w\\e])(?<=\\p{Punct}{0,}?)(?=^\\p{Lower})(?!\\b{8,14})(?<![|\\00-\\0146[^|\\04\\01\\04\\060\\f\\u224DO\\x1A\\xC4\\00\\02\\0315\\0351\\u84A8\\xCBt\\xCC\\06|\\0141\\00\\=\\e\\f\\x6B\\0026Tb\\040\\x76xJ&&[\\\\-\\]\\05\\07\\02\\u2DAF\\t\\x9C\\e\\0023\\02\\,X\\e|\\u6058flY\\u954C]]]{5}?)(?<=\\p{Sc}{8}+)[^|\\026-\\u89BA|o\\u6277\\t\\07\\x50&&\\p{Punct}]{8,14}+((?<=^\\p{Punct})|(?idmsux-idmsux)||(?>[\\x3E-\\]])|(?idmsux-idmsux:\\p{Punct})|(?<![\\0111\\0371\\xDF\\u6A49\\07\\u2A4D\\00\\0212\\02Xd-\\xED[^\\a-\\0061|\\0257\\04\\f\\[\\0266\\043\\03\\x2D\\042&&[^\\f-\\]&&\\s]]])|(?>[|\\n\\042\\uB09F\\06\\u0F2B\\uC96D\\x89\\uC166\\xAA|\\04-\\][^|\\a\\|\\rx\\04\\uA770\\n\\02\\t\\052\\056\\0274\\|\\=\\07\\e|\\00-\\x1D&&[^\\005\\uB15B\\uCDAC\\n\\x74\\0103\\0147\\uD91B\\n\\062G\\u9B4B\\077\\}\\0324&&[^\\0302\\,\\0221\\04\\u6D16\\04xy\\uD193\\[\\061\\06\\045\\x0F|\\e\\xBB\\f\\u1B52\\023\\u3AD2\\033\\007\\022\\}\\x66\\uA63FJ-\\0304]]]]{0,0})||(?<![^|\\0154U\\u0877\\03\\fy\\n\\|\\0147\\07-\\=[|q\\u69BE\\0243\\rp\\053\\02\\x33I\\u5E39\\u9C40\\052-\\xBC[|\\0064-\\?|\\uFC0C\\x30\\0060\\x45\\\\\\02\\?p\\xD8\\0155\\07\\0367\\04\\uF07B\\000J[^|\\0051-\\{|\\u9E4E\\u7328\\]\\u6AB8\\06\\x71\\a\\]\\e\\|KN\\u06AA\\0000\\063\\u2523&&[\\005\\0277\\x41U\\034\\}R\\u14C7\\u4767\\x09\\n\\054Ev\\0144\\<\\f\\,Q-\\xE4]]]]]{3}+)|(?>^+)|(?![^|\\|\\nJ\\t\\<\\04E\\\\\\t\\01\\\\\\02\\|\\=\\}\\xF3\\uBEC2\\032K\\014\\uCC5F\\072q\\|\\0153\\xD9\\0322\\uC6C8[^\\t\\0342\\x34\\x91\\06\\{\\xF1\\a\\u1710\\?\\xE7\\uC106\\02pF\\<&&[^|\\]\\064\\u381D\\u50CF\\eO&&[^|\\06\\x2F\\04\\045\\032\\u8536W\\0377\\0017|\\x06\\uE5FA\\05\\xD4\\020\\04c\\xFC\\02H\\x0A\\r]]]]+?)(?idmsux-idmsux)|(?<![|\\r-\\,&&[I\\t\\r\\0201\\xDB\\e&&[^|\\02\\06\\00\\<\\a\\u7952\\064\\051\\073\\x41\\?n\\040\\0053\\031&&[\\x15-\\|]]]]{8,11}?)(?![^|\\<-\\uA74B\\xFA\\u7CD2\\024\\07n\\<\\x6A\\0042\\uE4FF\\r\\u896B\\[\\=\\042Y&&^\\p{ASCII}]++)|(?<![R-\\|&&[\\a\\0120A\\u6145\\<\\050-d[|\\e-\\uA07C|\\016-\\u80D9]]]{1,}+)|(?idmsux-idmsux)|(?idmsux-idmsux)|(?idmsux-idmsux:\\B{6,}?)|(?<=\\D{5,8}?)|(?>[\\{-\\0207|\\06-\\0276\\p{XDigit}])(?idmsux-idmsux:[^|\\x52\\0012\\]u\\xAD\\0051f\\0142\\\\l\\|\\050\\05\\f\\t\\u7B91\\r\\u7763\\{|h\\0104\\a\\f\\0234\\u2D4F&&^\\P{InGreek}]))");
+ Pattern.compile("|(?idmsux-idmsux)|(?idmsux-idmsux)|[^|\\[-\\0274|\\,-\\\\[^|W\\}\\nq\\x65\\002\\xFE\\05\\06\\00\\x66\\x47i\\,\\xF2\\=\\06\\u0EA4\\x9B\\x3C\\f\\|\\{\\xE5\\05\\r\\u944A\\xCA\\e|\\x19\\04\\x07\\04\\u607B\\023\\0073\\x91Tr\\0150\\x83]]?(?idmsux-idmsux:\\p{Alpha}{7}?)||(?<=[^\\uEC47\\01\\02\\u3421\\a\\f\\a\\013q\\035w\\e])(?<=\\p{Punct}{0,}?)(?=^\\p{Lower})(?!\\b{8,14})(?<![|\\00-\\0146[^|\\04\\01\\04\\060\\f\\u224DO\\x1A\\xC4\\00\\02\\0315\\0351\\u84A8\\xCBt\\xCC\\06|\\0141\\00\\=\\e\\f\\x6B\\0026Tb\\040\\x76xJ&&[\\\\-\\]\\05\\07\\02\\u2DAF\\t\\x9C\\e\\0023\\02\\,X\\e|\\u6058flY\\u954C]]]{5}?)(?<=\\p{Sc}{8}+)[^|\\026-\\u89BA|o\\u6277\\t\\07\\x50&&\\p{Punct}]{8,14}+((?<=^\\p{Punct})|(?idmsux-idmsux)||(?>[\\x3E-\\]])|(?idmsux-idmsux:\\p{Punct})|(?<![\\0111\\0371\\xDF\\u6A49\\07\\u2A4D\\00\\0212\\02Xd-\\xED[^\\a-\\0061|\\0257\\04\\f\\[\\0266\\043\\03\\x2D\\042&&[^\\f-\\]&&\\s]]])|(?>[|\\n\\042\\uB09F\\06\\u0F2B\\uC96D\\x89\\uC166\\xAA|\\04-\\][^|\\a\\|\\rx\\04\\uA770\\n\\02\\t\\052\\056\\0274\\|\\=\\07\\e|\\00-\\x1D&&[^\\005\\uB15B\\uCDAC\\n\\x74\\0103\\0147\\uD91B\\n\\062G\\u9B4B\\077\\}\\0324&&[^\\0302\\,\\0221\\04\\u6D16\\04xy\\uD193\\[\\061\\06\\045\\x0F|\\e\\xBB\\f\\u1B52\\023\\u3AD2\\033\\007\\022\\}\\x66\\uA63FJ-\\0304]]]]{0,0})||(?<![^|\\0154U\\u0877\\03\\fy\\n\\|\\0147\\07-\\=[|q\\u69BE\\0243\\rp\\053\\02\\x33I\\u5E39\\u9C40\\052-\\xBC[|\\0064-\\?|\\uFC0C\\x30\\0060\\x45\\\\\\02\\?p\\xD8\\0155\\07\\0367\\04\\uF07B\\000J[^|\\0051-\\{|\\u9E4E\\u7328\\]\\u6AB8\\06\\x71\\a\\]\\e\\|KN\\u06AA\\0000\\063\\u2523&&[\\005\\0277\\x41U\\034\\}R\\u14C7\\u4767\\x09\\n\\054Ev\\0144\\<\\f\\,Q-\\xE4]]]]]{3}+)|(?>^+)|(?![^|\\|\\nJ\\t\\<\\04E\\\\\\t\\01\\\\\\02\\|\\=\\}\\xF3\\uBEC2\\032K\\014\\uCC5F\\072q\\|\\0153\\xD9\\0322\\uC6C8[^\\t\\0342\\x34\\x91\\06\\{\\xF1\\a\\u1710\\?\\xE7\\uC106\\02pF\\<&&[^|\\]\\064\\u381D\\u50CF\\eO&&[^|\\06\\x2F\\04\\045\\032\\u8536W\\0377\\0017|\\x06\\uE5FA\\05\\xD4\\020\\04c\\xFC\\02H\\x0A\\r]]]]+?)(?idmsux-idmsux)|(?<![|\\r-\\,&&[I\\t\\r\\0201\\xDB\\e&&[^|\\02\\06\\00\\<\\a\\u7952\\064\\051\\073\\x41\\?n\\040\\0053\\031&&[\\x15-\\|]]]]{8,11}?)(?![^|\\<-\\uA74B\\xFA\\u7CD2\\024\\07n\\<\\x6A\\0042\\uE4FF\\r\\u896B\\[\\=\\042Y&&^\\p{ASCII}]++)|(?<![R-\\|&&[\\a\\0120A\\u6145\\<\\050-d[|\\e-\\uA07C|\\016-\\u80D9]]]{1,}+)|(?idmsux-idmsux)|(?idmsux-idmsux)|(?idmsux-idmsux:\\B{6,}?)|(?<=\\D{5,8}?)|(?>[\\{-\\0207|\\06-\\0276\\p{XDigit}])(?idmsux-idmsux:[^|\\x52\\0012\\]u\\xAD\\0051f\\0142\\\\l\\|\\050\\05\\f\\t\\u7B91\\r\\u7763\\{|h\\0104\\a\\f\\0234\\u2D4F&&^\\P{InGreek}]))");
+ }
+
+ public void test_bug_5858() {
// HARMONY-5858
Pattern.compile("\\u6211", Pattern.LITERAL);
}
@@ -940,13 +952,11 @@ public class PatternTest extends TestCase {
boolean isCompiled = false;
try {
- Pattern.compile("(?:)", Pattern.CANON_EQ);
- Pattern.compile("(?:)", Pattern.CANON_EQ | Pattern.DOTALL);
- Pattern
- .compile("(?:)", Pattern.CANON_EQ
- | Pattern.CASE_INSENSITIVE);
- Pattern.compile("(?:)", Pattern.CANON_EQ | Pattern.COMMENTS
- | Pattern.UNIX_LINES);
+ // icu4c doesn't support CANON_EQ.
+ Pattern.compile("(?:)"/*, Pattern.CANON_EQ*/);
+ Pattern.compile("(?:)", /*Pattern.CANON_EQ |*/ Pattern.DOTALL);
+ Pattern.compile("(?:)", /*Pattern.CANON_EQ |*/ Pattern.CASE_INSENSITIVE);
+ Pattern.compile("(?:)", /*Pattern.CANON_EQ |*/ Pattern.COMMENTS | Pattern.UNIX_LINES);
isCompiled = true;
} catch (PatternSyntaxException e) {
System.out.println(e);
@@ -1055,6 +1065,10 @@ public class PatternTest extends TestCase {
}
public void testCanonEqFlag() {
+ // icu4c doesn't support CANON_EQ.
+ if (true) {
+ return;
+ }
/*
* for decompositions see
@@ -1251,6 +1265,11 @@ public class PatternTest extends TestCase {
}
public void testIndexesCanonicalEq() {
+ // icu4c doesn't support CANON_EQ.
+ if (true) {
+ return;
+ }
+
String baseString;
String testString;
Pattern pat;
@@ -1280,6 +1299,10 @@ public class PatternTest extends TestCase {
}
public void testCanonEqFlagWithSupplementaryCharacters() {
+ // icu4c doesn't support CANON_EQ.
+ if (true) {
+ return;
+ }
/*
* \u1D1BF->\u1D1BB\u1D16F->\u1D1B9\u1D165\u1D16F in UTF32