diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2017-10-29 17:15:31 -0700 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2017-10-29 17:15:31 -0700 |
commit | cf8e737a26e60d20c60bf4ab8e07c2a1c50954fd (patch) | |
tree | d1900b9cad341ada10662465424c3387019e7ce4 | |
parent | ee1c3d384dbf4e19244ffac595a7667efe0493f5 (diff) | |
download | mill-cf8e737a26e60d20c60bf4ab8e07c2a1c50954fd.tar.gz mill-cf8e737a26e60d20c60bf4ab8e07c2a1c50954fd.tar.bz2 mill-cf8e737a26e60d20c60bf4ab8e07c2a1c50954fd.zip |
Add some final output checks to javac integration test
-rw-r--r-- | src/test/examples/javac/src/Foo.java | 2 | ||||
-rw-r--r-- | src/test/scala/forge/IntegrationTests.scala | 20 |
2 files changed, 18 insertions, 4 deletions
diff --git a/src/test/examples/javac/src/Foo.java b/src/test/examples/javac/src/Foo.java index a5ba9e2a..e694f9fa 100644 --- a/src/test/examples/javac/src/Foo.java +++ b/src/test/examples/javac/src/Foo.java @@ -2,6 +2,6 @@ package test; public class Foo{ static int value = 31337; public static void main(String[] args){ - System.out.println(value); + System.out.println(value + Bar.value); } }
\ No newline at end of file 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") } } } |