diff options
author | Evgeny Mandrikov <138671+Godin@users.noreply.github.com> | 2020-02-02 01:29:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-02 00:29:36 +0100 |
commit | 468fa9942e8f72df3e5fba5f0065ef4859e09fd8 (patch) | |
tree | c676b9b081f9f9faff9864fd375c2a23cbe1c64f /org.jacoco.core.test/src | |
parent | d013ac8700e0e4d14eb13eddf063cfcfbad0669c (diff) | |
download | jacoco-468fa9942e8f72df3e5fba5f0065ef4859e09fd8.tar.gz |
Add filter for bridge methods (#1010)
Diffstat (limited to 'org.jacoco.core.test/src')
-rw-r--r-- | org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/BridgeFilterTest.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/BridgeFilterTest.java b/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/BridgeFilterTest.java new file mode 100644 index 00000000..b0dd1adc --- /dev/null +++ b/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/BridgeFilterTest.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2009, 2020 Mountainminds GmbH & Co. KG and Contributors + * This program and the accompanying materials are made available under + * the terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Evgeny Mandrikov - initial API and implementation + * + *******************************************************************************/ +package org.jacoco.core.internal.analysis.filter; + +import org.jacoco.core.internal.instr.InstrSupport; +import org.junit.Test; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.tree.MethodNode; + +/** + * Unit tests for {@link BridgeFilter}. + */ +public class BridgeFilterTest extends FilterTestBase { + + private final BridgeFilter filter = new BridgeFilter(); + + @Test + public void should_filter_bridge_methods() { + final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, + Opcodes.ACC_BRIDGE, "m", "()Ljava/lang/Object;", null, null); + m.visitInsn(Opcodes.NOP); + + filter.filter(m, context, output); + + assertMethodIgnored(m); + } + + @Test + public void should_not_filter_non_bridge_methods() { + final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, 0, + "m", "()Ljava/lang/Object;", null, null); + m.visitInsn(Opcodes.NOP); + + filter.filter(m, context, output); + + assertIgnored(); + } + +} |