blob: d98f2671233cc888a7e5e6e718617861af40e750 (
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
|
import scala.tools.partest._
object Test extends DirectTest {
def code = ???
def macros_1 = """
import scala.reflect.macros.BlackboxContext
object Impls {
def impl(c: BlackboxContext) = { import c.universe._; c.Expr[Unit](q"()") }
}
object Macros {
//import Impls._
def impl(c: BlackboxContext) = { import c.universe._; c.Expr[Unit](q"()") }
def foo = macro impl
}
"""
def compileMacros() = {
val classpath = List(sys.props("partest.lib"), sys.props("partest.reflect")) mkString sys.props("path.separator")
compileString(newCompiler("-language:experimental.macros", "-cp", classpath, "-d", testOutput.path))(macros_1)
}
def test_2 = """
object Test extends App {
println(Macros.foo)
}
"""
def compileTest() = {
val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator")
compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(test_2)
}
def show(): Unit = {
log("Compiling Macros_1...")
if (compileMacros()) {
log("Compiling Test_2...")
if (compileTest()) log("Success!") else log("Failed...")
}
}
}
|