use of com.google.idea.blaze.base.lang.buildfile.psi.GlobExpression in project intellij by bazelbuild.
the class GlobFindUsagesTest method testGlobWithExcludes.
@Test
public void testGlobWithExcludes() {
PsiFile test = workspace.createPsiFile(new WorkspacePath("java/com/google/tests/Test.java"));
PsiFile foo = workspace.createPsiFile(new WorkspacePath("java/com/google/Foo.java"));
BuildFile file = createBuildFile(new WorkspacePath("java/com/google/BUILD"), "glob(" + " ['**/*.java']," + " exclude = ['tests/*.java'])");
GlobExpression glob = PsiUtils.findFirstChildOfClassRecursive(file, GlobExpression.class);
PsiReference[] references = FindUsages.findAllReferences(foo);
assertThat(references).hasLength(1);
assertThat(references[0].getElement()).isEqualTo(glob);
assertThat(FindUsages.findAllReferences(test)).isEmpty();
}
use of com.google.idea.blaze.base.lang.buildfile.psi.GlobExpression in project intellij by bazelbuild.
the class GlobFindUsagesTest method testSimpleGlobReferencingSingleFile2.
@Test
public void testSimpleGlobReferencingSingleFile2() {
PsiFile ref = workspace.createPsiFile(new WorkspacePath("java/com/google/Test.java"));
BuildFile file = createBuildFile(new WorkspacePath("java/com/google/BUILD"), "glob(['*.java'])");
GlobExpression glob = PsiUtils.findFirstChildOfClassRecursive(file, GlobExpression.class);
PsiReference[] references = FindUsages.findAllReferences(ref);
assertThat(references).hasLength(1);
assertThat(references[0].getElement()).isEqualTo(glob);
}
use of com.google.idea.blaze.base.lang.buildfile.psi.GlobExpression in project intellij by bazelbuild.
the class GlobFindUsagesTest method testSimpleGlobReferencingSingleFile3.
@Test
public void testSimpleGlobReferencingSingleFile3() {
PsiFile ref = workspace.createPsiFile(new WorkspacePath("java/com/google/Test.java"));
BuildFile file = createBuildFile(new WorkspacePath("java/com/google/BUILD"), "glob(['T*t.java'])");
GlobExpression glob = PsiUtils.findFirstChildOfClassRecursive(file, GlobExpression.class);
PsiReference[] references = FindUsages.findAllReferences(ref);
assertThat(references).hasLength(1);
assertThat(references[0].getElement()).isEqualTo(glob);
}
use of com.google.idea.blaze.base.lang.buildfile.psi.GlobExpression in project intellij by bazelbuild.
the class GlobReferenceTest method testSimpleGlobReferencingSingleFile.
@Test
public void testSimpleGlobReferencingSingleFile() {
PsiFile ref = workspace.createPsiFile(new WorkspacePath("java/com/google/Test.java"));
BuildFile file = createBuildFile(new WorkspacePath("java/com/google/BUILD"), "glob(['**/*.java'])");
GlobExpression glob = PsiUtils.findFirstChildOfClassRecursive(file, GlobExpression.class);
List<PsiElement> references = multiResolve(glob);
assertThat(references).hasSize(1);
assertThat(references).containsExactly(ref);
}
use of com.google.idea.blaze.base.lang.buildfile.psi.GlobExpression in project intellij by bazelbuild.
the class GlobReferenceTest method testSimpleGlobReferencingSingleFile2.
@Test
public void testSimpleGlobReferencingSingleFile2() {
PsiFile ref = workspace.createPsiFile(new WorkspacePath("java/com/google/Test.java"));
BuildFile file = createBuildFile(new WorkspacePath("java/com/google/BUILD"), "glob(['*.java'])");
GlobExpression glob = PsiUtils.findFirstChildOfClassRecursive(file, GlobExpression.class);
List<PsiElement> references = multiResolve(glob);
assertThat(references).hasSize(1);
assertThat(references).containsExactly(ref);
}
Aggregations