" return x\n" +
" }\n" +
" return nil\n" +
"}\n"));
GoSwitchExpressionStatement exprSwitch =
castAs(GoSwitchExpressionStatement.class, 0,
get(
get(
file.getMainFunction()
).getBlock()
).getStatements()
);
assertEquals("x := 1", get(exprSwitch.getSimpleStatement()).getText());
assertEquals("x", get(exprSwitch.getExpression()).getText());
GoSwitchExpressionClause clause = childAt(0, exprSwitch.getClauses());
assertEquals(1, clause.getExpressions().length);
assertEquals("1", childAt(0, clause.getExpressions()).getText());
assertFalse(clause.isDefault());
clause = childAt(1, exprSwitch.getClauses());
assertEquals(0, clause.getExpressions().length);
assertTrue(clause.isDefault());
}