[groovy] Fix tests failed because of changed description

GitOrigin-RevId: 71e76ae96bb2af42e4d85600d8e7edda2812ebb4
This commit is contained in:
Konstantin Nisht
2021-04-14 22:03:02 +03:00
committed by intellij-monorepo-bot
parent 3cb89b934e
commit 6a6acdf771
6 changed files with 16 additions and 30 deletions
@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.codeInspection.confusing
import com.intellij.codeInspection.LocalInspectionTool
@@ -18,20 +18,20 @@ class GroovyPointlessBooleanInspectionTest extends GroovyLatestTest implements H
@Test
void 'simple unary'() {
doTest($/<warning descr="!false can be simplified to 'true'">!false</warning>/$, 'true')
doTest($/<warning descr="!true can be simplified to 'false'">!true</warning>/$, 'false')
doTest($/<warning descr="Redundant boolean operations">!false</warning>/$, 'true')
doTest($/<warning descr="Redundant boolean operations">!true</warning>/$, 'false')
}
@Test
void 'double-negation unary'() {
doTest($/<warning descr="!!false can be simplified to 'false'">!!false</warning>/$, 'false')
doTest($/<warning descr="!!true can be simplified to 'true'">!!true</warning>/$, 'true')
doTest($/<warning descr="Redundant boolean operations">!!false</warning>/$, 'false')
doTest($/<warning descr="Redundant boolean operations">!!true</warning>/$, 'true')
}
@Test
void 'triple-negation unary'() {
doTest($/!<caret><warning descr="!!false can be simplified to 'false'">!!false</warning>/$, '!false')
doTest($/!<caret><warning descr="!!true can be simplified to 'true'">!!true</warning>/$, '!true')
doTest($/!<caret><warning descr="Redundant boolean operations">!!false</warning>/$, '!false')
doTest($/!<caret><warning descr="Redundant boolean operations">!!true</warning>/$, '!true')
}
private void doTest(String before, String after) {
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2015 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.
*/
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.lang.highlighting
import com.intellij.codeInspection.InspectionProfileEntry
@@ -24,7 +10,7 @@ class GrResultOfAssignmentUsedTest extends GrHighlightingTestBase {
@Override
InspectionProfileEntry[] getCustomInspections() { [inspection] }
final warnStart = '<warning descr="Result of assignment expression used">'
final warnStart = '<warning descr="Usage of assignment expression result">'
final warnEnd = '</warning>'
void testUsedVar() {
@@ -15,11 +15,11 @@ Boolean getSchedule2() {
}
boolean getSchedule3(boolean cronExpression) {
return <warning descr="'cronExpression ? true : false' can be simplified to 'cronExpression'">cronExpression ? true : false</warning>
return <warning descr="Trivial conditional expression">cronExpression ? true : false</warning>
}
boolean getSchedule4(Boolean cronExpression) {
return <warning descr="'cronExpression ? true : false' can be simplified to 'cronExpression'">cronExpression ? true : false</warning>
return <warning descr="Trivial conditional expression">cronExpression ? true : false</warning>
}
+1 -1
View File
@@ -1,4 +1,4 @@
class Foo {
}
print <warning descr="Type 'Foo' cannot be iterated in range because it does not have method 'next()'"><warning descr="Type 'Foo' cannot be iterated in range because it does not have method 'previous()'"><warning descr="Type 'Foo' doesn't implement Comparable">new Foo()..new Foo()</warning></warning></warning>
print <warning descr="Type 'Foo' cannot be iterated in range because it does not have method 'next()'"><warning descr="Type 'Foo' cannot be iterated in range because it does not have method 'previous()'"><warning descr="Type 'Foo' does not implement Comparable">new Foo()..new Foo()</warning></warning></warning>
@@ -3,13 +3,13 @@ public class AssResult {
String vs = 'prefix'
if (b) vs += ps // no warning
if (b) { vs += ps } // no warning
print <warning descr="Result of assignment expression used">vs = 4</warning>
print <warning descr="Usage of assignment expression result">vs = 4</warning>
println ps
}
def assUsed() {
def a = 2
<warning descr="Result of assignment expression used">a = 3</warning>
<warning descr="Usage of assignment expression result">a = 3</warning>
}
void assIsNotUsed() {
@@ -1,5 +1,5 @@
for (int i=0;i<10; i++) {
def x = <warning descr="Result of increment or decrement expression used">i++</warning>
def x = <warning descr="Usage of increment or decrement results">i++</warning>
}
def x= 0
@@ -8,5 +8,5 @@ if (true) x++
print x
def foo(d) {
<warning descr="Result of increment or decrement expression used">d++</warning> //used in return
<warning descr="Usage of increment or decrement results">d++</warning> //used in return
}