use of com.google.idea.blaze.base.lang.buildfile.psi.ReferenceExpression in project intellij by bazelbuild.
the class LocalReferenceTest method testReferenceResolves.
@Test
public void testReferenceResolves() {
BuildFile file = createBuildFile(new WorkspacePath("java/com/google/BUILD"), "a = 1", "c = a");
AssignmentStatement[] stmts = file.childrenOfClass(AssignmentStatement.class);
ReferenceExpression ref = (ReferenceExpression) stmts[1].getAssignedValue();
PsiElement referencedElement = ref.getReferencedElement();
assertThat(referencedElement).isEqualTo(stmts[0].getLeftHandSideExpression());
}
use of com.google.idea.blaze.base.lang.buildfile.psi.ReferenceExpression in project intellij by bazelbuild.
the class LocalReferenceTest method testCreatesReference.
@Test
public void testCreatesReference() {
BuildFile file = createBuildFile(new WorkspacePath("java/com/google/BUILD"), "a = 1", "c = a");
AssignmentStatement[] stmts = file.childrenOfClass(AssignmentStatement.class);
assertThat(stmts).hasLength(2);
assertThat(stmts[1].getAssignedValue()).isInstanceOf(ReferenceExpression.class);
ReferenceExpression ref = (ReferenceExpression) stmts[1].getAssignedValue();
assertThat(ref.getReference()).isInstanceOf(LocalReference.class);
}
Aggregations