diff options
author | Dale Wijnand <dale.wijnand@gmail.com> | 2016-05-24 14:09:48 +0100 |
---|---|---|
committer | Dale Wijnand <dale.wijnand@gmail.com> | 2016-05-26 16:01:57 +0100 |
commit | 3873fcfcbcc6c7f0c1660c18e45b265170580546 (patch) | |
tree | 59952086ce1560c73654a610645e78c6baf2f595 /test/junit | |
parent | 65642d9f5ca6abc4836811fd0db0fc7d7b4dcb1c (diff) | |
download | scala-3873fcfcbcc6c7f0c1660c18e45b265170580546.tar.gz scala-3873fcfcbcc6c7f0c1660c18e45b265170580546.tar.bz2 scala-3873fcfcbcc6c7f0c1660c18e45b265170580546.zip |
Fully qualify types in REPL generated code
Diffstat (limited to 'test/junit')
-rw-r--r-- | test/junit/scala/tools/nsc/interpreter/ScriptedTest.scala | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/junit/scala/tools/nsc/interpreter/ScriptedTest.scala b/test/junit/scala/tools/nsc/interpreter/ScriptedTest.scala index a8dc8eb3e0..01d17110d6 100644 --- a/test/junit/scala/tools/nsc/interpreter/ScriptedTest.scala +++ b/test/junit/scala/tools/nsc/interpreter/ScriptedTest.scala @@ -13,6 +13,14 @@ class ScriptedTest { // same as by service discovery //new ScriptEngineManager().getEngineByName("scala").asInstanceOf[ScriptEngine with Compilable] + // scripted, but also -Yno-predef -Yno-imports + def scriptedNoNothing: ScriptEngine with Compilable = { + val settings = new Settings() + settings.noimports.value = true + settings.nopredef.value = true + Scripted(settings = settings) + } + @Test def eval() = { val engine = scripted engine.put("foo","bar") @@ -24,6 +32,17 @@ class ScriptedTest { assert("barbar" == c.eval()) assert("bazbaz" == c.eval(bindings)) } + @Test def evalNoNothing() = { + val engine = scriptedNoNothing + engine.put("foo","bar") + assert("bar" == engine.eval("foo")) + val bindings = engine.createBindings() + bindings.put("foo","baz") + assert("baz" == engine.eval("foo", bindings)) + val c = engine.compile("import scala.Predef.augmentString ; def f = foo.asInstanceOf[java.lang.String] ; f * 2") + assert("barbar" == c.eval()) + assert("bazbaz" == c.eval(bindings)) + } @Test def `SI-7933 multiple eval compiled script`() = { val engine = scripted val init = """val i = new java.util.concurrent.atomic.AtomicInteger""" |