Skip to content

Commit 6f76dd1

Browse files
committed
Refactor Artem Stasiuk's OOE parser tests
Shorten test names and minimize string literals.
1 parent 4940b6a commit 6f76dd1

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
@@ -767,47 +767,46 @@ class XMLTestJVM {
767767
}
768768

769769
@UnitTest(expected = classOf[FatalError])
770-
def shouldThrowFatalErrorWhenCantFindRequestedXToken {
771-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<a/>"), false)
772-
773-
x.xToken('b')
770+
def xTokenFailure {
771+
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("a"), false)
772+
assertEquals((): Unit, x.xToken('b'))
774773
}
775774

776775
@UnitTest(expected = classOf[FatalError])
777-
def shouldThrowFatalErrorWhenCantFindRequestedXCharData {
778-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<a/>"), false)
776+
def xCharDataFailure {
777+
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
779778

780779
x.xCharData
781780
}
782781

783782
@UnitTest(expected = classOf[FatalError])
784-
def shouldThrowFatalErrorWhenCantFindRequestedXComment {
785-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<a/>"), false)
783+
def xCommentFailure {
784+
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
786785

787786
x.xComment
788787
}
789788

790789
@UnitTest(expected = classOf[FatalError])
791-
def shouldThrowFatalErrorWhenCantFindRequestedXmlProcInstr {
792-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<a/>"), false)
790+
def xmlProcInstrFailure {
791+
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("aa"), false)
793792

794-
x.xmlProcInstr()
793+
assertEquals(new UnprefixedAttribute("aa", Text(""), Null), x.xmlProcInstr)
795794
}
796795

797796
@Ignore("Ignored for future fix, currently throw OOE because of infinity MarkupParserCommon:66")
798797
@UnitTest(expected = classOf[FatalError])
799-
def shouldThrowFatalErrorWhenCantFindRequestedXAttributeValue {
800-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<a/>"), false)
798+
def xAttributeValueFailure {
799+
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
801800

802-
x.xAttributeValue()
801+
x.xAttributeValue
803802
}
804803

805804
@Ignore("Ignored for future fix, currently return unexpected result")
806805
@UnitTest(expected = classOf[FatalError])
807-
def shouldThrowFatalErrorWhenCantFindRequestedXEntityValue {
808-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<a/>"), false)
806+
def xEntityValueFailure {
807+
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
809808

810-
assertEquals("a/>", x.xEntityValue())
809+
x.xEntityValue
811810
}
812811

813812
}

0 commit comments

Comments
 (0)