@@ -4,6 +4,8 @@ import com.eed3si9n.expecty.Expecty.expect
4
4
5
5
import java .io .File
6
6
7
+ import scala .cli .integration .Constants .munitVersion
8
+
7
9
class TestTestsDefault extends TestTestDefinitions with TestDefault {
8
10
test(" Pure Java with Scala tests" ) {
9
11
val inputs = TestInputs (
@@ -40,4 +42,31 @@ class TestTestsDefault extends TestTestDefinitions with TestDefault {
40
42
.call(cwd = root, stdout = os.Inherit )
41
43
}
42
44
}
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
+ }
43
72
}
0 commit comments