diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2016-05-23 10:17:15 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2016-05-23 10:17:15 +1000 |
commit | 2e40aa5871859b9ab6bdc03d56a81746fa90b1e5 (patch) | |
tree | 44db43073e3d974fc5ced61de278abd45b8e1227 /test/junit/scala/tools/nsc/backend/jvm/opt/EmptyExceptionHandlersTest.scala | |
parent | a79b9b7220c87ba21b374eda25702c7bc446dc29 (diff) | |
parent | e26835c01254ecb4d9b4fa3a8bbe9c835f808a38 (diff) | |
download | scala-2e40aa5871859b9ab6bdc03d56a81746fa90b1e5.tar.gz scala-2e40aa5871859b9ab6bdc03d56a81746fa90b1e5.tar.bz2 scala-2e40aa5871859b9ab6bdc03d56a81746fa90b1e5.zip |
Merge pull request #5180 from lrytz/junit-pass
Clean up JUnit tests, make sure they pass without bootstrap [ci: last-only]
Diffstat (limited to 'test/junit/scala/tools/nsc/backend/jvm/opt/EmptyExceptionHandlersTest.scala')
-rw-r--r-- | test/junit/scala/tools/nsc/backend/jvm/opt/EmptyExceptionHandlersTest.scala | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/EmptyExceptionHandlersTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/EmptyExceptionHandlersTest.scala index 6d566c722f..3324058cb7 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/EmptyExceptionHandlersTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/EmptyExceptionHandlersTest.scala @@ -2,22 +2,23 @@ package scala.tools.nsc package backend.jvm package opt +import org.junit.Assert._ +import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 -import org.junit.Test -import scala.tools.asm.Opcodes._ -import org.junit.Assert._ -import CodeGenTools._ -import scala.tools.partest.ASMConverters -import ASMConverters._ -import scala.tools.testing.ClearAfterClass +import scala.tools.asm.Opcodes._ +import scala.tools.partest.ASMConverters._ +import scala.tools.testing.BytecodeTesting +import scala.tools.testing.BytecodeTesting._ @RunWith(classOf[JUnit4]) -class EmptyExceptionHandlersTest extends ClearAfterClass { +class EmptyExceptionHandlersTest extends BytecodeTesting { + override def compilerArgs = "-Yopt:unreachable-code" + def dceCompiler = compiler + val noOptCompiler = cached("noOptCompiler", () => newCompiler(extraArgs = "-Yopt:l:none")) - val dceCompiler = cached("dceCompiler", () => newCompiler(extraArgs = "-Yopt:unreachable-code")) val exceptionDescriptor = "java/lang/Exception" @@ -59,8 +60,8 @@ class EmptyExceptionHandlersTest extends ClearAfterClass { def eliminateUnreachableHandler(): Unit = { val code = "def f: Unit = try { } catch { case _: Exception => println(0) }; println(1)" - assertTrue(singleMethod(noOptCompiler)(code).handlers.length == 1) - val optMethod = singleMethod(dceCompiler)(code) + assertTrue(noOptCompiler.compileMethod(code).handlers.length == 1) + val optMethod = dceCompiler.compileMethod(code) assertTrue(optMethod.handlers.isEmpty) val code2 = @@ -72,7 +73,7 @@ class EmptyExceptionHandlersTest extends ClearAfterClass { | println(2) |}""".stripMargin - assertTrue(singleMethod(dceCompiler)(code2).handlers.isEmpty) + assertTrue(dceCompiler.compileMethod(code2).handlers.isEmpty) } @Test @@ -84,6 +85,6 @@ class EmptyExceptionHandlersTest extends ClearAfterClass { | catch { case _: Exception => 2 } |}""".stripMargin - assertTrue(singleMethod(dceCompiler)(code).handlers.length == 1) + assertTrue(dceCompiler.compileMethod(code).handlers.length == 1) } } |