Skip to content

Commit 4b6dcf5

Browse files
committed
Refactor Artem Stasiuk's OOE parser tests
Shorten test names and minimize string literals.
1 parent 9cee0d6 commit 4b6dcf5

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

jvm/src/test/scala/scala/xml/XMLTest.scala

+16-17
Original file line numberDiff line numberDiff line change
@@ -639,48 +639,47 @@ class XMLTestJVM {
639639
assertEquals("<node>\n <leaf/>\n</node>", pp.format(x))
640640
}
641641

642-
@UnitTest(expected = classOf[FatalError])
643-
def shouldThrowFatalErrorWhenCantFindRequestedXToken {
644-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<a/>"), false)
642+
def xTokenFailure {
643+
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("a"), false)
645644

646-
x.xToken('b')
645+
assertEquals(Seq.empty[Char], x.xToken('b'))
647646
}
648647

649648
@UnitTest(expected = classOf[FatalError])
650-
def shouldThrowFatalErrorWhenCantFindRequestedXCharData {
651-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<a/>"), false)
649+
def xCharDataFailure {
650+
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
652651

653652
x.xCharData
654653
}
655654

656655
@UnitTest(expected = classOf[FatalError])
657-
def shouldThrowFatalErrorWhenCantFindRequestedXComment {
658-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<a/>"), false)
656+
def xCommentFailure {
657+
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
659658

660659
x.xComment
661660
}
662661

663662
@UnitTest(expected = classOf[FatalError])
664-
def shouldThrowFatalErrorWhenCantFindRequestedXmlProcInstr {
665-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<a/>"), false)
663+
def xmlProcInstrFailure {
664+
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("aa"), false)
666665

667-
x.xmlProcInstr()
666+
x.xmlProcInstr
668667
}
669668

670669
@Ignore("Ignored for future fix, currently throw OOE because of infinity MarkupParserCommon:66")
671670
@UnitTest(expected = classOf[FatalError])
672-
def shouldThrowFatalErrorWhenCantFindRequestedXAttributeValue {
673-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<a/>"), false)
671+
def xAttributeValueFailure {
672+
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
674673

675-
x.xAttributeValue()
674+
x.xAttributeValue
676675
}
677676

678677
@Ignore("Ignored for future fix, currently return unexpected result")
679678
@UnitTest(expected = classOf[FatalError])
680-
def shouldThrowFatalErrorWhenCantFindRequestedXEntityValue {
681-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<a/>"), false)
679+
def xEntityValueFailure {
680+
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
682681

683-
assertEquals("a/>", x.xEntityValue())
682+
x.xEntityValue
684683
}
685684

686685
}

0 commit comments

Comments
 (0)