diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-05-12 18:30:53 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-05-12 18:30:53 +0200 |
commit | 89bacb9c25a58454ff1878e67f7ea07ffc8c269f (patch) | |
tree | 51f1ff6c66aebe1b6109b1cffcc2bb8e4cf760a3 /tests/pending/run/interpolation.scala | |
parent | a0fa33deafbea1bf53edc068c5ed9db5592822f9 (diff) | |
download | dotty-89bacb9c25a58454ff1878e67f7ea07ffc8c269f.tar.gz dotty-89bacb9c25a58454ff1878e67f7ea07ffc8c269f.tar.bz2 dotty-89bacb9c25a58454ff1878e67f7ea07ffc8c269f.zip |
Run tests as they were in scala.
Diffstat (limited to 'tests/pending/run/interpolation.scala')
-rw-r--r-- | tests/pending/run/interpolation.scala | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/pending/run/interpolation.scala b/tests/pending/run/interpolation.scala new file mode 100644 index 000000000..14d981934 --- /dev/null +++ b/tests/pending/run/interpolation.scala @@ -0,0 +1,32 @@ +object Test extends App { + + def test1(n: Int) = { + println(s"Bob is $n years old") + println(f"Bob is $n%2d years old") + println(s"Bob will be ${n+1} years old") + println(f"Bob will be ${n+1}%2d years old") + println(s"$n+1 = ${n+1}") + println(f"$n%d+1 = ${n+1}%d") + } + + def test2(f: Float) = { + println(s"Best price: $f") + println(f"Best price: $f%.2f") + println(s"$f% discount included") + println(f"$f%3.2f%% discount included") + } + + test1(1) + test1(12) + test1(123) + + test2(10.0f) + test2(13.345f) + + println(s"") + println(s"${0}") + println(s"${0}${0}") + println(f"") + println(f"${0}") + println(f"${0}${0}") +} |