Skip to content

Commit

Permalink
Restore scala3-tasty-management test
Browse files Browse the repository at this point in the history
  • Loading branch information
eed3si9n committed Feb 4, 2024
1 parent 3c0115a commit 55021f7
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import sbt.io.Using
import xsbti.compile.TastyFiles

ThisBuild / scalaVersion := "3.3.1"

TaskKey[Unit]("check") := {
assert((Compile / auxiliaryClassFiles).value == Seq(TastyFiles.instance))
assert((Test / auxiliaryClassFiles).value == Seq(TastyFiles.instance))
}

TaskKey[Unit]("check2") := checkTastyFiles(true, true).value

TaskKey[Unit]("check3") := checkTastyFiles(true, false).value

def checkTastyFiles(aExists: Boolean, bExists: Boolean) = Def.task {
val p = (Compile / packageBin).value
val c = fileConverter.value
Using.jarFile(false)(c.toPath(p).toFile()): jar =>
if aExists then assert(jar.getJarEntry("A.tasty") ne null)
else assert(jar.getJarEntry("A.tasty") eq null)

if bExists then assert(jar.getJarEntry("B.tasty") ne null)
else assert(jar.getJarEntry("B.tasty") eq null)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class A {
def initialized: Boolean = false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class B {
def foo(a: A): Boolean = a.initialized
}
10 changes: 10 additions & 0 deletions sbt-app/src/sbt-test/compiler-project/scala3-tasty-management/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
> check

> check2

$ delete src/main/scala/B.scala

> check3

# $ exists target/scala-3.0.0-M3/classes/A.tasty
# -$ exists target/scala-3.0.0-M3/classes/B.tasty

0 comments on commit 55021f7

Please sign in to comment.