From d3d697a9c5c51e4a78d8a0392cc37723bbe6e3e5 Mon Sep 17 00:00:00 2001 From: Burak Emir Date: Fri, 2 Mar 2007 19:25:20 +0000 Subject: fixed xml02 --- test/files/jvm/xml02.scala | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) (limited to 'test/files/jvm/xml02.scala') diff --git a/test/files/jvm/xml02.scala b/test/files/jvm/xml02.scala index ac400d7adf..bae815b1c1 100644 --- a/test/files/jvm/xml02.scala +++ b/test/files/jvm/xml02.scala @@ -2,21 +2,25 @@ import testing.SUnit._ object Test extends TestConsoleMain { - import scala.xml.NodeSeq + import scala.xml.{NodeSeq, Utility} import NodeSeq.view val ax = + val cx = + crazy text world + + val bx = 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") + override def runTest = { + assertTrue("@one", ax \ "@foo" == "bar") // uses NodeSeq.view! + assertTrue("@two", ax \ "@foo" == xml.Text("bar")) // dto. + assertTrue("@three", bx \ "@foo" == "bar&x") // dto. 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", "", bx.toString) @@ -24,28 +28,13 @@ object Test extends TestConsoleMain { } class XmlPat extends TestCase("patterns") with Assert { - override def run = { + override def runTest = { assertTrue( match { case => true; case _ => false; }) assertTrue( match { case => true; case _ => false; }); - - /* - assertEquals(ax match { case x @ - - if x \ "@foo" == "bar" => true; - case _ => false; }, - true); - - assertEquals( - - crazy text world - match { case - crazy text world - => true; - case _ => false; }, - true); - */ - } + assertTrue(Utility.trim(cx) match { case n @ crazy text world if n \ "@foo" == "bar" => true; }) + } } + def suite = new TestSuite( new XmlEx, new XmlPat -- cgit v1.2.3