summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
Diffstat (limited to 'test/files')
-rw-r--r--test/files/run/t4339.check3
-rw-r--r--test/files/run/t4339.scala35
2 files changed, 38 insertions, 0 deletions
diff --git a/test/files/run/t4339.check b/test/files/run/t4339.check
new file mode 100644
index 0000000000..46eabbe42b
--- /dev/null
+++ b/test/files/run/t4339.check
@@ -0,0 +1,3 @@
+Saw failure: scala.xml.parsing.FatalError: expected closing tag of foo
+EvElemStart(null,foo, bar="baz/>",)
+Saw failure: scala.xml.parsing.FatalError: expected closing tag of foo
diff --git a/test/files/run/t4339.scala b/test/files/run/t4339.scala
new file mode 100644
index 0000000000..bb8b847ec3
--- /dev/null
+++ b/test/files/run/t4339.scala
@@ -0,0 +1,35 @@
+
+import scala.util.{ Try, Success, Failure }
+import xml._
+import scala.io.Source.fromString
+import java.io.PrintStream
+
+object Test extends App {
+
+ def quietSource(text: String) = new io.Source {
+ override protected val iter = io.Source fromString text
+ override def report(pos: Int, msg: String, out: PrintStream) = ()
+ }
+ def reading(text: String)(f: pull.XMLEventReader => Unit): Unit = {
+ val r = new pull.XMLEventReader(quietSource(text))
+ try f(r)
+ finally r.stop()
+ }
+ def trying(body: => Unit): Unit =
+ Try (body) match {
+ case Success(_) => Console println "Expected failure"
+ case Failure(e) => Console println s"Saw failure: $e"
+ }
+
+ val problematic = """<foo bar="baz/>"""
+
+ trying (
+ parsing.ConstructingParser.fromSource(quietSource(problematic), false).document.docElem
+ )
+
+ trying (
+ reading(problematic) { r =>
+ while (r.hasNext) println(r.next())
+ }
+ )
+}