if (!file.getName().endsWith("_test.go")) {
return false;
}
GoFile goFile = (GoFile) file;
PsiElement psiSourceElement = (PsiElement) sourceElement.get();
try {
VirtualFile virtualFile = file.getVirtualFile();
if (virtualFile == null) {
return false;
}
psiSourceElement = locationToTestFunction(psiSourceElement);
Project project = file.getProject();
Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(virtualFile);
GoTestConfiguration testConfig = (GoTestConfiguration) configuration;
String packageName = goFile.getFullPackageName();
testConfig.packageName = packageName;
testConfig.packageDir = goFile.getContainingDirectory().getVirtualFile().getCanonicalPath();
testConfig.testTargetType = GoTestConfiguration.TestTargetType.Package;
if (psiSourceElement instanceof GoFile) {
configuration.setName(packageName);