Skip to content

Commit

Permalink
Merge pull request #1517 from Friendseeker/zinc-1507-test
Browse files Browse the repository at this point in the history
[1.x] Add scripted test for #1507
  • Loading branch information
eed3si9n authored Dec 18, 2024
2 parents c2e459f + d49fdb8 commit 3ba57aa
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ class IncHandler(directory: Path, cacheDir: Path, scriptedLog: ManagedLogger, co
onArgs("checkIterations") {
case (p, x :: Nil, i) => p.checkNumberOfCompilerIterations(i, x.toInt)
},
onArgs("checkNumberOfLibraries") {
case (p, x :: Nil, i) => p.checkNumberOfLibraries(i, x.toInt)
},
onArgs("checkCycles") {
case (p, x :: Nil, i) => p.checkNumberOfCycles(i, x.toInt)
},
Expand Down Expand Up @@ -525,6 +528,14 @@ case class ProjectStructure(
()
}

def checkNumberOfLibraries(i: IncState, expected: Int): Future[Unit] =
compile(i).map { analysis =>
val count = analysis.stamps.libraries.size
val msg = s"analysis.stamps.libraries.size = $count (expected $expected)"
assert(count == expected, msg)
()
}

def run(i: IncState, params: Seq[String]): Future[Unit] =
compile(i).map { analysis =>
discoverMainClasses(Some(analysis.apis)) match {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package A

class SRC[_]
class Refined {
def select() = new {
def using(opt: Option[SRC[_]] => Some[SRC[_]]) = opt
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package B

import A.Refined

class Client {
def temp = new Refined().select().using(null)
}
15 changes: 15 additions & 0 deletions zinc/src/sbt-test/source-dependencies/anon-class-dep/build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"projects": [
{
"name": "B",
"dependsOn": [
"A"
],
"scalaVersion": "2.13.x"
},
{
"name": "A",
"scalaVersion": "2.13.x"
}
]
}
2 changes: 2 additions & 0 deletions zinc/src/sbt-test/source-dependencies/anon-class-dep/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
> B/compile
> B/checkNumberOfLibraries 1

0 comments on commit 3ba57aa

Please sign in to comment.