diff options
Diffstat (limited to 'test/test/DottyBytecodeTest.scala')
-rw-r--r-- | test/test/DottyBytecodeTest.scala | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test/DottyBytecodeTest.scala b/test/test/DottyBytecodeTest.scala index 6b39116f8..3814b03bd 100644 --- a/test/test/DottyBytecodeTest.scala +++ b/test/test/DottyBytecodeTest.scala @@ -94,6 +94,22 @@ trait DottyBytecodeTest extends DottyTest { } /**************************** Comparison Methods ****************************/ + def verifySwitch(method: MethodNode, shouldFail: Boolean = false, debug: Boolean = false): Boolean = { + val instructions = instructionsFromMethod(method) + + val succ = instructions + .collect { + case x: TableSwitch => x + case x: LookupSwitch => x + } + .length > 0 + + if (debug || !succ && !shouldFail || succ && shouldFail) + instructions.foreach(Console.err.println) + + succ + } + def sameBytecode(methA: MethodNode, methB: MethodNode) = { val isa = instructionsFromMethod(methA) val isb = instructionsFromMethod(methB) |