Skip to content

Commit 107d8ff

Browse files
committed
Add printer tests
1 parent f7bf2b4 commit 107d8ff

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package dotty.tools.dotc.printing
2+
3+
import dotty.tools.DottyTest
4+
import dotty.tools.dotc.ast.tpd
5+
import dotty.tools.dotc.core.Names._
6+
import dotty.tools.dotc.core.Symbols._
7+
import org.junit.Assert.assertEquals
8+
import org.junit.Test
9+
10+
class PrinterTests extends DottyTest {
11+
import tpd._
12+
13+
@Test
14+
def packageObject: Unit = {
15+
val source = """
16+
package object foo {
17+
def bar: Int = 1
18+
}
19+
"""
20+
21+
checkCompile("frontend", source) { (tree, context) =>
22+
implicit val ctx = context
23+
val bar = tree.find(tree => tree.symbol.name == termName("bar")).get
24+
assertEquals("package object foo", bar.symbol.owner.show)
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)