You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/testcondition.cpp
+28-28Lines changed: 28 additions & 28 deletions
Original file line number
Diff line number
Diff line change
@@ -789,19 +789,19 @@ class TestCondition : public TestFixture {
789
789
" if (x) {}\n"
790
790
" else if (!x) {}\n"
791
791
"}");
792
-
ASSERT_EQUALS("test.cpp:3:style:Expression is always true because 'else if' condition is opposite to previous condition at line 2.\n"
793
-
"test.cpp:2:note:first condition\n"
794
-
"test.cpp:3:note:else if condition is opposite to first condition\n", errout_str());
792
+
ASSERT_EQUALS("[test.cpp:3:14]: style:Expression is always true because 'else if' condition is opposite to previous condition at line 2. [multiCondition]\n"
793
+
"[test.cpp:2:9]: note:first condition\n"
794
+
"[test.cpp:3:14]: note:else if condition is opposite to first condition\n", errout_str());
795
795
796
796
check("void f(int x) {\n"
797
797
" int y = x;\n"
798
798
" if (x) {}\n"
799
799
" else if (!y) {}\n"
800
800
"}");
801
-
ASSERT_EQUALS("test.cpp:4:style:Expression is always true because 'else if' condition is opposite to previous condition at line 3.\n"
802
-
"test.cpp:2:note:'y' is assigned value 'x' here.\n"
803
-
"test.cpp:3:note:first condition\n"
804
-
"test.cpp:4:note:else if condition is opposite to first condition\n", errout_str());
801
+
ASSERT_EQUALS("[test.cpp:4:14]: style:Expression is always true because 'else if' condition is opposite to previous condition at line 3. [multiCondition]\n"
802
+
"[test.cpp:2:13]: note:'y' is assigned value 'x' here.\n"
803
+
"[test.cpp:3:9]: note:first condition\n"
804
+
"[test.cpp:4:14]: note:else if condition is opposite to first condition\n", errout_str());
805
805
}
806
806
807
807
voidcheckBadBitmaskCheck() {
@@ -6021,27 +6021,27 @@ class TestCondition : public TestFixture {
6021
6021
" if (x == y)\n"
6022
6022
" x = y;\n"
6023
6023
"}");
6024
-
ASSERT_EQUALS("test.cpp:3:style:Assignment 'x=y' is redundant with condition 'x==y'.\n"
6025
-
"test.cpp:2:note:Condition 'x==y'\n"
6026
-
"test.cpp:3:note:Assignment 'x=y' is redundant\n", errout_str());
6024
+
ASSERT_EQUALS("[test.cpp:3:11]: style:Assignment 'x=y' is redundant with condition 'x==y'. [duplicateConditionalAssign]\n"
6025
+
"[test.cpp:2:11]: note:Condition 'x==y'\n"
6026
+
"[test.cpp:3:11]: note:Assignment 'x=y' is redundant\n", errout_str());
6027
6027
6028
6028
check("void f(int& x, int y) {\n"
6029
6029
" if (x != y)\n"
6030
6030
" x = y;\n"
6031
6031
"}");
6032
-
ASSERT_EQUALS("test.cpp:2:style:The statement 'if (x!=y) x=y' is logically equivalent to 'x=y'.\n"
6033
-
"test.cpp:3:note:Assignment 'x=y'\n"
6034
-
"test.cpp:2:note:Condition 'x!=y' is redundant\n", errout_str());
6032
+
ASSERT_EQUALS("[test.cpp:2:11]: style:The statement 'if (x!=y) x=y' is logically equivalent to 'x=y'. [duplicateConditionalAssign]\n"
6033
+
"[test.cpp:3:11]: note:Assignment 'x=y'\n"
6034
+
"[test.cpp:2:11]: note:Condition 'x!=y' is redundant\n", errout_str());
6035
6035
6036
6036
check("void f(int& x, int y) {\n"
6037
6037
" if (x == y)\n"
6038
6038
" x = y;\n"
6039
6039
" else\n"
6040
6040
" x = 1;\n"
6041
6041
"}");
6042
-
ASSERT_EQUALS("test.cpp:3:style:Assignment 'x=y' is redundant with condition 'x==y'.\n"
6043
-
"test.cpp:2:note:Condition 'x==y'\n"
6044
-
"test.cpp:3:note:Assignment 'x=y' is redundant\n", errout_str());
6042
+
ASSERT_EQUALS("[test.cpp:3:11]: style:Assignment 'x=y' is redundant with condition 'x==y'. [duplicateConditionalAssign]\n"
6043
+
"[test.cpp:2:11]: note:Condition 'x==y'\n"
6044
+
"[test.cpp:3:11]: note:Assignment 'x=y' is redundant\n", errout_str());
6045
6045
6046
6046
check("void f(int& x, int y) {\n"
6047
6047
" if (x != y)\n"
@@ -6091,18 +6091,18 @@ class TestCondition : public TestFixture {
6091
6091
" }\n"
6092
6092
" bool b;\n"
6093
6093
"};\n");
6094
-
ASSERT_EQUALS("test.cpp:4:style:The statement 'if (b) b=true' is redundant.\n"
6095
-
"test.cpp:4:note:Assignment 'b=true'\n"
6096
-
"test.cpp:4:note:Condition 'b' is redundant\n"
6097
-
"test.cpp:5:style:The statement 'if (b) b=false' is logically equivalent to 'b=false'.\n"
6098
-
"test.cpp:5:note:Assignment 'b=false'\n"
6099
-
"test.cpp:5:note:Condition 'b' is redundant\n"
6100
-
"test.cpp:6:style:The statement 'if (!b) b=true' is logically equivalent to 'b=true'.\n"
6101
-
"test.cpp:6:note:Assignment 'b=true'\n"
6102
-
"test.cpp:6:note:Condition '!b' is redundant\n"
6103
-
"test.cpp:7:style:The statement 'if (!b) b=false' is redundant.\n"
6104
-
"test.cpp:7:note:Assignment 'b=false'\n"
6105
-
"test.cpp:7:note:Condition '!b' is redundant\n",
6094
+
ASSERT_EQUALS("[test.cpp:4:13]: style:The statement 'if (b) b=true' is redundant. [duplicateConditionalAssign]\n"
6095
+
"[test.cpp:4:18]: note:Assignment 'b=true'\n"
6096
+
"[test.cpp:4:13]: note:Condition 'b' is redundant\n"
6097
+
"[test.cpp:5:13]: style:The statement 'if (b) b=false' is logically equivalent to 'b=false'. [duplicateConditionalAssign]\n"
6098
+
"[test.cpp:5:18]: note:Assignment 'b=false'\n"
6099
+
"[test.cpp:5:13]: note:Condition 'b' is redundant\n"
6100
+
"[test.cpp:6:13]: style:The statement 'if (!b) b=true' is logically equivalent to 'b=true'. [duplicateConditionalAssign]\n"
6101
+
"[test.cpp:6:19]: note:Assignment 'b=true'\n"
6102
+
"[test.cpp:6:13]: note:Condition '!b' is redundant\n"
6103
+
"[test.cpp:7:13]: style:The statement 'if (!b) b=false' is redundant. [duplicateConditionalAssign]\n"
6104
+
"[test.cpp:7:19]: note:Assignment 'b=false'\n"
6105
+
"[test.cpp:7:13]: note:Condition '!b' is redundant\n",
0 commit comments