blob: 72d01e46ff61697d2193c0f102128ac902e681b9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
package scala.scalajs.tools.classpath.builder.test
import scala.scalajs.tools.classpath.builder._
import scala.scalajs.tools.jsdep.JSDependencyManifest
import scala.scalajs.tools.io.VirtualScalaJSIRFile
import scala.scalajs.tools.io.VirtualJSFile
import java.io.File
import org.junit.Test
import org.junit.Assert._
class ClasspathElementsTraverserTest {
class TestElementTraverser extends ClasspathElementsTraverser with PhysicalFileSystem {
protected def handleDepManifest(m: => JSDependencyManifest): Unit = ???
protected def handleIR(relPath: String, ir: => VirtualScalaJSIRFile): Unit = ???
protected def handleJS(js: => VirtualJSFile): Unit = ???
def test(f: File): String = traverseClasspathElements(Seq(f))
}
val cpElementTraverser = new TestElementTraverser()
@Test
def testNotExistingJarFile(): Unit = {
val res = cpElementTraverser.test(new File("dummy.jar"))
assertTrue(res.endsWith(cpElementTraverser.DummyVersion))
}
@Test
def testExistingDirectory(): Unit = {
val res = cpElementTraverser.test(new File("tools/jvm/src/test/resources"))
assertTrue(res.indexOf(cpElementTraverser.DummyVersion) < 0)
}
@Test
def testExistingJarFile(): Unit = {
val res = cpElementTraverser.test(new File("tools/jvm/src/test/resources/test.jar"))
assertTrue(res.indexOf(cpElementTraverser.DummyVersion) < 0)
}
}
|