@@ -639,53 +639,58 @@ class XMLTestJVM {
639
639
assertEquals(" <node>\n <leaf/>\n </node>" , pp.format(x))
640
640
}
641
641
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
+
642
647
def xTokenFailure {
643
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" a" ), false )
648
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" a" ), false )
644
649
645
650
assertEquals(Seq .empty[Char ], x.xToken('b' ))
646
651
}
647
652
648
653
@ UnitTest (expected = classOf [FatalError ])
649
654
def xCharDataFailure {
650
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" " ), false )
655
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" " ), false )
651
656
652
657
x.xCharData
653
658
}
654
659
655
660
@ UnitTest (expected = classOf [FatalError ])
656
661
def xCommentFailure {
657
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" " ), false )
662
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" " ), false )
658
663
659
664
x.xComment
660
665
}
661
666
662
667
def xmlProcInstrFailure {
663
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" aa" ), false )
668
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" aa" ), false )
664
669
665
670
assertEquals(scala.xml.Null , x.xmlProcInstr)
666
671
}
667
672
668
673
@ UnitTest (expected = classOf [FatalError ])
669
674
def notationDeclFailure {
670
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" " ), false )
675
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" " ), false )
671
676
672
677
x.notationDecl
673
678
}
674
679
675
680
def pubidLiteralFailure {
676
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" " ), false )
681
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" " ), false )
677
682
678
683
assertEquals(" " , x.pubidLiteral)
679
684
}
680
685
681
686
def xAttributeValueFailure {
682
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" '" ), false )
687
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" '" ), false )
683
688
684
689
assertEquals(" " , x.xAttributeValue)
685
690
}
686
691
687
692
def xEntityValueFailure {
688
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" " ), false )
693
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" " ), false )
689
694
690
695
assertEquals(" " , x.xEntityValue)
691
696
}
0 commit comments