Fixed tests.
This commit is contained in:
parent
c13e488ab8
commit
b966623765
@ -63,10 +63,8 @@ class M68kLocalLabelReference(element: M68kSymbolReference) : PsiPolyVariantRefe
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getVariants(): Array<Any> {
|
override fun getVariants(): Array<Any> {
|
||||||
return findLocalLabels(element) { true }.asSequence()
|
return findLocalLabels(element) { true }
|
||||||
.distinct()
|
|
||||||
.map { LookupElementBuilder.createWithIcon(it) }
|
.map { LookupElementBuilder.createWithIcon(it) }
|
||||||
.toList()
|
|
||||||
.toTypedArray()
|
.toTypedArray()
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package de.platon42.intellij.plugins.m68k.refs
|
package de.platon42.intellij.plugins.m68k.refs
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.lookup.LookupElementBuilder
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import com.intellij.testFramework.fixtures.CodeInsightTestFixture
|
import com.intellij.testFramework.fixtures.CodeInsightTestFixture
|
||||||
import de.platon42.intellij.jupiter.LightCodeInsightExtension
|
import de.platon42.intellij.jupiter.LightCodeInsightExtension
|
||||||
@ -8,6 +9,7 @@ import de.platon42.intellij.jupiter.TestDataPath
|
|||||||
import de.platon42.intellij.jupiter.TestDataSubPath
|
import de.platon42.intellij.jupiter.TestDataSubPath
|
||||||
import de.platon42.intellij.plugins.m68k.AbstractM68kTest
|
import de.platon42.intellij.plugins.m68k.AbstractM68kTest
|
||||||
import de.platon42.intellij.plugins.m68k.psi.M68kLocalLabel
|
import de.platon42.intellij.plugins.m68k.psi.M68kLocalLabel
|
||||||
|
import de.platon42.intellij.plugins.m68k.psi.M68kSymbolReference
|
||||||
import org.assertj.core.api.Assertions.assertThat
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.junit.jupiter.api.extension.ExtendWith
|
import org.junit.jupiter.api.extension.ExtendWith
|
||||||
@ -18,20 +20,20 @@ import org.junit.jupiter.api.extension.ExtendWith
|
|||||||
internal class M68kReferenceContributorTest : AbstractM68kTest() {
|
internal class M68kReferenceContributorTest : AbstractM68kTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
internal fun reference_to_dot_local_label(@MyFixture myFixture: CodeInsightTestFixture) {
|
internal fun reference_to_dot_local_label_can_be_renamed(@MyFixture myFixture: CodeInsightTestFixture) {
|
||||||
// val reference = myFixture.getReferenceAtCaretPositionWithAssertion("dot_local_label.asm")
|
|
||||||
// assertThat(reference.element).isInstanceOf(M68kSym)
|
|
||||||
myFixture.configureByFile("dot_local_label.asm")
|
myFixture.configureByFile("dot_local_label.asm")
|
||||||
assertThat(myFixture.elementAtCaret).isInstanceOf(M68kLocalLabel::class.java)
|
assertThat(myFixture.elementAtCaret).isInstanceOf(M68kLocalLabel::class.java)
|
||||||
.extracting(PsiElement::getText).isEqualTo(".loop")
|
.extracting(PsiElement::getText).isEqualTo(".loop")
|
||||||
|
myFixture.renameElementAtCaret(".narf")
|
||||||
|
myFixture.checkResultByFile("dot_local_label_after_rename.asm")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
internal fun reference_to_multiple_conditional_local_label_dollar(@MyFixture myFixture: CodeInsightTestFixture) {
|
internal fun reference_to_multiple_conditional_local_label_dollar_and_variants(@MyFixture myFixture: CodeInsightTestFixture) {
|
||||||
val reference = myFixture.getReferenceAtCaretPositionWithAssertion("multiple_conditional_local_label_dollar.asm")
|
val reference = myFixture.getReferenceAtCaretPositionWithAssertion("multiple_conditional_local_label_dollar.asm")
|
||||||
assertThat(reference.element).isInstanceOf(M68kLocalLabel::class.java)
|
assertThat(reference.element).isInstanceOf(M68kSymbolReference::class.java)
|
||||||
myFixture.configureByFile("multiple_conditional_local_label_dollar.asm")
|
assertThat(reference.variants).hasOnlyElementsOfType(LookupElementBuilder::class.java)
|
||||||
assertThat(myFixture.elementAtCaret).isInstanceOf(M68kLocalLabel::class.java)
|
.extracting<String> { (it as LookupElementBuilder).lookupString }
|
||||||
.extracting(PsiElement::getText).isEqualTo("loop$")
|
.containsExactlyInAnyOrderElementsOf(listOf("loop$", "loop$", ".skip"))
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
main
|
||||||
|
tst.w d1
|
||||||
|
beq.s .skip
|
||||||
|
moveq.l #42,d0
|
||||||
|
.narf move.l d0,(a0)+
|
||||||
|
dbra d0,.narf
|
||||||
|
.skip subq.w #1,d1
|
||||||
|
beq.s .narf
|
||||||
|
rts
|
Loading…
Reference in New Issue
Block a user