@@ -93,31 +93,33 @@ class PluginASTSupportTest extends FunSuite with MacroSupport {
93
93
94
94
test(" scoverage component should ignore complex macros #11" ) {
95
95
val compiler = ScoverageCompiler .default
96
- compiler.compileCodeSnippet(s """ object ComplexMacro {
97
- |
98
- | import scala.language.experimental.macros
99
- | import ${macroContextPackageName}.Context
100
- |
101
- | def debug(params: Any*): Unit = macro debugImpl
102
- |
103
- | def debugImpl(c: Context)(params: c.Expr[Any]*) = {
104
- | import c.universe._
105
- |
106
- | val trees = params map {param => (param.tree match {
107
- | case Literal(Constant(_)) => reify { print(param.splice) }
108
- | case _ => reify {
109
- | val variable = c.Expr[String](Literal(Constant(show(param.tree)))).splice
110
- | print(s" $$ variable = $$ {param.splice}")
111
- | }
112
- | }).tree
113
- | }
114
- |
115
- | val separators = (1 until trees.size).map(_ => (reify { print(", ") }).tree) :+ (reify { println() }).tree
116
- | val treesWithSeparators = trees zip separators flatMap {p => List(p._1, p._2)}
117
- |
118
- | c.Expr[Unit](Block(treesWithSeparators.toList, Literal(Constant(()))))
119
- | }
120
- |} """ .stripMargin)
96
+ compiler.compileCodeSnippet(
97
+ s """ object ComplexMacro {
98
+ |
99
+ | import scala.language.experimental.macros
100
+ | import ${macroContextPackageName}.Context
101
+ |
102
+ | def debug(params: Any*): Unit = macro debugImpl
103
+ |
104
+ | def debugImpl(c: Context)(params: c.Expr[Any]*) = {
105
+ | import c.universe._
106
+ |
107
+ | val trees = params map {param => (param.tree match {
108
+ | case Literal(Constant(_)) => reify { print(param.splice) }
109
+ | case _ => reify {
110
+ | val variable = c.Expr[String](Literal(Constant(show(param.tree)))).splice
111
+ | print(s" $$ variable = $$ {param.splice}")
112
+ | }
113
+ | }).tree
114
+ | }
115
+ |
116
+ | val separators = (1 until trees.size).map(_ => (reify { print(", ") }).tree) :+ (reify { println() }).tree
117
+ | val treesWithSeparators = trees zip separators flatMap {p => List(p._1, p._2)}
118
+ |
119
+ | c.Expr[Unit](Block(treesWithSeparators.toList, Literal(Constant(()))))
120
+ | }
121
+ |} """ .stripMargin
122
+ )
121
123
assert(! compiler.reporter.hasErrors)
122
124
}
123
125
0 commit comments