mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[groovy] extract CategorySupportTest
This commit is contained in:
+45
@@ -0,0 +1,45 @@
|
||||
// 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.
|
||||
package org.jetbrains.plugins.groovy.lang.resolve
|
||||
|
||||
import com.intellij.psi.PsiModifier
|
||||
import groovy.transform.CompileStatic
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrGdkMethod
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrReflectedMethod
|
||||
import org.jetbrains.plugins.groovy.util.GroovyLatestTest
|
||||
import org.jetbrains.plugins.groovy.util.ResolveTest
|
||||
import org.junit.Test
|
||||
|
||||
@CompileStatic
|
||||
class CategorySupportTest extends GroovyLatestTest implements ResolveTest {
|
||||
|
||||
@Test
|
||||
void 'static category method outside of category'() {
|
||||
def resolved = resolveTest '''\
|
||||
@Category(String) class C { def foo() {} }
|
||||
C.<caret>foo("")
|
||||
''', GrReflectedMethod
|
||||
assert resolved.modifierList.hasModifierProperty(PsiModifier.STATIC)
|
||||
}
|
||||
|
||||
@Test
|
||||
void 'category method within category'() {
|
||||
resolveTest '''\
|
||||
@Category(String)
|
||||
class C {
|
||||
def foo() {}
|
||||
def usage() { <caret>foo() }
|
||||
}
|
||||
''', GrGdkMethod
|
||||
}
|
||||
|
||||
@Test
|
||||
void 'explicit category method within category'() {
|
||||
resolveTest '''\
|
||||
@Category(String)
|
||||
class C {
|
||||
static def foo(String s) {}
|
||||
def usage() { <caret>foo() }
|
||||
}
|
||||
''', GrGdkMethod
|
||||
}
|
||||
}
|
||||
@@ -722,15 +722,6 @@ class Foo {
|
||||
assertNotNull(resolve('a.groovy'))
|
||||
}
|
||||
|
||||
void testCategoryClassMethod() {
|
||||
def resolved = resolve('a.groovy', GrReflectedMethod)
|
||||
assertTrue(resolved.modifierList.hasModifierProperty(PsiModifier.STATIC))
|
||||
}
|
||||
|
||||
void testCategoryMethodWithinCategory() {
|
||||
assertNotNull resolve('a.groovy')
|
||||
}
|
||||
|
||||
void testMixinAndCategory() {
|
||||
def ref = configureByText("""
|
||||
@Category(B)
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
@Category(A)
|
||||
class B {
|
||||
def foo(){}
|
||||
}
|
||||
|
||||
class A{}
|
||||
|
||||
B.f<ref>oo(new A())
|
||||
@@ -1,11 +0,0 @@
|
||||
class A {}
|
||||
|
||||
@Category(A)
|
||||
class B {
|
||||
|
||||
def foo() {
|
||||
ba<ref>r()
|
||||
}
|
||||
|
||||
def bar() {}
|
||||
}
|
||||
Reference in New Issue
Block a user