summaryrefslogtreecommitdiff
path: root/src/test/scala/forge/IntegrationTests.scala
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2017-10-29 17:15:31 -0700
committerLi Haoyi <haoyi.sg@gmail.com>2017-10-29 17:15:31 -0700
commitcf8e737a26e60d20c60bf4ab8e07c2a1c50954fd (patch)
treed1900b9cad341ada10662465424c3387019e7ce4 /src/test/scala/forge/IntegrationTests.scala
parentee1c3d384dbf4e19244ffac595a7667efe0493f5 (diff)
downloadmill-cf8e737a26e60d20c60bf4ab8e07c2a1c50954fd.tar.gz
mill-cf8e737a26e60d20c60bf4ab8e07c2a1c50954fd.tar.bz2
mill-cf8e737a26e60d20c60bf4ab8e07c2a1c50954fd.zip
Add some final output checks to javac integration test
Diffstat (limited to 'src/test/scala/forge/IntegrationTests.scala')
-rw-r--r--src/test/scala/forge/IntegrationTests.scala20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/test/scala/forge/IntegrationTests.scala b/src/test/scala/forge/IntegrationTests.scala
index cfa8a864..b28dfd41 100644
--- a/src/test/scala/forge/IntegrationTests.scala
+++ b/src/test/scala/forge/IntegrationTests.scala
@@ -3,7 +3,7 @@ package forge
import java.io.FileOutputStream
import java.util.jar.JarEntry
-import ammonite.ops.{Path, cp, ls, mkdir, pwd, read}
+import ammonite.ops._
import forge.util.{Args, OSet, PathRef}
import utest._
@@ -46,8 +46,9 @@ object IntegrationTests extends TestSuite{
val tests = Tests{
'javac {
+ val workspacePath = pwd / 'target / 'workspace / 'javac
val javacSrcPath = pwd / 'src / 'test / 'examples / 'javac
- val javacDestPath = pwd / 'target / 'workspace / 'javac / 'src
+ val javacDestPath = workspacePath / 'src
mkdir(pwd / 'target / 'workspace / 'javac)
cp(javacSrcPath, javacDestPath)
@@ -70,7 +71,7 @@ object IntegrationTests extends TestSuite{
val mapping = Discovered.mapping(Build)
def check(targets: OSet[Target[_]], expected: OSet[Target[_]]) = {
- val evaluator = new Evaluator(pwd / 'target / 'workspace / 'javac, mapping)
+ val evaluator = new Evaluator(workspacePath, mapping)
val evaluated = evaluator.evaluate(targets).evaluated.filter(mapping.contains)
assert(evaluated == expected)
}
@@ -119,6 +120,19 @@ object IntegrationTests extends TestSuite{
check(targets = OSet(allSources), expected = OSet(sourceRoot, allSources))
check(targets = OSet(jar), expected = OSet(classFiles, jar))
+ val jarContents = %%('jar, "-tf", workspacePath/'jar)(workspacePath).out.string
+ val expectedJarContents =
+ """hello.txt
+ |test/Bar.class
+ |test/BarThree.class
+ |test/BarTwo.class
+ |test/Foo.class
+ |test/FooTwo.class
+ |""".stripMargin
+ assert(jarContents == expectedJarContents)
+
+ val executed = %%('java, "-cp", workspacePath/'jar, "test.Foo")(workspacePath).out.string
+ assert(executed == (31337 + 271828) + "\n")
}
}
}