forked from checkstyle/checkstyle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
supplemental: Update tests for Issue checkstyle#14014
- Loading branch information
Markus Jung
committed
Nov 13, 2023
1 parent
f5b01b9
commit 9ee4718
Showing
3 changed files
with
98 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...ndentation/indentation/InputIndentationCheckSwitchExpressionDeclarationLCurlyNewLine.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
//non-compiled with javac: Compilable with Java14 //indent:0 exp:0 | ||
package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0 | ||
|
||
/* Config: //indent:0 exp:0 | ||
* //indent:1 exp:1 | ||
* basicOffset = 4 //indent:1 exp:1 | ||
* braceAdjustment = 0 //indent:1 exp:1 | ||
* caseIndent = 4 //indent:1 exp:1 | ||
* throwsIndent = 4 //indent:1 exp:1 | ||
* arrayInitIndent = 4 //indent:1 exp:1 | ||
* lineWrappingIndentation = 4 //indent:1 exp:1 | ||
* forceStrictCondition = false //indent:1 exp:1 | ||
*/ //indent:1 exp:1 | ||
public class InputIndentationCheckSwitchExpressionDeclarationLCurlyNewLine { //indent:0 exp:0 | ||
|
||
public void validDeclare() { //indent:4 exp:4 | ||
String requestId = switch ("in") //indent:8 exp:8 | ||
{ //indent:8 exp:8 | ||
case "correct" -> "true"; //indent:12 exp:12 | ||
default -> "also correct"; //indent:12 exp:12 | ||
}; //indent:8 exp:8 | ||
} //indent:4 exp:4 | ||
|
||
public void validAssign(String result) { //indent:4 exp:4 | ||
result = switch ("in") //indent:8 exp:8 | ||
{ //indent:8 exp:8 | ||
case "correct" -> "true"; //indent:12 exp:12 | ||
default -> "also correct"; //indent:12 exp:12 | ||
}; //indent:8 exp:8 | ||
} //indent:4 exp:4 | ||
|
||
public void invalidAssignLeftCurlyWithLesserIndent(String result) { //indent:4 exp:4 | ||
result = switch ("in") //indent:8 exp:8 | ||
{ //indent:4 exp:8 warn | ||
case "correct" -> "true"; //indent:12 exp:12 | ||
case "incorrect" -> "true"; //indent:12 exp:12 | ||
default -> "also incorrect"; //indent:12 exp:12 | ||
}; //indent:8 exp:8 | ||
} //indent:4 exp:4 | ||
public void invalidDeclareLeftCurlyWithLesserIndent() { //indent:4 exp:4 | ||
String result = switch ("in") //indent:8 exp:8 | ||
{ //indent:4 exp:8 warn | ||
case "correct" -> "true"; //indent:12 exp:12 | ||
case "incorrect" -> "true"; //indent:12 exp:12 | ||
default -> "also incorrect"; //indent:12 exp:12 | ||
}; //indent:8 exp:8 | ||
} //indent:4 exp:4 | ||
public void invalidAssignLeftCurlyWithBiggerIndent(String result) { //indent:4 exp:4 | ||
result = switch ("in") //indent:8 exp:8 | ||
{ //indent:12 exp:8 warn | ||
case "correct" -> "true"; //indent:12 exp:12 | ||
case "incorrect" -> "true"; //indent:12 exp:12 | ||
default -> "also incorrect"; //indent:12 exp:12 | ||
}; //indent:8 exp:8 | ||
} //indent:4 exp:4 | ||
public void invalidDeclareLeftCurlyWithBiggerIndent() { //indent:4 exp:4 | ||
String result = switch ("in") //indent:8 exp:8 | ||
{ //indent:12 exp:8 warn | ||
case "correct" -> "true"; //indent:12 exp:12 | ||
case "incorrect" -> "true"; //indent:12 exp:12 | ||
default -> "also incorrect"; //indent:12 exp:12 | ||
}; //indent:8 exp:8 | ||
} //indent:4 exp:4 | ||
} //indent:0 exp:0 |