[groovy] tests: implement getBasePath()

This commit is contained in:
Daniil Ovchinnikov
2016-06-08 23:26:10 +03:00
parent 5f2c869b76
commit da9bca97f4
25 changed files with 39 additions and 56 deletions
@@ -58,7 +58,7 @@ public abstract class LightGroovyTestCase extends LightCodeInsightFixtureTestCas
*/
@Override
@NonNls
protected abstract String getBasePath();
protected String getBasePath() { null }
protected void addGroovyTransformField() {
@@ -26,7 +26,6 @@ import org.junit.runners.model.Statement
class SetupRule implements TestRule {
final LightGroovyTestCase testCase = new LightGroovyTestCase() {
String basePath = ""
LightProjectDescriptor projectDescriptor = GroovyLightProjectDescriptor.GROOVY_LATEST_REAL_JDK
}
@@ -32,7 +32,6 @@ import static org.jetbrains.plugins.groovy.GroovyLightProjectDescriptor.GROOVY_L
@CompileStatic
class JsonBuilderTest extends LightGroovyTestCase {
final String basePath = null
final LightProjectDescriptor projectDescriptor = GROOVY_LATEST
void 'test highlighting'() {
@@ -31,7 +31,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMe
@CompileStatic
class StreamingJsonBuilderTest extends LightGroovyTestCase {
final String basePath = null
final LightProjectDescriptor projectDescriptor = GroovyLightProjectDescriptor.GROOVY_LATEST
void 'test highlighting'() {
@@ -27,8 +27,6 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrLightMethodBuilder
*/
class XmlMarkupBuilderTest extends LightGroovyTestCase {
final String basePath = ""
public void testHighlighting() {
myFixture.enableInspections(GroovyAssignabilityCheckInspection, GrUnresolvedAccessInspection)
myFixture.configureByText "A.groovy", """\
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -22,10 +22,6 @@ import org.jetbrains.plugins.groovy.LightGroovyTestCase
@CompileStatic
class GrDependencyVisitorTest extends LightGroovyTestCase {
@Override
protected String getBasePath() {
return ""
}
void test() {
def file = myFixture.addFileToProject("C.groovy", "import groovy.util.ConfigObject\nclass C { }")
@@ -26,8 +26,6 @@ import org.jetbrains.plugins.groovy.lang.resolve.ast.builder.BuilderAnnotationCo
@CompileStatic
class MiscBuilderTransformationTest extends LightGroovyTestCase {
final String basePath = null
final LightProjectDescriptor projectDescriptor = GroovyLightProjectDescriptor.GROOVY_LATEST
void 'test resolve inner class from java'() {
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2016 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 org.jetbrains.plugins.groovy.dsl
import com.intellij.psi.util.PsiTreeUtil
@@ -9,10 +24,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrNewExp
* @author peter
*/
class DsldTest extends LightGroovyTestCase {
@Override
protected String getBasePath() {
return ''
}
public void testUnknownPointcut() {
checkHighlighting "contribute(asdfsadf()) { property name:'foo', type:'String' }",
@@ -28,7 +28,6 @@ import static org.jetbrains.plugins.groovy.util.TestUtils.CARET_MARKER
public class GrChangeToOperatorTest extends LightGroovyTestCase {
final String basePath = null
final LightProjectDescriptor projectDescriptor = GroovyLightProjectDescriptor.GROOVY_LATEST
def inspection = new ChangeToOperatorInspection()
@@ -27,7 +27,6 @@ import org.jetbrains.plugins.groovy.codeInspection.declaration.GrMethodMayBeStat
@CompileStatic
public class GrMethodMayBeStaticTest extends LightGroovyTestCase {
final String basePath = null
final LightProjectDescriptor projectDescriptor = GroovyLightProjectDescriptor.GROOVY_LATEST
final GrMethodMayBeStaticInspection inspection = new GrMethodMayBeStaticInspection()
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2016 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 org.jetbrains.plugins.groovy.inspections
import org.jetbrains.plugins.groovy.LightGroovyTestCase
@@ -7,7 +22,6 @@ import org.jetbrains.plugins.groovy.codeInspection.control.GroovyFallthroughInsp
* @author Bas Leijdekkers
*/
class GroovyFallthroughInspectionTest extends LightGroovyTestCase {
final String basePath = null
private void doTest(final String text) {
myFixture.configureByText('_.groovy', text)
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -23,10 +23,6 @@ import org.jetbrains.plugins.groovy.LightGroovyTestCase
* @author peter
*/
class LiteralConstructorUsagesTest extends LightGroovyTestCase {
@Override
protected String getBasePath() {
null
}
public void testList_AsCast() throws Exception {
def foo = myFixture.addClass("""class Foo {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -23,7 +23,6 @@ import org.jetbrains.plugins.groovy.GroovyFileType
* @author Max Medvedev
*/
class JoinLineTest extends GroovyEditorActionTestBase {
final String basePath = null
void testVariable() {
doTest('''\
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -27,7 +27,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefini
* @author Max Medvedev
*/
class GrAnnotationCollectorTest extends LightGroovyTestCase {
final String basePath = null
void testAnnotatedAlias() {
doTest('''\
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -25,7 +25,6 @@ import org.jetbrains.plugins.groovy.LightGroovyTestCase
* @author Max Medvedev
*/
class GrReturnPointHighlightingTest extends LightGroovyTestCase {
final String basePath = null
void testReturnPoint1() {
doTest('''\
@@ -24,8 +24,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefini
@CompileStatic
class GrAliasedImportInheritorsTest extends LightGroovyTestCase {
final String basePath = null
void 'test aliased import'() {
def iface = myFixture.addClass '''
package pckg;
@@ -259,9 +259,4 @@ class A implements T {
PsiMethod findMethod(String className, String methodName) {
return JavaPsiFacade.getInstance(project).findClass(className, GlobalSearchScope.allScope(project)).findMethodsByName(methodName, false)[0]
}
@Override
protected String getBasePath() {
return null
}
}
@@ -32,10 +32,6 @@ import org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrAnonymousClassIndex
*/
@CompileStatic
class GrStubAstSwitchTest extends LightGroovyTestCase {
@Override
protected String getBasePath() {
null
}
void testDontLoadContentWhenProcessingImports() {
GroovyFileImpl file = (GroovyFileImpl)myFixture.addFileToProject("A.groovy", """
@@ -25,7 +25,6 @@ import org.jetbrains.plugins.groovy.codeInspection.untypedUnresolvedAccess.GrUnr
@CompileStatic
class DelegatesToSupportTest extends LightGroovyTestCase {
final String basePath = null
final LightProjectDescriptor projectDescriptor = GroovyLightProjectDescriptor.GROOVY_LATEST
@Override
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -19,7 +19,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
public class GrDocResolveTest extends GroovyResolveTestCase {
final String basePath = null
void 'test resolve to property from within class'() {
resolveByText('''\
@@ -33,8 +33,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrRefere
public abstract class GroovyResolveTestCase extends LightGroovyTestCase {
@NonNls protected static final String MARKER = "<ref>";
protected String getBasePath() { null }
@Override
void setUp() {
super.setUp();
@@ -26,7 +26,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMe
class GroovyTraitCoercionTest extends GroovyResolveTestCase {
String basePath = null
LightProjectDescriptor projectDescriptor = GroovyLightProjectDescriptor.GROOVY_LATEST
@Override
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -24,10 +24,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMe
* @author Max Medvedev
*/
class ResolveAnnotationAttributeTest extends GroovyResolveTestCase {
@Override
protected String getBasePath() {
return null
}
void testSimpleAttribute() {
final ref = this.configureByText('''
@@ -21,7 +21,6 @@ import org.jetbrains.plugins.groovy.GroovyLightProjectDescriptor
class ResolveMethod23Test extends GroovyResolveTestCase {
final String basePath = null
final LightProjectDescriptor projectDescriptor = GroovyLightProjectDescriptor.GROOVY_2_3
void 'test resolve upper bound type method'() {
@@ -23,8 +23,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrRefere
* @author Max Medvedev
*/
class ResolveWithDelegatesToTest extends LightGroovyTestCase {
@Override
protected String getBasePath() { null }
@Override
public void setUp() throws Exception {