Test not only line marker number but also their position
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
open class A {
|
open class <lineMarker></lineMarker>A {
|
||||||
open fun a(){
|
open fun a(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class B:A(){
|
class B:A(){
|
||||||
override fun a(){
|
override fun <lineMarker></lineMarker>a(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
trait A {
|
trait <lineMarker></lineMarker>A {
|
||||||
fun a(){
|
fun a(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class B :A {
|
class B :A {
|
||||||
override fun a(){
|
override fun <lineMarker></lineMarker>a(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+21
-14
@@ -18,8 +18,10 @@ package org.jetbrains.jet.plugin.codeInsight;
|
|||||||
|
|
||||||
import com.intellij.codeInsight.daemon.LineMarkerInfo;
|
import com.intellij.codeInsight.daemon.LineMarkerInfo;
|
||||||
import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl;
|
import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Document;
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
|
import com.intellij.psi.PsiDocumentManager;
|
||||||
|
import com.intellij.testFramework.ExpectedHighlightingData;
|
||||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||||
|
|
||||||
@@ -33,26 +35,31 @@ public class OverrideImplementLineMarkerTest extends LightCodeInsightFixtureTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testTrait() throws Throwable {
|
public void testTrait() throws Throwable {
|
||||||
doSimpleTest(2);
|
doTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testClass() throws Throwable {
|
public void testClass() throws Throwable {
|
||||||
doSimpleTest(2);
|
doTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doSimpleTest(int count) throws Throwable {
|
private void doTest() {
|
||||||
myFixture.configureByFile(getTestName(false) + ".kt");
|
try {
|
||||||
doTest(count);
|
myFixture.configureByFile(getTestName(false) + ".kt");
|
||||||
}
|
Project project = myFixture.getProject();
|
||||||
|
Document document = myFixture.getEditor().getDocument();
|
||||||
|
|
||||||
private void doTest(int count) {
|
ExpectedHighlightingData data = new ExpectedHighlightingData(document, false, false, false, myFixture.getFile());
|
||||||
Editor editor = myFixture.getEditor();
|
data.init();
|
||||||
Project project = myFixture.getProject();
|
|
||||||
|
|
||||||
myFixture.doHighlighting();
|
PsiDocumentManager.getInstance(project).commitAllDocuments();
|
||||||
|
|
||||||
List<LineMarkerInfo> infoList = DaemonCodeAnalyzerImpl.getLineMarkers(editor.getDocument(), project);
|
myFixture.doHighlighting();
|
||||||
assertNotNull(infoList);
|
|
||||||
assertEquals(count, infoList.size());
|
List<LineMarkerInfo> markers = DaemonCodeAnalyzerImpl.getLineMarkers(document, project);
|
||||||
|
data.checkLineMarkers(markers, document.getText());
|
||||||
|
}
|
||||||
|
catch (Exception exc) {
|
||||||
|
throw new RuntimeException(exc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user