Skip to content

Commit

Permalink
minor: add text blocks input (#7103)
Browse files Browse the repository at this point in the history
  • Loading branch information
nrmancuso authored and rnveach committed Jun 23, 2020
1 parent a67d059 commit 0a47921
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/ant-phase-verify.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@
<exclude name="**/InputJava14InstanceofWithPatternMatching.java"/>
<!-- until https://github.com/checkstyle/checkstyle/issues/8023 -->
<exclude name="**/InputJava14Records.java"/>
<!-- until https://github.com/checkstyle/checkstyle/issues/7103 -->
<exclude name="**/InputJava14TextBlocks.java"/>
</fileset>
</path>
<formatter type="plain"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
//non-compiled with javac: Compilable with Java14

public class InputJava14TextBlocks
{
private static final CharSequence type = "type";

static {
String doubleQuotes = """
""
""";
String oneDoubleQuote = """
"
""";
String empty = """
""";
String oneSingleQuote = """
'
""";
String escape = """
<html>\u000D\u000A\n
<body>\u000D\u000A\n
<p>Hello, world</p>\u000D\u000A\n
</body>\u000D\u000A\n
</html>\u000D\u000A
""";
String testMoreEscapes = """
fun with\n
whitespace\t\r
and other escapes \"""
""";
String sqlQuery = """
SELECT `EMP_ID`, `LAST_NAME` FROM `EMPLOYEE_TB`
WHERE `CITY` = 'INDIANAPOLIS'
ORDER BY `EMP_ID`, `LAST_NAME`;
""";
String concat = """
The quick brown fox""" + " \n" + """
jumps over the lazy dog
""";
String someCode = """
function hello() {
print('"Hello, world"');
}
hello();
""";
String multiLineStr =
"""
SELECT * FROM USERS
WHERE USER_ID = '1'
""";
String textBlockCeption =
"""
String text = \"""
A text block inside a text block
\""";
""";
String code1 = """
public void print($type o) {
System.out.println(Objects.toString(o));
}
""".replace("$type", type);
String code2 = String.format("""
public void print(%s o) {
System.out.println(Objects.toString(o));
}
""", type);
}
public String getFormattedText(String parameter) {
return """
Some parameter: %s
""".formatted(parameter);
}
public String getIgnoredNewLines() {
return """
This is a long test which looks to \
have a newline but actually does not""";
}
public String getEscapedSpaces() {
return """
line 1·······
line 2·······\s
""";
}
}

0 comments on commit 0a47921

Please sign in to comment.