Skip to content

Commit b7d71ed

Browse files
committed
more Unicode property escapes handling tests (issue #583)
1 parent a1443d7 commit b7d71ed

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/test/java/org/htmlunit/javascript/regexp/RegExpJsToJavaConverter2Test.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ public void validationPatternUnicodePropertyEscapeUppercaseLetter() throws Excep
111111
validation("\\p{uppercaseletter}*", "&#x041C&#x0419&#x0420");
112112
}
113113

114-
115114
/**
116115
* @throws Exception if an error occurs
117116
*/
@@ -122,6 +121,16 @@ public void validationPatternUnicodePropertyEscapeLowercaseLetter() throws Excep
122121
validation("\\p{Ll}*", "&#x043C&#x0439&#x0440");
123122
}
124123

124+
/**
125+
* @throws Exception if an error occurs
126+
*/
127+
@Test
128+
@Alerts("false")
129+
public void validationPatternUnicodePropertyEscapePrivateUse() throws Exception {
130+
validation("[^\\p{gc=Co}\\p{gc=Cn}]+", "&#xE111");
131+
validation("[^\\p{gc=Co}\\p{gc=Cn}]+", "&#x05FD");
132+
}
133+
125134
private void validation(final String pattern, final String value) throws Exception {
126135
final String html =
127136
"<html><head>\n"

src/test/java/org/htmlunit/javascript/regexp/RegExpJsToJavaConverterTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,8 @@ public void unicodePropertyEscapes() {
397397
assertEquals("\\p{Lu}0-9", regExpJsToJavaConverter.convert("\\p{Lu}0-9"));
398398
assertEquals("\\p{Ll}0-9", regExpJsToJavaConverter.convert("\\p{Ll}0-9"));
399399

400+
assertEquals("[^\\p{gc=Co}\\p{gc=Cn}]+", regExpJsToJavaConverter.convert("[^\\p{gc=Co}\\p{gc=Cn}]+"));
401+
400402
// assertEquals("p\\{html\\}0-9", regExpJsToJavaConverter.convert("\\p{html}0-9"));
401403
}
402404
}

0 commit comments

Comments
 (0)