aboutsummaryrefslogtreecommitdiff
path: root/org.jacoco.core.test/src/org/jacoco/core/internal/flow/InstructionTest.java
diff options
context:
space:
mode:
authorEvgeny Mandrikov <Godin@users.noreply.github.com>2017-09-29 06:06:11 +0200
committerMarc R. Hoffmann <hoffmann@mountainminds.com>2017-09-29 06:06:11 +0200
commit1962cf59bc403a27f68c55b39bb833b00fa386a0 (patch)
tree2bca7259d0e9cfe50630f430b8a56a9bf3adbbc8 /org.jacoco.core.test/src/org/jacoco/core/internal/flow/InstructionTest.java
parentaca2da1d7479d6b536e027e8fa7db74428d781e6 (diff)
downloadjacoco-1962cf59bc403a27f68c55b39bb833b00fa386a0.tar.gz
Yak shaving: add ability to merge coverage of several instructions (#601)
This is required for implementation of filter of duplicate blocks that compilers generate for `finally`.
Diffstat (limited to 'org.jacoco.core.test/src/org/jacoco/core/internal/flow/InstructionTest.java')
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/internal/flow/InstructionTest.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/org.jacoco.core.test/src/org/jacoco/core/internal/flow/InstructionTest.java b/org.jacoco.core.test/src/org/jacoco/core/internal/flow/InstructionTest.java
index a6fb15e8..a6a7ee6d 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/internal/flow/InstructionTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/internal/flow/InstructionTest.java
@@ -93,6 +93,18 @@ public class InstructionTest {
}
@Test
+ public void merge_should_add_covered_branches_from_another_instruction() {
+ final Instruction i1 = new Instruction(new InsnNode(Opcodes.NOP), 123);
+ i1.setCovered(0);
+ final Instruction i2 = new Instruction(new InsnNode(Opcodes.NOP), 123);
+ i2.setCovered(1);
+ i1.merge(i2);
+ assertEquals("{0, 1}", i1.toString());
+ assertEquals(2, i1.getCoveredBranches());
+ assertEquals("{1}", i2.toString());
+ }
+
+ @Test
public void testSetCoveredOnLongSequence() {
final Instruction first = new Instruction(new InsnNode(Opcodes.NOP), 0);
Instruction next = first;