From d08060ee326345970cd1dbfbb73d227105e35d67 Mon Sep 17 00:00:00 2001 From: Julien Richard-Foy Date: Fri, 10 Aug 2012 00:34:39 +0200 Subject: Fix raw string interpolator: string parts which were after the first argument were still escaped --- test/files/run/rawstrings.check | 2 +- test/files/run/rawstrings.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/files/run/rawstrings.check b/test/files/run/rawstrings.check index 36e63594df..2b6c40725a 100644 --- a/test/files/run/rawstrings.check +++ b/test/files/run/rawstrings.check @@ -1 +1 @@ -[\n\t'"$] +[\n\t'"$\n] diff --git a/test/files/run/rawstrings.scala b/test/files/run/rawstrings.scala index 9df64f6625..b4d6e0c40a 100644 --- a/test/files/run/rawstrings.scala +++ b/test/files/run/rawstrings.scala @@ -1,3 +1,3 @@ object Test extends App { - println(raw"[\n\t'${'"'}$$]") + println(raw"[\n\t'${'"'}$$\n]") } -- cgit v1.2.3 From 88b4b91b0a9191c98dc3f80c1a2cbea1a5ff4e12 Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Wed, 24 Oct 2012 10:59:50 -0400 Subject: Fixes SI-6559 - StringContext not using passed in escape function. As reported by Curtis Stanford, with indication of what to fix. standardInterpolator was not correctly calling the passed in process function, so raw strings were not really raw. --- test/files/run/t6559.scala | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test/files/run/t6559.scala (limited to 'test') diff --git a/test/files/run/t6559.scala b/test/files/run/t6559.scala new file mode 100644 index 0000000000..5c671f7275 --- /dev/null +++ b/test/files/run/t6559.scala @@ -0,0 +1,17 @@ + +object Test { + + def main(args: Array[String]) = { + val one = "1" + val two = "2" + + val raw = raw"\n$one\n$two\n" + val escaped = s"\n$one\n$two\n" + val buggy = "\\n1\n2\n" + val correct = "\\n1\\n2\\n" + + assert(raw != escaped, "Raw strings should not be escaped.") + assert(raw != buggy, "Raw strings after variables should not be escaped.") + assert(raw == correct, "Raw strings should stay raw.") + } +} -- cgit v1.2.3