From 9c50dd52743b7ff4de19548669dfa7e7a0304034 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 17 Jul 2013 09:27:29 -0700 Subject: Prepare removal of scala-xml, scala-parser-combinators Every test deleted here has found its way to the respective repositories of scala-xml and scala-parser-combinators, where they will continue to be tested with partest. The modified tests became independent of these modules, as they should've been from the start. --- test/files/jvm/xml03syntax.scala | 97 ---------------------------------------- 1 file changed, 97 deletions(-) delete mode 100644 test/files/jvm/xml03syntax.scala (limited to 'test/files/jvm/xml03syntax.scala') diff --git a/test/files/jvm/xml03syntax.scala b/test/files/jvm/xml03syntax.scala deleted file mode 100644 index 41663681c7..0000000000 --- a/test/files/jvm/xml03syntax.scala +++ /dev/null @@ -1,97 +0,0 @@ -import scala.xml._ - -object Test { - - private def handle[A](x: Node): A = { - println(x) - x.child(0).asInstanceOf[Atom[A]].data - } - - def main(args: Array[String]) { - test1() - test2() - test3() - } - - private def test1() { - val xNull = {null} // these used to be Atom(unit), changed to empty children - - println(xNull.child sameElements Nil) - - val x0 = {} // these used to be Atom(unit), changed to empty children - val x00 = { } // dto. - - val xa = { "world" } - - - println(x0.child sameElements Nil) - println(x00.child sameElements Nil) - println(handle[String](xa) == "world") - - val xb = { 1.5 } - - println(handle[Double](xb) == 1.5) - - val xc = { 5 } - - println(handle[Int](xc) == 5) - - val xd = { true } - - println(handle[Boolean](xd) == true) - - val xe = { 5:Short } - - println(handle[Short](xe) == (5:Short)) - - val xf = { val x = 27; x } - - println(handle[Int](xf) == 27) - - val xg = { List(1,2,3,4) } - - println(xg) - for (z <- xg.child) { - println(z.toString() + {if (z.isInstanceOf[Text]) "(is text node ' ')" else ""}) - } - - val xh = { for(x <- List(1,2,3,4) if x % 2 == 0) yield x } - - println(xh) - for (z <- xh.child) { - println(z.toString() + {if (z.isInstanceOf[Text]) "(is text node ' ')" else ""}) - } - println - } - - /** see SVN r13821 (emir): support for , - * so that Options can be used for optional attributes. - */ - private def test2() { - val x1: Option[Seq[Node]] = Some(hello) - val n1 = ; - println("node="+n1+", key="+n1.attribute("key")) - - val x2: Option[Seq[Node]] = None - val n2 = ; - println("node="+n2+", key="+n2.attribute("key")) - } - - private def test3() { - // this demonstrates how to handle entities - val s = io.Source.fromString(" ") - object parser extends xml.parsing.ConstructingParser(s, false /*ignore ws*/) { - override def replacementText(entityName: String): io.Source = { - entityName match { - case "nbsp" => io.Source.fromString("\u0160"); - case _ => super.replacementText(entityName); - } - } - nextch; // !!important, to initialize the parser - } - val parsed = parser.element(TopScope) // parse the source as element - // alternatively, we could call document() - println(parsed) - } - -} -- cgit v1.2.3