Lines Matching refs:check

45  * This is a test class created to check the operation of
158 private static void check(Matcher m, String expected) {
164 private static void check(Matcher m, String result, boolean expected) {
170 private static void check(Pattern p, String s, boolean expected) {
175 private static void check(String p, String s, boolean expected) {
181 private static void check(String p, char c, boolean expected) {
190 private static void check(String p, int codePoint, boolean expected) {
199 private static void check(String p, int flag, String input, String s,
205 check(matcher, s, expected);
207 check(pattern, input, false);
260 private static boolean check(Runnable test) {
271 check(new Runnable() { public void run() { Pattern.compile(null); }});
272 check(new Runnable() { public void run() { Pattern.matches(null, null); }});
273 check(new Runnable() { public void run() { Pattern.matches("xyz", null);}});
274 check(new Runnable() { public void run() { Pattern.quote(null);}});
275 check(new Runnable() { public void run() { Pattern.compile("xyz").split(null);}});
276 check(new Runnable() { public void run() { Pattern.compile("xyz").matcher(null);}});
280 check(new Runnable() { public void run() { m.appendTail(null);}});
281 check(new Runnable() { public void run() { m.replaceAll(null);}});
282 check(new Runnable() { public void run() { m.replaceFirst(null);}});
283 check(new Runnable() { public void run() { m.appendReplacement(null, null);}});
284 check(new Runnable() { public void run() { m.reset(null);}});
285 check(new Runnable() { public void run() { Matcher.quoteReplacement(null);}});
286 //check(new Runnable() { public void run() { m.usePattern(null);}});
468 static void check(String regex, String input, String[] expected) {
481 check("(?<=%.{0,5})foo\\d",
487 check("(?<=.*\\b)foo", "abcd foo", new String[]{"foo"});
488 check("(?<=.*)\\bfoo", "abcd foo", new String[]{"foo"});
489 check("(?<!abc )\\bfoo", "abc foo", new String[0]);
490 check("(?<!abc \\b)foo", "abc foo", new String[0]);
493 check("(?<!%.{0,5})foo\\d",
498 check("(?<=%b{1,4})foo", "%bbbbfoo", new String[] {"foo"});
501 check("(?<=%b{1,4}?)foo", "%bbbbfoo", new String[] {"foo"});
504 check("(?<=%b{1,4})fo\ud800\udc00o", "%bbbbfo\ud800\udc00o",
506 check("(?<=%b{1,4}?)fo\ud800\udc00o", "%bbbbfo\ud800\udc00o",
508 check("(?<!%b{1,4})fo\ud800\udc00o", "%afo\ud800\udc00o",
510 check("(?<!%b{1,4}?)fo\ud800\udc00o", "%afo\ud800\udc00o",
671 check(pattern, "abc\\t$^", true);
674 check(pattern, "abc\\t$^", true);
677 check(pattern, "\\Qa^$bcabc\\E", true);
678 check(pattern, "a^$bcabc", false);
681 check(pattern, "\\Q\\E", true);
684 check(pattern, "abcefg\\Q\\Ehij", true);
687 check(pattern, "\\\\\\\\", true);
690 check(pattern, "\\Qa^$bcabc\\E", true);
691 check(pattern, "a^$bcabc", false);
694 check(pattern, "\\Qabc\\Edef", true);
695 check(pattern, "abcdef", false);
698 check(pattern, "abc\\Edef", true);
699 check(pattern, "abcdef", false);
702 check(pattern, "\\E", true);
705 check(pattern, "((((abc.+?:)", true);
710 check(pattern, "abc^cat$def", true);
711 check(pattern, "cat", false);
716 check(pattern, "ABCDEF", true);
717 check(pattern, "AbCdEf", true);
722 check(pattern, "A...b", true);
723 check(pattern, "Axxxb", false);
728 check(pattern, "testa\u030a", false);
729 check(pattern, "test\u00e5", false);
735 check(pattern, toSupplementaries("abc\\t$^"), true);
738 check(pattern, toSupplementaries("abc\\t$^"), true);
741 check(pattern, toSupplementaries("\\Qa^$bcabc\\E"), true);
742 check(pattern, toSupplementaries("a^$bcabc"), false);
745 check(pattern, toSupplementaries("\\Qa^$bcabc\\E"), true);
746 check(pattern, toSupplementaries("a^$bcabc"), false);
749 check(pattern, toSupplementaries("\\Qabc\\Edef"), true);
750 check(pattern, toSupplementaries("abcdef"), false);
753 check(pattern, toSupplementaries("abc\\Edef"), true);
754 check(pattern, toSupplementaries("abcdef"), false);
757 check(pattern, toSupplementaries("((((abc.+?:)"), true);
762 check(pattern, toSupplementaries("abc^cat$def"), true);
763 check(pattern, toSupplementaries("cat"), false);
769 check(pattern, toSupplementaries("a...b"), true);
770 check(pattern, toSupplementaries("axxxb"), false);
776 check(pattern, t + "a\u030a", false);
777 check(pattern, t + "\u00e5", false);
940 check(pattern, "dir1\\dir2", true);
943 check(pattern, "dir1\\dir2\\", true);
946 check(pattern, "dir1\\dir2\\", true);
950 check(pattern, toSupplementaries("dir1\\dir2"), true);
953 check(pattern, toSupplementaries("dir1\\dir2\\"), true);
956 check(pattern, toSupplementaries("dir1\\dir2\\"), true);
980 check(patterns[i], 0, input, input, true);
1012 check("{javaLowerCase}", c, Character.isLowerCase(c));
1013 check("{javaUpperCase}", c, Character.isUpperCase(c));
1014 check("{javaUpperCase}+", c, Character.isUpperCase(c));
1015 check("{javaTitleCase}", c, Character.isTitleCase(c));
1016 check("{javaDigit}", c, Character.isDigit(c));
1017 check("{javaDefined}", c, Character.isDefined(c));
1018 check("{javaLetter}", c, Character.isLetter(c));
1019 check("{javaLetterOrDigit}", c, Character.isLetterOrDigit(c));
1020 check("{javaJavaIdentifierStart}", c,
1022 check("{javaJavaIdentifierPart}", c,
1024 check("{javaUnicodeIdentifierStart}", c,
1026 check("{javaUnicodeIdentifierPart}", c,
1028 check("{javaIdentifierIgnorable}", c,
1030 check("{javaSpaceChar}", c, Character.isSpaceChar(c));
1031 check("{javaWhitespace}", c, Character.isWhitespace(c));
1032 check("{javaISOControl}", c, Character.isISOControl(c));
1033 check("{javaMirrored}", c, Character.isMirrored(c));
1042 check("{javaLowerCase}", c, Character.isLowerCase(c));
1043 check("{javaUpperCase}", c, Character.isUpperCase(c));
1044 check("{javaUpperCase}+", c, Character.isUpperCase(c));
1045 check("{javaTitleCase}", c, Character.isTitleCase(c));
1046 check("{javaDigit}", c, Character.isDigit(c));
1047 check("{javaDefined}", c, Character.isDefined(c));
1048 check("{javaLetter}", c, Character.isLetter(c));
1049 check("{javaLetterOrDigit}", c, Character.isLetterOrDigit(c));
1050 check("{javaJavaIdentifierStart}", c,
1052 check("{javaJavaIdentifierPart}", c,
1054 check("{javaUnicodeIdentifierStart}", c,
1056 check("{javaUnicodeIdentifierPart}", c,
1058 check("{javaIdentifierIgnorable}", c,
1060 check("{javaSpaceChar}", c, Character.isSpaceChar(c));
1061 check("{javaWhitespace}", c, Character.isWhitespace(c));
1062 check("{javaISOControl}", c, Character.isISOControl(c));
1063 check("{javaMirrored}", c, Character.isMirrored(c));
1096 check("^....", flags1, "test\ntest", "test", true);
1097 check(".....^", flags1, "test\ntest", "test", false);
1098 check(".....^", flags1, "test\n", "test", false);
1099 check("....^", flags1, "test\r\n", "test", false);
1101 check("^....", flags2, "test\ntest", "test", true);
1102 check("....^", flags2, "test\ntest", "test", false);
1103 check(".....^", flags2, "test\n", "test", false);
1104 check("....^", flags2, "test\r\n", "test", false);
1106 check("^....", flags3, "test\ntest", "test", true);
1107 check(".....^", flags3, "test\ntest", "test\n", true);
1108 check(".....^", flags3, "test\u0085test", "test\u0085", false);
1109 check(".....^", flags3, "test\n", "test", false);
1110 check(".....^", flags3, "test\r\n", "test", false);
1111 check("......^", flags3, "test\r\ntest", "test\r\n", true);
1113 check("^....", flags4, "test\ntest", "test", true);
1114 check(".....^", flags3, "test\ntest", "test\n", true);
1115 check(".....^", flags4, "test\u0085test", "test\u0085", true);
1116 check(".....^", flags4, "test\n", "test\n", false);
1117 check(".....^", flags4, "test\r\n", "test\r", false);
1121 check("^....", flags1, t+"\n"+t, t, true);
1122 check(".....^", flags1, t+"\n"+t, t, false);
1123 check(".....^", flags1, t+"\n", t, false);
1124 check("....^", flags1, t+"\r\n", t, false);
1126 check("^....", flags2, t+"\n"+t, t, true);
1127 check("....^", flags2, t+"\n"+t, t, false);
1128 check(".....^", flags2, t+"\n", t, false);
1129 check("....^", flags2, t+"\r\n", t, false);
1131 check("^....", flags3, t+"\n"+t, t, true);
1132 check(".....^", flags3, t+"\n"+t, t+"\n", true);
1133 check(".....^", flags3, t+"\u0085"+t, t+"\u0085", false);
1134 check(".....^", flags3, t+"\n", t, false);
1135 check(".....^", flags3, t+"\r\n", t, false);
1136 check("......^", flags3, t+"\r\n"+t, t+"\r\n", true);
1138 check("^....", flags4, t+"\n"+t, t, true);
1139 check(".....^", flags3, t+"\n"+t, t+"\n", true);
1140 check(".....^", flags4, t+"\u0085"+t, t+"\u0085", true);
1141 check(".....^", flags4, t+"\n", t+"\n", false);
1142 check(".....^", flags4, t+"\r\n", t+"\r", false);
1153 check("....$", flags1, "test\n", "test", true);
1154 check("....$", flags1, "test\r\n", "test", true);
1155 check(".....$", flags1, "test\n", "test\n", true);
1156 check(".....$", flags1, "test\u0085", "test\u0085", true);
1157 check("....$", flags1, "test\u0085", "test", true);
1159 check("....$", flags2, "test\n", "test", true);
1160 check(".....$", flags2, "test\n", "test\n", true);
1161 check(".....$", flags2, "test\u0085", "test\u0085", true);
1162 check("....$", flags2, "test\u0085", "est\u0085", true);
1164 check("....$.blah", flags3, "test\nblah", "test\nblah", true);
1165 check(".....$.blah", flags3, "test\n\nblah", "test\n\nblah", true);
1166 check("....$blah", flags3, "test\nblah", "!!!!", false);
1167 check(".....$blah", flags3, "test\nblah", "!!!!", false);
1172 check("....$", flags1, t+"\n", t, true);
1173 check("....$", flags1, t+"\r\n", t, true);
1174 check(".....$", flags1, t+"\n", t+"\n", true);
1175 check(".....$", flags1, t+"\u0085", t+"\u0085", true);
1176 check("....$", flags1, t+"\u0085", t, true);
1178 check("....$", flags2, t+"\n", t, true);
1179 check(".....$", flags2, t+"\n", t+"\n", true);
1180 check(".....$", flags2, t+"\u0085", t+"\u0085", true);
1181 check("....$", flags2, t+"\u0085", toSupplementaries("est\u0085"), true);
1183 check("....$."+b, flags3, t+"\n"+b, t+"\n"+b, true);
1184 check(".....$."+b, flags3, t+"\n\n"+b, t+"\n\n"+b, true);
1185 check("....$"+b, flags3, t+"\n"+b, "!!!!", false);
1186 check(".....$"+b, flags3, t+"\n"+b, "!!!!", false);
1216 check(p, "1 word word word 2", true);
1217 check(p, "1 wor wo w 2", true);
1218 check(p, "1 word word 2", true);
1219 check(p, "1 word 2", true);
1220 check(p, "1 wo w w 2", true);
1221 check(p, "1 wo w 2", true);
1222 check(p, "1 wor w 2", true);
1226 check(m, "ababc");
1231 check(m, toSupplementaries("ababc"));
1286 check(pattern, "foo\u0085", true);
1287 check(pattern, "foo\u2028", true);
1288 check(pattern, "foo\u2029", true);
1289 check(pattern, "foo\n", true);
1290 check(pattern, "foo\r", true);
1291 check(pattern, "foo\r\n", true);
1293 check(pattern, "fooo", false);
1294 check(pattern, "foo\n\r", false);
1298 check(pattern, "foo", true);
1299 check(pattern, "foo\n", true);
1301 check(pattern, "foo\r", false);
1302 check(pattern, "foo\u0085", false);
1303 check(pattern, "foo\u2028", false);
1304 check(pattern, "foo\u2029", false);
1390 check(matcher, "a\u2028", false);
1408 check(matcher, toSupplementaries("a\u2028"), false);
1768 check(pattern, "@@@@&&&&", true);
1771 check(pattern, "@@@@&&&&", true);
1774 check(pattern, "@@@@&&&&", true);
1846 check(matcher, "testing");
1885 check(matcher, toSupplementaries("testing"));
1995 check(pattern, "blahb]blech", true);
1998 check(pattern, "b", true);
2002 check(pattern, toSupplementaries("blahb]blech"), true);
2005 check(pattern, toSupplementaries("b"), true);
2012 check(pattern, "ab\u00ffcd", true);
2013 check(pattern, "Ab\u0178Cd", true);
2019 check(pattern, "ab\u00b5cd", true);
2020 check(pattern, "Ab\u039cCd", true);
2041 check(matcher, "a");
2042 check(matcher, "");
2043 check(matcher, "bc");
2044 check(matcher, "");
2045 check(matcher, "def");
2046 check(matcher, "");
2047 check(matcher, "");
2048 check(matcher, "g");
2049 check(matcher, "");
2055 check(matcher, "a");
2061 check(matcher, "a");
2062 check(matcher, "b");
2063 check(matcher, "c");
2064 check(matcher, "x");
2070 check(matcher, "a");
2076 check(matcher, "abc");
2082 check(matcher, "abc");
2083 check(matcher, "jkl");
2157 check(pattern, "zzzaabcazzz", true);
2160 check(pattern, "zzzaabcaazzz", true);
2163 check(pattern, "abcdefabc", true);
2166 check(pattern, "abcdefabc", false);
2173 check(pattern, "abcdef", false);
2180 check(pattern, "abcdefghija", false);
2181 check(pattern, "abcdefghija1", true);
2184 check(pattern, "abcdefghijkk", true);
2187 check(pattern, "abcdefghija1", true);
2191 check(pattern, toSupplementaries("zzzaabcazzz"), true);
2194 check(pattern, toSupplementaries("zzzaabcaazzz"), true);
2197 check(pattern, toSupplementaries("abcdefabc"), true);
2200 check(pattern, toSupplementaries("abcdefabc"), false);
2203 check(pattern, toSupplementaries("abcdefghija"), false);
2204 check(pattern, toSupplementaries("abcdefghija1"), true);
2207 check(pattern, toSupplementaries("abcdefghijkk"), true);
2474 check(p, "testa\u0308\u0300", true);
2475 check(p, "testa\u0300\u0308", false);
2479 check(p, "testa\u0308\u0323", true);
2480 check(p, "testa\u0323\u0308", true);
2484 check(p, "testa\u0308\u0323\u0300", true);
2485 check(p, "testa\u0323\u0308\u0300", true);
2486 check(p, "testa\u0308\u0300\u0323", true);
2487 check(p, "test\u00e4\u0323\u0300", true);
2488 check(p, "test\u00e4\u0300\u0323", true);
3342 private static void check(Pattern p, String s, String g, String expected) {
3390 check(Pattern.compile("x+(?<gname>y+)z+"),
3395 check(Pattern.compile("x+(?<gname8>y+)z+"),
3402 check(pattern, "zzzaabcazzz", true); // found "abca"
3404 check(Pattern.compile("(?<gname>a*)bc\\k<gname>"),
3407 check(Pattern.compile("(?<gname>abc)(def)\\k<gname>"),
3410 check(Pattern.compile("(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(?<gname>k)\\k<gname>"),
3414 check(Pattern.compile("(?<gname>" + toSupplementaries("a*)bc") + "\\k<gname>"),
3417 check(Pattern.compile("(?<gname>" + toSupplementaries("a*)bc") + "\\k<gname>"),
3420 check(Pattern.compile("(?<gname>" + toSupplementaries("abc)(def)") + "\\k<gname>"),
3423 check(Pattern.compile(toSupplementaries("(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)") +
3428 check(Pattern.compile("x+(?<gname>y+)z+\\k<gname>"),
3630 check("^\\x{1033c}$", "\uD800\uDF3C", true);
3631 check("^\\xF0\\x90\\x8C\\xBC$", "\uD800\uDF3C", false);
3632 check("^\\x{D800}\\x{DF3c}+$", "\uD800\uDF3C", false);
3633 check("^\\xF0\\x90\\x8C\\xBC$", "\uD800\uDF3C", false);
3636 check("^[\\x{D800}\\x{DF3c}]+$", "\uD800\uDF3C", false);
3637 check("^[\\xF0\\x90\\x8C\\xBC]+$", "\uD800\uDF3C", false);
3638 check("^[\\x{D800}\\x{DF3C}]+$", "\uD800\uDF3C", false);
3639 check("^[\\x{DF3C}\\x{D800}]+$", "\uD800\uDF3C", false);
3640 check("^[\\x{D800}\\x{DF3C}]+$", "\uDF3C\uD800", true);
3641 check("^[\\x{DF3C}\\x{D800}]+$", "\uDF3C\uD800", true);