0001: /*
0002: * Licensed to the Apache Software Foundation (ASF) under one or more
0003: * contributor license agreements. See the NOTICE file distributed with
0004: * this work for additional information regarding copyright ownership.
0005: * The ASF licenses this file to You under the Apache License, Version 2.0
0006: * (the "License"); you may not use this file except in compliance with
0007: * the License. You may obtain a copy of the License at
0008: *
0009: * http://www.apache.org/licenses/LICENSE-2.0
0010: *
0011: * Unless required by applicable law or agreed to in writing, software
0012: * distributed under the License is distributed on an "AS IS" BASIS,
0013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014: * See the License for the specific language governing permissions and
0015: * limitations under the License.
0016: */
0017:
0018: package org.apache.harmony.tests.java.util.regex;
0019:
0020: import java.io.Serializable;
0021: import java.util.regex.Matcher;
0022: import java.util.regex.Pattern;
0023: import java.util.regex.PatternSyntaxException;
0024:
0025: import junit.framework.TestCase;
0026:
0027: import org.apache.harmony.testframework.serialization.SerializationTest;
0028: import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
0029:
0030: @SuppressWarnings("nls")
0031: public class PatternTest extends TestCase {
0032: String[] testPatterns = {
0033: "(a|b)*abb",
0034: "(1*2*3*4*)*567",
0035: "(a|b|c|d)*aab",
0036: "(1|2|3|4|5|6|7|8|9|0)(1|2|3|4|5|6|7|8|9|0)*",
0037: "(abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ)*",
0038: "(a|b)*(a|b)*A(a|b)*lice.*",
0039: "(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z)(a|b|c|d|e|f|g|h|"
0040: + "i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z)*(1|2|3|4|5|6|7|8|9|0)*|while|for|struct|if|do",
0041: "x(?c)y", "x(?cc)y", "x(?:c)y"
0042:
0043: };
0044:
0045: /**
0046: * Constructor for PatternTest.
0047: *
0048: * @param name
0049: */
0050: public PatternTest(String name) {
0051: super (name);
0052: }
0053:
0054: public void testMatcher() {
0055: }
0056:
0057: /*
0058: * Class under test for String[] split(CharSequence, int)
0059: */
0060: public void testSplitCharSequenceint() {
0061: // splitting CharSequence which ends with pattern
0062: // bug6193
0063: assertEquals(",,".split(",", 3).length, 3);
0064: assertEquals(",,".split(",", 4).length, 3);
0065: // bug6193
0066: // bug5391
0067: assertEquals(
0068: Pattern.compile("o").split("boo:and:foo", 5).length, 5);
0069: assertEquals(Pattern.compile("b").split("ab", -1).length, 2);
0070: // bug5391
0071: String s[];
0072: Pattern pat = Pattern.compile("x");
0073: s = pat.split("zxx:zzz:zxx", 10);
0074: assertEquals(s.length, 5);
0075: s = pat.split("zxx:zzz:zxx", 3);
0076: assertEquals(s.length, 3);
0077: s = pat.split("zxx:zzz:zxx", -1);
0078: assertEquals(s.length, 5);
0079: s = pat.split("zxx:zzz:zxx", 0);
0080: assertEquals(s.length, 3);
0081: // other splitting
0082: // negative limit
0083: pat = Pattern.compile("b");
0084: s = pat.split("abccbadfebb", -1);
0085: assertEquals(s.length, 5);
0086: s = pat.split("", -1);
0087: assertEquals(s.length, 1);
0088: pat = Pattern.compile("");
0089: s = pat.split("", -1);
0090: assertEquals(s.length, 1);
0091: s = pat.split("abccbadfe", -1);
0092: assertEquals(s.length, 11);
0093: // zero limit
0094: pat = Pattern.compile("b");
0095: s = pat.split("abccbadfebb", 0);
0096: assertEquals(s.length, 3);
0097: s = pat.split("", 0);
0098: assertEquals(s.length, 1);
0099: pat = Pattern.compile("");
0100: s = pat.split("", 0);
0101: assertEquals(s.length, 1);
0102: s = pat.split("abccbadfe", 0);
0103: assertEquals(s.length, 10);
0104: // positive limit
0105: pat = Pattern.compile("b");
0106: s = pat.split("abccbadfebb", 12);
0107: assertEquals(s.length, 5);
0108: s = pat.split("", 6);
0109: assertEquals(s.length, 1);
0110: pat = Pattern.compile("");
0111: s = pat.split("", 11);
0112: assertEquals(s.length, 1);
0113: s = pat.split("abccbadfe", 15);
0114: assertEquals(s.length, 11);
0115:
0116: pat = Pattern.compile("b");
0117: s = pat.split("abccbadfebb", 5);
0118: assertEquals(s.length, 5);
0119: s = pat.split("", 1);
0120: assertEquals(s.length, 1);
0121: pat = Pattern.compile("");
0122: s = pat.split("", 1);
0123: assertEquals(s.length, 1);
0124: s = pat.split("abccbadfe", 11);
0125: assertEquals(s.length, 11);
0126:
0127: pat = Pattern.compile("b");
0128: s = pat.split("abccbadfebb", 3);
0129: assertEquals(s.length, 3);
0130: pat = Pattern.compile("");
0131: s = pat.split("abccbadfe", 5);
0132: assertEquals(s.length, 5);
0133: }
0134:
0135: /*
0136: * Class under test for String[] split(CharSequence)
0137: */
0138: public void testSplitCharSequence() {
0139: String s[];
0140: Pattern pat = Pattern.compile("b");
0141: s = pat.split("abccbadfebb");
0142: assertEquals(s.length, 3);
0143: s = pat.split("");
0144: assertEquals(s.length, 1);
0145: pat = Pattern.compile("");
0146: s = pat.split("");
0147: assertEquals(s.length, 1);
0148: s = pat.split("abccbadfe");
0149: assertEquals(s.length, 10);
0150: // bug6544
0151: String s1 = "";
0152: String[] arr = s1.split(":");
0153: assertEquals(arr.length, 1);
0154: // bug6544
0155: }
0156:
0157: public void testPattern() {
0158: }
0159:
0160: public void testFlags() {
0161: String baseString;
0162: String testString;
0163: Pattern pat;
0164: Matcher mat;
0165:
0166: baseString = "((?i)|b)a";
0167: testString = "A";
0168: pat = Pattern.compile(baseString);
0169: mat = pat.matcher(testString);
0170: assertFalse(mat.matches());
0171:
0172: baseString = "(?i)a|b";
0173: testString = "A";
0174: pat = Pattern.compile(baseString);
0175: mat = pat.matcher(testString);
0176: assertTrue(mat.matches());
0177:
0178: baseString = "(?i)a|b";
0179: testString = "B";
0180: pat = Pattern.compile(baseString);
0181: mat = pat.matcher(testString);
0182: assertTrue(mat.matches());
0183:
0184: baseString = "c|(?i)a|b";
0185: testString = "B";
0186: pat = Pattern.compile(baseString);
0187: mat = pat.matcher(testString);
0188: assertTrue(mat.matches());
0189:
0190: baseString = "(?i)a|(?s)b";
0191: testString = "B";
0192: pat = Pattern.compile(baseString);
0193: mat = pat.matcher(testString);
0194: assertTrue(mat.matches());
0195:
0196: baseString = "(?i)a|(?-i)b";
0197: testString = "B";
0198: pat = Pattern.compile(baseString);
0199: mat = pat.matcher(testString);
0200: assertFalse(mat.matches());
0201:
0202: baseString = "(?i)a|(?-i)c|b";
0203: testString = "B";
0204: pat = Pattern.compile(baseString);
0205: mat = pat.matcher(testString);
0206: assertFalse(mat.matches());
0207:
0208: baseString = "(?i)a|(?-i)c|(?i)b";
0209: testString = "B";
0210: pat = Pattern.compile(baseString);
0211: mat = pat.matcher(testString);
0212: assertTrue(mat.matches());
0213:
0214: baseString = "(?i)a|(?-i)b";
0215: testString = "A";
0216: pat = Pattern.compile(baseString);
0217: mat = pat.matcher(testString);
0218: assertTrue(mat.matches());
0219:
0220: baseString = "((?i))a";
0221: testString = "A";
0222: pat = Pattern.compile(baseString);
0223: mat = pat.matcher(testString);
0224: assertFalse(mat.matches());
0225:
0226: baseString = "|(?i)|a";
0227: testString = "A";
0228: pat = Pattern.compile(baseString);
0229: mat = pat.matcher(testString);
0230: assertTrue(mat.matches());
0231:
0232: baseString = "(?i)((?s)a.)";
0233: testString = "A\n";
0234: pat = Pattern.compile(baseString);
0235: mat = pat.matcher(testString);
0236: assertTrue(mat.matches());
0237:
0238: baseString = "(?i)((?-i)a)";
0239: testString = "A";
0240: pat = Pattern.compile(baseString);
0241: mat = pat.matcher(testString);
0242: assertFalse(mat.matches());
0243:
0244: baseString = "(?i)(?s:a.)";
0245: testString = "A\n";
0246: pat = Pattern.compile(baseString);
0247: mat = pat.matcher(testString);
0248: assertTrue(mat.matches());
0249:
0250: baseString = "(?i)fgh(?s:aa)";
0251: testString = "fghAA";
0252: pat = Pattern.compile(baseString);
0253: mat = pat.matcher(testString);
0254: assertTrue(mat.matches());
0255:
0256: baseString = "(?i)((?-i))a";
0257: testString = "A";
0258: pat = Pattern.compile(baseString);
0259: mat = pat.matcher(testString);
0260: assertTrue(mat.matches());
0261:
0262: baseString = "abc(?i)d";
0263: testString = "ABCD";
0264: pat = Pattern.compile(baseString);
0265: mat = pat.matcher(testString);
0266: assertFalse(mat.matches());
0267:
0268: testString = "abcD";
0269: mat = pat.matcher(testString);
0270: assertTrue(mat.matches());
0271:
0272: baseString = "a(?i)a(?-i)a(?i)a(?-i)a";
0273: testString = "aAaAa";
0274: pat = Pattern.compile(baseString);
0275: mat = pat.matcher(testString);
0276: assertTrue(mat.matches());
0277:
0278: testString = "aAAAa";
0279: mat = pat.matcher(testString);
0280: assertFalse(mat.matches());
0281: }
0282:
0283: public void testFlagsMethod() {
0284: String baseString;
0285: Pattern pat;
0286:
0287: /*
0288: * These tests are for compatibility with RI only. Logically we have to
0289: * return only flags specified during the compilation. For example
0290: * pat.flags() == 0 when we compile Pattern pat =
0291: * Pattern.compile("(?i)abc(?-i)"); but the whole expression is compiled
0292: * in a case insensitive manner. So there is little sense to do calls to
0293: * flags() now.
0294: */
0295: baseString = "(?-i)";
0296: pat = Pattern.compile(baseString);
0297:
0298: baseString = "(?idmsux)abc(?-i)vg(?-dmu)";
0299: pat = Pattern.compile(baseString);
0300: assertEquals(pat.flags(), Pattern.DOTALL | Pattern.COMMENTS);
0301:
0302: baseString = "(?idmsux)abc|(?-i)vg|(?-dmu)";
0303: pat = Pattern.compile(baseString);
0304: assertEquals(pat.flags(), Pattern.DOTALL | Pattern.COMMENTS);
0305:
0306: baseString = "(?is)a((?x)b.)";
0307: pat = Pattern.compile(baseString);
0308: assertEquals(pat.flags(), Pattern.DOTALL
0309: | Pattern.CASE_INSENSITIVE);
0310:
0311: baseString = "(?i)a((?-i))";
0312: pat = Pattern.compile(baseString);
0313: assertEquals(pat.flags(), Pattern.CASE_INSENSITIVE);
0314:
0315: baseString = "((?i)a)";
0316: pat = Pattern.compile(baseString);
0317: assertEquals(pat.flags(), 0);
0318:
0319: pat = Pattern.compile("(?is)abc");
0320: assertEquals(pat.flags(), Pattern.CASE_INSENSITIVE
0321: | Pattern.DOTALL);
0322: }
0323:
0324: /*
0325: * Class under test for Pattern compile(String, int)
0326: */
0327: public void testCompileStringint() {
0328: /*
0329: * this tests are needed to verify that appropriate exceptions are
0330: * thrown
0331: */
0332: String pattern = "b)a";
0333: try {
0334: Pattern.compile(pattern);
0335: fail("Expected a PatternSyntaxException when compiling pattern: "
0336: + pattern);
0337: } catch (PatternSyntaxException e) {
0338: // pass
0339: }
0340: pattern = "bcde)a";
0341: try {
0342: Pattern.compile(pattern);
0343: fail("Expected a PatternSyntaxException when compiling pattern: "
0344: + pattern);
0345: } catch (PatternSyntaxException e) {
0346: // pass
0347: }
0348: pattern = "bbg())a";
0349: try {
0350: Pattern.compile(pattern);
0351: fail("Expected a PatternSyntaxException when compiling pattern: "
0352: + pattern);
0353: } catch (PatternSyntaxException e) {
0354: // pass
0355: }
0356:
0357: pattern = "cdb(?i))a";
0358: try {
0359: Pattern.compile(pattern);
0360: fail("Expected a PatternSyntaxException when compiling pattern: "
0361: + pattern);
0362: } catch (PatternSyntaxException e) {
0363: // pass
0364: }
0365:
0366: /*
0367: * This pattern should compile - HARMONY-2127
0368: */
0369: pattern = "x(?c)y";
0370: Pattern.compile(pattern);
0371:
0372: /*
0373: * this pattern doesn't match any string, but should be compiled anyway
0374: */
0375: pattern = "(b\\1)a";
0376: Pattern.compile(pattern);
0377: }
0378:
0379: /*
0380: * Class under test for Pattern compile(String)
0381: */
0382: public void testQuantCompileNeg() {
0383: String[] patterns = { "5{,2}", "{5asd", "{hgdhg", "{5,hjkh",
0384: "{,5hdsh", "{5,3shdfkjh}" };
0385: for (String element : patterns) {
0386: try {
0387: Pattern.compile(element);
0388: fail("PatternSyntaxException was expected, but compilation succeeds");
0389: } catch (PatternSyntaxException pse) {
0390: continue;
0391: }
0392: }
0393: // Regression for HARMONY-1365
0394: String pattern = "(?![^\\<C\\f\\0146\\0270\\}&&[|\\02-\\x3E\\}|X-\\|]]{7,}+)[|\\\\\\x98\\<\\?\\u4FCFr\\,\\0025\\}\\004|\\0025-\\052\061]|(?<![|\\01-\\u829E])|(?<!\\p{Alpha})|^|(?-s:[^\\x15\\\\\\x24F\\a\\,\\a\\u97D8[\\x38\\a[\\0224-\\0306[^\\0020-\\u6A57]]]]??)(?uxix:[^|\\{\\[\\0367\\t\\e\\x8C\\{\\[\\074c\\]V[|b\\fu\\r\\0175\\<\\07f\\066s[^D-\\x5D]]])(?xx:^{5,}+)(?uuu)(?=^\\D)|(?!\\G)(?>\\G*?)(?![^|\\]\\070\\ne\\{\\t\\[\\053\\?\\\\\\x51\\a\\075\\0023-\\[&&[|\\022-\\xEA\\00-\\u41C2&&[^|a-\\xCC&&[^\\037\\uECB3\\u3D9A\\x31\\|\\<b\\0206\\uF2EC\\01m\\,\\ak\\a\\03&&\\p{Punct}]]]])(?-dxs:[|\\06-\\07|\\e-\\x63&&[|Tp\\u18A3\\00\\|\\xE4\\05\\061\\015\\0116C|\\r\\{\\}\\006\\xEA\\0367\\xC4\\01\\0042\\0267\\xBB\\01T\\}\\0100\\?[|\\[-\\u459B|\\x23\\x91\\rF\\0376[|\\?-\\x94\\0113-\\\\\\s]]]]{6}?)(?<=[^\\t-\\x42H\\04\\f\\03\\0172\\?i\\u97B6\\e\\f\\uDAC2])(?=\\B*+)(?>[^\\016\\r\\{\\,\\uA29D\\034\\02[\\02-\\[|\\t\\056\\uF599\\x62\\e\\<\\032\\uF0AC\\0026\\0205Q\\|\\\\\\06\\0164[|\\057-\\u7A98&&[\\061-g|\\|\\0276\\n\\042\\011\\e\\xE8\\x64B\\04\\u6D0EDW^\\p{Lower}]]]]?)(?<=[^\\n\\\\\\t\\u8E13\\,\\0114\\u656E\\xA5\\]&&[\\03-\\026|\\uF39D\\01\\{i\\u3BC2\\u14FE]])(?<=[^|\\uAE62\\054H\\|\\}&&^\\p{Space}])(?sxx)(?<=[\\f\\006\\a\\r\\xB4]*+)|(?x-xd:^{5}+)()";
0395: assertNotNull(Pattern.compile(pattern));
0396: }
0397:
0398: public void testQuantCompilePos() {
0399: String[] patterns = {/* "(abc){1,3}", */"abc{2,}", "abc{5}" };
0400: for (String element : patterns) {
0401: Pattern.compile(element);
0402: }
0403: }
0404:
0405: public void testQuantComposition() {
0406: String pattern = "(a{1,3})aab";
0407: java.util.regex.Pattern pat = java.util.regex.Pattern
0408: .compile(pattern);
0409: java.util.regex.Matcher mat = pat.matcher("aaab");
0410: mat.matches();
0411: mat.start(1);
0412: mat.group(1);
0413: }
0414:
0415: public void testMatches() {
0416: String[][] posSeq = {
0417: { "abb", "ababb", "abababbababb",
0418: "abababbababbabababbbbbabb" },
0419: { "213567", "12324567", "1234567", "213213567",
0420: "21312312312567", "444444567" },
0421: { "abcdaab", "aab", "abaab", "cdaab", "acbdadcbaab" },
0422: { "213234567", "3458", "0987654", "7689546432",
0423: "0398576", "98432", "5" },
0424: {
0425: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
0426: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
0427: + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" },
0428: { "ababbaAabababblice", "ababbaAliceababab",
0429: "ababbAabliceaaa", "abbbAbbbliceaaa", "Alice" },
0430: { "a123", "bnxnvgds156", "for", "while", "if", "struct" },
0431: { "xy" }, { "xy" }, { "xcy" }
0432:
0433: };
0434:
0435: for (int i = 0; i < testPatterns.length; i++) {
0436: for (int j = 0; j < posSeq[i].length; j++) {
0437: assertTrue("Incorrect match: " + testPatterns[i]
0438: + " vs " + posSeq[i][j], Pattern.matches(
0439: testPatterns[i], posSeq[i][j]));
0440: }
0441: }
0442: }
0443:
0444: public void testTimeZoneIssue() {
0445: Pattern p = Pattern.compile("GMT(\\+|\\-)(\\d+)(:(\\d+))?");
0446: Matcher m = p.matcher("GMT-9:45");
0447: assertTrue(m.matches());
0448: assertEquals("-", m.group(1));
0449: assertEquals("9", m.group(2));
0450: assertEquals(":45", m.group(3));
0451: assertEquals("45", m.group(4));
0452: }
0453:
0454: public void testCompileRanges() {
0455: String[] correctTestPatterns = { "[^]*abb]*",
0456: "[^a-d[^m-p]]*abb", "[a-d\\d]*abb", "[abc]*abb",
0457: "[a-e&&[de]]*abb", "[^abc]*abb", "[a-e&&[^de]]*abb",
0458: "[a-z&&[^m-p]]*abb", "[a-d[m-p]]*abb", "[a-zA-Z]*abb",
0459: "[+*?]*abb", "[^+*?]*abb" };
0460:
0461: String[] inputSecuence = { "kkkk", "admpabb",
0462: "abcabcd124654abb", "abcabccbacababb",
0463: "dededededededeedabb", "gfdhfghgdfghabb",
0464: "accabacbcbaabb", "acbvfgtyabb", "adbcacdbmopabcoabb",
0465: "jhfkjhaSDFGHJkdfhHNJMjkhfabb", "+*??+*abb",
0466: "sdfghjkabb" };
0467:
0468: for (int i = 0; i < correctTestPatterns.length; i++) {
0469: assertTrue("pattern: " + correctTestPatterns[i]
0470: + " input: " + inputSecuence[i], Pattern.matches(
0471: correctTestPatterns[i], inputSecuence[i]));
0472:
0473: }
0474:
0475: String[] wrongInputSecuence = { "]", "admpkk",
0476: "abcabcd124k654abb", "abwcabccbacababb",
0477: "abababdeababdeabb", "abcabcacbacbabb", "acdcbecbaabb",
0478: "acbotyabb", "adbcaecdbmopabcoabb",
0479: "jhfkjhaSDFGHJk;dfhHNJMjkhfabb", "+*?a?+*abb",
0480: "sdf+ghjkabb" };
0481:
0482: for (int i = 0; i < correctTestPatterns.length; i++) {
0483: assertFalse("pattern: " + correctTestPatterns[i]
0484: + " input: " + wrongInputSecuence[i], Pattern
0485: .matches(correctTestPatterns[i],
0486: wrongInputSecuence[i]));
0487:
0488: }
0489: }
0490:
0491: public void testRangesSpecialCases() {
0492: String neg_patterns[] = { "[a-&&[b-c]]", "[a-\\w]", "[b-a]",
0493: "[]" };
0494:
0495: for (String element : neg_patterns) {
0496: try {
0497: Pattern.compile(element);
0498: fail("PatternSyntaxException was expected: " + element);
0499: } catch (PatternSyntaxException pse) {
0500: }
0501: }
0502:
0503: String pos_patterns[] = { "[-]+", "----", "[a-]+",
0504: "a-a-a-a-aa--", "[\\w-a]+", "123-2312--aaa-213",
0505: "[a-]]+", "-]]]]]]]]]]]]]]]" };
0506:
0507: for (int i = 0; i < pos_patterns.length; i++) {
0508: String pat = pos_patterns[i++];
0509: String inp = pos_patterns[i];
0510: assertTrue("pattern: " + pat + " input: " + inp, Pattern
0511: .matches(pat, inp));
0512: }
0513: }
0514:
0515: public void testZeroSymbols() {
0516: assertTrue(Pattern.matches("[\0]*abb", "\0\0\0\0\0\0abb"));
0517: }
0518:
0519: public void testEscapes() {
0520: Pattern pat = Pattern.compile("\\Q{]()*?");
0521: Matcher mat = pat.matcher("{]()*?");
0522:
0523: assertTrue(mat.matches());
0524: }
0525:
0526: public void testRegressions() {
0527: // Bug 181
0528: Pattern.compile("[\\t-\\r]");
0529:
0530: // HARMONY-4472
0531: Pattern.compile("a*.+");
0532:
0533: // Bug187
0534: Pattern
0535: .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}]))");
0536: }
0537:
0538: public void testOrphanQuantifiers() {
0539: try {
0540: Pattern.compile("+++++");
0541: fail("PatternSyntaxException expected");
0542: } catch (PatternSyntaxException pse) {
0543: }
0544: }
0545:
0546: public void testOrphanQuantifiers2() {
0547: try {
0548: Pattern.compile("\\d+*");
0549: fail("PatternSyntaxException expected");
0550: } catch (PatternSyntaxException pse) {
0551: }
0552: }
0553:
0554: public void testBug197() {
0555: Object[] vals = { ":", new Integer(2),
0556: new String[] { "boo", "and:foo" }, ":", new Integer(5),
0557: new String[] { "boo", "and", "foo" }, ":",
0558: new Integer(-2), new String[] { "boo", "and", "foo" },
0559: ":", new Integer(3),
0560: new String[] { "boo", "and", "foo" }, ":",
0561: new Integer(1), new String[] { "boo:and:foo" }, "o",
0562: new Integer(5),
0563: new String[] { "b", "", ":and:f", "", "" }, "o",
0564: new Integer(4),
0565: new String[] { "b", "", ":and:f", "o" }, "o",
0566: new Integer(-2),
0567: new String[] { "b", "", ":and:f", "", "" }, "o",
0568: new Integer(0), new String[] { "b", "", ":and:f" } };
0569:
0570: for (int i = 0; i < vals.length / 3;) {
0571: String[] res = Pattern.compile(vals[i++].toString()).split(
0572: "boo:and:foo", ((Integer) vals[i++]).intValue());
0573: String[] expectedRes = (String[]) vals[i++];
0574:
0575: assertEquals(expectedRes.length, res.length);
0576:
0577: for (int j = 0; j < expectedRes.length; j++) {
0578: assertEquals(expectedRes[j], res[j]);
0579: }
0580: }
0581: }
0582:
0583: public void testURIPatterns() {
0584: String URI_REGEXP_STR = "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?";
0585: String SCHEME_REGEXP_STR = "^[a-zA-Z]{1}[\\w+-.]+$";
0586: String REL_URI_REGEXP_STR = "^(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?";
0587: String IPV6_REGEXP_STR = "^[0-9a-fA-F\\:\\.]+(\\%\\w+)?$";
0588: String IPV6_REGEXP_STR2 = "^\\[[0-9a-fA-F\\:\\.]+(\\%\\w+)?\\]$";
0589: String IPV4_REGEXP_STR = "^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$";
0590: String HOSTNAME_REGEXP_STR = "\\w+[\\w\\-\\.]*";
0591:
0592: Pattern.compile(URI_REGEXP_STR);
0593: Pattern.compile(REL_URI_REGEXP_STR);
0594: Pattern.compile(SCHEME_REGEXP_STR);
0595: Pattern.compile(IPV4_REGEXP_STR);
0596: Pattern.compile(IPV6_REGEXP_STR);
0597: Pattern.compile(IPV6_REGEXP_STR2);
0598: Pattern.compile(HOSTNAME_REGEXP_STR);
0599: }
0600:
0601: public void testFindBoundaryCases1() {
0602: Pattern pat = Pattern.compile(".*\n");
0603: Matcher mat = pat.matcher("a\n");
0604:
0605: mat.find();
0606: assertEquals("a\n", mat.group());
0607:
0608: }
0609:
0610: public void testFindBoundaryCases2() {
0611: Pattern pat = Pattern.compile(".*A");
0612: Matcher mat = pat.matcher("aAa");
0613:
0614: mat.find();
0615: assertEquals("aA", mat.group());
0616:
0617: }
0618:
0619: public void testFindBoundaryCases3() {
0620: Pattern pat = Pattern.compile(".*A");
0621: Matcher mat = pat.matcher("a\naA\n");
0622:
0623: mat.find();
0624: assertEquals("aA", mat.group());
0625:
0626: }
0627:
0628: public void testFindBoundaryCases4() {
0629: Pattern pat = Pattern.compile("A.*");
0630: Matcher mat = pat.matcher("A\n");
0631:
0632: mat.find();
0633: assertEquals("A", mat.group());
0634:
0635: }
0636:
0637: public void testFindBoundaryCases5() {
0638: Pattern pat = Pattern.compile(".*A.*");
0639: Matcher mat = pat.matcher("\nA\naaa\nA\naaAaa\naaaA\n");
0640: // Matcher mat = pat.matcher("\nA\n");
0641: String[] res = { "A", "A", "aaAaa", "aaaA" };
0642: int k = 0;
0643: for (; mat.find(); k++) {
0644: assertEquals(res[k], mat.group());
0645: }
0646: }
0647:
0648: public void testFindBoundaryCases6() {
0649: String[] res = { "", "a", "", "" };
0650: Pattern pat = Pattern.compile(".*");
0651: Matcher mat = pat.matcher("\na\n");
0652: int k = 0;
0653:
0654: for (; mat.find(); k++) {
0655: assertEquals(res[k], mat.group());
0656: }
0657: }
0658:
0659: public void _testFindBoundaryCases7() {
0660: Pattern pat = Pattern.compile(".*");
0661: Matcher mat = pat.matcher("\na\n");
0662: int k = 0;
0663:
0664: for (; mat.find(); k++) {
0665: System.out.println(mat.group());
0666: System.out.flush();
0667: }
0668: }
0669:
0670: public void testBackReferences() {
0671: Pattern pat = Pattern.compile("(\\((\\w*):(.*):(\\2)\\))");
0672: Matcher mat = pat
0673: .matcher("(start1: word :start1)(start2: word :start2)");
0674: int k = 1;
0675: for (; mat.find(); k++) {
0676: assertEquals("start" + k, mat.group(2));
0677: assertEquals(" word ", mat.group(3));
0678: assertEquals("start" + k, mat.group(4));
0679:
0680: }
0681:
0682: assertEquals(3, k);
0683: pat = Pattern.compile(".*(.)\\1");
0684: mat = pat.matcher("saa");
0685: assertTrue(mat.matches());
0686: }
0687:
0688: public void _testBackReferences1() {
0689: Pattern pat = Pattern.compile("(\\((\\w*):(.*):(\\2)\\))");
0690: Matcher mat = pat
0691: .matcher("(start1: word :start1)(start2: word :start2)");
0692: int k = 1;
0693: for (; mat.find(); k++) {
0694: System.out.println(mat.group(2));
0695: System.out.println(mat.group(3));
0696: System.out.println(mat.group(4));
0697:
0698: }
0699:
0700: assertEquals(3, k);
0701: }
0702:
0703: public void testNewLine() {
0704: Pattern pat = Pattern.compile("(^$)*\n", Pattern.MULTILINE);
0705: Matcher mat = pat.matcher("\r\n\n");
0706: int counter = 0;
0707: while (mat.find()) {
0708: counter++;
0709: }
0710: assertEquals(2, counter);
0711: }
0712:
0713: public void testFindGreedy() {
0714: Pattern pat = Pattern.compile(".*aaa", Pattern.DOTALL);
0715: Matcher mat = pat.matcher("aaaa\naaa\naaaaaa");
0716: mat.matches();
0717: assertEquals(15, mat.end());
0718: }
0719:
0720: public void testSerialization() throws Exception {
0721: Pattern pat = Pattern.compile("a*bc");
0722: SerializableAssert comparator = new SerializableAssert() {
0723: public void assertDeserialized(Serializable initial,
0724: Serializable deserialized) {
0725: assertEquals(((Pattern) initial).toString(),
0726: ((Pattern) deserialized).toString());
0727: }
0728: };
0729: SerializationTest.verifyGolden(this , pat, comparator);
0730: SerializationTest.verifySelf(pat, comparator);
0731: }
0732:
0733: public void testSOLQuant() {
0734: Pattern pat = Pattern.compile("$*", Pattern.MULTILINE);
0735: Matcher mat = pat.matcher("\n\n");
0736: int counter = 0;
0737: while (mat.find()) {
0738: counter++;
0739: }
0740:
0741: assertEquals(3, counter);
0742: }
0743:
0744: public void testIllegalEscape() {
0745: try {
0746: Pattern.compile("\\y");
0747: fail("PatternSyntaxException expected");
0748: } catch (PatternSyntaxException pse) {
0749: }
0750: }
0751:
0752: public void testEmptyFamily() {
0753: Pattern.compile("\\p{Lower}");
0754: }
0755:
0756: public void testNonCaptConstr() {
0757: // Flags
0758: Pattern pat = Pattern.compile("(?i)b*(?-i)a*");
0759: assertTrue(pat.matcher("bBbBaaaa").matches());
0760: assertFalse(pat.matcher("bBbBAaAa").matches());
0761:
0762: // Non-capturing groups
0763: pat = Pattern.compile("(?i:b*)a*");
0764: assertTrue(pat.matcher("bBbBaaaa").matches());
0765: assertFalse(pat.matcher("bBbBAaAa").matches());
0766:
0767: pat = Pattern
0768: // 1 2 3 4 5 6 7 8 9 10 11
0769: .compile("(?:-|(-?\\d+\\d\\d\\d))?(?:-|-(\\d\\d))?(?:-|-(\\d\\d))?(T)?(?:(\\d\\d):(\\d\\d):(\\d\\d)(\\.\\d+)?)?(?:(?:((?:\\+|\\-)\\d\\d):(\\d\\d))|(Z))?");
0770: Matcher mat = pat.matcher("-1234-21-31T41:51:61.789+71:81");
0771: assertTrue(mat.matches());
0772: assertEquals("-1234", mat.group(1));
0773: assertEquals("21", mat.group(2));
0774: assertEquals("31", mat.group(3));
0775: assertEquals("T", mat.group(4));
0776: assertEquals("41", mat.group(5));
0777: assertEquals("51", mat.group(6));
0778: assertEquals("61", mat.group(7));
0779: assertEquals(".789", mat.group(8));
0780: assertEquals("+71", mat.group(9));
0781: assertEquals("81", mat.group(10));
0782:
0783: // positive lookahead
0784: pat = Pattern.compile(".*\\.(?=log$).*$");
0785: assertTrue(pat.matcher("a.b.c.log").matches());
0786: assertFalse(pat.matcher("a.b.c.log.").matches());
0787:
0788: // negative lookahead
0789: pat = Pattern.compile(".*\\.(?!log$).*$");
0790: assertFalse(pat.matcher("abc.log").matches());
0791: assertTrue(pat.matcher("abc.logg").matches());
0792:
0793: // positive lookbehind
0794: pat = Pattern.compile(".*(?<=abc)\\.log$");
0795: assertFalse(pat.matcher("cde.log").matches());
0796: assertTrue(pat.matcher("abc.log").matches());
0797:
0798: // negative lookbehind
0799: pat = Pattern.compile(".*(?<!abc)\\.log$");
0800: assertTrue(pat.matcher("cde.log").matches());
0801: assertFalse(pat.matcher("abc.log").matches());
0802:
0803: // atomic group
0804: pat = Pattern.compile("(?>a*)abb");
0805: assertFalse(pat.matcher("aaabb").matches());
0806: pat = Pattern.compile("(?>a*)bb");
0807: assertTrue(pat.matcher("aaabb").matches());
0808:
0809: pat = Pattern.compile("(?>a|aa)aabb");
0810: assertTrue(pat.matcher("aaabb").matches());
0811: pat = Pattern.compile("(?>aa|a)aabb");
0812: assertFalse(pat.matcher("aaabb").matches());
0813:
0814: // quantifiers over look ahead
0815: pat = Pattern.compile(".*(?<=abc)*\\.log$");
0816: assertTrue(pat.matcher("cde.log").matches());
0817: pat = Pattern.compile(".*(?<=abc)+\\.log$");
0818: assertFalse(pat.matcher("cde.log").matches());
0819:
0820: }
0821:
0822: public void _testCorrectReplacementBackreferencedJointSet() {
0823: Pattern.compile("ab(a)*\\1");
0824: Pattern.compile("abc(cd)fg");
0825: Pattern.compile("aba*cd");
0826: Pattern.compile("ab(a)*+cd");
0827: Pattern.compile("ab(a)*?cd");
0828: Pattern.compile("ab(a)+cd");
0829: Pattern.compile(".*(.)\\1");
0830: Pattern.compile("ab((a)|c|d)e");
0831: Pattern.compile("abc((a(b))cd)");
0832: Pattern.compile("ab(a)++cd");
0833: Pattern.compile("ab(a)?(c)d");
0834: Pattern.compile("ab(a)?+cd");
0835: Pattern.compile("ab(a)??cd");
0836: Pattern.compile("ab(a)??cd");
0837: Pattern.compile("ab(a){1,3}?(c)d");
0838: }
0839:
0840: public void testCompilePatternWithTerminatorMark() {
0841: Pattern pat = Pattern.compile("a\u0000\u0000cd");
0842: Matcher mat = pat.matcher("a\u0000\u0000cd");
0843: assertTrue(mat.matches());
0844: }
0845:
0846: public void testAlternations() {
0847: String baseString = "|a|bc";
0848: Pattern pat = Pattern.compile(baseString);
0849: Matcher mat = pat.matcher("");
0850:
0851: assertTrue(mat.matches());
0852:
0853: baseString = "a||bc";
0854: pat = Pattern.compile(baseString);
0855: mat = pat.matcher("");
0856: assertTrue(mat.matches());
0857:
0858: baseString = "a|bc|";
0859: pat = Pattern.compile(baseString);
0860: mat = pat.matcher("");
0861: assertTrue(mat.matches());
0862:
0863: baseString = "a|b|";
0864: pat = Pattern.compile(baseString);
0865: mat = pat.matcher("");
0866: assertTrue(mat.matches());
0867:
0868: baseString = "a(|b|cd)e";
0869: pat = Pattern.compile(baseString);
0870: mat = pat.matcher("ae");
0871: assertTrue(mat.matches());
0872:
0873: baseString = "a(b||cd)e";
0874: pat = Pattern.compile(baseString);
0875: mat = pat.matcher("ae");
0876: assertTrue(mat.matches());
0877:
0878: baseString = "a(b|cd|)e";
0879: pat = Pattern.compile(baseString);
0880: mat = pat.matcher("ae");
0881: assertTrue(mat.matches());
0882:
0883: baseString = "a(b|c|)e";
0884: pat = Pattern.compile(baseString);
0885: mat = pat.matcher("ae");
0886: assertTrue(mat.matches());
0887:
0888: baseString = "a(|)e";
0889: pat = Pattern.compile(baseString);
0890: mat = pat.matcher("ae");
0891: assertTrue(mat.matches());
0892:
0893: baseString = "|";
0894: pat = Pattern.compile(baseString);
0895: mat = pat.matcher("");
0896: assertTrue(mat.matches());
0897:
0898: baseString = "a(?:|)e";
0899: pat = Pattern.compile(baseString);
0900: mat = pat.matcher("ae");
0901: assertTrue(mat.matches());
0902:
0903: baseString = "a||||bc";
0904: pat = Pattern.compile(baseString);
0905: mat = pat.matcher("");
0906: assertTrue(mat.matches());
0907:
0908: baseString = "(?i-is)|a";
0909: pat = Pattern.compile(baseString);
0910: mat = pat.matcher("a");
0911: assertTrue(mat.matches());
0912: }
0913:
0914: public void testMatchWithGroups() {
0915: String baseString = "jwkerhjwehrkwjehrkwjhrwkjehrjwkehrjkwhrkwehrkwhrkwrhwkhrwkjehr";
0916: String pattern = ".*(..).*\\1.*";
0917: assertTrue(Pattern.compile(pattern).matcher(baseString)
0918: .matches());
0919:
0920: baseString = "saa";
0921: pattern = ".*(.)\\1";
0922: assertTrue(Pattern.compile(pattern).matcher(baseString)
0923: .matches());
0924: assertTrue(Pattern.compile(pattern).matcher(baseString).find());
0925: }
0926:
0927: public void testSplitEmptyCharSequence() {
0928: String s1 = "";
0929: String[] arr = s1.split(":");
0930: assertEquals(arr.length, 1);
0931: }
0932:
0933: public void testSplitEndsWithPattern() {
0934: assertEquals(",,".split(",", 3).length, 3);
0935: assertEquals(",,".split(",", 4).length, 3);
0936:
0937: assertEquals(
0938: Pattern.compile("o").split("boo:and:foo", 5).length, 5);
0939: assertEquals(Pattern.compile("b").split("ab", -1).length, 2);
0940: }
0941:
0942: public void testCaseInsensitiveFlag() {
0943: assertTrue(Pattern.matches("(?i-:AbC)", "ABC"));
0944: }
0945:
0946: public void testEmptyGroups() {
0947: Pattern pat = Pattern.compile("ab(?>)cda");
0948: Matcher mat = pat.matcher("abcda");
0949: assertTrue(mat.matches());
0950:
0951: pat = Pattern.compile("ab()");
0952: mat = pat.matcher("ab");
0953: assertTrue(mat.matches());
0954:
0955: pat = Pattern.compile("abc(?:)(..)");
0956: mat = pat.matcher("abcgf");
0957: assertTrue(mat.matches());
0958: }
0959:
0960: public void testCompileNonCaptGroup() {
0961: boolean isCompiled = false;
0962:
0963: try {
0964: Pattern.compile("(?:)", Pattern.CANON_EQ);
0965: Pattern.compile("(?:)", Pattern.CANON_EQ | Pattern.DOTALL);
0966: Pattern.compile("(?:)", Pattern.CANON_EQ
0967: | Pattern.CASE_INSENSITIVE);
0968: Pattern.compile("(?:)", Pattern.CANON_EQ | Pattern.COMMENTS
0969: | Pattern.UNIX_LINES);
0970: isCompiled = true;
0971: } catch (PatternSyntaxException e) {
0972: System.out.println(e);
0973: }
0974: assertTrue(isCompiled);
0975: }
0976:
0977: public void testEmbeddedFlags() {
0978: String baseString = "(?i)((?s)a)";
0979: String testString = "A";
0980: Pattern pat = Pattern.compile(baseString);
0981: Matcher mat = pat.matcher(testString);
0982: assertTrue(mat.matches());
0983:
0984: baseString = "(?x)(?i)(?s)(?d)a";
0985: testString = "A";
0986: pat = Pattern.compile(baseString);
0987: mat = pat.matcher(testString);
0988: assertTrue(mat.matches());
0989:
0990: baseString = "(?x)(?i)(?s)(?d)a.";
0991: testString = "a\n";
0992: pat = Pattern.compile(baseString);
0993: mat = pat.matcher(testString);
0994: assertTrue(mat.matches());
0995:
0996: baseString = "abc(?x:(?i)(?s)(?d)a.)";
0997: testString = "abcA\n";
0998: pat = Pattern.compile(baseString);
0999: mat = pat.matcher(testString);
1000: assertTrue(mat.matches());
1001:
1002: baseString = "abc((?x)d)(?i)(?s)a";
1003: testString = "abcdA";
1004: pat = Pattern.compile(baseString);
1005: mat = pat.matcher(testString);
1006: assertTrue(mat.matches());
1007: }
1008:
1009: public void testAltWithFlags() {
1010: Pattern.compile("|(?i-xi)|()");
1011: }
1012:
1013: public void testRestoreFlagsAfterGroup() {
1014: String baseString = "abc((?x)d) a";
1015: String testString = "abcd a";
1016: Pattern pat = Pattern.compile(baseString);
1017: Matcher mat = pat.matcher(testString);
1018:
1019: assertTrue(mat.matches());
1020: }
1021:
1022: /*
1023: * Verify if the Pattern support the following character classes:
1024: * \p{javaLowerCase} \p{javaUpperCase} \p{javaWhitespace} \p{javaMirrored}
1025: */
1026: public void testCompileCharacterClass() {
1027: // Regression for HARMONY-606, 696
1028: Pattern pattern = Pattern.compile("\\p{javaLowerCase}");
1029: assertNotNull(pattern);
1030:
1031: pattern = Pattern.compile("\\p{javaUpperCase}");
1032: assertNotNull(pattern);
1033:
1034: pattern = Pattern.compile("\\p{javaWhitespace}");
1035: assertNotNull(pattern);
1036:
1037: pattern = Pattern.compile("\\p{javaMirrored}");
1038: assertNotNull(pattern);
1039:
1040: pattern = Pattern.compile("\\p{javaDefined}");
1041: assertNotNull(pattern);
1042:
1043: pattern = Pattern.compile("\\p{javaDigit}");
1044: assertNotNull(pattern);
1045:
1046: pattern = Pattern.compile("\\p{javaIdentifierIgnorable}");
1047: assertNotNull(pattern);
1048:
1049: pattern = Pattern.compile("\\p{javaISOControl}");
1050: assertNotNull(pattern);
1051:
1052: pattern = Pattern.compile("\\p{javaJavaIdentifierPart}");
1053: assertNotNull(pattern);
1054:
1055: pattern = Pattern.compile("\\p{javaJavaIdentifierStart}");
1056: assertNotNull(pattern);
1057:
1058: pattern = Pattern.compile("\\p{javaLetter}");
1059: assertNotNull(pattern);
1060:
1061: pattern = Pattern.compile("\\p{javaLetterOrDigit}");
1062: assertNotNull(pattern);
1063:
1064: pattern = Pattern.compile("\\p{javaSpaceChar}");
1065: assertNotNull(pattern);
1066:
1067: pattern = Pattern.compile("\\p{javaTitleCase}");
1068: assertNotNull(pattern);
1069:
1070: pattern = Pattern.compile("\\p{javaUnicodeIdentifierPart}");
1071: assertNotNull(pattern);
1072:
1073: pattern = Pattern.compile("\\p{javaUnicodeIdentifierStart}");
1074: assertNotNull(pattern);
1075: }
1076:
1077: public void testCanonEqFlag() {
1078:
1079: /*
1080: * for decompositions see
1081: * http://www.unicode.org/Public/4.0-Update/UnicodeData-4.0.0.txt
1082: * http://www.unicode.org/reports/tr15/#Decomposition
1083: */
1084: String baseString;
1085: String testString;
1086: Pattern pat;
1087: Matcher mat;
1088:
1089: baseString = "ab(a*)\\1";
1090: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1091:
1092: baseString = "a(abcdf)d";
1093: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1094:
1095: baseString = "aabcdfd";
1096: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1097:
1098: // \u01E0 -> \u0226\u0304 ->\u0041\u0307\u0304
1099: // \u00CC -> \u0049\u0300
1100:
1101: baseString = "\u01E0\u00CCcdb(ac)";
1102: testString = "\u0226\u0304\u0049\u0300cdbac";
1103: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1104: mat = pat.matcher(testString);
1105: assertTrue(mat.matches());
1106:
1107: baseString = "\u01E0cdb(a\u00CCc)";
1108: testString = "\u0041\u0307\u0304cdba\u0049\u0300c";
1109: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1110: mat = pat.matcher(testString);
1111: assertTrue(mat.matches());
1112:
1113: baseString = "a\u00CC";
1114: testString = "a\u0049\u0300";
1115: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1116: mat = pat.matcher(testString);
1117: assertTrue(mat.matches());
1118:
1119: baseString = "\u0226\u0304cdb(ac\u0049\u0300)";
1120: testString = "\u01E0cdbac\u00CC";
1121: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1122: mat = pat.matcher(testString);
1123: assertTrue(mat.matches());
1124:
1125: baseString = "cdb(?:\u0041\u0307\u0304\u00CC)";
1126: testString = "cdb\u0226\u0304\u0049\u0300";
1127: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1128: mat = pat.matcher(testString);
1129: assertTrue(mat.matches());
1130:
1131: baseString = "\u01E0[a-c]\u0049\u0300cdb(ac)";
1132: testString = "\u01E0b\u00CCcdbac";
1133: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1134: mat = pat.matcher(testString);
1135: assertTrue(mat.matches());
1136:
1137: baseString = "\u01E0|\u00CCcdb(ac)";
1138: testString = "\u0041\u0307\u0304";
1139: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1140: mat = pat.matcher(testString);
1141: assertTrue(mat.matches());
1142:
1143: baseString = "\u00CC?cdb(ac)*(\u01E0)*[a-c]";
1144: testString = "cdb\u0041\u0307\u0304b";
1145: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1146: mat = pat.matcher(testString);
1147: assertTrue(mat.matches());
1148:
1149: baseString = "a\u0300";
1150: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1151: mat = pat.matcher("a\u00E0a");
1152: assertTrue(mat.find());
1153:
1154: baseString = "\u7B20\uF9F8abc";
1155: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1156: mat = pat.matcher("\uF9F8\uF9F8abc");
1157: assertTrue(mat.matches());
1158:
1159: // \u01F9 -> \u006E\u0300
1160: // \u00C3 -> \u0041\u0303
1161:
1162: baseString = "cdb(?:\u00C3\u006E\u0300)";
1163: testString = "cdb\u0041\u0303\u01F9";
1164: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1165: mat = pat.matcher(testString);
1166: assertTrue(mat.matches());
1167:
1168: // \u014C -> \u004F\u0304
1169: // \u0163 -> \u0074\u0327
1170:
1171: baseString = "cdb(?:\u0163\u004F\u0304)";
1172: testString = "cdb\u0074\u0327\u014C";
1173: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1174: mat = pat.matcher(testString);
1175: assertTrue(mat.matches());
1176:
1177: // \u00E1->a\u0301
1178: // canonical ordering takes place \u0301\u0327 -> \u0327\u0301
1179:
1180: baseString = "c\u0327\u0301";
1181: testString = "c\u0301\u0327";
1182: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1183: mat = pat.matcher(testString);
1184: assertTrue(mat.matches());
1185:
1186: /*
1187: * Hangul decompositions
1188: */
1189: // \uD4DB->\u1111\u1171\u11B6
1190: // \uD21E->\u1110\u116D\u11B5
1191: // \uD264->\u1110\u1170
1192: // not Hangul:\u0453->\u0433\u0301
1193: baseString = "a\uD4DB\u1111\u1171\u11B6\uD264";
1194: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1195:
1196: baseString = "\u0453c\uD4DB";
1197: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1198:
1199: baseString = "a\u1110\u116D\u11B5b\uD21Ebc";
1200: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1201:
1202: baseString = "\uD4DB\uD21E\u1110\u1170cdb(ac)";
1203: testString = "\u1111\u1171\u11B6\u1110\u116D\u11B5\uD264cdbac";
1204: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1205: mat = pat.matcher(testString);
1206: assertTrue(mat.matches());
1207:
1208: baseString = "\uD4DB\uD264cdb(a\uD21Ec)";
1209: testString = "\u1111\u1171\u11B6\u1110\u1170cdba\u1110\u116D\u11B5c";
1210: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1211: mat = pat.matcher(testString);
1212: assertTrue(mat.matches());
1213:
1214: baseString = "a\uD4DB";
1215: testString = "a\u1111\u1171\u11B6";
1216: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1217: mat = pat.matcher(testString);
1218: assertTrue(mat.matches());
1219:
1220: baseString = "a\uD21E";
1221: testString = "a\u1110\u116D\u11B5";
1222: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1223: mat = pat.matcher(testString);
1224: assertTrue(mat.matches());
1225:
1226: baseString = "\u1111\u1171\u11B6cdb(ac\u1110\u116D\u11B5)";
1227: testString = "\uD4DBcdbac\uD21E";
1228: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1229: mat = pat.matcher(testString);
1230: assertTrue(mat.matches());
1231:
1232: baseString = "cdb(?:\u1111\u1171\u11B6\uD21E)";
1233: testString = "cdb\uD4DB\u1110\u116D\u11B5";
1234: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1235: mat = pat.matcher(testString);
1236: assertTrue(mat.matches());
1237:
1238: baseString = "\uD4DB[a-c]\u1110\u116D\u11B5cdb(ac)";
1239: testString = "\uD4DBb\uD21Ecdbac";
1240: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1241: mat = pat.matcher(testString);
1242: assertTrue(mat.matches());
1243:
1244: baseString = "\uD4DB|\u00CCcdb(ac)";
1245: testString = "\u1111\u1171\u11B6";
1246: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1247: mat = pat.matcher(testString);
1248: assertTrue(mat.matches());
1249:
1250: baseString = "\uD4DB|\u00CCcdb(ac)";
1251: testString = "\u1111\u1171";
1252: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1253: mat = pat.matcher(testString);
1254: assertFalse(mat.matches());
1255:
1256: baseString = "\u00CC?cdb(ac)*(\uD4DB)*[a-c]";
1257: testString = "cdb\u1111\u1171\u11B6b";
1258: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1259: mat = pat.matcher(testString);
1260: assertTrue(mat.matches());
1261:
1262: baseString = "\uD4DB";
1263: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1264: mat = pat.matcher("a\u1111\u1171\u11B6a");
1265: assertTrue(mat.find());
1266:
1267: baseString = "\u1111";
1268: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1269: mat = pat.matcher("bcda\uD4DBr");
1270: assertFalse(mat.find());
1271: }
1272:
1273: public void testIndexesCanonicalEq() {
1274: String baseString;
1275: String testString;
1276: Pattern pat;
1277: Matcher mat;
1278:
1279: baseString = "\uD4DB";
1280: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1281: mat = pat.matcher("bcda\u1111\u1171\u11B6awr");
1282: assertTrue(mat.find());
1283: assertEquals(mat.start(), 4);
1284: assertEquals(mat.end(), 7);
1285:
1286: baseString = "\uD4DB\u1111\u1171\u11B6";
1287: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1288: mat = pat.matcher("bcda\u1111\u1171\u11B6\uD4DBawr");
1289: assertTrue(mat.find());
1290: assertEquals(mat.start(), 4);
1291: assertEquals(mat.end(), 8);
1292:
1293: baseString = "\uD4DB\uD21E\u1110\u1170";
1294: testString = "abcabc\u1111\u1171\u11B6\u1110\u116D\u11B5\uD264cdbac";
1295: pat = Pattern.compile(baseString, Pattern.CANON_EQ);
1296: mat = pat.matcher(testString);
1297: assertTrue(mat.find());
1298: assertEquals(mat.start(), 6);
1299: assertEquals(mat.end(), 13);
1300: }
1301:
1302: public void testCanonEqFlagWithSupplementaryCharacters() {
1303:
1304: /*
1305: * \u1D1BF->\u1D1BB\u1D16F->\u1D1B9\u1D165\u1D16F in UTF32
1306: * \uD834\uDDBF->\uD834\uDDBB\uD834\uDD6F
1307: * ->\uD834\uDDB9\uD834\uDD65\uD834\uDD6F in UTF16
1308: */
1309: String patString = "abc\uD834\uDDBFef";
1310: String testString = "abc\uD834\uDDB9\uD834\uDD65\uD834\uDD6Fef";
1311: Pattern pat = Pattern.compile(patString, Pattern.CANON_EQ);
1312: Matcher mat = pat.matcher(testString);
1313: assertTrue(mat.matches());
1314:
1315: testString = "abc\uD834\uDDBB\uD834\uDD6Fef";
1316: mat = pat.matcher(testString);
1317: assertTrue(mat.matches());
1318:
1319: patString = "abc\uD834\uDDBB\uD834\uDD6Fef";
1320: testString = "abc\uD834\uDDBFef";
1321: pat = Pattern.compile(patString, Pattern.CANON_EQ);
1322: mat = pat.matcher(testString);
1323: assertTrue(mat.matches());
1324:
1325: testString = "abc\uD834\uDDB9\uD834\uDD65\uD834\uDD6Fef";
1326: mat = pat.matcher(testString);
1327: assertTrue(mat.matches());
1328:
1329: patString = "abc\uD834\uDDB9\uD834\uDD65\uD834\uDD6Fef";
1330: testString = "abc\uD834\uDDBFef";
1331: pat = Pattern.compile(patString, Pattern.CANON_EQ);
1332: mat = pat.matcher(testString);
1333: assertTrue(mat.matches());
1334:
1335: testString = "abc\uD834\uDDBB\uD834\uDD6Fef";
1336: mat = pat.matcher(testString);
1337: assertTrue(mat.matches());
1338:
1339: /*
1340: * testSupplementary characters with no decomposition
1341: */
1342: patString = "a\uD9A0\uDE8Ebc\uD834\uDDBB\uD834\uDD6Fe\uDE8Ef";
1343: testString = "a\uD9A0\uDE8Ebc\uD834\uDDBFe\uDE8Ef";
1344: pat = Pattern.compile(patString, Pattern.CANON_EQ);
1345: mat = pat.matcher(testString);
1346: assertTrue(mat.matches());
1347: }
1348:
1349: public void testRangesWithSurrogatesSupplementary() {
1350: String patString = "[abc\uD8D2]";
1351: String testString = "\uD8D2";
1352: Pattern pat = Pattern.compile(patString);
1353: Matcher mat = pat.matcher(testString);
1354: assertTrue(mat.matches());
1355:
1356: testString = "a";
1357: mat = pat.matcher(testString);
1358: assertTrue(mat.matches());
1359:
1360: testString = "ef\uD8D2\uDD71gh";
1361: mat = pat.matcher(testString);
1362: assertFalse(mat.find());
1363:
1364: testString = "ef\uD8D2gh";
1365: mat = pat.matcher(testString);
1366: assertTrue(mat.find());
1367:
1368: patString = "[abc\uD8D3&&[c\uD8D3]]";
1369: testString = "c";
1370: pat = Pattern.compile(patString);
1371: mat = pat.matcher(testString);
1372: assertTrue(mat.matches());
1373:
1374: testString = "a";
1375: mat = pat.matcher(testString);
1376: assertFalse(mat.matches());
1377:
1378: testString = "ef\uD8D3\uDD71gh";
1379: mat = pat.matcher(testString);
1380: assertFalse(mat.find());
1381:
1382: testString = "ef\uD8D3gh";
1383: mat = pat.matcher(testString);
1384: assertTrue(mat.find());
1385:
1386: patString = "[abc\uD8D3\uDBEE\uDF0C&&[c\uD8D3\uDBEE\uDF0C]]";
1387: testString = "c";
1388: pat = Pattern.compile(patString);
1389: mat = pat.matcher(testString);
1390: assertTrue(mat.matches());
1391:
1392: testString = "\uDBEE\uDF0C";
1393: mat = pat.matcher(testString);
1394: assertTrue(mat.matches());
1395:
1396: testString = "ef\uD8D3\uDD71gh";
1397: mat = pat.matcher(testString);
1398: assertFalse(mat.find());
1399:
1400: testString = "ef\uD8D3gh";
1401: mat = pat.matcher(testString);
1402: assertTrue(mat.find());
1403:
1404: patString = "[abc\uDBFC]\uDDC2cd";
1405: testString = "\uDBFC\uDDC2cd";
1406: pat = Pattern.compile(patString);
1407: mat = pat.matcher(testString);
1408: assertFalse(mat.matches());
1409:
1410: testString = "a\uDDC2cd";
1411: mat = pat.matcher(testString);
1412: assertTrue(mat.matches());
1413: }
1414:
1415: public void testSequencesWithSurrogatesSupplementary() {
1416: String patString = "abcd\uD8D3";
1417: String testString = "abcd\uD8D3\uDFFC";
1418: Pattern pat = Pattern.compile(patString);
1419: Matcher mat = pat.matcher(testString);
1420: assertFalse(mat.find());
1421:
1422: testString = "abcd\uD8D3abc";
1423: mat = pat.matcher(testString);
1424: assertTrue(mat.find());
1425:
1426: patString = "ab\uDBEFcd";
1427: testString = "ab\uDBEFcd";
1428: pat = Pattern.compile(patString);
1429: mat = pat.matcher(testString);
1430: assertTrue(mat.matches());
1431:
1432: patString = "\uDFFCabcd";
1433: testString = "\uD8D3\uDFFCabcd";
1434: pat = Pattern.compile(patString);
1435: mat = pat.matcher(testString);
1436: assertFalse(mat.find());
1437:
1438: testString = "abc\uDFFCabcdecd";
1439: mat = pat.matcher(testString);
1440: assertTrue(mat.find());
1441:
1442: patString = "\uD8D3\uDFFCabcd";
1443: testString = "abc\uD8D3\uD8D3\uDFFCabcd";
1444: pat = Pattern.compile(patString);
1445: mat = pat.matcher(testString);
1446: assertTrue(mat.find());
1447: }
1448:
1449: public void testPredefinedClassesWithSurrogatesSupplementary() {
1450: String patString = "[123\\D]";
1451: String testString = "a";
1452: Pattern pat = Pattern.compile(patString);
1453: Matcher mat = pat.matcher(testString);
1454: assertTrue(mat.find());
1455:
1456: testString = "5";
1457: mat = pat.matcher(testString);
1458: assertFalse(mat.find());
1459:
1460: testString = "3";
1461: mat = pat.matcher(testString);
1462: assertTrue(mat.find());
1463:
1464: // low surrogate
1465: testString = "\uDFC4";
1466: mat = pat.matcher(testString);
1467: assertTrue(mat.find());
1468:
1469: // high surrogate
1470: testString = "\uDADA";
1471: mat = pat.matcher(testString);
1472: assertTrue(mat.find());
1473:
1474: testString = "\uDADA\uDFC4";
1475: mat = pat.matcher(testString);
1476: assertTrue(mat.find());
1477:
1478: patString = "[123[^\\p{javaDigit}]]";
1479: testString = "a";
1480: pat = Pattern.compile(patString);
1481: mat = pat.matcher(testString);
1482: assertTrue(mat.find());
1483:
1484: testString = "5";
1485: mat = pat.matcher(testString);
1486: assertFalse(mat.find());
1487:
1488: testString = "3";
1489: mat = pat.matcher(testString);
1490: assertTrue(mat.find());
1491:
1492: // low surrogate
1493: testString = "\uDFC4";
1494: mat = pat.matcher(testString);
1495: assertTrue(mat.find());
1496:
1497: // high surrogate
1498: testString = "\uDADA";
1499: mat = pat.matcher(testString);
1500: assertTrue(mat.find());
1501:
1502: testString = "\uDADA\uDFC4";
1503: mat = pat.matcher(testString);
1504: assertTrue(mat.find());
1505:
1506: // surrogate characters
1507: patString = "\\p{Cs}";
1508: testString = "\uD916\uDE27";
1509: pat = Pattern.compile(patString);
1510: mat = pat.matcher(testString);
1511:
1512: /*
1513: * see http://www.unicode.org/reports/tr18/#Supplementary_Characters we
1514: * have to treat text as code points not code units. \\p{Cs} matches any
1515: * surrogate character but here testString is a one code point
1516: * consisting of two code units (two surrogate characters) so we find
1517: * nothing
1518: */
1519: assertFalse(mat.find());
1520:
1521: // swap low and high surrogates
1522: testString = "\uDE27\uD916";
1523: mat = pat.matcher(testString);
1524: assertTrue(mat.find());
1525:
1526: patString = "[\uD916\uDE271\uD91623&&[^\\p{Cs}]]";
1527: testString = "1";
1528: pat = Pattern.compile(patString);
1529: mat = pat.matcher(testString);
1530: assertTrue(mat.find());
1531:
1532: testString = "\uD916";
1533: pat = Pattern.compile(patString);
1534: mat = pat.matcher(testString);
1535: assertFalse(mat.find());
1536:
1537: testString = "\uD916\uDE27";
1538: pat = Pattern.compile(patString);
1539: mat = pat.matcher(testString);
1540: assertTrue(mat.find());
1541:
1542: // \uD9A0\uDE8E=\u7828E
1543: // \u78281=\uD9A0\uDE81
1544: patString = "[a-\uD9A0\uDE8E]";
1545: testString = "\uD9A0\uDE81";
1546: pat = Pattern.compile(patString);
1547: mat = pat.matcher(testString);
1548: assertTrue(mat.matches());
1549: }
1550:
1551: public void testDotConstructionWithSurrogatesSupplementary() {
1552: String patString = ".";
1553: String testString = "\uD9A0\uDE81";
1554: Pattern pat = Pattern.compile(patString);
1555: Matcher mat = pat.matcher(testString);
1556: assertTrue(mat.matches());
1557:
1558: testString = "\uDE81";
1559: mat = pat.matcher(testString);
1560: assertTrue(mat.matches());
1561:
1562: testString = "\uD9A0";
1563: mat = pat.matcher(testString);
1564: assertTrue(mat.matches());
1565:
1566: testString = "\n";
1567: mat = pat.matcher(testString);
1568: assertFalse(mat.matches());
1569:
1570: patString = ".*\uDE81";
1571: testString = "\uD9A0\uDE81\uD9A0\uDE81\uD9A0\uDE81";
1572: pat = Pattern.compile(patString);
1573: mat = pat.matcher(testString);
1574: assertFalse(mat.matches());
1575:
1576: testString = "\uD9A0\uDE81\uD9A0\uDE81\uDE81";
1577: mat = pat.matcher(testString);
1578: assertTrue(mat.matches());
1579:
1580: patString = ".*";
1581: testString = "\uD9A0\uDE81\n\uD9A0\uDE81\uD9A0\n\uDE81";
1582: pat = Pattern.compile(patString, Pattern.DOTALL);
1583: mat = pat.matcher(testString);
1584: assertTrue(mat.matches());
1585: }
1586:
1587: public void testQuantifiersWithSurrogatesSupplementary() {
1588: String patString = "\uD9A0\uDE81*abc";
1589: String testString = "\uD9A0\uDE81\uD9A0\uDE81abc";
1590: Pattern pat = Pattern.compile(patString);
1591: Matcher mat = pat.matcher(testString);
1592: assertTrue(mat.matches());
1593:
1594: testString = "abc";
1595: mat = pat.matcher(testString);
1596: assertTrue(mat.matches());
1597: }
1598:
1599: public void testAlternationsWithSurrogatesSupplementary() {
1600: String patString = "\uDE81|\uD9A0\uDE81|\uD9A0";
1601: String testString = "\uD9A0";
1602: Pattern pat = Pattern.compile(patString);
1603: Matcher mat = pat.matcher(testString);
1604: assertTrue(mat.matches());
1605:
1606: testString = "\uDE81";
1607: mat = pat.matcher(testString);
1608: assertTrue(mat.matches());
1609:
1610: testString = "\uD9A0\uDE81";
1611: mat = pat.matcher(testString);
1612: assertTrue(mat.matches());
1613:
1614: testString = "\uDE81\uD9A0";
1615: mat = pat.matcher(testString);
1616: assertFalse(mat.matches());
1617: }
1618:
1619: public void testGroupsWithSurrogatesSupplementary() {
1620:
1621: // this pattern matches nothing
1622: String patString = "(\uD9A0)\uDE81";
1623: String testString = "\uD9A0\uDE81";
1624: Pattern pat = Pattern.compile(patString);
1625: Matcher mat = pat.matcher(testString);
1626: assertFalse(mat.matches());
1627:
1628: patString = "(\uD9A0)";
1629: testString = "\uD9A0\uDE81";
1630: pat = Pattern.compile(patString, Pattern.DOTALL);
1631: mat = pat.matcher(testString);
1632: assertFalse(mat.find());
1633: }
1634:
1635: /*
1636: * Regression test for HARMONY-688
1637: */
1638: public void testUnicodeCategoryWithSurrogatesSupplementary() {
1639: Pattern p = Pattern.compile("\\p{javaLowerCase}");
1640: Matcher matcher = p.matcher("\uD801\uDC28");
1641: assertTrue(matcher.find());
1642: }
1643:
1644: public static void main(String[] args) {
1645: junit.textui.TestRunner.run(PatternTest.class);
1646: }
1647: }
|