summaryrefslogtreecommitdiff
path: root/src/partest-extras
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-09-08 00:38:43 -0700
committerJason Zaugg <jzaugg@gmail.com>2013-09-08 00:38:43 -0700
commite3968a5a40b09218990f2f7bc3e449d68cd2cf02 (patch)
treeacc10917a415184f8e9f66fa3f355caebe1b1b1d /src/partest-extras
parent45a7da1426586e9fe2abe19b41a296e76ef1d78a (diff)
parente8af579a4442b3cda9ea82ddc1ce7f9bd6899418 (diff)
downloadscala-e3968a5a40b09218990f2f7bc3e449d68cd2cf02.tar.gz
scala-e3968a5a40b09218990f2f7bc3e449d68cd2cf02.tar.bz2
scala-e3968a5a40b09218990f2f7bc3e449d68cd2cf02.zip
Merge pull request #2885 from som-snytt/issue/7791-script-linenums
SI-7791 Line number table reflects underlying file
Diffstat (limited to 'src/partest-extras')
-rw-r--r--src/partest-extras/scala/tools/partest/ScriptTest.scala21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/partest-extras/scala/tools/partest/ScriptTest.scala b/src/partest-extras/scala/tools/partest/ScriptTest.scala
new file mode 100644
index 0000000000..24a4121b54
--- /dev/null
+++ b/src/partest-extras/scala/tools/partest/ScriptTest.scala
@@ -0,0 +1,21 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2013 LAMP/EPFL
+ */
+
+package scala.tools.partest
+
+import scala.reflect.internal.util.ScalaClassLoader
+
+/** A `ScriptTest` is a `DirectTest` for which the code
+ * is the contents of a script file.
+ */
+abstract class ScriptTest extends DirectTest {
+ def testmain = "TestMain"
+ override def extraSettings = s"-usejavacp -Xscript $testmain"
+ def scriptPath = testPath changeExtension "script"
+ def code = scriptPath.toFile.slurp
+ def show() = {
+ compile()
+ ScalaClassLoader(getClass.getClassLoader).run(testmain, Seq.empty[String])
+ }
+}