aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorVladislav Lisetskiy <vladlis54@gmail.com>2016-04-24 16:24:49 +0300
committerRoman Ivanov <romani@users.noreply.github.com>2016-04-24 06:24:49 -0700
commit3defd234041f34854f50f1a77ae94d18fb730036 (patch)
treeda2d819936334f5c9794b34aab852c1384300163 /src/test
parentf111cc06fb4744981f79173db4659b8a8f12d5aa (diff)
downloadcheckstyle-3defd234041f34854f50f1a77ae94d18fb730036.tar.gz
Issue #2998: Fix CommentsIndentation Check false-positive at the end of a block (#3123)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheckTest.java3
-rw-r--r--src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputCommentsIndentationCommentIsAtTheEndOfBlock.java40
2 files changed, 43 insertions, 0 deletions
diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheckTest.java
index 578c8f692..449c2092a 100644
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheckTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheckTest.java
@@ -80,6 +80,9 @@ public class CommentsIndentationCheckTest extends BaseCheckTestSupport {
"322: " + getCheckMessage(MSG_KEY_SINGLE, 323, 0, 4),
"336: " + getCheckMessage(MSG_KEY_SINGLE, 337, 0, 4),
"355: " + getCheckMessage(MSG_KEY_SINGLE, 352, 9, 8),
+ "380: " + getCheckMessage(MSG_KEY_BLOCK, 381, 12, 8),
+ "393: " + getCheckMessage(MSG_KEY_SINGLE, 392, 12, 8),
+ "400: " + getCheckMessage(MSG_KEY_SINGLE, 401, 8, 10),
};
final String testInputFile = "InputCommentsIndentationCommentIsAtTheEndOfBlock.java";
verify(checkConfig, getPath(testInputFile), expected);
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputCommentsIndentationCommentIsAtTheEndOfBlock.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputCommentsIndentationCommentIsAtTheEndOfBlock.java
index 49a5aa8f1..1e769770f 100644
--- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputCommentsIndentationCommentIsAtTheEndOfBlock.java
+++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputCommentsIndentationCommentIsAtTheEndOfBlock.java
@@ -362,6 +362,46 @@ public class InputCommentsIndentationCommentIsAtTheEndOfBlock {
// comment
}
+ void foo53() {
+ // comment
+ new Object()
+ .toString();
+ // comment
+ }
+
+ void foo54() {
+ /* comment */
+ new Object()
+ .toString();
+ // comment
+ }
+
+ void foo55() {
+ /* violation */
+ new Object()
+ .toString();
+ // comment
+ }
+
+ void foo56() {
+ new Object().toString();
+ // comment
+ }
+
+ void foo57() {
+ new Object().toString();
+ // violation
+ }
+
+ void foo58() {
+ /*
+ comment
+ */
+ // comment
+ foo1();
+ // comment
+ }
+
// We almost reached the end of the class here.
}
// The END of the class.