@@ -766,57 +766,62 @@ 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
770
775
def xTokenTest {
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((): Unit , 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
@ UnitTest
790
795
def xmlProcInstrTest {
791
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" aa" ), false )
796
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" aa" ), false )
792
797
793
798
assertEquals(new UnprefixedAttribute (" aa" , Text (" " ), Null ), x.xmlProcInstr)
794
799
}
795
800
796
801
@ UnitTest (expected = classOf [FatalError ])
797
802
def notationDeclFailure {
798
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" " ), false )
803
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" " ), false )
799
804
800
805
x.notationDecl
801
806
}
802
807
803
808
@ UnitTest
804
809
def pubidLiteralTest {
805
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" " ), false )
810
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" " ), false )
806
811
807
812
assertEquals(" " , x.pubidLiteral)
808
813
}
809
814
810
815
@ UnitTest
811
816
def xAttributeValueTest {
812
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" '" ), false )
817
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" '" ), false )
813
818
814
819
assertEquals(" " , x.xAttributeValue)
815
820
}
816
821
817
822
@ UnitTest
818
823
def xEntityValueTest {
819
- val x = xml.parsing.ConstructingParser .fromSource(io. Source .fromString (" " ), false )
824
+ val x = xml.parsing.ConstructingParser .fromSource(toSource (" " ), false )
820
825
821
826
assertEquals(" " , x.xEntityValue)
822
827
}
0 commit comments