use of com.google.idea.blaze.base.model.primitives.WorkspacePath in project intellij by bazelbuild.
the class BlazePackageTest method testScopeIncludesSubdirectoriesWhichAreNotBlazePackages.
@Test
public void testScopeIncludesSubdirectoriesWhichAreNotBlazePackages() {
BuildFile pkg = createBuildFile(new WorkspacePath("java/com/google/BUILD"));
createBuildFile(new WorkspacePath("java/com/google/foo/bar/BUILD"));
PsiFile subDirFile = workspace.createPsiFile(new WorkspacePath("java/com/google/foo/test.txt"));
BlazePackage blazePackage = BlazePackage.getContainingPackage(subDirFile);
assertThat(blazePackage.buildFile).isEqualTo(pkg);
assertThat(blazePackage.getSearchScope(false).contains(subDirFile.getVirtualFile())).isTrue();
}
use of com.google.idea.blaze.base.model.primitives.WorkspacePath in project intellij by bazelbuild.
the class BlazePackageTest method testScopeDoesntCrossPackageBoundary.
@Test
public void testScopeDoesntCrossPackageBoundary() {
BuildFile pkg = createBuildFile(new WorkspacePath("java/com/google/BUILD"));
BuildFile subpkg = createBuildFile(new WorkspacePath("java/com/google/other/BUILD"));
BlazePackage blazePackage = BlazePackage.getContainingPackage(pkg);
assertThat(blazePackage.buildFile).isEqualTo(pkg);
assertThat(blazePackage.getSearchScope(false).contains(subpkg.getVirtualFile())).isFalse();
}
use of com.google.idea.blaze.base.model.primitives.WorkspacePath in project intellij by bazelbuild.
the class BlazePackageTest method testScopeLimitedToBlazeFiles.
@Test
public void testScopeLimitedToBlazeFiles() {
BuildFile pkg = createBuildFile(new WorkspacePath("java/com/google/BUILD"));
createBuildFile(new WorkspacePath("java/com/google/foo/bar/BUILD"));
PsiFile subDirFile = workspace.createPsiFile(new WorkspacePath("java/com/google/foo/test.txt"));
BlazePackage blazePackage = BlazePackage.getContainingPackage(subDirFile);
assertThat(blazePackage.buildFile).isEqualTo(pkg);
assertThat(blazePackage.getSearchScope(true).contains(subDirFile.getVirtualFile())).isFalse();
}
use of com.google.idea.blaze.base.model.primitives.WorkspacePath in project intellij by bazelbuild.
the class GlobalWordIndexTest method testWordsInCode.
@Test
public void testWordsInCode() {
VirtualFile file = workspace.createFile(new WorkspacePath("java/com/google/BUILD"), "java_library(", "name = \"long name with spaces\",", "src = [\"name_without_spaces\"]", ")");
assertContainsWords(file, UsageSearchContext.IN_CODE, "java_library", "name", "src");
}
use of com.google.idea.blaze.base.model.primitives.WorkspacePath in project intellij by bazelbuild.
the class BuiltInRuleAnnotatorTest method testInvalidValueInsideParenthesizedExpression.
@Test
public void testInvalidValueInsideParenthesizedExpression() {
specProvider.setRules(ImmutableMap.of(JAVA_TEST.name, JAVA_TEST));
BuildFile file = createBuildFile(new WorkspacePath("java/com/google/BUILD"), "java_test(", " name = (1),", ")");
assertHasError(file, String.format("Invalid value for attribute 'name'. Expected a value of type '%s'", Discriminator.STRING));
}
Aggregations