diff options
author | Paul Phillips <paulp@improving.org> | 2011-07-01 06:58:03 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-07-01 06:58:03 +0000 |
commit | 300cb9e1ee6559ea08b58b04dd89de94e4449fce (patch) | |
tree | aafc568430fc96757c484754f5639607e6f51ee9 /test/files | |
parent | 9d02b4adea3512e671e97c11dec9dd7fd8514c49 (diff) | |
download | scala-300cb9e1ee6559ea08b58b04dd89de94e4449fce.tar.gz scala-300cb9e1ee6559ea08b58b04dd89de94e4449fce.tar.bz2 scala-300cb9e1ee6559ea08b58b04dd89de94e4449fce.zip |
Keep BufferedSource from losing buffered data w...
Keep BufferedSource from losing buffered data when a derivative iterator
is created via getLines. Closes #4671, #4662, no review.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/bug4671.check | 46 | ||||
-rw-r--r-- | test/files/run/bug4671.scala | 13 |
2 files changed, 59 insertions, 0 deletions
diff --git a/test/files/run/bug4671.check b/test/files/run/bug4671.check new file mode 100644 index 0000000000..dc92c9a72f --- /dev/null +++ b/test/files/run/bug4671.check @@ -0,0 +1,46 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> object o { val file = sys.props("partest.cwd") + "/bug4671.scala" } +defined module o + +scala> val s = scala.io.Source.fromFile(o.file) +s: scala.io.BufferedSource = non-empty iterator + +scala> println(s.getLines.mkString("\n")) +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + // My god...it's full of quines + def code = """ +object o { val file = sys.props("partest.cwd") + "/bug4671.scala" } +val s = scala.io.Source.fromFile(o.file) +println(s.getLines.mkString("\n")) + +val s = scala.io.Source.fromFile(o.file) +println(s.mkString("")) +""".trim +} + +scala> + +scala> val s = scala.io.Source.fromFile(o.file) +s: scala.io.BufferedSource = non-empty iterator + +scala> println(s.mkString("")) +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + // My god...it's full of quines + def code = """ +object o { val file = sys.props("partest.cwd") + "/bug4671.scala" } +val s = scala.io.Source.fromFile(o.file) +println(s.getLines.mkString("\n")) + +val s = scala.io.Source.fromFile(o.file) +println(s.mkString("")) +""".trim +} + + +scala> diff --git a/test/files/run/bug4671.scala b/test/files/run/bug4671.scala new file mode 100644 index 0000000000..0c1e5908bf --- /dev/null +++ b/test/files/run/bug4671.scala @@ -0,0 +1,13 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + // My god...it's full of quines + def code = """ +object o { val file = sys.props("partest.cwd") + "/bug4671.scala" } +val s = scala.io.Source.fromFile(o.file) +println(s.getLines.mkString("\n")) + +val s = scala.io.Source.fromFile(o.file) +println(s.mkString("")) +""".trim +} |