@@ -749,53 +749,58 @@ class XMLTestJVM {
749
749
assertEquals(" <node>\n <leaf/>\n </node>" , pp.format(x))
750
750
}
751
751
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
+
752
757
def xTokenFailure {
753
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" a" ), false )
758
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" a" ), false )
754
759
755
760
assertEquals(Seq .empty[Char ], x.xToken('b' ))
756
761
}
757
762
758
763
@ UnitTest (expected = classOf [FatalError ])
759
764
def xCharDataFailure {
760
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" " ), false )
765
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" " ), false )
761
766
762
767
x.xCharData
763
768
}
764
769
765
770
@ UnitTest (expected = classOf [FatalError ])
766
771
def xCommentFailure {
767
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" " ), false )
772
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" " ), false )
768
773
769
774
x.xComment
770
775
}
771
776
772
777
def xmlProcInstrFailure {
773
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" aa" ), false )
778
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" aa" ), false )
774
779
775
780
assertEquals(scala.xml.Null , x.xmlProcInstr)
776
781
}
777
782
778
783
@ UnitTest (expected = classOf [FatalError ])
779
784
def notationDeclFailure {
780
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" " ), false )
785
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" " ), false )
781
786
782
787
x.notationDecl
783
788
}
784
789
785
790
def pubidLiteralFailure {
786
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" " ), false )
791
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" " ), false )
787
792
788
793
assertEquals(" " , x.pubidLiteral)
789
794
}
790
795
791
796
def xAttributeValueFailure {
792
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" '" ), false )
797
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" '" ), false )
793
798
794
799
assertEquals(" " , x.xAttributeValue)
795
800
}
796
801
797
802
def xEntityValueFailure {
798
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" " ), false )
803
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" " ), false )
799
804
800
805
assertEquals(" " , x.xEntityValue)
801
806
}
0 commit comments