Skip to content

Commit 21ad4a1

Browse files
committed
Silence test output ConstructingParser
1 parent cc4a06b commit 21ad4a1

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
@@ -639,53 +639,58 @@ class XMLTestJVM {
639639
assertEquals("<node>\n <leaf/>\n</node>", pp.format(x))
640640
}
641641

642+
def toSource(s: String) = new scala.io.Source {
643+
val iter = s.iterator
644+
override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err): Unit = {}
645+
}
646+
642647
def xTokenFailure {
643-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("a"), false)
648+
val x = xml.parsing.ConstructingParser.fromSource(toSource("a"), false)
644649

645650
assertEquals(Seq.empty[Char], x.xToken('b'))
646651
}
647652

648653
@UnitTest(expected = classOf[FatalError])
649654
def xCharDataFailure {
650-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
655+
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)
651656

652657
x.xCharData
653658
}
654659

655660
@UnitTest(expected = classOf[FatalError])
656661
def xCommentFailure {
657-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
662+
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)
658663

659664
x.xComment
660665
}
661666

662667
def xmlProcInstrFailure {
663-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("aa"), false)
668+
val x = xml.parsing.ConstructingParser.fromSource(toSource("aa"), false)
664669

665670
assertEquals(scala.xml.Null, x.xmlProcInstr)
666671
}
667672

668673
@UnitTest(expected = classOf[FatalError])
669674
def notationDeclFailure {
670-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
675+
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)
671676

672677
x.notationDecl
673678
}
674679

675680
def pubidLiteralFailure {
676-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
681+
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)
677682

678683
assertEquals("", x.pubidLiteral)
679684
}
680685

681686
def xAttributeValueFailure {
682-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("'"), false)
687+
val x = xml.parsing.ConstructingParser.fromSource(toSource("'"), false)
683688

684689
assertEquals("", x.xAttributeValue)
685690
}
686691

687692
def xEntityValueFailure {
688-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
693+
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)
689694

690695
assertEquals("", x.xEntityValue)
691696
}

0 commit comments

Comments
 (0)