< prev index next >
test/jdk/java/util/regex/RegExTest.java
Print this page
rev 57965 : [mq]: 8214245-Case-insensitive-matching-doesnt-work-correctly-for-POSIX-character-classes
*** 33,43 ****
* 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066
* 7067045 7014640 7189363 8007395 8013252 8013254 8012646 8023647 6559590
* 8027645 8035076 8039124 8035975 8074678 6854417 8143854 8147531 7071819
* 8151481 4867170 7080302 6728861 6995635 6736245 4916384 6328855 6192895
* 6345469 6988218 6693451 7006761 8140212 8143282 8158482 8176029 8184706
! * 8194667 8197462 8184692 8221431 8224789 8228352 8230829 8236034
*
* @library /test/lib
* @library /lib/testlibrary/java/lang
* @build jdk.test.lib.RandomFactory
* @run main RegExTest
--- 33,43 ----
* 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066
* 7067045 7014640 7189363 8007395 8013252 8013254 8012646 8023647 6559590
* 8027645 8035076 8039124 8035975 8074678 6854417 8143854 8147531 7071819
* 8151481 4867170 7080302 6728861 6995635 6736245 4916384 6328855 6192895
* 6345469 6988218 6693451 7006761 8140212 8143282 8158482 8176029 8184706
! * 8194667 8197462 8184692 8221431 8224789 8228352 8230829 8236034 8214245
*
* @library /test/lib
* @library /lib/testlibrary/java/lang
* @build jdk.test.lib.RandomFactory
* @run main RegExTest
*** 184,193 ****
--- 184,194 ----
grapheme();
expoBacktracking();
invalidGroupName();
illegalRepetitionRange();
surrogatePairWithCanonEq();
+ caseInsensitivePMatch();
if (failure) {
throw new
RuntimeException("RegExTest failed, 1st failure: " +
firstFailure);
*** 4998,5003 ****
--- 4999,5072 ----
failCount++;
System.out.println("Unexpected exception: " + t);
}
report("surrogatePairWithCanonEq");
}
+
+ // This test is for 8214245
+ private static void caseInsensitivePMatch() {
+ for (String input : List.of("abcd", "AbCd", "ABCD")) {
+ for (String pattern : List.of("abcd", "aBcD", "[a-d]{4}",
+ "(?:a|b|c|d){4}", "\\p{Lower}{4}", "\\p{Ll}{4}",
+ "\\p{IsLl}{4}", "\\p{gc=Ll}{4}",
+ "\\p{general_category=Ll}{4}", "\\p{IsLowercase}{4}",
+ "\\p{javaLowerCase}{4}", "\\p{Upper}{4}", "\\p{Lu}{4}",
+ "\\p{IsLu}{4}", "\\p{gc=Lu}{4}", "\\p{general_category=Lu}{4}",
+ "\\p{IsUppercase}{4}", "\\p{javaUpperCase}{4}",
+ "\\p{Lt}{4}", "\\p{IsLt}{4}", "\\p{gc=Lt}{4}",
+ "\\p{general_category=Lt}{4}", "\\p{IsTitlecase}{4}",
+ "\\p{javaTitleCase}{4}", "[\\p{Lower}]{4}", "[\\p{Ll}]{4}",
+ "[\\p{IsLl}]{4}", "[\\p{gc=Ll}]{4}",
+ "[\\p{general_category=Ll}]{4}", "[\\p{IsLowercase}]{4}",
+ "[\\p{javaLowerCase}]{4}", "[\\p{Upper}]{4}", "[\\p{Lu}]{4}",
+ "[\\p{IsLu}]{4}", "[\\p{gc=Lu}]{4}",
+ "[\\p{general_category=Lu}]{4}", "[\\p{IsUppercase}]{4}",
+ "[\\p{javaUpperCase}]{4}", "[\\p{Lt}]{4}", "[\\p{IsLt}]{4}",
+ "[\\p{gc=Lt}]{4}", "[\\p{general_category=Lt}]{4}",
+ "[\\p{IsTitlecase}]{4}", "[\\p{javaTitleCase}]{4}"))
+ {
+ if (!Pattern.compile(pattern, Pattern.CASE_INSENSITIVE)
+ .matcher(input)
+ .matches())
+ {
+ failCount++;
+ System.out.println("Expected to match: " +
+ "'" + input + "' =~ /" + pattern + "/");
+ }
+ }
+ }
+
+ for (String input : List.of("\u01c7", "\u01c8", "\u01c9")) {
+ for (String pattern : List.of("\u01c7", "\u01c8", "\u01c9",
+ "[\u01c7\u01c8]", "[\u01c7\u01c9]", "[\u01c8\u01c9]",
+ "[\u01c7-\u01c8]", "[\u01c8-\u01c9]", "[\u01c7-\u01c9]",
+ "\\p{Lower}", "\\p{Ll}", "\\p{IsLl}", "\\p{gc=Ll}",
+ "\\p{general_category=Ll}", "\\p{IsLowercase}",
+ "\\p{javaLowerCase}", "\\p{Upper}", "\\p{Lu}",
+ "\\p{IsLu}", "\\p{gc=Lu}", "\\p{general_category=Lu}",
+ "\\p{IsUppercase}", "\\p{javaUpperCase}",
+ "\\p{Lt}", "\\p{IsLt}", "\\p{gc=Lt}",
+ "\\p{general_category=Lt}", "\\p{IsTitlecase}",
+ "\\p{javaTitleCase}", "[\\p{Lower}]", "[\\p{Ll}]",
+ "[\\p{IsLl}]", "[\\p{gc=Ll}]",
+ "[\\p{general_category=Ll}]", "[\\p{IsLowercase}]",
+ "[\\p{javaLowerCase}]", "[\\p{Upper}]", "[\\p{Lu}]",
+ "[\\p{IsLu}]", "[\\p{gc=Lu}]",
+ "[\\p{general_category=Lu}]", "[\\p{IsUppercase}]",
+ "[\\p{javaUpperCase}]", "[\\p{Lt}]", "[\\p{IsLt}]",
+ "[\\p{gc=Lt}]", "[\\p{general_category=Lt}]",
+ "[\\p{IsTitlecase}]", "[\\p{javaTitleCase}]"))
+ {
+ if (!Pattern.compile(pattern, Pattern.CASE_INSENSITIVE
+ | Pattern.UNICODE_CHARACTER_CLASS)
+ .matcher(input)
+ .matches())
+ {
+ failCount++;
+ System.out.println("Expected to match: " +
+ "'" + input + "' =~ /" + pattern + "/");
+ }
+ }
+ }
+ report("caseInsensitivePMatch");
+ }
}
< prev index next >