diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2016-11-07 03:01:33 -0500 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-11-07 09:31:13 -0500 |
commit | 739885e3276e82fb2f4ff26d9ba55d3936c0b6cf (patch) | |
tree | 555bd733cbbfa6413752f0653e162dcb03efab55 | |
parent | 054ac5a9a8363b315e35ab77e7cc2cd621acf496 (diff) | |
download | cbt-739885e3276e82fb2f4ff26d9ba55d3936c0b6cf.tar.gz cbt-739885e3276e82fb2f4ff26d9ba55d3936c0b6cf.tar.bz2 cbt-739885e3276e82fb2f4ff26d9ba55d3936c0b6cf.zip |
Make Eval tests pass and add them to cbt tests
-rw-r--r-- | libraries/eval/Eval.scala | 10 | ||||
-rw-r--r-- | libraries/eval/test/EvalTest.scala | 6 | ||||
-rw-r--r-- | test/test.scala | 6 |
3 files changed, 16 insertions, 6 deletions
diff --git a/libraries/eval/Eval.scala b/libraries/eval/Eval.scala index 395fc2f..ff87651 100644 --- a/libraries/eval/Eval.scala +++ b/libraries/eval/Eval.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.twitter.util +package cbt.eval import java.io._ import java.math.BigInteger @@ -265,11 +265,11 @@ class Eval(target: Option[File]) { compiler.findClass(className).getOrElse { throw new ClassNotFoundException("no such class: " + className) } } - private[util] def resetReporter(): Unit = { + private[eval] def resetReporter(): Unit = { compiler.resetReporter() } - private[util] def uniqueId(code: String, idOpt: Option[Int] = Some(jvmId)): String = { + private[eval] def uniqueId(code: String, idOpt: Option[Int] = Some(jvmId)): String = { val digest = MessageDigest.getInstance("SHA-1").digest(code.getBytes()) val sha = new BigInteger(1, digest).toString(16) idOpt match { @@ -278,7 +278,7 @@ class Eval(target: Option[File]) { } } - private[util] def fileToClassName(f: File): String = { + private[eval] def fileToClassName(f: File): String = { // HOPE YOU'RE HAPPY GUYS!!!! /* __ * __/|_/ /_ __ ______ ________/|_ @@ -389,7 +389,7 @@ class Eval(target: Option[File]) { class ClassLoaderResolver(classLoader: ClassLoader) extends Resolver { private[this] def quotePath(path: String) = - "/" + path + /*"/" +*/ path def resolvable(path: String): Boolean = { classLoader.getResourceAsStream(quotePath(path)) != null diff --git a/libraries/eval/test/EvalTest.scala b/libraries/eval/test/EvalTest.scala index c9d33b3..0489fba 100644 --- a/libraries/eval/test/EvalTest.scala +++ b/libraries/eval/test/EvalTest.scala @@ -1,4 +1,4 @@ -package com.twitter.util +package cbt.eval.test import java.io.{File, FileWriter} import org.scalatest.WordSpec @@ -10,6 +10,10 @@ import scala.tools.nsc.reporters.{AbstractReporter, Reporter} import java.nio.file._ class EvalTest extends WordSpec { + class Eval(f: Option[File] = None) extends cbt.eval.Eval(f){ + override def classLoader = EvalTest.this.getClass.getClassLoader + } + object Eval extends Eval(None) def fromResourcePath(path: String): File = { assert(path.endsWith(".scala")) val tmpFile = File.createTempFile(path.stripSuffix(".scala"),"scala") diff --git a/test/test.scala b/test/test.scala index 5b4a4af..86ab44b 100644 --- a/test/test.scala +++ b/test/test.scala @@ -255,6 +255,12 @@ object Main{ assert(res.err.contains("null is disabled"), res.out) } + { + val res = runCbt("../libraries/eval", Seq("test")) + assert(res.exit0) + assert(res.out.contains("All tests passed"), res.out) + } + System.err.println(" DONE!") System.err.println( successes.toString ++ " succeeded, "++ failures.toString ++ " failed" ) if(failures > 0) System.exit(1) else System.exit(0) |