AbstractSearcherTest: check member kind in test data not the psi implementation class
It is not what should be tested in this test
This commit is contained in:
@@ -11,6 +11,6 @@ class TestClass5 {
|
||||
}
|
||||
|
||||
// ANNOTATION: java.lang.Deprecated
|
||||
// SEARCH: KotlinLightClass:TestClass1, KotlinLightClass:TestClass2, KotlinLightClass:TestClass3
|
||||
// SEARCH: KotlinLightClass:TestClass4
|
||||
// SEARCH: KotlinLightClass:TestClass5.innerTestClass5
|
||||
// SEARCH: class:TestClass1, class:TestClass2, class:TestClass3
|
||||
// SEARCH: class:TestClass4
|
||||
// SEARCH: class:innerTestClass5
|
||||
@@ -27,8 +27,8 @@ object Test7 {
|
||||
}
|
||||
|
||||
// ANNOTATION: java.lang.Deprecated
|
||||
// SEARCH: KotlinLightMethodForDeclaration:test1
|
||||
// SEARCH: KotlinLightMethodForDeclaration:test2
|
||||
// SEARCH: KotlinLightMethodForDeclaration:test4
|
||||
// SEARCH: KotlinLightMethodForDeclaration:test6
|
||||
// SEARCH: KotlinLightMethodForDeclaration:test7
|
||||
// SEARCH: method:test1
|
||||
// SEARCH: method:test2
|
||||
// SEARCH: method:test4
|
||||
// SEARCH: method:test6
|
||||
// SEARCH: method:test7
|
||||
@@ -7,5 +7,5 @@
|
||||
annotation class MyAnnotation(val first: String, val second: String)
|
||||
|
||||
// ANNOTATION: MyAnnotation
|
||||
// SEARCH: KotlinLightMethodForDeclaration:test1
|
||||
// SEARCH: KotlinLightClass:Test1
|
||||
// SEARCH: method:test1
|
||||
// SEARCH: class:Test1
|
||||
@@ -1,4 +1,4 @@
|
||||
class A: Object() {}
|
||||
|
||||
// CLASS: java.lang.Object
|
||||
// SEARCH: KotlinLightClass:A
|
||||
// SEARCH: class:A
|
||||
|
||||
@@ -3,4 +3,4 @@ class A: Base() {}
|
||||
open class Base() {}
|
||||
|
||||
// CLASS: Base
|
||||
// SEARCH: KotlinLightClass:A
|
||||
// SEARCH: class:A
|
||||
+1
-1
@@ -9,4 +9,4 @@ class Test2: junit.framework.TestCase() {
|
||||
}
|
||||
|
||||
// CLASS: junit.framework.TestCase
|
||||
// SEARCH: KotlinLightClass:Test1, KotlinLightClass:Test2
|
||||
// SEARCH: class:Test1, class:Test2
|
||||
+6
-6
@@ -17,9 +17,9 @@ class MyTestClass {
|
||||
}
|
||||
|
||||
// ANNOTATION: org.junit.Test
|
||||
// SEARCH: KotlinLightMethodForDeclaration:test1
|
||||
// SEARCH: KotlinLightMethodForDeclaration:test2
|
||||
// SEARCH: KotlinLightMethodForDeclaration:test3
|
||||
// SEARCH: KotlinLightMethodForDeclaration:test4
|
||||
// SEARCH: KotlinLightMethodForDeclaration:test5
|
||||
// SEARCH: KotlinLightMethodForDeclaration:test6
|
||||
// SEARCH: method:test1
|
||||
// SEARCH: method:test2
|
||||
// SEARCH: method:test3
|
||||
// SEARCH: method:test4
|
||||
// SEARCH: method:test5
|
||||
// SEARCH: method:test6
|
||||
+3
-3
@@ -10,6 +10,6 @@ class MyTestClass {
|
||||
}
|
||||
|
||||
// ANNOTATION: org.junit.Test
|
||||
// SEARCH: KotlinLightMethodForDeclaration:test1
|
||||
// SEARCH: KotlinLightMethodForDeclaration:test2
|
||||
// SEARCH: KotlinLightMethodForDeclaration:test3
|
||||
// SEARCH: method:test1
|
||||
// SEARCH: method:test2
|
||||
// SEARCH: method:test3
|
||||
+3
-3
@@ -10,6 +10,6 @@ class MyTestClass {
|
||||
}
|
||||
|
||||
// ANNOTATION: org.junit.Test
|
||||
// SEARCH: KotlinLightMethodForDeclaration:test1
|
||||
// SEARCH: KotlinLightMethodForDeclaration:test2
|
||||
// SEARCH: KotlinLightMethodForDeclaration:test3
|
||||
// SEARCH: method:test1
|
||||
// SEARCH: method:test2
|
||||
// SEARCH: method:test3
|
||||
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.search;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
@@ -59,13 +60,23 @@ public abstract class AbstractSearcherTest extends LightCodeInsightFixtureTestCa
|
||||
List<String> expected = InTextDirectivesUtils.findListWithPrefixes(FileUtil.loadFile(new File(getPathToFile()), true), "// SEARCH: ");
|
||||
List<String> actualModified = new ArrayList<String>();
|
||||
for (Object member : actual) {
|
||||
actualModified.add(member.toString());
|
||||
actualModified.add(stringRepresentation(member));
|
||||
}
|
||||
Collections.sort(expected);
|
||||
Collections.sort(actualModified);
|
||||
assertOrderedEquals(actualModified, expected);
|
||||
}
|
||||
|
||||
private static String stringRepresentation(Object member) {
|
||||
if (member instanceof PsiClass) {
|
||||
return "class:" + ((PsiClass) member).getName();
|
||||
}
|
||||
if (member instanceof PsiMethod) {
|
||||
return "method:" + ((PsiMethod) member).getName();
|
||||
}
|
||||
throw new IllegalStateException("Do not know how to render member of type: " + member.getClass().getName());
|
||||
}
|
||||
|
||||
protected String getPathToFile() {
|
||||
return getTestDataPath() + File.separator + getName() + ".kt";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user