use of com.intellij.psi.PsiPolyVariantReference in project intellij-elixir by KronicDeth.
the class AsTest method testReference.
public void testReference() {
myFixture.configureByFiles("reference.ex", "suffix1.ex");
PsiElement alias = myFixture.getFile().findElementAt(myFixture.getCaretOffset()).getParent().getPrevSibling().getFirstChild();
assertInstanceOf(alias, ElixirAlias.class);
PsiPolyVariantReference polyVariantReference = (PsiPolyVariantReference) alias.getReference();
assertNotNull(polyVariantReference);
ResolveResult[] resolveResults = polyVariantReference.multiResolve(false);
assertEquals(2, resolveResults.length);
// alias
assertEquals("alias Prefix.Suffix1, as: As", resolveResults[0].getElement().getParent().getParent().getParent().getParent().getParent().getText());
// defmodule
assertEquals("defmodule Prefix.Suffix1 do\nend", resolveResults[1].getElement().getText());
}
use of com.intellij.psi.PsiPolyVariantReference in project intellij-elixir by KronicDeth.
the class MultipleAliasTest method testReference.
public void testReference() {
myFixture.configureByFiles("reference.ex", "multiple_alias_aye.ex", "multiple_alias_bee.ex");
PsiElement alias = myFixture.getFile().findElementAt(myFixture.getCaretOffset()).getParent().getPrevSibling().getFirstChild();
assertInstanceOf(alias, ElixirAlias.class);
PsiPolyVariantReference polyVariantReference = (PsiPolyVariantReference) alias.getReference();
assertNotNull(polyVariantReference);
ResolveResult[] resolveResults = polyVariantReference.multiResolve(false);
assertEquals(2, resolveResults.length);
// alias
assertEquals("alias Prefix.{MultipleAliasAye, MultipleAliasBee}", resolveResults[0].getElement().getParent().getParent().getParent().getParent().getParent().getText());
// defmodule
assertEquals("defmodule Prefix.MultipleAliasAye do\nend", resolveResults[1].getElement().getText());
}
use of com.intellij.psi.PsiPolyVariantReference in project intellij-elixir by KronicDeth.
the class SuffixTest method testReference.
public void testReference() {
myFixture.configureByFiles("reference.ex", "suffix.ex");
PsiElement alias = myFixture.getFile().findElementAt(myFixture.getCaretOffset()).getParent().getPrevSibling().getFirstChild();
assertInstanceOf(alias, ElixirAlias.class);
PsiPolyVariantReference polyVariantReference = (PsiPolyVariantReference) alias.getReference();
assertNotNull(polyVariantReference);
ResolveResult[] resolveResults = polyVariantReference.multiResolve(false);
assertEquals(resolveResults.length, 2);
// alias
assertEquals("alias Prefix.Suffix", resolveResults[0].getElement().getParent().getParent().getText());
// defmodule
assertEquals("defmodule Prefix.Suffix do\nend", resolveResults[1].getElement().getText());
}
use of com.intellij.psi.PsiPolyVariantReference in project intellij-elixir by KronicDeth.
the class NestedTest method testReference.
public void testReference() {
myFixture.configureByFiles("reference.ex", "multiple_alias_aye.ex", "multiple_alias_bee.ex", "nested.ex");
PsiElement alias = myFixture.getFile().findElementAt(myFixture.getCaretOffset()).getParent().getPrevSibling();
assertInstanceOf(alias, QualifiedAlias.class);
PsiPolyVariantReference polyVariantReference = (PsiPolyVariantReference) alias.getReference();
assertNotNull(polyVariantReference);
ResolveResult[] resolveResults = polyVariantReference.multiResolve(false);
assertEquals(2, resolveResults.length);
// alias
assertEquals("alias Prefix.{MultipleAliasAye, MultipleAliasBee}", resolveResults[0].getElement().getParent().getParent().getParent().getParent().getParent().getText());
// defmodule
assertEquals("defmodule Prefix.MultipleAliasAye.Nested do\nend", resolveResults[1].getElement().getText());
}
use of com.intellij.psi.PsiPolyVariantReference in project intellij-elixir by KronicDeth.
the class NestedTest method testReference.
public void testReference() {
myFixture.configureByFiles("reference.ex", "suffix.ex", "nested.ex");
PsiElement alias = myFixture.getFile().findElementAt(myFixture.getCaretOffset()).getParent().getPrevSibling();
assertInstanceOf(alias, QualifiedAlias.class);
PsiPolyVariantReference polyVariantReference = (PsiPolyVariantReference) alias.getReference();
assertNotNull(polyVariantReference);
ResolveResult[] resolveResults = polyVariantReference.multiResolve(false);
assertEquals(2, resolveResults.length);
// alias
assertEquals("alias Prefix.Suffix", resolveResults[0].getElement().getParent().getParent().getText());
// defmodule
assertEquals("defmodule Prefix.Suffix.Nested do\nend", resolveResults[1].getElement().getText());
}
Aggregations