use of com.goide.runconfig.testing.frameworks.gotest.GotestRunConfigurationProducer 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.goide.runconfig.testing.frameworks.gotest.GotestRunConfigurationProducer in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoTestRunConfigurationProducerTest method testSameConfigurationOnPackageClause.
public void testSameConfigurationOnPackageClause() {
PsiFile file = myFixture.addFileToProject("import/path/a_test.go", "packag<caret>e main; func SomeNonTestName() {}");
myFixture.configureFromExistingVirtualFile(file.getVirtualFile());
ConfigurationContext configurationContext = createConfigurationContext();
GotestRunConfigurationProducer producer = new GotestRunConfigurationProducer();
GoTestRunConfiguration runConfiguration = createPackageConfiguration(GotestFramework.INSTANCE, "", "import/path");
assertTrue(producer.isConfigurationFromContext(runConfiguration, configurationContext));
runConfiguration = createPackageConfiguration(GotestFramework.INSTANCE, "otherPattern", "import/path");
assertFalse(producer.isConfigurationFromContext(runConfiguration, configurationContext));
runConfiguration = createPackageConfiguration(GobenchFramework.INSTANCE, "", "import/path");
assertFalse(producer.isConfigurationFromContext(runConfiguration, configurationContext));
runConfiguration = createPackageConfiguration(GotestFramework.INSTANCE, "", "import/path/other");
assertFalse(producer.isConfigurationFromContext(runConfiguration, configurationContext));
}
use of com.goide.runconfig.testing.frameworks.gotest.GotestRunConfigurationProducer in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoTestRunConfigurationProducerTest method testSameConfigurationOnFile.
public void testSameConfigurationOnFile() {
PsiFile file = myFixture.configureByText("a_test.go", "package main; <caret>\n\nfunc SomeNonTestName() {}");
ConfigurationContext configurationContext = createConfigurationContext();
GotestRunConfigurationProducer producer = new GotestRunConfigurationProducer();
GoTestRunConfiguration runConfiguration = createFileConfiguration(GotestFramework.INSTANCE, file.getVirtualFile().getPath());
assertTrue(producer.isConfigurationFromContext(runConfiguration, configurationContext));
runConfiguration = createFileConfiguration(GotestFramework.INSTANCE, file.getVirtualFile().getPath() + "_vl");
assertFalse(producer.isConfigurationFromContext(runConfiguration, configurationContext));
runConfiguration = createFileConfiguration(GobenchFramework.INSTANCE, file.getVirtualFile().getPath());
assertFalse(producer.isConfigurationFromContext(runConfiguration, configurationContext));
}
use of com.goide.runconfig.testing.frameworks.gotest.GotestRunConfigurationProducer in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoTestRunConfigurationProducerTest method testSameConfigurationOnNonTestFunction.
public void testSameConfigurationOnNonTestFunction() {
PsiFile file = myFixture.addFileToProject("import/path/a_test.go", "package main; func SomeNonTestName() {<caret>}");
myFixture.configureFromExistingVirtualFile(file.getVirtualFile());
ConfigurationContext configurationContext = createConfigurationContext();
GotestRunConfigurationProducer producer = new GotestRunConfigurationProducer();
GoTestRunConfiguration runConfiguration = createFileConfiguration(GotestFramework.INSTANCE, file.getVirtualFile().getPath());
assertTrue(producer.isConfigurationFromContext(runConfiguration, configurationContext));
runConfiguration = createFileConfiguration(GotestFramework.INSTANCE, file.getVirtualFile().getPath() + "_vl");
assertFalse(producer.isConfigurationFromContext(runConfiguration, configurationContext));
runConfiguration = createFileConfiguration(GobenchFramework.INSTANCE, file.getVirtualFile().getPath());
assertFalse(producer.isConfigurationFromContext(runConfiguration, configurationContext));
}
use of com.goide.runconfig.testing.frameworks.gotest.GotestRunConfigurationProducer 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));
}
Aggregations