diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/io/NullPrintStream.scala | 19 | ||||
-rw-r--r-- | test/files/run/xml-loop-bug.check | bin | 280 -> 0 bytes | |||
-rw-r--r-- | test/files/run/xml-loop-bug.scala | 1 |
3 files changed, 20 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/io/NullPrintStream.scala b/src/compiler/scala/tools/nsc/io/NullPrintStream.scala new file mode 100644 index 0000000000..9340796a83 --- /dev/null +++ b/src/compiler/scala/tools/nsc/io/NullPrintStream.scala @@ -0,0 +1,19 @@ +/* NSC -- new Scala compiler + * Copyright 2005-2010 LAMP/EPFL + * @author Paul Phillips + */ + +package scala.tools.nsc +package io + +import java.io.{ PrintStream, ByteArrayOutputStream } + +/** A sink for when you want to discard all output. + */ +class NullPrintStream extends PrintStream(new ByteArrayOutputStream()) { } + +object NullPrintStream extends NullPrintStream { + def setOut() = Console setOut this + def setErr() = Console setErr this + def setOutAndErr() = { setOut() ; setErr() } +} diff --git a/test/files/run/xml-loop-bug.check b/test/files/run/xml-loop-bug.check Binary files differdeleted file mode 100644 index a31b93d0cf..0000000000 --- a/test/files/run/xml-loop-bug.check +++ /dev/null diff --git a/test/files/run/xml-loop-bug.scala b/test/files/run/xml-loop-bug.scala index acb3c5c6da..3894779f7c 100644 --- a/test/files/run/xml-loop-bug.scala +++ b/test/files/run/xml-loop-bug.scala @@ -1,5 +1,6 @@ object Test { def main(args: Array[String]): Unit = { + scala.tools.nsc.io.NullPrintStream.setOutAndErr() scala.xml.parsing.ConstructingParser.fromSource(scala.io.Source.fromString("<!DOCTYPE xmeml SYSTEM> <xmeml> <sequence> </sequence> </xmeml> "), true).document.docElem } } |