Search in sources :

Example 6 with DartExpression

use of com.jetbrains.lang.dart.psi.DartExpression in project intellij-plugins by JetBrains.

the class TestUtil method findGroupOrTestName.

@Nullable
public static String findGroupOrTestName(@Nullable final DartCallExpression expression) {
    String testName;
    final DartArguments arguments = expression == null ? null : expression.getArguments();
    final DartArgumentList dartArgumentList = arguments == null ? null : arguments.getArgumentList();
    if (dartArgumentList == null || dartArgumentList.getExpressionList().isEmpty()) {
        return null;
    }
    final DartExpression dartExpression = dartArgumentList.getExpressionList().get(0);
    testName = dartExpression == null ? "" : StringUtil.unquoteString(dartExpression.getText());
    return testName;
}
Also used : DartArgumentList(com.jetbrains.lang.dart.psi.DartArgumentList) DartArguments(com.jetbrains.lang.dart.psi.DartArguments) DartExpression(com.jetbrains.lang.dart.psi.DartExpression) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

DartExpression (com.jetbrains.lang.dart.psi.DartExpression)6 Nullable (org.jetbrains.annotations.Nullable)3 SelectionModel (com.intellij.openapi.editor.SelectionModel)1 Pass (com.intellij.openapi.util.Pass)1 PsiElement (com.intellij.psi.PsiElement)1 IncorrectOperationException (com.intellij.util.IncorrectOperationException)1 DartArgumentList (com.jetbrains.lang.dart.psi.DartArgumentList)1 DartArguments (com.jetbrains.lang.dart.psi.DartArguments)1 DartCallExpression (com.jetbrains.lang.dart.psi.DartCallExpression)1 DartClass (com.jetbrains.lang.dart.psi.DartClass)1 DartReference (com.jetbrains.lang.dart.psi.DartReference)1