Unnecessary Parentheses Check compilable UT input

This commit is contained in:
alexkravin 2014-12-03 17:33:16 +04:00 committed by Roman Ivanov
parent 2c93af9335
commit 3b333a24c1
2 changed files with 45 additions and 44 deletions

View File

@ -40,50 +40,50 @@ public class UnnecessaryParenthesesCheckTest extends BaseCheckTestSupport
createCheckConfig(UnnecessaryParenthesesCheck.class);
final String[] expected = {
"4:22: Unnecessary parentheses around assignment right-hand side.",
"4:29: Unnecessary parentheses around expression.",
"4:31: Unnecessary parentheses around identifier 'i'.",
"4:46: Unnecessary parentheses around assignment right-hand side.",
"5:15: Unnecessary parentheses around assignment right-hand side.",
"6:14: Unnecessary parentheses around identifier 'x'.",
"6:17: Unnecessary parentheses around assignment right-hand side.",
"7:15: Unnecessary parentheses around assignment right-hand side.",
"8:14: Unnecessary parentheses around identifier 'x'.",
"8:17: Unnecessary parentheses around assignment right-hand side.",
"11:22: Unnecessary parentheses around assignment right-hand side.",
"11:30: Unnecessary parentheses around identifier 'i'.",
"11:46: Unnecessary parentheses around assignment right-hand side.",
"15:17: Unnecessary parentheses around literal '0'.",
"25:11: Unnecessary parentheses around assignment right-hand side.",
"29:11: Unnecessary parentheses around assignment right-hand side.",
"31:11: Unnecessary parentheses around assignment right-hand side.",
"33:11: Unnecessary parentheses around assignment right-hand side.",
"34:16: Unnecessary parentheses around identifier 'a'.",
"35:14: Unnecessary parentheses around identifier 'a'.",
"35:20: Unnecessary parentheses around identifier 'b'.",
"35:26: Unnecessary parentheses around literal '600'.",
"35:40: Unnecessary parentheses around literal '12.5f'.",
"35:56: Unnecessary parentheses around identifier 'arg2'.",
"36:14: Unnecessary parentheses around string \"this\".",
"36:25: Unnecessary parentheses around string \"that\".",
"37:11: Unnecessary parentheses around assignment right-hand side.",
"37:14: Unnecessary parentheses around string \"this is a really, really...\".",
"39:16: Unnecessary parentheses around return value.",
"43:21: Unnecessary parentheses around literal '1'.",
"43:26: Unnecessary parentheses around literal '13.5'.",
"44:22: Unnecessary parentheses around literal 'true'.",
"45:17: Unnecessary parentheses around identifier 'b'.",
"49:17: Unnecessary parentheses around assignment right-hand side.",
"51:11: Unnecessary parentheses around assignment right-hand side.",
"53:16: Unnecessary parentheses around return value.",
"63:13: Unnecessary parentheses around expression.",
"67:16: Unnecessary parentheses around expression.",
"72:19: Unnecessary parentheses around expression.",
"73:23: Unnecessary parentheses around literal '4000'.",
"78:19: Unnecessary parentheses around assignment right-hand side.",
"80:11: Unnecessary parentheses around assignment right-hand side.",
"80:16: Unnecessary parentheses around literal '3'.",
"81:27: Unnecessary parentheses around assignment right-hand side.",
"5:22: Unnecessary parentheses around assignment right-hand side.",
"5:29: Unnecessary parentheses around expression.",
"5:31: Unnecessary parentheses around identifier 'i'.",
"5:46: Unnecessary parentheses around assignment right-hand side.",
"6:15: Unnecessary parentheses around assignment right-hand side.",
"7:14: Unnecessary parentheses around identifier 'x'.",
"7:17: Unnecessary parentheses around assignment right-hand side.",
"8:15: Unnecessary parentheses around assignment right-hand side.",
"9:14: Unnecessary parentheses around identifier 'x'.",
"9:17: Unnecessary parentheses around assignment right-hand side.",
"12:22: Unnecessary parentheses around assignment right-hand side.",
"12:30: Unnecessary parentheses around identifier 'i'.",
"12:46: Unnecessary parentheses around assignment right-hand side.",
"16:17: Unnecessary parentheses around literal '0'.",
"26:11: Unnecessary parentheses around assignment right-hand side.",
"30:11: Unnecessary parentheses around assignment right-hand side.",
"32:11: Unnecessary parentheses around assignment right-hand side.",
"34:11: Unnecessary parentheses around assignment right-hand side.",
"35:16: Unnecessary parentheses around identifier 'a'.",
"36:14: Unnecessary parentheses around identifier 'a'.",
"36:20: Unnecessary parentheses around identifier 'b'.",
"36:26: Unnecessary parentheses around literal '600'.",
"36:40: Unnecessary parentheses around literal '12.5f'.",
"36:56: Unnecessary parentheses around identifier 'arg2'.",
"37:14: Unnecessary parentheses around string \"this\".",
"37:25: Unnecessary parentheses around string \"that\".",
"38:11: Unnecessary parentheses around assignment right-hand side.",
"38:14: Unnecessary parentheses around string \"this is a really, really...\".",
"40:16: Unnecessary parentheses around return value.",
"44:21: Unnecessary parentheses around literal '1'.",
"44:26: Unnecessary parentheses around literal '13.5'.",
"45:22: Unnecessary parentheses around literal 'true'.",
"46:17: Unnecessary parentheses around identifier 'b'.",
"50:17: Unnecessary parentheses around assignment right-hand side.",
"52:11: Unnecessary parentheses around assignment right-hand side.",
"54:16: Unnecessary parentheses around return value.",
"64:13: Unnecessary parentheses around expression.",
"68:16: Unnecessary parentheses around expression.",
"73:19: Unnecessary parentheses around expression.",
"74:23: Unnecessary parentheses around literal '4000'.",
"79:19: Unnecessary parentheses around assignment right-hand side.",
"81:11: Unnecessary parentheses around assignment right-hand side.",
"81:16: Unnecessary parentheses around literal '3'.",
"82:27: Unnecessary parentheses around assignment right-hand side.",
};
verify(checkConfig, getPath(TEST_FILE), expected);

View File

@ -1,3 +1,4 @@
package com.puppycrawl.tools.checkstyle.coding;
public class InputUnnecessaryParentheses {
int f1() {
int x = 0;