blob: e25399b16bf1338d142d8848dd56c41cd00e3395 (
plain) (
tree)
|
|
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)
}
}
|