@@ -633,7 +633,7 @@ class XMLTestJVM {
633
633
import scala .xml .parsing ._
634
634
@ UnitTest
635
635
def dontLoop : Unit = {
636
- val xml = " <!DOCTYPE xmeml SYSTEM> <xmeml> <sequence> </sequence> </xmeml> "
636
+ val xml = " <!DOCTYPE xmeml SYSTEM 'uri' > <xmeml> <sequence> </sequence> </xmeml> "
637
637
val sink = new PrintStream (new ByteArrayOutputStream ())
638
638
(Console withOut sink) {
639
639
(Console withErr sink) {
@@ -749,4 +749,48 @@ class XMLTestJVM {
749
749
assertEquals(" <node>\n <leaf/>\n </node>" , pp.format(x))
750
750
}
751
751
752
+ @ UnitTest (expected = classOf [FatalError ])
753
+ def shouldThrowFatalErrorWhenCantFindRequestedXToken {
754
+ val x = xml.parsing.ConstructingParser .fromSource(io.Source .fromString(" <a/>" ), false )
755
+
756
+ x.xToken('b' )
757
+ }
758
+
759
+ @ UnitTest (expected = classOf [FatalError ])
760
+ def shouldThrowFatalErrorWhenCantFindRequestedXCharData {
761
+ val x = xml.parsing.ConstructingParser .fromSource(io.Source .fromString(" <a/>" ), false )
762
+
763
+ x.xCharData
764
+ }
765
+
766
+ @ UnitTest (expected = classOf [FatalError ])
767
+ def shouldThrowFatalErrorWhenCantFindRequestedXComment {
768
+ val x = xml.parsing.ConstructingParser .fromSource(io.Source .fromString(" <a/>" ), false )
769
+
770
+ x.xComment
771
+ }
772
+
773
+ @ UnitTest (expected = classOf [FatalError ])
774
+ def shouldThrowFatalErrorWhenCantFindRequestedXmlProcInstr {
775
+ val x = xml.parsing.ConstructingParser .fromSource(io.Source .fromString(" <a/>" ), false )
776
+
777
+ x.xmlProcInstr()
778
+ }
779
+
780
+ @ Ignore (" Ignored for future fix, currently throw OOE because of infinity MarkupParserCommon:66" )
781
+ @ UnitTest (expected = classOf [FatalError ])
782
+ def shouldThrowFatalErrorWhenCantFindRequestedXAttributeValue {
783
+ val x = xml.parsing.ConstructingParser .fromSource(io.Source .fromString(" <a/>" ), false )
784
+
785
+ x.xAttributeValue()
786
+ }
787
+
788
+ @ Ignore (" Ignored for future fix, currently return unexpected result" )
789
+ @ UnitTest (expected = classOf [FatalError ])
790
+ def shouldThrowFatalErrorWhenCantFindRequestedXEntityValue {
791
+ val x = xml.parsing.ConstructingParser .fromSource(io.Source .fromString(" <a/>" ), false )
792
+
793
+ assertEquals(" a/>" , x.xEntityValue())
794
+ }
795
+
752
796
}
0 commit comments