Search in sources :

Example 1 with GobenchRunConfigurationProducer

use of com.goide.runconfig.testing.frameworks.gobench.GobenchRunConfigurationProducer in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoTestRunConfigurationProducerTest method testSameConfigurationOnFunction.

public void testSameConfigurationOnFunction() {
    PsiFile file = myFixture.addFileToProject("import/path/a_test.go", "package main; func TestName() {<caret>}");
    myFixture.configureFromExistingVirtualFile(file.getVirtualFile());
    ConfigurationContext configurationContext = createConfigurationContext();
    RunConfigurationProducer<GoTestRunConfiguration> producer = new GotestRunConfigurationProducer();
    GoTestRunConfiguration runConfiguration = createPackageConfiguration(GotestFramework.INSTANCE, "^TestName$", "import/path");
    assertTrue(producer.isConfigurationFromContext(runConfiguration, configurationContext));
    runConfiguration = createPackageConfiguration(GotestFramework.INSTANCE, "otherPattern", "import/path");
    assertFalse(producer.isConfigurationFromContext(runConfiguration, configurationContext));
    runConfiguration = createPackageConfiguration(GobenchFramework.INSTANCE, "^TestName$", "import/path");
    assertFalse(producer.isConfigurationFromContext(runConfiguration, configurationContext));
    runConfiguration = createPackageConfiguration(GotestFramework.INSTANCE, "^TestName$", "import/path/other");
    assertFalse(producer.isConfigurationFromContext(runConfiguration, configurationContext));
    producer = new GobenchRunConfigurationProducer();
    runConfiguration = createFileConfiguration(GobenchFramework.INSTANCE, file.getVirtualFile().getPath());
    assertFalse(producer.isConfigurationFromContext(runConfiguration, configurationContext));
}
Also used : GobenchRunConfigurationProducer(com.goide.runconfig.testing.frameworks.gobench.GobenchRunConfigurationProducer) ConfigurationContext(com.intellij.execution.actions.ConfigurationContext) PsiFile(com.intellij.psi.PsiFile) GotestRunConfigurationProducer(com.goide.runconfig.testing.frameworks.gotest.GotestRunConfigurationProducer)

Aggregations

GobenchRunConfigurationProducer (com.goide.runconfig.testing.frameworks.gobench.GobenchRunConfigurationProducer)1 GotestRunConfigurationProducer (com.goide.runconfig.testing.frameworks.gotest.GotestRunConfigurationProducer)1 ConfigurationContext (com.intellij.execution.actions.ConfigurationContext)1 PsiFile (com.intellij.psi.PsiFile)1