From dcd5615e9e3e09a74d090e230a5eb88fc22e942e Mon Sep 17 00:00:00 2001 From: rnveach Date: Mon, 13 Feb 2017 10:15:58 -0500 Subject: [PATCH] Issue #3803: added new case for if and or operator for IndentationCheck --- .../checkstyle/checks/indentation/IndentationCheckTest.java | 4 ++++ .../checkstyle/checks/indentation/InputInvalidIfIndent.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java index d7425c4bc..3d7c33971 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java @@ -1061,6 +1061,10 @@ public class IndentationCheckTest extends BaseCheckTestSupport { "245: " + getCheckMessage(MSG_ERROR, "if rparen", 6, 8), "251: " + getCheckMessage(MSG_ERROR, "if lparen", 6, 8), "253: " + getCheckMessage(MSG_ERROR, "if rparen", 6, 8), + "256: " + getCheckMessage(MSG_ERROR, "if", 0, 8), + "257: " + getCheckMessage(MSG_CHILD_ERROR, "if", 0, 12), + "258: " + getCheckMessage(MSG_CHILD_ERROR, "if", 0, 12), + "259: " + getCheckMessage(MSG_ERROR, "if rcurly", 0, 8), }; verifyWarns(checkConfig, fileName, expected); } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputInvalidIfIndent.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputInvalidIfIndent.java index f33f8a6d9..e69312ba8 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputInvalidIfIndent.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/indentation/InputInvalidIfIndent.java @@ -253,6 +253,10 @@ System.getProperty("blah"); //indent:0 exp:12 warn ) { //indent:6 exp:8 warn System.getProperty("blah"); //indent:12 exp:12 } //indent:8 exp:8 +if (test //indent:0 exp:8 warn +|| test) { //indent:0 exp:12 warn +System.getProperty("blah"); //indent:0 exp:12 warn +} //indent:0 exp:8 warn } //indent:4 exp:4