diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/jvm/signum.scala | 15 | ||||
-rw-r--r-- | test/files/run/t5230.check | 2 | ||||
-rw-r--r-- | test/files/run/t5230.scala | 19 |
3 files changed, 36 insertions, 0 deletions
diff --git a/test/files/jvm/signum.scala b/test/files/jvm/signum.scala new file mode 100644 index 0000000000..feb28d3e43 --- /dev/null +++ b/test/files/jvm/signum.scala @@ -0,0 +1,15 @@ +object Test { + def main(args: Array[String]) { + assert(math.signum(Long.MaxValue) == 1L) + assert(math.signum(1L) == 1L) + assert(math.signum(0L) == 0L) + assert(math.signum(-1L) == -1L) + assert(math.signum(Long.MinValue) == -1L) + + assert(math.signum(Int.MaxValue) == 1) + assert(math.signum(1) == 1) + assert(math.signum(0) == 0) + assert(math.signum(-1) == -1) + assert(math.signum(Int.MinValue) == -1) + } +} diff --git a/test/files/run/t5230.check b/test/files/run/t5230.check new file mode 100644 index 0000000000..5db6ec9b38 --- /dev/null +++ b/test/files/run/t5230.check @@ -0,0 +1,2 @@ +2 +evaluated = null diff --git a/test/files/run/t5230.scala b/test/files/run/t5230.scala new file mode 100644 index 0000000000..5aab8f9290 --- /dev/null +++ b/test/files/run/t5230.scala @@ -0,0 +1,19 @@ +import scala.tools.nsc.reporters._ +import scala.tools.nsc.Settings +import reflect.runtime.Mirror.ToolBox + +object Test extends App { + val code = scala.reflect.Code.lift{ + class C { + val x = 2 + } + + println(new C().x) + }; + + val reporter = new ConsoleReporter(new Settings) + val toolbox = new ToolBox(reporter) + val ttree = toolbox.typeCheck(code.tree) + val evaluated = toolbox.runExpr(ttree) + println("evaluated = " + evaluated) +} |