-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1616 from retronym/backport/6559
SI-6559 Fix raw string interpolator: string parts which were after the first argument were still escaped
- Loading branch information
Showing
4 changed files
with
20 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[\n\t'"$] | ||
[\n\t'"$\n] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
object Test extends App { | ||
println(raw"[\n\t'${'"'}$$]") | ||
println(raw"[\n\t'${'"'}$$\n]") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.") | ||
} | ||
} |