@@ -523,7 +523,7 @@ class XMLTestJVM {
523
523
import scala .xml .parsing ._
524
524
@ UnitTest
525
525
def dontLoop : Unit = {
526
- val xml = " <!DOCTYPE xmeml SYSTEM> <xmeml> <sequence> </sequence> </xmeml> "
526
+ val xml = " <!DOCTYPE xmeml SYSTEM 'uri' > <xmeml> <sequence> </sequence> </xmeml> "
527
527
val sink = new PrintStream (new ByteArrayOutputStream ())
528
528
(Console withOut sink) {
529
529
(Console withErr sink) {
@@ -639,4 +639,48 @@ class XMLTestJVM {
639
639
assertEquals(" <node>\n <leaf/>\n </node>" , pp.format(x))
640
640
}
641
641
642
+ @ UnitTest (expected = classOf [FatalError ])
643
+ def shouldThrowFatalErrorWhenCantFindRequestedXToken {
644
+ val x = xml.parsing.ConstructingParser .fromSource(io.Source .fromString(" <a/>" ), false )
645
+
646
+ x.xToken('b' )
647
+ }
648
+
649
+ @ UnitTest (expected = classOf [FatalError ])
650
+ def shouldThrowFatalErrorWhenCantFindRequestedXCharData {
651
+ val x = xml.parsing.ConstructingParser .fromSource(io.Source .fromString(" <a/>" ), false )
652
+
653
+ x.xCharData
654
+ }
655
+
656
+ @ UnitTest (expected = classOf [FatalError ])
657
+ def shouldThrowFatalErrorWhenCantFindRequestedXComment {
658
+ val x = xml.parsing.ConstructingParser .fromSource(io.Source .fromString(" <a/>" ), false )
659
+
660
+ x.xComment
661
+ }
662
+
663
+ @ UnitTest (expected = classOf [FatalError ])
664
+ def shouldThrowFatalErrorWhenCantFindRequestedXmlProcInstr {
665
+ val x = xml.parsing.ConstructingParser .fromSource(io.Source .fromString(" <a/>" ), false )
666
+
667
+ x.xmlProcInstr()
668
+ }
669
+
670
+ @ Ignore (" Ignored for future fix, currently throw OOE because of infinity MarkupParserCommon:66" )
671
+ @ UnitTest (expected = classOf [FatalError ])
672
+ def shouldThrowFatalErrorWhenCantFindRequestedXAttributeValue {
673
+ val x = xml.parsing.ConstructingParser .fromSource(io.Source .fromString(" <a/>" ), false )
674
+
675
+ x.xAttributeValue()
676
+ }
677
+
678
+ @ Ignore (" Ignored for future fix, currently return unexpected result" )
679
+ @ UnitTest (expected = classOf [FatalError ])
680
+ def shouldThrowFatalErrorWhenCantFindRequestedXEntityValue {
681
+ val x = xml.parsing.ConstructingParser .fromSource(io.Source .fromString(" <a/>" ), false )
682
+
683
+ assertEquals(" a/>" , x.xEntityValue())
684
+ }
685
+
642
686
}
0 commit comments