diff options
author | Burak Emir <emir@epfl.ch> | 2007-03-02 19:07:57 +0000 |
---|---|---|
committer | Burak Emir <emir@epfl.ch> | 2007-03-02 19:07:57 +0000 |
commit | 61b2debaa00361250fbee05cbb71f2c989ad2c03 (patch) | |
tree | 7e4ed39511700f88f7b68a695fcf18ef67366ecf /test/files/jvm/xml02.scala | |
parent | a1c87639762b2b9172c1a775fbd3cfaa66536ab0 (diff) | |
download | scala-61b2debaa00361250fbee05cbb71f2c989ad2c03.tar.gz scala-61b2debaa00361250fbee05cbb71f2c989ad2c03.tar.bz2 scala-61b2debaa00361250fbee05cbb71f2c989ad2c03.zip |
* small lib addition to testing.SUnit, made Uni...
* small lib addition to testing.SUnit, made UnitTest @deprecated added
* xml pattern matching on prefixes (in SymbolicXMLBuilder) xml name
* parsing ensures that names do not end in a colon (namespaces) rewrote
* xml02 to use SUnit
Diffstat (limited to 'test/files/jvm/xml02.scala')
-rw-r--r-- | test/files/jvm/xml02.scala | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/test/files/jvm/xml02.scala b/test/files/jvm/xml02.scala index d0d97e64eb..ac400d7adf 100644 --- a/test/files/jvm/xml02.scala +++ b/test/files/jvm/xml02.scala @@ -1,39 +1,32 @@ -object Test { -def main(args:Array[String]) = { +import testing.SUnit._ + +object Test extends TestConsoleMain { + import scala.xml.NodeSeq import NodeSeq.view - import testing.UnitTest._ - val ax = <hello foo="bar"> <world/> </hello> - Console.println("attributes"); - - Console.println("one"); - assertEquals(ax \ "@foo", "bar") - Console.println("two"); - assertEquals(ax \ "@foo", xml.Text("bar")) - val bx = <hello foo="bar&x"></hello> - Console.println("three"); - assertEquals(bx \ "@foo", "bar&x") - Console.println("four"); - assertSameElements(bx \ "@foo", List(xml.Text("bar&x"))) - //assertSameElements(bx \ "@foo", List(xml.Text("bar"),xml.EntityRef("amp"),xml.Text("x"))) - - Console.println("five"); - assertEquals(bx.toString, "<hello foo=\"bar&x\"></hello>") - - - /* patterns */ - Console.println("patterns"); - assertEquals(<hello/> match { case <hello/> => true; case _ => false; }, - true); + class XmlEx extends TestCase("attributes") with Assert { + override def run = { + assertEquals("@one", "bar", ax \ "@foo") + assertEquals("@two", xml.Text("bar"), ax \ "@foo") + assertEquals("@three", "bar&x", bx \ "@foo") + assertTrue ("@four", (bx \ "@foo") sameElements List(xml.Text("bar&x"))) + //assertTrue("@four", (bx \ "@foo") sameElements List(xml.Text("bar"),xml.EntityRef("amp"),xml.Text("x"))) + assertEquals("@five", "<hello foo=\"bar&x\"></hello>", bx.toString) + } + } + class XmlPat extends TestCase("patterns") with Assert { + override def run = { + assertTrue(<hello/> match { case <hello/> => true; case _ => false; }) + assertTrue(<x:ga xmlns:x="z"/> match { case <x:ga/> => true; case _ => false; }); /* assertEquals(ax match { case x @ <hello> @@ -51,6 +44,10 @@ def main(args:Array[String]) = { case _ => false; }, true); */ -} - + } + } + def suite = new TestSuite( + new XmlEx, + new XmlPat + ) } |