summaryrefslogtreecommitdiff
path: root/test/files/jvm/t7006/Test.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/jvm/t7006/Test.scala')
-rw-r--r--test/files/jvm/t7006/Test.scala7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/files/jvm/t7006/Test.scala b/test/files/jvm/t7006/Test.scala
index 5cc38e42a2..065a23510e 100644
--- a/test/files/jvm/t7006/Test.scala
+++ b/test/files/jvm/t7006/Test.scala
@@ -7,12 +7,13 @@ object Test extends BytecodeTest {
def show: Unit = {
val classNode = loadClassNode("Foo_1")
val methodNode = getMethod(classNode, "foo")
- assert(countNops(methodNode.instructions) == 0)
+ assert(count(methodNode.instructions, asm.Opcodes.NOP) == 0)
+ assert(count(methodNode.instructions, asm.Opcodes.GOTO) == 1)
}
- def countNops(insnList: InsnList): Int = {
+ def count(insnList: InsnList, opcode: Int): Int = {
def isNop(node: asm.tree.AbstractInsnNode): Boolean =
- (node.getOpcode == asm.Opcodes.NOP)
+ (node.getOpcode == opcode)
insnList.iterator.asScala.count(isNop)
}
}