use of com.google.idea.blaze.base.lang.projectview.psi.ProjectViewPsiSectionItem in project intellij by bazelbuild.
the class ProjectViewLabelReferenceTest method testDirectoryReference.
@Test
public void testDirectoryReference() {
PsiDirectory directory = workspace.createPsiDirectory(new WorkspacePath("foo/bar"));
PsiFile projectView = workspace.createPsiFile(new WorkspacePath(".bazelproject"), "directories:", " foo/bar");
ProjectViewPsiSectionItem importItem = PsiUtils.findFirstChildOfClassRecursive(projectView, ProjectViewPsiSectionItem.class);
assertThat(importItem).isNotNull();
assertThat(importItem.getReference().resolve()).isEqualTo(directory);
}
use of com.google.idea.blaze.base.lang.projectview.psi.ProjectViewPsiSectionItem in project intellij by bazelbuild.
the class ProjectViewLabelReferenceTest method testFileReference.
@Test
public void testFileReference() {
PsiFile referencedFile = workspace.createPsiFile(new WorkspacePath("ijwb.bazelproject"), "directories:", " java/com/google/foo", "targets:", " //java/com/google/foo/...");
PsiFile file = workspace.createPsiFile(new WorkspacePath(".bazelproject"), "import ijwb.bazelproject");
ProjectViewPsiSectionItem importItem = PsiUtils.findFirstChildOfClassRecursive(file, ProjectViewPsiSectionItem.class);
assertThat(importItem).isNotNull();
assertThat(importItem.getReference().resolve()).isEqualTo(referencedFile);
}
use of com.google.idea.blaze.base.lang.projectview.psi.ProjectViewPsiSectionItem in project intellij by bazelbuild.
the class ProjectViewLabelReferenceTest method testTargetReference.
@Test
public void testTargetReference() {
PsiFile buildFile = workspace.createPsiFile(new WorkspacePath("foo/bar/BUILD"), "java_library(", " name = 'lib',", ")");
PsiFile projectView = workspace.createPsiFile(new WorkspacePath(".bazelproject"), "targets:", " //foo/bar:lib");
FuncallExpression target = ((BuildFile) buildFile).findRule("lib");
ProjectViewPsiSectionItem importItem = PsiUtils.findFirstChildOfClassRecursive(projectView, ProjectViewPsiSectionItem.class);
assertThat(importItem).isNotNull();
assertThat(importItem.getReference().resolve()).isEqualTo(target);
}
Aggregations