diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 93a1ac5e7..87d1b7f95 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -639,53 +639,58 @@ class XMLTestJVM { assertEquals("\n \n", pp.format(x)) } + def toSource(s: String) = new scala.io.Source { + val iter = s.iterator + override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err): Unit = {} + } + def xTokenFailure { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("a"), false) + val x = xml.parsing.ConstructingParser.fromSource(toSource("a"), false) assertEquals(Seq.empty[Char], x.xToken('b')) } @UnitTest(expected = classOf[FatalError]) def xCharDataFailure { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false) x.xCharData } @UnitTest(expected = classOf[FatalError]) def xCommentFailure { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false) x.xComment } def xmlProcInstrFailure { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("aa"), false) + val x = xml.parsing.ConstructingParser.fromSource(toSource("aa"), false) assertEquals(scala.xml.Null, x.xmlProcInstr) } @UnitTest(expected = classOf[FatalError]) def notationDeclFailure { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false) x.notationDecl } def pubidLiteralFailure { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false) assertEquals("", x.pubidLiteral) } def xAttributeValueFailure { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("'"), false) + val x = xml.parsing.ConstructingParser.fromSource(toSource("'"), false) assertEquals("", x.xAttributeValue) } def xEntityValueFailure { - val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false) + val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false) assertEquals("", x.xEntityValue) }