diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-07-17 09:27:29 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-08-27 10:26:21 -0700 |
commit | 9c50dd52743b7ff4de19548669dfa7e7a0304034 (patch) | |
tree | 8b0044529b3106ea84bca046dc5710fada708cce /test/files/jvm/unittest_xml.scala | |
parent | 7817efe2468480317965fc5baece52be392f0f7a (diff) | |
download | scala-9c50dd52743b7ff4de19548669dfa7e7a0304034.tar.gz scala-9c50dd52743b7ff4de19548669dfa7e7a0304034.tar.bz2 scala-9c50dd52743b7ff4de19548669dfa7e7a0304034.zip |
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.
Diffstat (limited to 'test/files/jvm/unittest_xml.scala')
-rw-r--r-- | test/files/jvm/unittest_xml.scala | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/test/files/jvm/unittest_xml.scala b/test/files/jvm/unittest_xml.scala deleted file mode 100644 index 106334e625..0000000000 --- a/test/files/jvm/unittest_xml.scala +++ /dev/null @@ -1,101 +0,0 @@ -import scala.xml.{ MetaData, Null, Utility, PrefixedAttribute, UnprefixedAttribute } - -object Test { - - def main(args:Array[String]) = { - MetaDataTest.run() - UtilityTest.run() - } - - object MetaDataTest { - - import scala.xml.{ TopScope, NamespaceBinding, Node, Atom, Text } - - def domatch(x:Node): Node = { - x match { - case Node("foo", md @ UnprefixedAttribute(_, value, _), _*) if !value.isEmpty => - md("bar")(0) - case _ => new Atom(3) - } - } - - def run() { - - var x: MetaData = Null - var s: NamespaceBinding = TopScope - - // testing method def apply(uri:String, scp:NamespaceBinding, k:String): Seq[Node] - // def apply(k:String): Seq[Node] - - assert(null == x("za://foo.com", s, "bar" ), "absent element (prefixed) 1") - assert(null == x("bar"), "absent element (unprefix) 1") - - assert(None == x.get("za://foo.com", s, "bar" ), "absent element (prefixed) 2") - assert(None == x.get("bar"), "absent element (unprefix) 2") - - x = new PrefixedAttribute("zo","bar", new Atom(42), x) - s = new NamespaceBinding("zo","za://foo.com",s) - - assert(new Atom(42) == x("za://foo.com", s, "bar" ), "present element (prefixed) 3") - assert(null == x("bar"), "present element (unprefix) 3") - - assert(Some(new Atom(42)) == x.get("za://foo.com", s, "bar" ), "present element (prefixed) 4") - assert(None == x.get("bar"), "present element (unprefix) 4") - - x = new UnprefixedAttribute("bar","meaning", x) - - assert(null == x(null, s, "bar"), "present element (prefixed) 5") - assert(Text("meaning") == x("bar"), "present element (unprefix) 5") - - assert(None == x.get(null, s, "bar" ), "present element (prefixed) 6") - assert(Some(Text("meaning")) == x.get("bar"), "present element (unprefix) 6") - - val z = <foo bar="gar"/> - val z2 = <foo/> - - assert(Text("gar") == domatch(z), "attribute extractor 1") - assert(new Atom(3) == domatch(z2), "attribute extractor 2") - - } - } - - object UtilityTest { - def run() { - assert(Utility.isNameStart('b')) - assert(!Utility.isNameStart(':')) - - val x = <foo> - <toomuchws/> - </foo> - - val y = xml.Utility.trim(x) - - assert(1 == (y match { case <foo><toomuchws/></foo> => 1 }), "trim 1") - - val x2 = <foo> - <toomuchws> a b b a </toomuchws> - </foo> - - val y2 = xml.Utility.trim(x2) - - assert(2 == (y2 match { case <foo><toomuchws>a b b a</toomuchws></foo> => 2 }), "trim 2") - - val z = <bar>''</bar> - val z1 = z.toString - - assert("<bar>''</bar>" == z1, "apos unescaped") - - val q = xml.Utility.sort(<a g='3' j='2' oo='2' a='2'/>) - assert(" a=\"2\" g=\"3\" j=\"2\" oo=\"2\"" == xml.Utility.sort(q.attributes).toString) - - val pp = new xml.PrettyPrinter(80,5) - assert("<a a=\"2\" g=\"3\" j=\"2\" oo=\"2\"/>" == pp.format(q)) - - <hi> - <there/> - <guys/> - </hi>.hashCode // Bug #777 - } - } - -} |