Skip to content

Commit f6670e3

Browse files
committed
Silence test output ConstructingParser
1 parent d1d1280 commit f6670e3

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

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

+13-8
Original file line numberDiff line numberDiff line change
@@ -749,53 +749,58 @@ class XMLTestJVM {
749749
assertEquals("<node>\n <leaf/>\n</node>", pp.format(x))
750750
}
751751

752+
def toSource(s: String) = new scala.io.Source {
753+
val iter = s.iterator
754+
override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err): Unit = {}
755+
}
756+
752757
def xTokenFailure {
753-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("a"), false)
758+
val x = xml.parsing.ConstructingParser.fromSource(toSource("a"), false)
754759

755760
assertEquals(Seq.empty[Char], x.xToken('b'))
756761
}
757762

758763
@UnitTest(expected = classOf[FatalError])
759764
def xCharDataFailure {
760-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
765+
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)
761766

762767
x.xCharData
763768
}
764769

765770
@UnitTest(expected = classOf[FatalError])
766771
def xCommentFailure {
767-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
772+
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)
768773

769774
x.xComment
770775
}
771776

772777
def xmlProcInstrFailure {
773-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("aa"), false)
778+
val x = xml.parsing.ConstructingParser.fromSource(toSource("aa"), false)
774779

775780
assertEquals(scala.xml.Null, x.xmlProcInstr)
776781
}
777782

778783
@UnitTest(expected = classOf[FatalError])
779784
def notationDeclFailure {
780-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
785+
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)
781786

782787
x.notationDecl
783788
}
784789

785790
def pubidLiteralFailure {
786-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
791+
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)
787792

788793
assertEquals("", x.pubidLiteral)
789794
}
790795

791796
def xAttributeValueFailure {
792-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("'"), false)
797+
val x = xml.parsing.ConstructingParser.fromSource(toSource("'"), false)
793798

794799
assertEquals("", x.xAttributeValue)
795800
}
796801

797802
def xEntityValueFailure {
798-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
803+
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)
799804

800805
assertEquals("", x.xEntityValue)
801806
}

0 commit comments

Comments
 (0)