diff options
Diffstat (limited to 'test/files/run/interpolationMultiline2.scala')
-rw-r--r-- | test/files/run/interpolationMultiline2.scala | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/test/files/run/interpolationMultiline2.scala b/test/files/run/interpolationMultiline2.scala index f6a682c3ce..2de4c4b22e 100644 --- a/test/files/run/interpolationMultiline2.scala +++ b/test/files/run/interpolationMultiline2.scala @@ -2,14 +2,15 @@ object Test extends App { def test1(n: Int) = { val old = "old" - try { println(s"""Bob is ${s"$n"} years ${s"$old"}!""") } catch { case ex => println(ex) } - try { println(s"""Bob is ${f"$n"} years ${s"$old"}!""") } catch { case ex => println(ex) } - try { println(f"""Bob is ${s"$n"} years ${s"$old"}!""") } catch { case ex => println(ex) } - try { println(f"""Bob is ${f"$n"} years ${s"$old"}!""") } catch { case ex => println(ex) } - try { println(f"""Bob is ${f"$n%2d"} years ${s"$old"}!""") } catch { case ex => println(ex) } - try { println(f"""Bob is ${s"$n%2d"} years ${s"$old"}!""") } catch { case ex => println(ex) } - try { println(s"""Bob is ${f"$n%2d"} years ${s"$old"}!""") } catch { case ex => println(ex) } - try { println(s"""Bob is ${s"$n%2d"} years ${s"$old"}!""") } catch { case ex => println(ex) } + val catcher: PartialFunction[Throwable, Unit] = { case e => println(e) } + try { println(s"""Bob is ${s"$n"} years ${s"$old"}!""") } catch catcher + try { println(s"""Bob is ${f"$n"} years ${s"$old"}!""") } catch catcher + try { println(f"""Bob is ${s"$n"} years ${s"$old"}!""") } catch catcher + try { println(f"""Bob is ${f"$n"} years ${s"$old"}!""") } catch catcher + try { println(f"""Bob is ${f"$n%2d"} years ${s"$old"}!""") } catch catcher + try { println(f"""Bob is ${s"$n%2d"} years ${s"$old"}!""") } catch catcher + try { println(s"""Bob is ${f"$n%2d"} years ${s"$old"}!""") } catch catcher + try { println(s"""Bob is ${s"$n%2d"} years ${s"$old"}!""") } catch catcher } test1(1) |