use of com.intellij.psi.PsiFile in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoSelfImportInspectionTest method testRemoveSelfImport.
public void testRemoveSelfImport() {
PsiFile file = myFixture.addFileToProject("path/a.go", "package pack;" + "import <error descr=\"Self import is not allowed\"><caret>\"path\"</error>");
myFixture.configureFromExistingVirtualFile(file.getVirtualFile());
myFixture.checkHighlighting();
applySingleQuickFix(GoDeleteImportQuickFix.QUICK_FIX_NAME);
myFixture.checkResult("package pack;");
}
use of com.intellij.psi.PsiFile in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoSelfImportInspectionTest method testDoNotConsiderImportFromTestPackageAsSelfImport.
public void testDoNotConsiderImportFromTestPackageAsSelfImport() {
PsiFile file = myFixture.addFileToProject("path/a_test.go", "package pack_test; import <caret>\"path\"");
myFixture.configureFromExistingVirtualFile(file.getVirtualFile());
myFixture.checkHighlighting();
}
use of com.intellij.psi.PsiFile in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoNamedElementTest method doTestGetUseScope.
private <T> void doTestGetUseScope(@NotNull String text, @NotNull Class<T> scope) {
myFixture.configureByText("a.go", text);
PsiFile file = myFixture.getFile();
GoVarDefinition var = PsiTreeUtil.findChildOfType(file, GoVarDefinition.class);
assertNotNull(var);
assertTrue(scope.isInstance(var.getUseScope()));
}
use of com.intellij.psi.PsiFile in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoIntroduceFunctionFixTest method testInOtherPackageWithChanOfImportedTypes.
public void testInOtherPackageWithChanOfImportedTypes() {
myFixture.addFileToProject("a/a.go", "package a; type MyType int; func CreateChanOfMyType() chan MyType { return nil};");
PsiFile file = myFixture.addFileToProject("b/b.go", "package b; import alias \"a\"; func _() { asd<caret>(alias.CreateChanOfMyType());};");
myFixture.configureFromExistingVirtualFile(file.getVirtualFile());
applySingleQuickFix(QUICK_FIX_NAME);
myFixture.checkResult("package b; import alias \"a\"; " + "func _() { asd(alias.CreateChanOfMyType());}\nfunc asd(myType chan alias.MyType) {\n\t<caret>\n};");
}
use of com.intellij.psi.PsiFile in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoIntroduceFunctionFixTest method testInOtherPackageWithTwoAlias.
public void testInOtherPackageWithTwoAlias() {
myFixture.addFileToProject("c/c.go", "package c; type MyType int;");
myFixture.addFileToProject("a/a.go", "package a; import myC \"c\" func CreateMyType() myC.MyType { return myC.MyType{}};");
PsiFile file = myFixture.addFileToProject("b/b.go", "package b; import (. \"a\"; importC \"c\"); func _() { asd<caret>(CreateMyType());};");
myFixture.configureFromExistingVirtualFile(file.getVirtualFile());
applySingleQuickFix(QUICK_FIX_NAME);
myFixture.checkResult("package b; import (. \"a\"; importC \"c\"); func _() { asd(CreateMyType());}\nfunc asd(myType importC.MyType) {\n\t<caret>\n};");
}
Aggregations