Skip to content

Commit 520399a

Browse files
committed
Run Scala 3 default integration tests on all stable versions (so 3 LTS as well)
1 parent 5c9a569 commit 520399a

File tree

2 files changed

+54
-56
lines changed

2 files changed

+54
-56
lines changed

modules/integration/src/test/scala/scala/cli/integration/CompileTests3StableDefinitions.scala

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package scala.cli.integration
22

33
import com.eed3si9n.expecty.Expecty.expect
44

5+
import java.io.File
6+
57
trait CompileTests3StableDefinitions { _: CompileTestDefinitions =>
68
test(s"TASTY processor does not warn about Scala $actualScalaVersion") {
79
TestInputs(os.rel / "simple.sc" -> s"""println("Hello")""")
@@ -14,4 +16,55 @@ trait CompileTests3StableDefinitions { _: CompileTestDefinitions =>
1416
}
1517
}
1618

19+
test("render explain message") {
20+
val fileName = "Hello.scala"
21+
val inputs = TestInputs(
22+
os.rel / fileName -> // should be dump to 3.3.1 after release
23+
s"""//> using scala "3.3.1-RC1-bin-20230203-3ef1e73-NIGHTLY"
24+
|//> using options "--explain"
25+
|
26+
|class A
27+
|val i: Int = A()
28+
|""".stripMargin
29+
)
30+
inputs.fromRoot { root =>
31+
val out = os.proc(TestUtil.cli, "compile", extraOptions, fileName)
32+
.call(cwd = root, check = false, mergeErrIntoOut = true).out.trim()
33+
34+
expect(out.contains("Explanation"))
35+
}
36+
}
37+
38+
test("as jar") {
39+
val inputs = TestInputs(
40+
os.rel / "Foo.scala" ->
41+
"""object Foo {
42+
| def n = 2
43+
|}
44+
|""".stripMargin
45+
)
46+
inputs.fromRoot { root =>
47+
val out = os.proc(TestUtil.cli, "compile", extraOptions, ".", "--print-class-path")
48+
.call(cwd = root)
49+
.out.trim()
50+
val cp = out.split(File.pathSeparator).toVector.map(os.Path(_, root))
51+
expect(cp.headOption.exists(os.isDir(_)))
52+
expect(cp.drop(1).forall(os.isFile(_)))
53+
54+
val asJarOut = os.proc(
55+
TestUtil.cli,
56+
"--power",
57+
"compile",
58+
extraOptions,
59+
".",
60+
"--print-class-path",
61+
"--as-jar"
62+
)
63+
.call(cwd = root)
64+
.out.trim()
65+
val asJarCp = asJarOut.split(File.pathSeparator).toVector.map(os.Path(_, root))
66+
expect(asJarCp.forall(os.isFile(_)))
67+
}
68+
}
69+
1770
}
Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,4 @@
11
package scala.cli.integration
22

3-
import com.eed3si9n.expecty.Expecty.expect
4-
5-
import java.io.File
6-
73
class CompileTestsDefault extends CompileTestDefinitions with CompileTests3StableDefinitions
8-
with TestDefault {
9-
test("render explain message") {
10-
val fileName = "Hello.scala"
11-
val inputs = TestInputs(
12-
os.rel / fileName -> // should be dump to 3.3.1 after release
13-
s"""//> using scala "3.3.1-RC1-bin-20230203-3ef1e73-NIGHTLY"
14-
|//> using options "--explain"
15-
|
16-
|class A
17-
|val i: Int = A()
18-
|""".stripMargin
19-
)
20-
inputs.fromRoot { root =>
21-
val out = os.proc(TestUtil.cli, "compile", extraOptions, fileName)
22-
.call(cwd = root, check = false, mergeErrIntoOut = true).out.trim()
23-
24-
expect(out.contains("Explanation"))
25-
}
26-
}
27-
28-
test("as jar") {
29-
val inputs = TestInputs(
30-
os.rel / "Foo.scala" ->
31-
"""object Foo {
32-
| def n = 2
33-
|}
34-
|""".stripMargin
35-
)
36-
inputs.fromRoot { root =>
37-
val out = os.proc(TestUtil.cli, "compile", extraOptions, ".", "--print-class-path")
38-
.call(cwd = root)
39-
.out.trim()
40-
val cp = out.split(File.pathSeparator).toVector.map(os.Path(_, root))
41-
expect(cp.headOption.exists(os.isDir(_)))
42-
expect(cp.drop(1).forall(os.isFile(_)))
43-
44-
val asJarOut = os.proc(
45-
TestUtil.cli,
46-
"--power",
47-
"compile",
48-
extraOptions,
49-
".",
50-
"--print-class-path",
51-
"--as-jar"
52-
)
53-
.call(cwd = root)
54-
.out.trim()
55-
val asJarCp = asJarOut.split(File.pathSeparator).toVector.map(os.Path(_, root))
56-
expect(asJarCp.forall(os.isFile(_)))
57-
}
58-
}
59-
}
4+
with TestDefault

0 commit comments

Comments
 (0)