From 9bc17e7779f878f17b97130359940b0d0b30f243 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Fri, 1 Mar 2013 19:22:56 +0100 Subject: SI-6725 `f` interpolator now supports %n tokens Currently the `f` interpolator supports format specifiers which specify conversions for formatted arguments. However Java formatting is not limited to argument-related conversions as explained in: http://docs.oracle.com/javase/6/docs/api/java/util/Formatter.html#detail. Conversions which don't correspond to any arguments are `%` (used to emit verbatim `'%'` characters) and `n` (used to emit platform-specific line separators). Of those only the former is supported, and this patch fixes the oversight. --- test/files/run/t6725-1.check | 2 ++ test/files/run/t6725-1.scala | 5 +++++ test/files/run/t6725-2.check | 8 ++++++++ test/files/run/t6725-2.scala | 6 ++++++ 4 files changed, 21 insertions(+) create mode 100644 test/files/run/t6725-1.check create mode 100644 test/files/run/t6725-1.scala create mode 100644 test/files/run/t6725-2.check create mode 100644 test/files/run/t6725-2.scala (limited to 'test') diff --git a/test/files/run/t6725-1.check b/test/files/run/t6725-1.check new file mode 100644 index 0000000000..6ed281c757 --- /dev/null +++ b/test/files/run/t6725-1.check @@ -0,0 +1,2 @@ +1 +1 diff --git a/test/files/run/t6725-1.scala b/test/files/run/t6725-1.scala new file mode 100644 index 0000000000..a167ef8aa3 --- /dev/null +++ b/test/files/run/t6725-1.scala @@ -0,0 +1,5 @@ +object Test extends App { + val a = 1 + val s = f"$a%s%n$a%s" + println(s) +} \ No newline at end of file diff --git a/test/files/run/t6725-2.check b/test/files/run/t6725-2.check new file mode 100644 index 0000000000..3496917ad5 --- /dev/null +++ b/test/files/run/t6725-2.check @@ -0,0 +1,8 @@ + + +aaaa + + +aaaa +aaaa +aaaa diff --git a/test/files/run/t6725-2.scala b/test/files/run/t6725-2.scala new file mode 100644 index 0000000000..e033cf5ea8 --- /dev/null +++ b/test/files/run/t6725-2.scala @@ -0,0 +1,6 @@ +object Test extends App { + println(f"%n") + println(f"aaaa%n") + println(f"%naaaa") + println(f"aaaa%naaaa") +} \ No newline at end of file -- cgit v1.2.3