File tree 1 file changed +29
-0
lines changed
core/src/test/java/com/google/googlejavaformat/java
1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,35 @@ public void textBlockTrailingWhitespace() throws Exception {
119
119
assertThat (actual ).isEqualTo (expected );
120
120
}
121
121
122
+ // It would be neat if the formatter could remove the trailing whitespace here, but in general
123
+ // it preserves unicode escapes from the original text.
124
+ @ Test
125
+ public void textBlockTrailingWhitespaceUnicodeEscape () throws Exception {
126
+ assumeTrue (Runtime .version ().feature () >= 15 );
127
+ // We want a unicode escape in the Java source being formatted, so it needs to be escaped
128
+ // in the string literal in this test.
129
+ String input =
130
+ lines (
131
+ "public class T {" ,
132
+ " String s =" ,
133
+ " \" \" \" " ,
134
+ " lorem\\ u0020" ,
135
+ " ipsum" ,
136
+ " \" \" \" ;" ,
137
+ "}" );
138
+ String expected =
139
+ lines (
140
+ "public class T {" ,
141
+ " String s =" ,
142
+ " \" \" \" " ,
143
+ " lorem\\ u0020" ,
144
+ " ipsum" ,
145
+ " \" \" \" ;" ,
146
+ "}" );
147
+ String actual = StringWrapper .wrap (100 , input , new Formatter ());
148
+ assertThat (actual ).isEqualTo (expected );
149
+ }
150
+
122
151
@ Test
123
152
public void textBlockSpaceTabMix () throws Exception {
124
153
assumeTrue (Runtime .version ().feature () >= 15 );
You can’t perform that action at this time.
0 commit comments