use of com.intellij.psi.PsiFile in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoBuildMatcherTest method testCgoCImport.
public void testCgoCImport() {
myFixture.configureByText("a.go", "package a; import \"C\"");
PsiFile file = myFixture.getFile();
assertTrue(new GoBuildMatcher(new GoTargetSystem("linux", "amd64", "1.4", null, ThreeState.YES)).matchFile(file));
assertFalse(new GoBuildMatcher(new GoTargetSystem("linux", "amd64", "1.4", null, ThreeState.NO)).matchFile(file));
}
use of com.intellij.psi.PsiFile in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoTestRunConfigurationProducerTest method testSameConfigurationOnDirectory.
public void testSameConfigurationOnDirectory() {
PsiFile file = myFixture.configureByText("a.go", "package main");
PsiDirectory directory = file.getParent();
assertNotNull(directory);
ConfigurationContext configurationContext = new ConfigurationContext(directory);
GotestRunConfigurationProducer producer = new GotestRunConfigurationProducer();
GoTestRunConfiguration runConfiguration = createDirectoryConfiguration(GotestFramework.INSTANCE, directory.getVirtualFile().getPath(), directory.getVirtualFile().getPath());
assertTrue(producer.isConfigurationFromContext(runConfiguration, configurationContext));
runConfiguration = createDirectoryConfiguration(GotestFramework.INSTANCE, directory.getVirtualFile().getPath() + "_vl", directory.getVirtualFile().getPath());
assertFalse(producer.isConfigurationFromContext(runConfiguration, configurationContext));
runConfiguration = createDirectoryConfiguration(GobenchFramework.INSTANCE, directory.getVirtualFile().getPath(), directory.getVirtualFile().getPath());
assertFalse(producer.isConfigurationFromContext(runConfiguration, configurationContext));
runConfiguration = createDirectoryConfiguration(GotestFramework.INSTANCE, directory.getVirtualFile().getPath(), directory.getVirtualFile().getPath() + "_vl");
assertFalse(producer.isConfigurationFromContext(runConfiguration, configurationContext));
}
use of com.intellij.psi.PsiFile in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoIntroduceFunctionFixTest method testInOtherPackageWithImportForSideEffects.
public void testInOtherPackageWithImportForSideEffects() {
myFixture.addFileToProject("a/a.go", "package a; type MyType int");
myFixture.addFileToProject("b/b.go", "package b; import `a`; func CreateMyType() b.MyType {return b.MyType{}};");
PsiFile file = myFixture.addFileToProject("c/c.go", "package c; import `b`; import _ `a`; func _() { asd<caret>(b.CreateMyType());};");
myFixture.configureFromExistingVirtualFile(file.getVirtualFile());
applySingleQuickFix(QUICK_FIX_NAME);
myFixture.checkResult("package c; import `b`; import _ `a`; func _() { asd(b.CreateMyType());}\nfunc asd(myType interface{}) {\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 testInOtherPackageWithDotAlias.
public void testInOtherPackageWithDotAlias() {
myFixture.addFileToProject("a/a.go", "package a; type MyType int; func CreateMyType() MyType { return MyType{}};");
PsiFile file = myFixture.addFileToProject("b/b.go", "package b; import . \"a\"; func _() { asd<caret>(CreateMyType());};");
myFixture.configureFromExistingVirtualFile(file.getVirtualFile());
applySingleQuickFix(QUICK_FIX_NAME);
myFixture.checkResult("package b; import . \"a\"; func _() { asd(CreateMyType());}\nfunc asd(myType MyType) {\n\t<caret>\n};");
}
use of com.intellij.psi.PsiFile in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoRunConfigurationProducerTest method testSameRunApplicationConfigurationOnPackage.
public void testSameRunApplicationConfigurationOnPackage() {
PsiFile file = myFixture.configureByText("a.go", "package main; <caret>\nfunc main() {}");
PsiElement at = file.findElementAt(myFixture.getCaretOffset());
assertNotNull(at);
ConfigurationContext configurationContext = new ConfigurationContext(at);
GoApplicationRunConfigurationProducer producer = new GoApplicationRunConfigurationProducer();
GoApplicationConfiguration runConfiguration = createRunAppFileConfiguration(file.getVirtualFile().getPath());
assertTrue(producer.isConfigurationFromContext(runConfiguration, configurationContext));
runConfiguration = createRunAppFileConfiguration(file.getVirtualFile().getPath() + "_vl");
assertFalse(producer.isConfigurationFromContext(runConfiguration, configurationContext));
}
Aggregations