summaryrefslogtreecommitdiff
path: root/test/junit
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@typesafe.com>2016-07-13 13:05:20 +0200
committerGitHub <noreply@github.com>2016-07-13 13:05:20 +0200
commit1bca3866b09dc0df71b1d141d22bc4fa9d97a71c (patch)
treeb597091143c3d015b6b545361a9c452b73eead1d /test/junit
parent247207d08c02f6091c024424d8ecc1d0e77f0a38 (diff)
parent0eac3cb85dd4720b015a0d060691f68b63032b85 (diff)
downloadscala-1bca3866b09dc0df71b1d141d22bc4fa9d97a71c.tar.gz
scala-1bca3866b09dc0df71b1d141d22bc4fa9d97a71c.tar.bz2
scala-1bca3866b09dc0df71b1d141d22bc4fa9d97a71c.zip
Merge pull request #5234 from som-snytt/review/printers
Avoid triple-quoting triple quotes in printer
Diffstat (limited to 'test/junit')
-rw-r--r--test/junit/scala/reflect/internal/PrintersTest.scala16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/junit/scala/reflect/internal/PrintersTest.scala b/test/junit/scala/reflect/internal/PrintersTest.scala
index 2305e7ea50..d581ca8cf4 100644
--- a/test/junit/scala/reflect/internal/PrintersTest.scala
+++ b/test/junit/scala/reflect/internal/PrintersTest.scala
@@ -79,6 +79,22 @@ class BasePrintTest {
@Test def testConstantLong = assertTreeCode(Literal(Constant(42l)))("42L")
+ val sq = "\""
+ val tq = "\"" * 3
+ val teq = "\"\"\\\""
+
+ @Test def testConstantMultiline = assertTreeCode(Literal(Constant("hello\nworld")))(s"${tq}hello\nworld${tq}")
+
+ @Test def testConstantFormfeed = assertTreeCode(Literal(Constant("hello\fworld")))(s"${sq}hello\\fworld${sq}")
+
+ @Test def testConstantControl = assertTreeCode(Literal(Constant("hello\u0003world")))(s"${sq}hello\\u0003world${sq}")
+
+ @Test def testConstantFormfeedChar = assertTreeCode(Literal(Constant('\f')))("'\\f'")
+
+ @Test def testConstantControlChar = assertTreeCode(Literal(Constant(3.toChar)))("'\\u0003'")
+
+ @Test def testConstantEmbeddedTriple = assertTreeCode(Literal(Constant(s"${tq}hello${tq}\nworld")))(s"${tq}${teq}hello${teq}\nworld${tq}")
+
@Test def testOpExpr = assertPrintedCode("(5).+(4)", checkTypedTree = false)
@Test def testName1 = assertPrintedCode("class test")