@@ -7,9 +7,10 @@ import java.util.zip.ZipFile
7
7
8
8
import scala .jdk .CollectionConverters ._
9
9
10
- class PublishTests extends munit.FunSuite {
10
+ abstract class PublishTestDefinitions (val scalaVersionOpt : Option [String ])
11
+ extends munit.FunSuite with TestScalaVersionArgs {
11
12
12
- private def extraOptions = TestUtil .extraOptions
13
+ private def extraOptions = scalaVersionArgs ++ TestUtil .extraOptions
13
14
14
15
test(" simple" ) {
15
16
val inputs = TestInputs (
@@ -22,8 +23,6 @@ class PublishTests extends munit.FunSuite {
22
23
|//> using publish.license "Apache 2.0:http://opensource.org/licenses/Apache-2.0"
23
24
|//> using publish.developer "someone|Someone||https://github.com/someone"
24
25
|
25
- |//> using scala "3.1.1"
26
- |
27
26
|package foo
28
27
|
29
28
|object Hello {
@@ -41,12 +40,15 @@ class PublishTests extends munit.FunSuite {
41
40
)
42
41
)
43
42
43
+ val scalaSuffix =
44
+ if (actualScalaVersion.startsWith(" 3." )) " _3"
45
+ else " _" + actualScalaVersion.split('.' ).take(2 ).mkString(" ." )
44
46
val expectedArtifactsDir =
45
- os.rel / " org" / " virtuslab" / " scalacli" / " test" / " simple_3 " / " 0.2.0-SNAPSHOT"
47
+ os.rel / " org" / " virtuslab" / " scalacli" / " test" / s " simple $scalaSuffix " / " 0.2.0-SNAPSHOT"
46
48
val baseExpectedArtifacts = Seq (
47
- " simple_3 -0.2.0-SNAPSHOT.pom" ,
48
- " simple_3 -0.2.0-SNAPSHOT.jar" ,
49
- " simple_3 -0.2.0-SNAPSHOT-sources.jar"
49
+ s " simple $scalaSuffix -0.2.0-SNAPSHOT.pom " ,
50
+ s " simple $scalaSuffix -0.2.0-SNAPSHOT.jar " ,
51
+ s " simple $scalaSuffix -0.2.0-SNAPSHOT-sources.jar "
50
52
)
51
53
val expectedArtifacts = baseExpectedArtifacts
52
54
.flatMap { n =>
@@ -113,7 +115,7 @@ class PublishTests extends munit.FunSuite {
113
115
114
116
val repoArgs =
115
117
Seq [os.Shellable ](" -r" , " !central" , " -r" , (root / " test-repo" ).toNIO.toUri.toASCIIString)
116
- val dep = " org.virtuslab.scalacli.test:simple_3 :0.2.0-SNAPSHOT"
118
+ val dep = s " org.virtuslab.scalacli.test:simple $scalaSuffix :0.2.0-SNAPSHOT "
117
119
val res = os.proc(TestUtil .cs, " launch" , repoArgs, dep).call(cwd = root)
118
120
val output = res.out.text().trim
119
121
expect(output == " Hello" )
0 commit comments