Skip to content

Commit 5305c28

Browse files
committed
Silence test output ConstructingParser
1 parent 54a439c commit 5305c28

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

jvm/src/test/scala/scala/xml/XMLTest.scala

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -766,53 +766,58 @@ class XMLTestJVM {
766766
assertEquals(x, XML.loadString(formatted))
767767
}
768768

769+
def toSource(s: String) = new scala.io.Source {
770+
val iter = s.iterator
771+
override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err): Unit = {}
772+
}
773+
769774
@UnitTest(expected = classOf[FatalError])
770775
def xTokenFailure {
771-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("a"), false)
776+
val x = xml.parsing.ConstructingParser.fromSource(toSource("a"), false)
772777
assertEquals(Seq.empty[Char], x.xToken('b'))
773778
}
774779

775780
@UnitTest(expected = classOf[FatalError])
776781
def xCharDataFailure {
777-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
782+
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)
778783

779784
x.xCharData
780785
}
781786

782787
@UnitTest(expected = classOf[FatalError])
783788
def xCommentFailure {
784-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
789+
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)
785790

786791
x.xComment
787792
}
788793

789794
def xmlProcInstrFailure {
790-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("aa"), false)
795+
val x = xml.parsing.ConstructingParser.fromSource(toSource("aa"), false)
791796

792797
assertEquals(scala.xml.Null, x.xmlProcInstr)
793798
}
794799

795800
@UnitTest(expected = classOf[FatalError])
796801
def notationDeclFailure {
797-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
802+
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)
798803

799804
x.notationDecl
800805
}
801806

802807
def pubidLiteralFailure {
803-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
808+
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)
804809

805810
assertEquals("", x.pubidLiteral)
806811
}
807812

808813
def xAttributeValueFailure {
809-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("'"), false)
814+
val x = xml.parsing.ConstructingParser.fromSource(toSource("'"), false)
810815

811816
assertEquals("", x.xAttributeValue)
812817
}
813818

814819
def xEntityValueFailure {
815-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
820+
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)
816821

817822
assertEquals("", x.xEntityValue)
818823
}

0 commit comments

Comments
 (0)