aboutsummaryrefslogtreecommitdiffstats
path: root/javaparser-testing/src/test/java/com/github/javaparser/ast/stmt/BlockStmtTest.java
blob: 5e5976ab8be4ef7fa570a08c40eb869821d5b0d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.github.javaparser.ast.stmt;

import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.expr.MethodCallExpr;
import com.github.javaparser.ast.expr.NameExpr;
import org.junit.Test;

public class BlockStmtTest {
    @Test
    public void issue748AddingIdenticalStatementsDoesParentingRight() {
        BlockStmt blockStmt = new BlockStmt();
        Expression exp = new NameExpr("x");
        MethodCallExpr expression = new MethodCallExpr(exp, "y");

        blockStmt.addStatement(expression);
        blockStmt.addStatement(expression.clone());
        // This fails when the issue exists:
        String s = blockStmt.toString();
    }

}