summaryrefslogtreecommitdiff
path: root/test/junit/scala/reflect/internal/PrintersTest.scala
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2016-06-16 09:52:20 -0700
committerSom Snytt <som.snytt@gmail.com>2016-06-16 09:52:20 -0700
commit14d3b9e7062662ae55cca02ad653a68aa6aef78d (patch)
treec396cd90b9730138f132ee220a57bb138095d9ca /test/junit/scala/reflect/internal/PrintersTest.scala
parent8eaa53d57c8d3346e03ccde7b7d4c4c8103d9253 (diff)
downloadscala-14d3b9e7062662ae55cca02ad653a68aa6aef78d.tar.gz
scala-14d3b9e7062662ae55cca02ad653a68aa6aef78d.tar.bz2
scala-14d3b9e7062662ae55cca02ad653a68aa6aef78d.zip
Refactor triple quote quoting
To quote a triple quote, only quote one quote. Refactors the code for legibility. Adds test for other inline cruft like control chars.
Diffstat (limited to 'test/junit/scala/reflect/internal/PrintersTest.scala')
-rw-r--r--test/junit/scala/reflect/internal/PrintersTest.scala12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/junit/scala/reflect/internal/PrintersTest.scala b/test/junit/scala/reflect/internal/PrintersTest.scala
index 916f21adc8..38fe205af7 100644
--- a/test/junit/scala/reflect/internal/PrintersTest.scala
+++ b/test/junit/scala/reflect/internal/PrintersTest.scala
@@ -79,13 +79,17 @@ class BasePrintTest {
@Test def testConstantLong = assertTreeCode(Literal(Constant(42l)))("42L")
- @Test def testConstantMultiline = assertTreeCode(Literal(Constant("hello\nworld")))("\"\"\"hello\nworld\"\"\"")
-
val sq = "\""
- val teq = "\\\"" * 3
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\\03world${sq}")
- @Test def testConstantEmbeddedTriple = assertTreeCode(Literal(Constant(s"${tq}hello${tq}\nworld")))(s"${sq}${teq}hello${teq}\\nworld${sq}")
+ @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)