use of com.google.idea.blaze.base.lang.buildfile.psi.BuildFile 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.lang.buildfile.psi.BuildFile 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.lang.buildfile.psi.BuildFile 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.lang.buildfile.psi.BuildFile 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));
}
use of com.google.idea.blaze.base.lang.buildfile.psi.BuildFile in project intellij by bazelbuild.
the class BuiltInRuleAnnotatorTest method testMissingMandatoryAttributeError.
@Test
public void testMissingMandatoryAttributeError() {
specProvider.setRules(ImmutableMap.of(JAVA_TEST.name, JAVA_TEST));
BuildFile file = createBuildFile(new WorkspacePath("java/com/google/BUILD"), "java_test(", " srcs = ['src'],", " neverlink = 0,", ")");
assertHasError(file, "Target missing required attribute(s): name");
}
Aggregations