IDEA-87966 tests added

This commit is contained in:
Danila Ponomarenko
2012-06-29 17:09:25 +04:00
parent 301fd02f1e
commit 63227be277
3 changed files with 61 additions and 0 deletions
@@ -0,0 +1,22 @@
public class Bug {
interface I1{}
interface I2{}
class C1 {}
class C2 extends C1 implements I1, I2{}
class C3 extends C1 implements I1, I2{}
public static void x(C1 c1) {
if (c1 instanceof I1 && c1 instanceof I2) {
}
if (1 > Math.random() && Math.random()==Math.random()) {
}
boolean b = true;
if (!b){
}
}
}
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
<problem>
<file>PointlessBooleanExpression.java</file>
<line>18</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Pointless boolean expression</problem_class>
<description>Condition '!b' is always 'false'</description>
</problem>
</problems>
@@ -0,0 +1,30 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.siyeh.ig.controlflow;
import com.siyeh.ig.IGInspectionTestCase;
/**
* @author Danila Ponomarenko
*/
public class PointlessBooleanExpressionInspectionTest extends IGInspectionTestCase {
public void testIgnoreExpressionsContainingConstants() throws Exception {
final PointlessBooleanExpressionInspection inspection = new PointlessBooleanExpressionInspection();
inspection.m_ignoreExpressionsContainingConstants = true;
doTest("com/siyeh/igtest/controlflow/pointless_boolean_expression_ignore_cont_const", inspection);
}
}