summaryrefslogtreecommitdiff
path: root/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/InspectionGadgets/test/com/siyeh/igtest/bugs')
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/FallthruInSwithInspection.java25
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/SwitchStatementDensityInspection.java41
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/SwitchStatementsWithoutDefaultInspection.java62
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/empty_statement_body/EmptyStatementBody.java (renamed from plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/EmptyStatementBodyInspection.java)7
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/empty_statement_body/expected.xml65
5 files changed, 69 insertions, 131 deletions
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/FallthruInSwithInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/FallthruInSwithInspection.java
deleted file mode 100644
index 94629ee3a6dd..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/FallthruInSwithInspection.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.siyeh.igtest.bugs;
-
-public class FallthruInSwithInspection
-{
- private int m_bar;
-
- public FallthruInSwithInspection()
- {
- m_bar = 0;
- }
-
- public void foo()
- {
- final int bar = m_bar;
- switch(bar)
- {
- case (3):
- case (4):
- System.out.println("3");
- case (5):
- case (6):
- System.out.println("4");
- }
- }
-}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/SwitchStatementDensityInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/SwitchStatementDensityInspection.java
deleted file mode 100644
index 338e69cb98be..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/SwitchStatementDensityInspection.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.siyeh.igtest.bugs;
-
-public class SwitchStatementDensityInspection
-{
- private int m_bar;
-
- public SwitchStatementDensityInspection()
- {
- m_bar = 0;
- }
-
- public void fooBar()
- {
- final int bar = m_bar;
- switch(bar)
- {
- case 3:
- case 4:
- System.out.println("3");
- System.out.println("3");
- System.out.println("3");
- System.out.println("3");
- System.out.println("3");
- System.out.println("3");
- System.out.println("3");
- System.out.println("3");
- System.out.println("3");
- System.out.println("3");
- System.out.println("3");
- System.out.println("3");
- break;
- case 6:
- System.out.println("4");
- break;
- default:
- break;
- }
-
-
- }
-}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/SwitchStatementsWithoutDefaultInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/SwitchStatementsWithoutDefaultInspection.java
deleted file mode 100644
index f33bc24694c7..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/SwitchStatementsWithoutDefaultInspection.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.siyeh.igtest.bugs;
-
-public class SwitchStatementsWithoutDefaultInspection
-{
- private int m_bar;
-
- public SwitchStatementsWithoutDefaultInspection()
- {
- m_bar = 0;
- }
-
- public void fooBar()
- {
- final int bar = m_bar;
- switch(bar)
- {
- case 3:
- case 4:
- System.out.println("3");
- break;
- case 7:
- case5:
- System.out.println("bar");
- break;
- case 6:
- System.out.println("4");
- break;
- default:
- break;
- }
-
- switch(bar)
- {
- case 3:
- case 4:
- System.out.println("3");
-
- break;
- case 7:
- case5:
- System.out.println("bar");
- break;
- case 6:
- System.out.println("4");
- break;
- }
- MyEnum var = MyEnum.foo;
- switch(var)
- {
- case foo:
- case bar:
- case baz:
- break;
- }
- switch(var)
- {
- case bar:
- case baz:
- break;
- }
- }
-}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/EmptyStatementBodyInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/empty_statement_body/EmptyStatementBody.java
index 4b1aca254417..38f7601b13ab 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/EmptyStatementBodyInspection.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/empty_statement_body/EmptyStatementBody.java
@@ -1,8 +1,8 @@
-package com.siyeh.igtest.bugs;
+package com.siyeh.igtest.bugs.empty_statement_body;
-public class EmptyStatementBodyInspection
+public class EmptyStatementBody
{
- private void foo()
+ private void foo(int j)
{
while(bar());
while(bar()){
@@ -29,6 +29,7 @@ public class EmptyStatementBodyInspection
}
else;
+ switch (j) {}
}
private boolean bar()
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/empty_statement_body/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/empty_statement_body/expected.xml
new file mode 100644
index 000000000000..2132751ff25d
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/empty_statement_body/expected.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems>
+ <problem>
+ <file>EmptyStatementBody.java</file>
+ <line>7</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Statement with empty body</problem_class>
+ <description>&lt;code&gt;while&lt;/code&gt; statement has empty body #loc</description>
+ </problem>
+
+ <problem>
+ <file>EmptyStatementBody.java</file>
+ <line>8</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Statement with empty body</problem_class>
+ <description>&lt;code&gt;while&lt;/code&gt; statement has empty body #loc</description>
+ </problem>
+
+ <problem>
+ <file>EmptyStatementBody.java</file>
+ <line>11</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Statement with empty body</problem_class>
+ <description>&lt;code&gt;for&lt;/code&gt; statement has empty body #loc</description>
+ </problem>
+
+ <problem>
+ <file>EmptyStatementBody.java</file>
+ <line>12</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Statement with empty body</problem_class>
+ <description>&lt;code&gt;for&lt;/code&gt; statement has empty body #loc</description>
+ </problem>
+
+ <problem>
+ <file>EmptyStatementBody.java</file>
+ <line>16</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Statement with empty body</problem_class>
+ <description>&lt;code&gt;if&lt;/code&gt; statement has empty body #loc</description>
+ </problem>
+
+ <problem>
+ <file>EmptyStatementBody.java</file>
+ <line>17</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Statement with empty body</problem_class>
+ <description>&lt;code&gt;if&lt;/code&gt; statement has empty body #loc</description>
+ </problem>
+
+ <problem>
+ <file>EmptyStatementBody.java</file>
+ <line>23</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Statement with empty body</problem_class>
+ <description>&lt;code&gt;else&lt;/code&gt; statement has empty body #loc</description>
+ </problem>
+
+ <problem>
+ <file>EmptyStatementBody.java</file>
+ <line>30</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Statement with empty body</problem_class>
+ <description>&lt;code&gt;else&lt;/code&gt; statement has empty body #loc</description>
+ </problem>
+
+ <problem>
+ <file>EmptyStatementBody.java</file>
+ <line>32</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Statement with empty body</problem_class>
+ <description>&lt;code&gt;switch&lt;/code&gt; statement has empty body #loc</description>
+ </problem>
+</problems> \ No newline at end of file