Skip to content

Commit

Permalink
Add some extra tests
Browse files Browse the repository at this point in the history
  • Loading branch information
harpocrates committed Mar 29, 2021
1 parent 5404759 commit 374fa19
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/files/neg/text-blocks.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
text-blocks/Invalid1.java:3: error: illegal text block open delimiter sequence, missing line terminator
public static final String badOpeningDelimiter = """non-whitespace
^
text-blocks/Invalid1.java:3: error: <identifier> expected
public static final String badOpeningDelimiter = """non-whitespace
^
text-blocks/Invalid1.java:5: error: illegal text block open delimiter sequence, missing line terminator
""";
^
text-blocks/Invalid2.java:5: error: unclosed string literal
foo"""";
^
4 errors
6 changes: 6 additions & 0 deletions test/files/neg/text-blocks/Invalid1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class Invalid1 {

public static final String badOpeningDelimiter = """non-whitespace
foo
""";
}
6 changes: 6 additions & 0 deletions test/files/neg/text-blocks/Invalid2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class Invalid2 {

// Closing delimiter is first three eligible `"""`, not last
public static final String closingDelimiterIsNotScalas = """
foo"""";
}
6 changes: 6 additions & 0 deletions test/files/run/t12290.check
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ ORDER BY "EMP_ID", "LAST_NAME";
</body>
</html>

====
this line has 4 tabs before it
this line has 5 spaces before it and space after it
this line has 2 tabs and 3 spaces before it
 this line has 6 spaces before it

====
String text = """
A text block inside a text block
Expand Down
2 changes: 2 additions & 0 deletions test/files/run/t12290/Test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ object Test extends App {
println("====")
println(valueOf[TextBlocks.html5.type])
println("====")
println(valueOf[TextBlocks.mixedIndents.type])
println("====")
println(valueOf[TextBlocks.code.type])
println("====")
println(valueOf[TextBlocks.simpleString.type])
Expand Down
9 changes: 9 additions & 0 deletions test/files/run/t12290/TextBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ class TextBlocks {
</body>
</html>
""";

// mixed indentation
final static String mixedIndents = """
\s this line has 4 tabs before it
this line has 5 spaces before it and space after it \u0020 \u000C\u0020 \u001E
this line has 2 tabs and 3 spaces before it
\u0020 \u000C\u0020 \u001E this line has 6 spaces before it
""";

final static String code =
"""
String text = \"""
Expand Down

0 comments on commit 374fa19

Please sign in to comment.