Skip to content

Commit e696ee6

Browse files
committed
Silence test output ConstructingParser
1 parent 239e3ed commit e696ee6

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

Diff for: jvm/src/test/scala/scala/xml/XMLTest.scala

+13-8
Original file line numberDiff line numberDiff line change
@@ -766,57 +766,62 @@ 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
770775
def xTokenTest {
771-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("a"), false)
776+
val x = xml.parsing.ConstructingParser.fromSource(toSource("a"), false)
772777
assertEquals((): Unit, 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
@UnitTest
790795
def xmlProcInstrTest {
791-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("aa"), false)
796+
val x = xml.parsing.ConstructingParser.fromSource(toSource("aa"), false)
792797

793798
assertEquals(new UnprefixedAttribute("aa", Text(""), Null), x.xmlProcInstr)
794799
}
795800

796801
@UnitTest(expected = classOf[FatalError])
797802
def notationDeclFailure {
798-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
803+
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)
799804

800805
x.notationDecl
801806
}
802807

803808
@UnitTest
804809
def pubidLiteralTest {
805-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
810+
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)
806811

807812
assertEquals("", x.pubidLiteral)
808813
}
809814

810815
@UnitTest
811816
def xAttributeValueTest {
812-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("'"), false)
817+
val x = xml.parsing.ConstructingParser.fromSource(toSource("'"), false)
813818

814819
assertEquals("", x.xAttributeValue)
815820
}
816821

817822
@UnitTest
818823
def xEntityValueTest {
819-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
824+
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)
820825

821826
assertEquals("", x.xEntityValue)
822827
}

0 commit comments

Comments
 (0)