@@ -766,53 +766,58 @@ class XMLTestJVM {
766
766
assertEquals(x, XML .loadString(formatted))
767
767
}
768
768
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
+
769
774
@ UnitTest (expected = classOf [FatalError ])
770
775
def xTokenFailure {
771
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" a" ), false )
776
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" a" ), false )
772
777
assertEquals(Seq .empty[Char ], x.xToken('b' ))
773
778
}
774
779
775
780
@ UnitTest (expected = classOf [FatalError ])
776
781
def xCharDataFailure {
777
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" " ), false )
782
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" " ), false )
778
783
779
784
x.xCharData
780
785
}
781
786
782
787
@ UnitTest (expected = classOf [FatalError ])
783
788
def xCommentFailure {
784
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" " ), false )
789
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" " ), false )
785
790
786
791
x.xComment
787
792
}
788
793
789
794
def xmlProcInstrFailure {
790
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" aa" ), false )
795
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" aa" ), false )
791
796
792
797
assertEquals(scala.xml.Null , x.xmlProcInstr)
793
798
}
794
799
795
800
@ UnitTest (expected = classOf [FatalError ])
796
801
def notationDeclFailure {
797
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" " ), false )
802
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" " ), false )
798
803
799
804
x.notationDecl
800
805
}
801
806
802
807
def pubidLiteralFailure {
803
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" " ), false )
808
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" " ), false )
804
809
805
810
assertEquals(" " , x.pubidLiteral)
806
811
}
807
812
808
813
def xAttributeValueFailure {
809
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" '" ), false )
814
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" '" ), false )
810
815
811
816
assertEquals(" " , x.xAttributeValue)
812
817
}
813
818
814
819
def xEntityValueFailure {
815
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" " ), false )
820
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" " ), false )
816
821
817
822
assertEquals(" " , x.xEntityValue)
818
823
}
0 commit comments