Skip to content

Commit 0c8158e

Browse files
committed
Refactor Artem Stasiuk's OOE parser tests
Shorten test names and minimize string literals.
1 parent 40d7eb8 commit 0c8158e

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

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

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -749,48 +749,47 @@ class XMLTestJVM {
749749
assertEquals("<node>\n <leaf/>\n</node>", pp.format(x))
750750
}
751751

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

756-
x.xToken('b')
755+
assertEquals(Seq.empty[Char], x.xToken('b'))
757756
}
758757

759758
@UnitTest(expected = classOf[FatalError])
760-
def shouldThrowFatalErrorWhenCantFindRequestedXCharData {
761-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<a/>"), false)
759+
def xCharDataFailure {
760+
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
762761

763762
x.xCharData
764763
}
765764

766765
@UnitTest(expected = classOf[FatalError])
767-
def shouldThrowFatalErrorWhenCantFindRequestedXComment {
768-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<a/>"), false)
766+
def xCommentFailure {
767+
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
769768

770769
x.xComment
771770
}
772771

773772
@UnitTest(expected = classOf[FatalError])
774-
def shouldThrowFatalErrorWhenCantFindRequestedXmlProcInstr {
775-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<a/>"), false)
773+
def xmlProcInstrFailure {
774+
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("aa"), false)
776775

777-
x.xmlProcInstr()
776+
x.xmlProcInstr
778777
}
779778

780779
@Ignore("Ignored for future fix, currently throw OOE because of infinity MarkupParserCommon:66")
781780
@UnitTest(expected = classOf[FatalError])
782-
def shouldThrowFatalErrorWhenCantFindRequestedXAttributeValue {
783-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<a/>"), false)
781+
def xAttributeValueFailure {
782+
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
784783

785-
x.xAttributeValue()
784+
x.xAttributeValue
786785
}
787786

788787
@Ignore("Ignored for future fix, currently return unexpected result")
789788
@UnitTest(expected = classOf[FatalError])
790-
def shouldThrowFatalErrorWhenCantFindRequestedXEntityValue {
791-
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<a/>"), false)
789+
def xEntityValueFailure {
790+
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
792791

793-
assertEquals("a/>", x.xEntityValue())
792+
x.xEntityValue
794793
}
795794

796795
}

0 commit comments

Comments
 (0)