summaryrefslogtreecommitdiffstats
path: root/runtime/syntax/testdir/input/java_string.java
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 07:39:57 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 07:40:16 +0000
commit6af24b2457752c0d36aaf9f29f03d39afd09937f (patch)
tree2671b594908d1f971de6b2a2d473f97dfb7291d2 /runtime/syntax/testdir/input/java_string.java
parentReleasing progress-linux version 2:9.1.0016-1~progress7.99u1. (diff)
downloadvim-6af24b2457752c0d36aaf9f29f03d39afd09937f.tar.xz
vim-6af24b2457752c0d36aaf9f29f03d39afd09937f.zip
Merging upstream version 2:9.1.0199.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'runtime/syntax/testdir/input/java_string.java')
-rw-r--r--runtime/syntax/testdir/input/java_string.java104
1 files changed, 104 insertions, 0 deletions
diff --git a/runtime/syntax/testdir/input/java_string.java b/runtime/syntax/testdir/input/java_string.java
new file mode 100644
index 0000000..43a7a05
--- /dev/null
+++ b/runtime/syntax/testdir/input/java_string.java
@@ -0,0 +1,104 @@
+class StringTests // JDK 21+ (--enable-preview --release 21).
+{
+ static {
+ String s1 = "A quick brown fox jumps over the lazy dog";
+ String s2 = "\"Woof\s!\"";
+ String s3 = """
+ A\s\
+ quick \
+ brown\s\
+ fox \
+ jumps\s\
+ over \
+ the\s\
+ lazy \
+ dog""";
+ String s4 = """
+ "Woof\s!\"""";
+ String s5 = """
+ String s3 = \"""
+ A\\s\\
+ quick \\
+ brown\\s\\
+ fox \\
+ jumps\\s\\
+ over \\
+ the\\s\\
+ lazy \\
+ dog\""";""";
+
+ // There are SPACE, FF, HT, CR, and LF after """.
+ String empty = """
+ """;
+
+ System.out.println("""
+ "
+ ""
+ ""\u005c"
+ ""\u005c""
+ ""\"\u0022\u0022
+ ""\"""\u005c\u0022
+ ""\"""\""
+ ""\"""\""\"""");
+
+ System.out.println(STR."""
+ "
+ \{"\"\""}
+ \{"\"\""}\{"\u005c\u0022"}
+ \{"\"\""}\{"\u005c\u0022"}"
+ \{"\"\""}\"\{"\u005c\u0022\u005c\u0022"}
+ \{"\"\""}\"\{"\"\""}\{"\u005c\u0022"}
+ \{"\"\""}\"\{"\"\""}\""
+ \{"\"\""}\"\{"\"\""}\""\""""); // JDK 21+.
+
+ String woof = "Woof", dog = "dog", fox = "fox";
+
+ String s6 = STR
+ ."A quick brown \{fox} jumps over the lazy \{dog}";
+ String s7 = STR.process(StringTemplate.RAW
+ ."\"\{woof}\s!\"");
+ String s8 = STR."""
+ A\s\
+ quick \
+ brown\s\
+ \{fox} \
+ jumps\s\
+ over \
+ the\s\
+ lazy \
+ \{dog}""";
+ String s9 = STR.process(StringTemplate.RAW
+ .
+ """
+ "\{woof}\s!\"""");
+ String s10 = java.util.FormatProcessor.FMT
+ . "%-14s\{"A\s" + STR . "quick" + "brown"}%s\{fox} "
+ + java.util.FormatProcessor.FMT
+ . "%-20s\{"jumps\sover the\s"
+ + STR . "lazy"}%s\{dog}";
+ String s11 = STR."""
+ \"\{ // A nested comment.
+ (new java.util.function.Function<String, String>() {
+ public String apply(String bay) { return bay; };
+ }).apply(woof)
+ }\s!\"""";
+ String s12 = java.util.FormatProcessor.FMT
+ ."""
+ %-14s\{STR."""
+ A\s\
+ \{ "quick" } \
+ brown"""}\
+ %s\{ fox } \
+ %-20s\{STR."""
+ jumps\s\
+ over \
+ the\s\
+ \{ "lazy" } """}\
+ %s\{ dog }""";
+ String s13 = STR
+ ."\"\{ /* A nested comment. */
+ ((java.util.function.Function<String, String>) bay -> bay)
+ .apply(woof)
+ }\s!\"";
+ }
+}