@@ -4,6 +4,8 @@ import com.eed3si9n.expecty.Expecty.expect
44
55import java .io .File
66
7+ import scala .cli .integration .Constants .munitVersion
8+
79class TestTestsDefault extends TestTestDefinitions with TestDefault {
810 test(" Pure Java with Scala tests" ) {
911 val inputs = TestInputs (
@@ -40,4 +42,31 @@ class TestTestsDefault extends TestTestDefinitions with TestDefault {
4042 .call(cwd = root, stdout = os.Inherit )
4143 }
4244 }
45+
46+ test(
47+ s " successful test --cross $actualScalaVersion with ${Constants .scala213} and ${Constants .scala212}"
48+ ) {
49+ val crossVersions = Seq (actualScalaVersion, Constants .scala213, Constants .scala212)
50+ val expectedMessage = " Hello"
51+ TestInputs (
52+ os.rel / " Cross.test.scala" ->
53+ s """ //> using dep org.scalameta::munit:: $munitVersion
54+ |class MyTests extends munit.FunSuite {
55+ | test("foo") {
56+ | assert(2 + 2 == 4)
57+ | println(" $expectedMessage")
58+ | }
59+ |}
60+ | """ .stripMargin,
61+ os.rel / " project.scala" -> s " //> using scala ${crossVersions.mkString(" " )}"
62+ ).fromRoot { root =>
63+ val output = os.proc(TestUtil .cli, " test" , extraOptions, " ." , " --cross" , " --power" )
64+ .call(cwd = root).out.text()
65+ def countOccurrences (a : String , b : String ): Int =
66+ if (b.isEmpty) 0 // Avoid infinite splitting
67+ else a.sliding(b.length).count(_ == b)
68+ expect(output.contains(expectedMessage))
69+ expect(countOccurrences(output, expectedMessage) == crossVersions.length)
70+ }
71+ }
4372}
0 commit comments