diff options
author | Som Snytt <som.snytt@gmail.com> | 2016-06-16 09:52:20 -0700 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2016-06-16 09:52:20 -0700 |
commit | 14d3b9e7062662ae55cca02ad653a68aa6aef78d (patch) | |
tree | c396cd90b9730138f132ee220a57bb138095d9ca /test/junit | |
parent | 8eaa53d57c8d3346e03ccde7b7d4c4c8103d9253 (diff) | |
download | scala-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')
-rw-r--r-- | test/junit/scala/reflect/internal/PrintersTest.scala | 12 |
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) |