KT-1389 Ctrl-Alt-B on class declaration does not work - one more test, remove class info from test info, fix order of test data
#KT-1389 In Progress
This commit is contained in:
@@ -0,0 +1,11 @@
|
|||||||
|
package testing
|
||||||
|
|
||||||
|
open class Test
|
||||||
|
|
||||||
|
open class TestOther : <caret>Test()
|
||||||
|
|
||||||
|
class TestOtherMore : TestOther()
|
||||||
|
|
||||||
|
// REF: Test
|
||||||
|
// REF: TestOther
|
||||||
|
// REF: TestOtherMore
|
||||||
@@ -2,6 +2,9 @@ package testing
|
|||||||
|
|
||||||
open class <caret>Test
|
open class <caret>Test
|
||||||
|
|
||||||
class TestOther : Test()
|
open class TestOther : Test()
|
||||||
|
|
||||||
// REF: JetLightClass:testing.TestOther
|
class TestOtherMore : TestOther()
|
||||||
|
|
||||||
|
// REF: TestOtherMore
|
||||||
|
// REF: TestOther
|
||||||
|
|||||||
@@ -18,8 +18,11 @@ package org.jetbrains.jet.plugin.navigation;
|
|||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Ordering;
|
||||||
import com.intellij.codeInsight.navigation.GotoImplementationHandler;
|
import com.intellij.codeInsight.navigation.GotoImplementationHandler;
|
||||||
import com.intellij.codeInsight.navigation.GotoTargetHandler;
|
import com.intellij.codeInsight.navigation.GotoTargetHandler;
|
||||||
|
import com.intellij.navigation.ItemPresentation;
|
||||||
|
import com.intellij.navigation.NavigationItem;
|
||||||
import com.intellij.openapi.projectRoots.Sdk;
|
import com.intellij.openapi.projectRoots.Sdk;
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import com.intellij.testFramework.LightCodeInsightTestCase;
|
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||||
@@ -29,6 +32,7 @@ import org.jetbrains.jet.testing.InTextDirectivesUtils;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,6 +43,10 @@ public class JetGotoImplementationTest extends LightCodeInsightTestCase {
|
|||||||
doTest();
|
doTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testClassImplementatorsWithDeclaration() {
|
||||||
|
doTest();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTestDataPath() {
|
protected String getTestDataPath() {
|
||||||
return new File(PluginTestCaseBase.getTestDataPathBase(), "/navigation/implementations").getPath() +
|
return new File(PluginTestCaseBase.getTestDataPathBase(), "/navigation/implementations").getPath() +
|
||||||
@@ -55,6 +63,7 @@ public class JetGotoImplementationTest extends LightCodeInsightTestCase {
|
|||||||
|
|
||||||
List<String> expectedReferences = Arrays.asList(
|
List<String> expectedReferences = Arrays.asList(
|
||||||
InTextDirectivesUtils.findListWithPrefix("// REF:", getEditor().getDocument().getText()));
|
InTextDirectivesUtils.findListWithPrefix("// REF:", getEditor().getDocument().getText()));
|
||||||
|
Collections.sort(expectedReferences);
|
||||||
|
|
||||||
GotoTargetHandler.GotoData elements = new GotoImplementationHandler().getSourceAndTargetElements(getEditor(), getFile());
|
GotoTargetHandler.GotoData elements = new GotoImplementationHandler().getSourceAndTargetElements(getEditor(), getFile());
|
||||||
|
|
||||||
@@ -63,11 +72,14 @@ public class JetGotoImplementationTest extends LightCodeInsightTestCase {
|
|||||||
@Override
|
@Override
|
||||||
public String apply(@Nullable PsiElement element) {
|
public String apply(@Nullable PsiElement element) {
|
||||||
assertNotNull(element);
|
assertNotNull(element);
|
||||||
return element.toString();
|
assertTrue(element instanceof NavigationItem);
|
||||||
|
ItemPresentation presentation = ((NavigationItem)element).getPresentation();
|
||||||
|
assertNotNull(presentation);
|
||||||
|
return presentation.getPresentableText();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
assertOrderedEquals(expectedReferences, psiElements);
|
assertOrderedEquals(Ordering.natural().sortedCopy(psiElements), expectedReferences);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assertEmpty(expectedReferences);
|
assertEmpty(expectedReferences);
|
||||||
|
|||||||
Reference in New Issue
Block a user