Search in sources :

Example 36 with WorkspacePath

use of com.google.idea.blaze.base.model.primitives.WorkspacePath 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");
}
Also used : BuildFile(com.google.idea.blaze.base.lang.buildfile.psi.BuildFile) WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) Test(org.junit.Test)

Example 37 with WorkspacePath

use of com.google.idea.blaze.base.model.primitives.WorkspacePath in project intellij by bazelbuild.

the class BuiltInRuleAnnotatorTest method testUnresolvedValueInsideParenthesizedExpression.

@Test
public void testUnresolvedValueInsideParenthesizedExpression() {
    specProvider.setRules(ImmutableMap.of(JAVA_TEST.name, JAVA_TEST));
    BuildFile file = createBuildFile(new WorkspacePath("java/com/google/BUILD"), "java_test(", "    name = (ref),", ")");
    assertNoErrors(file);
}
Also used : BuildFile(com.google.idea.blaze.base.lang.buildfile.psi.BuildFile) WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) Test(org.junit.Test)

Example 38 with WorkspacePath

use of com.google.idea.blaze.base.model.primitives.WorkspacePath in project intellij by bazelbuild.

the class BuiltInRuleAnnotatorTest method testGlobTreatedAsList.

@Test
public void testGlobTreatedAsList() {
    specProvider.setRules(ImmutableMap.of(JAVA_TEST.name, JAVA_TEST));
    BuildFile file = createBuildFile(new WorkspacePath("java/com/google/BUILD"), "java_test(", "    name = 'import',", "    srcs = glob(['src']),", "    neverlink = 0,", ")");
    assertNoErrors(file);
}
Also used : BuildFile(com.google.idea.blaze.base.lang.buildfile.psi.BuildFile) WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) Test(org.junit.Test)

Example 39 with WorkspacePath

use of com.google.idea.blaze.base.model.primitives.WorkspacePath in project intellij by bazelbuild.

the class BuiltInRuleAnnotatorTest method testInvalidAttributeTypeError.

@Test
public void testInvalidAttributeTypeError() {
    specProvider.setRules(ImmutableMap.of(JAVA_TEST.name, JAVA_TEST));
    BuildFile file = createBuildFile(new WorkspacePath("java/com/google/BUILD"), "java_test(", "    name = 'import',", "    srcs = 'src',", "    neverlink = 0,", ")");
    assertHasError(file, String.format("Invalid value for attribute 'srcs'. Expected a value of type '%s'", Discriminator.LABEL_LIST));
}
Also used : BuildFile(com.google.idea.blaze.base.lang.buildfile.psi.BuildFile) WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) Test(org.junit.Test)

Example 40 with WorkspacePath

use of com.google.idea.blaze.base.model.primitives.WorkspacePath in project intellij by bazelbuild.

the class BuiltInRuleAnnotatorTest method testNoMissingMandatoryArgErrorIfKwargsPresent.

@Test
public void testNoMissingMandatoryArgErrorIfKwargsPresent() {
    specProvider.setRules(ImmutableMap.of(JAVA_TEST.name, JAVA_TEST));
    BuildFile file = createBuildFile(new WorkspacePath("java/com/google/BUILD"), "def java_test(srcs=[], **kwargs):", "  native.java_test(srcs = srcs, **kwargs)");
    assertNoErrors(file);
}
Also used : BuildFile(com.google.idea.blaze.base.lang.buildfile.psi.BuildFile) WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) Test(org.junit.Test)

Aggregations

WorkspacePath (com.google.idea.blaze.base.model.primitives.WorkspacePath)509 Test (org.junit.Test)454 BuildFile (com.google.idea.blaze.base.lang.buildfile.psi.BuildFile)197 PsiFile (com.intellij.psi.PsiFile)84 File (java.io.File)75 ProjectView (com.google.idea.blaze.base.projectview.ProjectView)53 TargetMapBuilder (com.google.idea.blaze.base.ideinfo.TargetMapBuilder)48 Editor (com.intellij.openapi.editor.Editor)46 VirtualFile (com.intellij.openapi.vfs.VirtualFile)41 BlazeJavaImportResult (com.google.idea.blaze.java.sync.model.BlazeJavaImportResult)40 FuncallExpression (com.google.idea.blaze.base.lang.buildfile.psi.FuncallExpression)37 PsiReference (com.intellij.psi.PsiReference)37 MockBlazeProjectDataManager (com.google.idea.blaze.base.model.MockBlazeProjectDataManager)34 ConfigurationContext (com.intellij.execution.actions.ConfigurationContext)34 BlazeContentEntry (com.google.idea.blaze.java.sync.model.BlazeContentEntry)33 BlazeCommandRunConfiguration (com.google.idea.blaze.base.run.BlazeCommandRunConfiguration)29 MockBlazeProjectDataBuilder (com.google.idea.blaze.base.model.MockBlazeProjectDataBuilder)26 ImportRoots (com.google.idea.blaze.base.sync.projectview.ImportRoots)26 TargetMap (com.google.idea.blaze.base.ideinfo.TargetMap)25 PsiElement (com.intellij.psi.PsiElement)25