Skip to content

Commit

Permalink
Silence test output ConstructingParser
Browse files Browse the repository at this point in the history
  • Loading branch information
ashawley committed Jun 25, 2018
1 parent 54a439c commit 5305c28
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions jvm/src/test/scala/scala/xml/XMLTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -766,53 +766,58 @@ class XMLTestJVM {
assertEquals(x, XML.loadString(formatted))
}

def toSource(s: String) = new scala.io.Source {
val iter = s.iterator
override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err): Unit = {}
}

@UnitTest(expected = classOf[FatalError])
def xTokenFailure {
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("a"), false)
val x = xml.parsing.ConstructingParser.fromSource(toSource("a"), false)
assertEquals(Seq.empty[Char], x.xToken('b'))
}

@UnitTest(expected = classOf[FatalError])
def xCharDataFailure {
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)

x.xCharData
}

@UnitTest(expected = classOf[FatalError])
def xCommentFailure {
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)

x.xComment
}

def xmlProcInstrFailure {
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("aa"), false)
val x = xml.parsing.ConstructingParser.fromSource(toSource("aa"), false)

assertEquals(scala.xml.Null, x.xmlProcInstr)
}

@UnitTest(expected = classOf[FatalError])
def notationDeclFailure {
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)

x.notationDecl
}

def pubidLiteralFailure {
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)

assertEquals("", x.pubidLiteral)
}

def xAttributeValueFailure {
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("'"), false)
val x = xml.parsing.ConstructingParser.fromSource(toSource("'"), false)

assertEquals("", x.xAttributeValue)
}

def xEntityValueFailure {
val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString(""), false)
val x = xml.parsing.ConstructingParser.fromSource(toSource(""), false)

assertEquals("", x.xEntityValue)
}
Expand Down

0 comments on commit 5305c28

Please sign in to comment.