diff options
author | Paul Phillips <paulp@improving.org> | 2011-05-19 20:06:19 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-05-19 20:06:19 +0000 |
commit | 4afa092314487c0095ff9fd5756d05340f6150b0 (patch) | |
tree | d3cf421e67192041f78858fe10735505f4891b3c /test/files/jvm/xml02.scala | |
parent | 7595671ec3929aa4ac978826521300a900250214 (diff) | |
download | scala-4afa092314487c0095ff9fd5756d05340f6150b0.tar.gz scala-4afa092314487c0095ff9fd5756d05340f6150b0.tar.bz2 scala-4afa092314487c0095ff9fd5756d05340f6150b0.zip |
Removes SUnit (long deprecated!) from the stand...
Removes SUnit (long deprecated!) from the standard library.
the relatively small number of partest tests in Scala's suite that
were still using SUnit now either just use regular asserts, or they
print stuff that partest checks with a .check file. Also fixed some bad
indentation, removed ancient useless-looking commented-out code, etc.
Contributed by Seth Tisue (way to go seth) no review.
Diffstat (limited to 'test/files/jvm/xml02.scala')
-rw-r--r-- | test/files/jvm/xml02.scala | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/test/files/jvm/xml02.scala b/test/files/jvm/xml02.scala index 11f77cc90f..fb790d5926 100644 --- a/test/files/jvm/xml02.scala +++ b/test/files/jvm/xml02.scala @@ -1,6 +1,11 @@ -import testing.SUnit._ +object Test { -object Test extends TestConsoleMain { + def main(args: Array[String]) { + XmlEx.run() + XmlEy.run() + XmlPat.run() + DodgyNamespace.run() + } import scala.xml.{NodeSeq, Utility} import NodeSeq.seqToNodeSeq @@ -15,38 +20,38 @@ object Test extends TestConsoleMain { val bx = <hello foo="bar&x"></hello> - object XmlEx extends TestCase("attributes") with Assert { + object XmlEx { - override def runTest = { - assertTrue("@one", (ax \ "@foo") xml_== "bar") // uses NodeSeq.view! - assertTrue("@two", (ax \ "@foo") xml_== xml.Text("bar")) // dto. - assertTrue("@three", (bx \ "@foo") xml_== "bar&x") // dto. - assertTrue ("@four", (bx \ "@foo") xml_sameElements List(xml.Text("bar&x"))) - assertEquals("@five", "<hello foo=\"bar&x\"></hello>", bx.toString) + def run() { + assert((ax \ "@foo") xml_== "bar") // uses NodeSeq.view! + assert((ax \ "@foo") xml_== xml.Text("bar")) // dto. + assert((bx \ "@foo") xml_== "bar&x") // dto. + assert((bx \ "@foo") xml_sameElements List(xml.Text("bar&x"))) + assert("<hello foo=\"bar&x\"></hello>" == bx.toString) } } - object XmlEy extends TestCase("attributes with namespace") with Assert { - override def runTest = { + object XmlEy { + def run() { val z = ax \ "@{the namespace from outer space}foo" - assertTrue("@six", (ax \ "@{the namespace from outer space}foo") xml_== "baz") - assertTrue("@eight", (cx \ "@{the namespace from outer space}foo") xml_== "baz") + assert((ax \ "@{the namespace from outer space}foo") xml_== "baz") + assert((cx \ "@{the namespace from outer space}foo") xml_== "baz") try { ax \ "@" - assertTrue("wrong1", false) + assert(false) } catch { case _: IllegalArgumentException => } try { ax \ "@{" - assertTrue("wrong2", false) + assert(false) } catch { case _: IllegalArgumentException => } try { ax \ "@{}" - assertTrue("wrong3", false) + assert(false) } catch { case _: IllegalArgumentException => } @@ -54,25 +59,20 @@ object Test extends TestConsoleMain { } } - object XmlPat extends TestCase("patterns") with Assert { - override def runTest = { - assertTrue(<hello/> match { case <hello/> => true; case _ => false; }) - assertTrue(<x:ga xmlns:x="z"/> match { case <x:ga/> => true; case _ => false; }); - assertTrue(Utility.trim(cx) match { case n @ <hello>crazy text world</hello> if (n \ "@foo") xml_== "bar" => true; }) - assertTrue(Utility.trim(cx) match { case n @ <z:hello>crazy text world</z:hello> if (n \ "@foo") xml_== "bar" => true; }) + object XmlPat { + def run() { + assert(<hello/> match { case <hello/> => true; case _ => false; }) + assert(<x:ga xmlns:x="z"/> match { case <x:ga/> => true; case _ => false; }); + assert(Utility.trim(cx) match { case n @ <hello>crazy text world</hello> if (n \ "@foo") xml_== "bar" => true; }) + assert(Utility.trim(cx) match { case n @ <z:hello>crazy text world</z:hello> if (n \ "@foo") xml_== "bar" => true; }) } } - object DodgyNamespace extends TestCase("DodgyNamespace") with Assert { - override def runTest = { + object DodgyNamespace { + def run() { val x = <flog xmlns:ee="http://ee.com"><foo xmlns:dog="http://dog.com"><dog:cat/></foo></flog> - assertTrue(x.toString.matches(".*xmlns:dog=\"http://dog.com\".*")); + assert(x.toString.matches(".*xmlns:dog=\"http://dog.com\".*")); } } - def suite = new TestSuite( - XmlEx, - XmlEy, - XmlPat, - DodgyNamespace - ) + } |