mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
make IG test light
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
package com.siyeh.igtest.bugs;
|
||||
|
||||
public class DuplicateCondition {
|
||||
public void foo()
|
||||
{
|
||||
if(bar()||bar())
|
||||
{
|
||||
System.out.println("1");
|
||||
}else if(bar()|| true)
|
||||
{
|
||||
System.out.println("2");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean bar()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void incompleteCode(String s) {
|
||||
if (s.contains(A)) {
|
||||
|
||||
} else if (s.contains(B)) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+27
-3
@@ -3,10 +3,34 @@ package com.siyeh.igtest.controlflow.duplicate_condition;
|
||||
public class DuplicateCondition {
|
||||
|
||||
void x(boolean b) {
|
||||
if (b || b || b ) {
|
||||
if (<warning descr="Duplicate condition 'b'">b</warning> || <warning descr="Duplicate condition 'b'">b</warning> || <warning descr="Duplicate condition 'b'">b</warning> ) {
|
||||
|
||||
} else if (b) {
|
||||
} else if (<warning descr="Duplicate condition 'b'">b</warning>) {
|
||||
|
||||
} else if (b) {}
|
||||
} else if (<warning descr="Duplicate condition 'b'">b</warning>) {}
|
||||
}
|
||||
|
||||
public void foo()
|
||||
{
|
||||
if(<warning descr="Duplicate condition 'bar()'">bar()</warning>||<warning descr="Duplicate condition 'bar()'">bar()</warning>)
|
||||
{
|
||||
System.out.println("1");
|
||||
}else if(<warning descr="Duplicate condition 'bar()'">bar()</warning>|| true)
|
||||
{
|
||||
System.out.println("2");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean bar()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void incompleteCode(String s) {
|
||||
if (s.contains(<error descr="Cannot resolve symbol 'A'">A</error>)) {
|
||||
|
||||
} else if (s.contains(<error descr="Cannot resolve symbol 'B'">B</error>)) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
<problem>
|
||||
<file>DuplicateCondition.java</file>
|
||||
<line>6</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Duplicate condition in 'if' statement</problem_class>
|
||||
<description>Duplicate condition <code>b</code> #loc</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>DuplicateCondition.java</file>
|
||||
<line>6</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Duplicate condition in 'if' statement</problem_class>
|
||||
<description>Duplicate condition <code>b</code> #loc</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>DuplicateCondition.java</file>
|
||||
<line>8</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Duplicate condition in 'if' statement</problem_class>
|
||||
<description>Duplicate condition <code>b</code> #loc</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>DuplicateCondition.java</file>
|
||||
<line>6</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Duplicate condition in 'if' statement</problem_class>
|
||||
<description>Duplicate condition <code>b</code> #loc</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>DuplicateCondition.java</file>
|
||||
<line>10</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Duplicate condition in 'if' statement</problem_class>
|
||||
<description>Duplicate condition <code>b</code> #loc</description>
|
||||
</problem>
|
||||
</problems>
|
||||
+12
-4
@@ -1,10 +1,18 @@
|
||||
package com.siyeh.ig.controlflow;
|
||||
|
||||
import com.siyeh.ig.IGInspectionTestCase;
|
||||
import com.intellij.codeInspection.InspectionProfileEntry;
|
||||
import com.siyeh.ig.LightInspectionTestCase;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class DuplicateConditionInspectionTest extends IGInspectionTestCase {
|
||||
public class DuplicateConditionInspectionTest extends LightInspectionTestCase {
|
||||
|
||||
public void test() throws Exception {
|
||||
doTest("com/siyeh/igtest/controlflow/duplicate_condition", new DuplicateConditionInspection());
|
||||
public void testDuplicateCondition() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected InspectionProfileEntry getInspection() {
|
||||
return new DuplicateConditionInspection();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user