@@ -633,7 +633,7 @@ class XMLTestJVM {
633633 import scala .xml .parsing ._
634634 @ UnitTest
635635 def dontLoop : Unit = {
636- val xml = " <!DOCTYPE xmeml SYSTEM> <xmeml> <sequence> </sequence> </xmeml> "
636+ val xml = " <!DOCTYPE xmeml SYSTEM 'uri' > <xmeml> <sequence> </sequence> </xmeml> "
637637 val sink = new PrintStream (new ByteArrayOutputStream ())
638638 (Console withOut sink) {
639639 (Console withErr sink) {
@@ -765,4 +765,49 @@ class XMLTestJVM {
765765 val formatted = pp.format(x)
766766 assertEquals(x, XML .loadString(formatted))
767767 }
768+
769+ @ UnitTest (expected = classOf [FatalError ])
770+ def shouldThrowFatalErrorWhenCantFindRequestedXToken {
771+ val x = xml.parsing.ConstructingParser .fromSource(io.Source .fromString(" <a/>" ), false )
772+
773+ x.xToken('b' )
774+ }
775+
776+ @ UnitTest (expected = classOf [FatalError ])
777+ def shouldThrowFatalErrorWhenCantFindRequestedXCharData {
778+ val x = xml.parsing.ConstructingParser .fromSource(io.Source .fromString(" <a/>" ), false )
779+
780+ x.xCharData
781+ }
782+
783+ @ UnitTest (expected = classOf [FatalError ])
784+ def shouldThrowFatalErrorWhenCantFindRequestedXComment {
785+ val x = xml.parsing.ConstructingParser .fromSource(io.Source .fromString(" <a/>" ), false )
786+
787+ x.xComment
788+ }
789+
790+ @ UnitTest (expected = classOf [FatalError ])
791+ def shouldThrowFatalErrorWhenCantFindRequestedXmlProcInstr {
792+ val x = xml.parsing.ConstructingParser .fromSource(io.Source .fromString(" <a/>" ), false )
793+
794+ x.xmlProcInstr()
795+ }
796+
797+ @ Ignore (" Ignored for future fix, currently throw OOE because of infinity MarkupParserCommon:66" )
798+ @ UnitTest (expected = classOf [FatalError ])
799+ def shouldThrowFatalErrorWhenCantFindRequestedXAttributeValue {
800+ val x = xml.parsing.ConstructingParser .fromSource(io.Source .fromString(" <a/>" ), false )
801+
802+ x.xAttributeValue()
803+ }
804+
805+ @ Ignore (" Ignored for future fix, currently return unexpected result" )
806+ @ UnitTest (expected = classOf [FatalError ])
807+ def shouldThrowFatalErrorWhenCantFindRequestedXEntityValue {
808+ val x = xml.parsing.ConstructingParser .fromSource(io.Source .fromString(" <a/>" ), false )
809+
810+ assertEquals(" a/>" , x.xEntityValue())
811+ }
812+
768813}
0 commit comments