blob: e25399b16bf1338d142d8848dd56c41cd00e3395 (
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
|
package scala.scalajs.compiler.test
import util.JSASTTest
import org.junit.Test
import org.junit.Assert._
import scala.reflect.internal.util.BatchSourceFile
import scala.scalajs.ir.{Trees => js}
class PositionTest extends JSASTTest {
@Test
def virtualFilePosition = {
val name = "<foo with illegal URI chars: %%>"
val source = new BatchSourceFile(name,
"""class A { def x = 1 }""")
var found = false
sourceAST(source) traverse {
case lit: js.IntLiteral =>
found = true
assertEquals(
"Scheme of virtual file URI should be `virtualfile'",
"virtualfile", lit.pos.source.getScheme)
assertEquals(
"Scheme specific part of virtual file URI should be its path",
name, lit.pos.source.getSchemeSpecificPart)
}
assertTrue("Should have IntLiteral tree", found)
}
}
|