@@ -17,12 +17,12 @@ object HelloGroovyTests extends TestSuite {
1717 lazy val millDiscover = Discover [this .type ]
1818
1919 // needed for a special test where only the tests are written in Groovy while appcode remains Java
20- object `mixed-compile ` extends JavaModule with MavenModule {
20+ object `groovy-tests ` extends JavaMavenModuleWithGroovyTests {
2121
22- object `test` extends TestGroovyMavenModule with TestModule .Junit5 {
22+ object `test` extends GroovyMavenTests with TestModule .Junit5 {
2323
2424 override def moduleDeps : Seq [JavaModule ] = Seq (
25- HelloGroovy .`mixed-compile `, // TODO improve: TestOnly does not inherit outer deps
25+ HelloGroovy .`groovy-tests `,
2626 )
2727
2828 override def groovyVersion = groovy4Version
@@ -37,6 +37,7 @@ object HelloGroovyTests extends TestSuite {
3737
3838 object `joint-compile` extends GroovyModule {
3939 override def groovyVersion : T [String ] = groovy4Version
40+ override def mainClass = Some (" jointcompile.JavaMain" )
4041 }
4142
4243 trait Test extends GroovyModule {
@@ -92,52 +93,53 @@ object HelloGroovyTests extends TestSuite {
9293 def tests : Tests = Tests {
9394
9495 def m = HelloGroovy .main
95- def mixed = HelloGroovy .`mixed-compile`
96-
97- test(" running a Groovy script" ) {
98- testEval().scoped { eval =>
99- val Right (_) = eval.apply(m.script.run()): @ unchecked
100- }
101- }
102-
103- test(" compile & run Groovy module" ) {
104- testEval().scoped { eval =>
105- val Right (result) = eval.apply(m.compile): @ unchecked
106-
107- assert(
108- os.walk(result.value.classes.path).exists(_.last == " Hello.class" )
109- )
110-
111- val Right (_) = eval.apply(m.run()): @ unchecked
112- }
113- }
114-
115- test(" compile & run Groovy JUnit5 test" ) {
116- testEval().scoped { eval =>
117-
118- val Right (result) = eval.apply(m.test.compile): @ unchecked
119-
120- assert(
121- os.walk(result.value.classes.path).exists(_.last == " HelloTest.class" )
122- )
123-
124- val Right (discovered) = eval.apply(m.test.discoveredTestClasses): @ unchecked
125- assert(discovered.value == Seq (" hello.tests.HelloTest" ))
126-
127- val Right (_) = eval.apply(m.test.testForked()): @ unchecked
128- }
129- }
130-
131- test(" compiling & running a statically compiled Groovy" ) {
132- testEval().scoped { eval =>
133- val Right (result) = eval.apply(m.staticcompile.compile): @ unchecked
134- assert(
135- os.walk(result.value.classes.path).exists(_.last == " HelloStatic.class" )
136- )
137- val Right (_) = eval.apply(m.staticcompile.run()): @ unchecked
138- }
139- }
140-
96+ def mixed = HelloGroovy .`groovy-tests`
97+ def joint = HelloGroovy .`joint-compile`
98+
99+ // test("running a Groovy script") {
100+ // testEval().scoped { eval =>
101+ // val Right(_) = eval.apply(m.script.run()): @unchecked
102+ // }
103+ // }
104+ //
105+ // test("compile & run Groovy module") {
106+ // testEval().scoped { eval =>
107+ // val Right(result) = eval.apply(m.compile): @unchecked
108+ //
109+ // assert(
110+ // os.walk(result.value.classes.path).exists(_.last == "Hello.class")
111+ // )
112+ //
113+ // val Right(_) = eval.apply(m.run()): @unchecked
114+ // }
115+ // }
116+ //
117+ // test("compile & run Groovy JUnit5 test") {
118+ // testEval().scoped { eval =>
119+ //
120+ // val Right(result) = eval.apply(m.test.compile): @unchecked
121+ //
122+ // assert(
123+ // os.walk(result.value.classes.path).exists(_.last == "HelloTest.class")
124+ // )
125+ //
126+ // val Right(discovered) = eval.apply(m.test.discoveredTestClasses): @unchecked
127+ // assert(discovered.value == Seq("hello.tests.HelloTest"))
128+ //
129+ // val Right(_) = eval.apply(m.test.testForked()): @unchecked
130+ // }
131+ // }
132+ //
133+ // test("compiling & running a statically compiled Groovy") {
134+ // testEval().scoped { eval =>
135+ // val Right(result) = eval.apply(m.staticcompile.compile): @unchecked
136+ // assert(
137+ // os.walk(result.value.classes.path).exists(_.last == "HelloStatic.class")
138+ // )
139+ // val Right(_) = eval.apply(m.staticcompile.run()): @unchecked
140+ // }
141+ // }
142+ //
141143 test(" compile & run test-only Maven JUnit5 test" ) {
142144 testEval().scoped { eval =>
143145
@@ -153,23 +155,33 @@ object HelloGroovyTests extends TestSuite {
153155 val Right (_) = eval.apply(mixed.test.testForked()): @ unchecked
154156 }
155157 }
156-
157- test(" compile & run Spock test" ) {
158+ //
159+ // test("compile & run Spock test") {
160+ // testEval().scoped { eval =>
161+ //
162+ // val Right(result1) = eval.apply(m.spock.compile): @unchecked
163+ // assert(
164+ // os.walk(result1.value.classes.path).exists(_.last == "SpockTest.class")
165+ // )
166+ //
167+ // val Right(discovered) = eval.apply(m.spock.discoveredTestClasses): @unchecked
168+ // assert(discovered.value == Seq("hello.spock.SpockTest"))
169+ //
170+ // val Right(_) = eval.apply(m.spock.testForked()): @unchecked
171+ // }
172+ // }
173+
174+ test(" compile joint (groovy <-> java cycle) & run test" ) {
158175 testEval().scoped { eval =>
176+ val Right (result) = eval.apply(joint.compile): @ unchecked
159177
160- val Right (result1) = eval.apply(m.spock.compile): @ unchecked
161178 assert(
162- os.walk(result1 .value.classes.path).exists(_.last == " SpockTest .class" )
179+ os.walk(result .value.classes.path).exists(_.last == " JavaPrinter .class" )
163180 )
164181
165- val Right (discovered) = eval.apply(m.spock.discoveredTestClasses): @ unchecked
166- assert(discovered.value == Seq (" hello.spock.SpockTest" ))
167-
168- val Right (_) = eval.apply(m.spock.testForked()): @ unchecked
182+ val Right (_) = eval.apply(joint.run()): @ unchecked
169183 }
170184 }
171185
172-
173-
174186 }
175187}
0 commit comments