Skip to content

Commit a7992a7

Browse files
committed
Use same test style with existing term-show test
1 parent 3136fac commit a7992a7

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

tests/run-macros/term-show.check

-9
This file was deleted.

tests/run-macros/term-show/Macro_1.scala

+2-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ object TypeToolbox {
66
import quotes.reflect.*
77
Expr(v.show)
88

9-
/*
10-
inline def show(inline className: String): String = ${ showImpl('className) }
11-
private def showImpl(className: Expr[String])(using Quotes) : Expr[String] =
9+
inline def showTree(inline className: String): String = ${ showTreeImpl('className) }
10+
private def showTreeImpl(className: Expr[String])(using Quotes) : Expr[String] =
1211
import quotes.reflect.*
1312
val name = className.valueOrAbort
1413
val res = Symbol.requiredClass(name).tree.show
1514
Expr(res)
16-
*/
1715
}

tests/run-macros/term-show/Test_2.scala

+11-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ object Test {
3838
| ()
3939
|}""".stripMargin)
4040

41-
println(show("A"))
41+
assert(showTree("A")
42+
==
43+
"""@scala.annotation.internal.SourceFile("tests/run-macros/term-show/Test_2.scala") trait A() extends java.lang.Object {
44+
| def imp(x: scala.Int)(implicit str: scala.Predef.String): scala.Int
45+
| def use(`x₂`: scala.Int)(using `str₂`: scala.Predef.String): scala.Int
46+
| def era(`x₃`: scala.Int)(erased `str₃`: scala.Predef.String): scala.Int
47+
| def f1(x1: scala.Int, erased x2: scala.Int): scala.Int
48+
| def f2(erased `x1₂`: scala.Int, erased `x2₂`: scala.Int): scala.Int
49+
| def f3(using `x1₃`: scala.Int, erased `x2₃`: scala.Int): scala.Int
50+
| def f4(using erased `x1₄`: scala.Int, erased `x2₄`: scala.Int): scala.Int
51+
|}""".stripMargin)
4252
}
4353
}

0 commit comments

Comments
 (0)