diff --git a/sootup.core/src/test/java/sootup/core/graph/MutableBlockStmtGraphTest.java b/sootup.core/src/test/java/sootup/core/graph/MutableBlockStmtGraphTest.java index d0874c49137..0e8c7824f75 100644 --- a/sootup.core/src/test/java/sootup/core/graph/MutableBlockStmtGraphTest.java +++ b/sootup.core/src/test/java/sootup/core/graph/MutableBlockStmtGraphTest.java @@ -278,6 +278,25 @@ public void modifyStmtToBlockAtTail() { assertEquals(1, graph.getBlocksSorted().size()); } + @Test + public void removeEdgeMerge() { + MutableBlockStmtGraph graph = new MutableBlockStmtGraph(); + + graph.addNode(firstNop); + graph.setStartingStmt(firstNop); + graph.putEdge(firstNop, secondNop); + graph.putEdge(secondNop, conditionalStmt); + + assertEquals(1, graph.getBlocks().size()); + // this edge splits the block between the first and second Nop + graph.putEdge(conditionalStmt, secondNop); + assertEquals(2, graph.getBlocks().size()); + + // this edge removal should merge both blocks together again + graph.removeEdge(conditionalStmt, secondNop); + assertEquals(1, graph.getBlocks().size()); + } + @Test public void removeStmtInBetweenBlock() {