Search in sources :

Example 1 with GoRunFileConfiguration

use of com.goide.runconfig.file.GoRunFileConfiguration in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoRunConfigurationProducerTest method testSameRunApplicationConfigurationOnFile.

public void testSameRunApplicationConfigurationOnFile() {
    PsiFile file = myFixture.configureByText("a.go", "package main; <caret>\nfunc main() {}");
    PsiElement at = file.findElementAt(myFixture.getCaretOffset());
    assertNotNull(at);
    ConfigurationContext configurationContext = new ConfigurationContext(at);
    GoRunFileConfigurationProducer producer = new GoRunFileConfigurationProducer();
    GoRunFileConfiguration runConfiguration = createFileConfiguration(file.getVirtualFile().getPath());
    assertTrue(producer.isConfigurationFromContext(runConfiguration, configurationContext));
    runConfiguration = createFileConfiguration(file.getVirtualFile().getPath() + "_vl");
    assertFalse(producer.isConfigurationFromContext(runConfiguration, configurationContext));
}
Also used : ConfigurationContext(com.intellij.execution.actions.ConfigurationContext) GoRunFileConfigurationProducer(com.goide.runconfig.file.GoRunFileConfigurationProducer) PsiFile(com.intellij.psi.PsiFile) PsiElement(com.intellij.psi.PsiElement) GoRunFileConfiguration(com.goide.runconfig.file.GoRunFileConfiguration)

Example 2 with GoRunFileConfiguration

use of com.goide.runconfig.file.GoRunFileConfiguration in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoRunConfigurationProducerTest method testSameRunFileConfigurationOnFile.

public void testSameRunFileConfigurationOnFile() {
    PsiFile file = myFixture.configureByText("a.go", "package main; <caret>\nfunc main() {}");
    PsiElement at = file.findElementAt(myFixture.getCaretOffset());
    assertNotNull(at);
    ConfigurationContext configurationContext = new ConfigurationContext(at);
    GoRunFileConfigurationProducer producer = new GoRunFileConfigurationProducer();
    GoRunFileConfiguration runConfiguration = createFileConfiguration(file.getVirtualFile().getPath());
    assertTrue(producer.isConfigurationFromContext(runConfiguration, configurationContext));
    runConfiguration = createFileConfiguration(file.getVirtualFile().getPath() + "_vl");
    assertFalse(producer.isConfigurationFromContext(runConfiguration, configurationContext));
}
Also used : ConfigurationContext(com.intellij.execution.actions.ConfigurationContext) GoRunFileConfigurationProducer(com.goide.runconfig.file.GoRunFileConfigurationProducer) PsiFile(com.intellij.psi.PsiFile) PsiElement(com.intellij.psi.PsiElement) GoRunFileConfiguration(com.goide.runconfig.file.GoRunFileConfiguration)

Example 3 with GoRunFileConfiguration

use of com.goide.runconfig.file.GoRunFileConfiguration in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoRunConfigurationProducerTest method createFileConfiguration.

private GoRunFileConfiguration createFileConfiguration(String filePath) {
    GoRunFileConfigurationType type = GoRunFileConfigurationType.getInstance();
    GoRunFileConfiguration result = new GoRunFileConfiguration(myFixture.getProject(), "run file", type);
    result.setFilePath(filePath);
    return result;
}
Also used : GoRunFileConfigurationType(com.goide.runconfig.file.GoRunFileConfigurationType) GoRunFileConfiguration(com.goide.runconfig.file.GoRunFileConfiguration)

Aggregations

GoRunFileConfiguration (com.goide.runconfig.file.GoRunFileConfiguration)3 GoRunFileConfigurationProducer (com.goide.runconfig.file.GoRunFileConfigurationProducer)2 ConfigurationContext (com.intellij.execution.actions.ConfigurationContext)2 PsiElement (com.intellij.psi.PsiElement)2 PsiFile (com.intellij.psi.PsiFile)2 GoRunFileConfigurationType (com.goide.runconfig.file.GoRunFileConfigurationType)1