diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2016-05-20 10:59:21 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2016-05-20 16:44:18 +0200 |
commit | 5d5a6aa154ab533dca4a0e589a7ae67c3c037d61 (patch) | |
tree | d2b813b56b7bc01f90a8bde9180d5c3295564125 /test/junit/scala/tools/nsc/backend/jvm/BTypesTest.scala | |
parent | 72a59d932db6f16defd14bd729e0f6ec894c7e1b (diff) | |
download | scala-5d5a6aa154ab533dca4a0e589a7ae67c3c037d61.tar.gz scala-5d5a6aa154ab533dca4a0e589a7ae67c3c037d61.tar.bz2 scala-5d5a6aa154ab533dca4a0e589a7ae67c3c037d61.zip |
Better abstraction for bytecode tests. Also organize some imports.
Diffstat (limited to 'test/junit/scala/tools/nsc/backend/jvm/BTypesTest.scala')
-rw-r--r-- | test/junit/scala/tools/nsc/backend/jvm/BTypesTest.scala | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/test/junit/scala/tools/nsc/backend/jvm/BTypesTest.scala b/test/junit/scala/tools/nsc/backend/jvm/BTypesTest.scala index ebeb577149..0144fa7366 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/BTypesTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/BTypesTest.scala @@ -1,30 +1,29 @@ package scala.tools.nsc package backend.jvm +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 scala.tools.testing.BytecodeTesting._ -import scala.tools.testing.ClearAfterClass +import scala.tools.asm.Opcodes +import scala.tools.testing.BytecodeTesting @RunWith(classOf[JUnit4]) -class BTypesTest extends ClearAfterClass { - val compiler = cached("compiler", () => { - val comp = newCompiler(extraArgs = "-Yopt:l:none") - new comp.Run() // initializes some of the compiler - comp.exitingDelambdafy(comp.scalaPrimitives.init()) // needed: it's only done when running the backend, and we don't actually run the compiler - comp.exitingDelambdafy(comp.genBCode.bTypes.initializeCoreBTypes()) - comp - }) - import compiler.genBCode.bTypes._ +class BTypesTest extends BytecodeTesting { + override def compilerArgs = "-Yopt:l:none" + import compiler.global + locally { + new global.Run() // initializes some of the compiler + global.exitingDelambdafy(global.scalaPrimitives.init()) // needed: it's only done when running the backend, and we don't actually run the compiler + global.exitingDelambdafy(global.genBCode.bTypes.initializeCoreBTypes()) + } + import global.genBCode.bTypes._ - def classBTFS(sym: compiler.Symbol) = compiler.exitingDelambdafy(classBTypeFromSymbol(sym)) + def classBTFS(sym: global.Symbol) = global.exitingDelambdafy(classBTypeFromSymbol(sym)) - def jlo = compiler.definitions.ObjectClass - def jls = compiler.definitions.StringClass + def jlo = global.definitions.ObjectClass + def jls = global.definitions.StringClass def o = classBTFS(jlo) def s = classBTFS(jls) def oArr = ArrayBType(o) |