Search in sources :

Example 11 with GoExpression

use of com.goide.psi.GoExpression in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoExpressionUtilTest method doTest.

@Override
protected void doTest() {
    PsiFile file = myFixture.configureByText("a.go", "package main\n func foo(i interface{}, j interface{}){}\n" + vars + "\n func _(){\n fo<caret>o(" + left + ", " + right + ")\n}");
    myFixture.checkHighlighting();
    GoCallExpr call = PsiTreeUtil.getParentOfType(file.findElementAt(myFixture.getCaretOffset()), GoCallExpr.class);
    assert call != null;
    List<GoExpression> expressions = call.getArgumentList().getExpressionList();
    assertTrue(left + " should " + (ok ? "" : "not ") + "be identical " + right, ok == GoExpressionUtil.identical(expressions.get(0), expressions.get(1)));
}
Also used : PsiFile(com.intellij.psi.PsiFile) GoExpression(com.goide.psi.GoExpression) GoCallExpr(com.goide.psi.GoCallExpr)

Aggregations

GoExpression (com.goide.psi.GoExpression)11 PsiElement (com.intellij.psi.PsiElement)5 NotNull (org.jetbrains.annotations.NotNull)3 Nullable (org.jetbrains.annotations.Nullable)3 GoRangeClause (com.goide.psi.GoRangeClause)2 GoAndExpr (com.goide.psi.GoAndExpr)1 GoAssignmentStatement (com.goide.psi.GoAssignmentStatement)1 GoBinaryExpr (com.goide.psi.GoBinaryExpr)1 GoCallExpr (com.goide.psi.GoCallExpr)1 GoConstSpec (com.goide.psi.GoConstSpec)1 GoIfStatement (com.goide.psi.GoIfStatement)1 GoRecvStatement (com.goide.psi.GoRecvStatement)1 GoReferenceExpression (com.goide.psi.GoReferenceExpression)1 GoType (com.goide.psi.GoType)1 GoVisitor (com.goide.psi.GoVisitor)1 GoElementFactory (com.goide.psi.impl.GoElementFactory)1 LocalQuickFixOnPsiElement (com.intellij.codeInspection.LocalQuickFixOnPsiElement)1 Project (com.intellij.openapi.project.Project)1 StringUtil (com.intellij.openapi.util.text.StringUtil)1 PsiFile (com.intellij.psi.PsiFile)1