diff options
Diffstat (limited to 'test/junit')
-rw-r--r-- | test/junit/scala/reflect/internal/PrintersTest.scala | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/junit/scala/reflect/internal/PrintersTest.scala b/test/junit/scala/reflect/internal/PrintersTest.scala index 534cd5b95f..0e93e30dcc 100644 --- a/test/junit/scala/reflect/internal/PrintersTest.scala +++ b/test/junit/scala/reflect/internal/PrintersTest.scala @@ -28,7 +28,7 @@ object PrinterHelper { private def normalizeEOL(resultCode: String) = resultCode.lines mkString s"$LF" - def assertResultCode(code: String)(parsedCode: String = "", typedCode: String = "", wrap: Boolean = false) = { + def assertResultCode(code: String)(parsedCode: String = "", typedCode: String = "", wrap: Boolean = false, printRoot: Boolean = false) = { def toolboxTree(tree: => Tree) = try{ tree } catch { @@ -55,7 +55,7 @@ object PrinterHelper { assertEquals("using toolbox parser" + LF, wrapCode(parsedCode), normalizeEOL(showCode(parsedTree))) if (!typedCode.isEmpty()) { val typedTree = toolboxTree(toolbox.typecheck(parsedTree)) - assertEquals("using toolbox typechecker" + LF, wrapCode(typedCode), normalizeEOL(showCode(typedTree))) + assertEquals("using toolbox typechecker" + LF, wrapCode(typedCode), normalizeEOL(showCode(typedTree, printRootPkg = printRoot))) } } @@ -328,6 +328,11 @@ trait BasePrintTests { code = "List(1, 2, 3) map (_ - 1)")( parsedCode = "List(1, 2, 3).map(((x$1) => x$1.-(1))) ", typedCode = "scala.collection.immutable.List.apply(1, 2, 3).map(((x$1) => x$1.-(1)))(scala.collection.immutable.List.canBuildFrom)") + + @Test def testFunc4 = assertResultCode( + code = "val x: String => Int = ((str: String) => 1)")( + parsedCode = "val x: _root_.scala.Function1[String, Int] = ((str: String) => 1)", + typedCode = " val x: _root_.scala.Function1[_root_.scala.Predef.String, _root_.scala.Int] = ((str: _root_.scala.Predef.String) => 1)", printRoot = true) @Test def testImport1 = assertPrintedCode("import scala.collection.mutable") |