summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVladimirNik <vladimir.nikolaev9@gmail.com>2014-02-12 05:59:57 +0400
committerVladimirNik <vladimir.nikolaev9@gmail.com>2014-02-20 01:23:25 +0400
commit9505aff3aa44bb3a37c47c244ac6ab9de83fd2a4 (patch)
tree8bbd87a84cb5b422ac1080f1a8c8632428d8800e /test
parent931edcc94ebd73b420b2359d989442bf700588eb (diff)
downloadscala-9505aff3aa44bb3a37c47c244ac6ab9de83fd2a4.tar.gz
scala-9505aff3aa44bb3a37c47c244ac6ab9de83fd2a4.tar.bz2
scala-9505aff3aa44bb3a37c47c244ac6ab9de83fd2a4.zip
printers flag processing improvements: printRootPkg flag fixed, comments to flags metadata printing added
Diffstat (limited to 'test')
-rw-r--r--test/junit/scala/reflect/internal/PrintersTest.scala9
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")