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:
Nikolay Krasko
2012-08-15 22:09:24 +04:00
parent 0b97b14642
commit 1b4603a64a
3 changed files with 30 additions and 4 deletions
@@ -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
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.collect.Lists;
import com.google.common.collect.Ordering;
import com.intellij.codeInsight.navigation.GotoImplementationHandler;
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.psi.PsiElement;
import com.intellij.testFramework.LightCodeInsightTestCase;
@@ -29,6 +32,7 @@ import org.jetbrains.jet.testing.InTextDirectivesUtils;
import java.io.File;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
@@ -39,6 +43,10 @@ public class JetGotoImplementationTest extends LightCodeInsightTestCase {
doTest();
}
public void testClassImplementatorsWithDeclaration() {
doTest();
}
@Override
protected String getTestDataPath() {
return new File(PluginTestCaseBase.getTestDataPathBase(), "/navigation/implementations").getPath() +
@@ -55,6 +63,7 @@ public class JetGotoImplementationTest extends LightCodeInsightTestCase {
List<String> expectedReferences = Arrays.asList(
InTextDirectivesUtils.findListWithPrefix("// REF:", getEditor().getDocument().getText()));
Collections.sort(expectedReferences);
GotoTargetHandler.GotoData elements = new GotoImplementationHandler().getSourceAndTargetElements(getEditor(), getFile());
@@ -63,11 +72,14 @@ public class JetGotoImplementationTest extends LightCodeInsightTestCase {
@Override
public String apply(@Nullable PsiElement 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 {
assertEmpty(expectedReferences);