-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
89 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package xsbt | ||
|
||
import org.junit.Assert.* | ||
import org.junit.Ignore | ||
import org.junit.Test | ||
|
||
import java.io.File | ||
import java.nio.file.Path | ||
import java.nio.file.Paths | ||
|
||
class ProductsSpecification { | ||
|
||
@Test | ||
def extractProductsFromJar = { | ||
val src = | ||
"""package example | ||
| | ||
|class A { | ||
| class B | ||
| def foo = | ||
| class C | ||
|}""".stripMargin | ||
val output = compiler.compileSrcsToJar(src) | ||
val srcFile = output.srcFiles.head | ||
val products = output.analysis.productClassesToSources.filter(_._2 == srcFile).keys.toSet | ||
|
||
def toPathInJar(className: String): Path = | ||
Paths.get(s"${output.classesOutput}!${className.replace('.', File.separatorChar)}.class") | ||
val expected = Set("example.A", "example.A$B", "example.A$C$1").map(toPathInJar) | ||
assertEquals(products, expected) | ||
} | ||
|
||
private def compiler = new ScalaCompilerForUnitTesting | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters