From fda1a479b50ba517d3822337b7fa80c523016575 Mon Sep 17 00:00:00 2001 From: Daniil Ovchinnikov Date: Thu, 30 Jan 2020 21:48:10 +0300 Subject: [PATCH] [groovy] fix testdata: rename classes to differ from file names if the file is a script GitOrigin-RevId: 37e48f2fcafb2bd0dceb4025a9f1902e085f2507 --- .../groovy/lang/resolve/GroovyResolveTestCase.groovy | 4 ++-- .../groovy/lang/resolve/TypeInferenceTest.groovy | 4 ++-- .../resolve/inference/genericWildcard/A.groovy | 11 +++++------ .../testdata/resolve/inference/incMethod/A.groovy | 4 ++-- .../testdata/resolve/property/f1property/A.groovy | 4 ++-- .../testdata/resolve/property/fromGetter2/A.groovy | 4 ++-- .../testdata/resolve/property/fromSetter2/A.groovy | 4 ++-- .../property/nonStaticFieldInStaticContext/A.groovy | 4 ++-- .../testdata/resolve/property/toGetter/A.groovy | 4 ++-- .../testdata/resolve/property/toSetter/A.groovy | 4 ++-- 10 files changed, 23 insertions(+), 24 deletions(-) diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/GroovyResolveTestCase.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/GroovyResolveTestCase.groovy index fc075fae8612..104580117023 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/GroovyResolveTestCase.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/GroovyResolveTestCase.groovy @@ -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-2020 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.resolve import com.intellij.openapi.util.text.StringUtil @@ -47,7 +47,7 @@ abstract class GroovyResolveTestCase extends LightGroovyTestCase { fileText = fileText.substring(0, offset) + fileText.substring(offset + MARKER.length()) if (newFilePath == null) { - myFixture.configureByText("aaa." + vFile.extension, fileText) + myFixture.configureByText(vFile.getName(), fileText) } else { myFixture.configureByText(newFilePath, fileText) diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/TypeInferenceTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/TypeInferenceTest.groovy index c07358e24e62..b86e34bd8120 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/TypeInferenceTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/TypeInferenceTest.groovy @@ -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-2020 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.resolve import com.intellij.openapi.util.RecursionManager @@ -118,7 +118,7 @@ class TypeInferenceTest extends TypeInferenceTestBase { void testGenericWildcard() { final GrReferenceExpression ref = (GrReferenceExpression)configureByFile("genericWildcard/A.groovy").element - assertEquals("A", ref.type.canonicalText) + assertEquals("X", ref.type.canonicalText) } void testArrayLikeAccessWithIntSequence() { diff --git a/plugins/groovy/testdata/resolve/inference/genericWildcard/A.groovy b/plugins/groovy/testdata/resolve/inference/genericWildcard/A.groovy index 7d99a8fa9b3f..04594537a443 100644 --- a/plugins/groovy/testdata/resolve/inference/genericWildcard/A.groovy +++ b/plugins/groovy/testdata/resolve/inference/genericWildcard/A.groovy @@ -1,12 +1,11 @@ -class A {} +class X {} interface Base {} interface I1 extends Base {} interface I2 extends Base {} -def A or(A... e) {return null} - -def a1 = new A() -def a2 = new A() -or(a1, a2) +def X or(X... e) {return null} +def x1 = new X() +def x2 = new X() +or(x1, x2) diff --git a/plugins/groovy/testdata/resolve/inference/incMethod/A.groovy b/plugins/groovy/testdata/resolve/inference/incMethod/A.groovy index 094dd1d71ae7..6137cd4328fa 100644 --- a/plugins/groovy/testdata/resolve/inference/incMethod/A.groovy +++ b/plugins/groovy/testdata/resolve/inference/incMethod/A.groovy @@ -1,8 +1,8 @@ -class A { +class X { def next() {2} } -def aa = new A() +def aa = new X() aa++ print aa \ No newline at end of file diff --git a/plugins/groovy/testdata/resolve/property/f1property/A.groovy b/plugins/groovy/testdata/resolve/property/f1property/A.groovy index cc093931974a..12e0bafaf37e 100644 --- a/plugins/groovy/testdata/resolve/property/f1property/A.groovy +++ b/plugins/groovy/testdata/resolve/property/f1property/A.groovy @@ -1,5 +1,5 @@ -class A { +class X { def f1 } -print new A().getF1() \ No newline at end of file +print new X().getF1() \ No newline at end of file diff --git a/plugins/groovy/testdata/resolve/property/fromGetter2/A.groovy b/plugins/groovy/testdata/resolve/property/fromGetter2/A.groovy index 26aaa85af715..dd80a3e4a459 100644 --- a/plugins/groovy/testdata/resolve/property/fromGetter2/A.groovy +++ b/plugins/groovy/testdata/resolve/property/fromGetter2/A.groovy @@ -1,4 +1,4 @@ -class A { +class X { int j def r() { @@ -6,4 +6,4 @@ class A { } } -int r = new A().j \ No newline at end of file +int r = new X().j \ No newline at end of file diff --git a/plugins/groovy/testdata/resolve/property/fromSetter2/A.groovy b/plugins/groovy/testdata/resolve/property/fromSetter2/A.groovy index af9c2c0ece22..fd68e4a46185 100644 --- a/plugins/groovy/testdata/resolve/property/fromSetter2/A.groovy +++ b/plugins/groovy/testdata/resolve/property/fromSetter2/A.groovy @@ -1,4 +1,4 @@ -class A { +class X { int j def r() { @@ -7,4 +7,4 @@ class A { } -new A().j=10 \ No newline at end of file +new X().j=10 \ No newline at end of file diff --git a/plugins/groovy/testdata/resolve/property/nonStaticFieldInStaticContext/A.groovy b/plugins/groovy/testdata/resolve/property/nonStaticFieldInStaticContext/A.groovy index 81b128116f53..2840458c95cb 100644 --- a/plugins/groovy/testdata/resolve/property/nonStaticFieldInStaticContext/A.groovy +++ b/plugins/groovy/testdata/resolve/property/nonStaticFieldInStaticContext/A.groovy @@ -1,5 +1,5 @@ -class A { +class X { public nonFinal = 4 } -print A.nonFinal \ No newline at end of file +print X.nonFinal \ No newline at end of file diff --git a/plugins/groovy/testdata/resolve/property/toGetter/A.groovy b/plugins/groovy/testdata/resolve/property/toGetter/A.groovy index 17c91d097c5c..ca242df06ad0 100644 --- a/plugins/groovy/testdata/resolve/property/toGetter/A.groovy +++ b/plugins/groovy/testdata/resolve/property/toGetter/A.groovy @@ -1,4 +1,4 @@ -class A { +class X { int property int getProperty() { @@ -6,6 +6,6 @@ class A { } } -def a = new A() +def a = new X() def p = a.property \ No newline at end of file diff --git a/plugins/groovy/testdata/resolve/property/toSetter/A.groovy b/plugins/groovy/testdata/resolve/property/toSetter/A.groovy index a02270b02542..01ecc5de39b7 100644 --- a/plugins/groovy/testdata/resolve/property/toSetter/A.groovy +++ b/plugins/groovy/testdata/resolve/property/toSetter/A.groovy @@ -1,4 +1,4 @@ -class A { +class X { int property int getProperty() { @@ -10,6 +10,6 @@ class A { } } -def a = new A() +def a = new X() a.property = 0 \ No newline at end of file