mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8233116: Escape Sequences For Line Continuation and White Space (Preview)
Reviewed-by: vromero, jlahoda, bchristi, mcimadamore
This commit is contained in:
parent
7afaaf1229
commit
234f326d79
6 changed files with 249 additions and 138 deletions
|
@ -32,6 +32,8 @@
|
|||
public class TextBlockLang {
|
||||
public static void main(String... args) {
|
||||
test1();
|
||||
test2();
|
||||
test3();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -75,6 +77,30 @@ public class TextBlockLang {
|
|||
""", 4);
|
||||
}
|
||||
|
||||
/*
|
||||
* Test escape-S.
|
||||
*/
|
||||
static void test2() {
|
||||
if ('\s' != ' ') {
|
||||
throw new RuntimeException("Failed character escape-S");
|
||||
}
|
||||
EQ("\s", " ");
|
||||
EQ("""
|
||||
\s
|
||||
""", " \n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Test escape line terminator.
|
||||
*/
|
||||
static void test3() {
|
||||
EQ("""
|
||||
abc \
|
||||
""", "abc ");
|
||||
EQ("\\\n".translateEscapes(), "");
|
||||
EQ("\\\r\n".translateEscapes(), "");
|
||||
EQ("\\\r".translateEscapes(), "");
|
||||
}
|
||||
|
||||
/*
|
||||
* Raise an exception if the string is not the expected length.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue