summaryrefslogtreecommitdiff
path: root/test/files/jvm/xml02.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-02-26 22:24:46 +0000
committerPaul Phillips <paulp@improving.org>2010-02-26 22:24:46 +0000
commit64fd0c1346dcd43cb814e4f99638321c159108fd (patch)
treea9cc92f5756442698813bc4d97bdf191b85b0680 /test/files/jvm/xml02.scala
parent462e27a358fc466d51aaeec28c994c6667d320eb (diff)
downloadscala-64fd0c1346dcd43cb814e4f99638321c159108fd.tar.gz
scala-64fd0c1346dcd43cb814e4f99638321c159108fd.tar.bz2
scala-64fd0c1346dcd43cb814e4f99638321c159108fd.zip
Quite a lot more work on XML equality than I ca...
Quite a lot more work on XML equality than I can properly justify spending time on, but you know how it is once you get started on something. This commit will likely break some code out there in the world but this is impossible to avoid if we are to achieve sane equality in trunk. For anyone who was relying upon the 2.7 equality behavior for scala.xml.* classes, using "xml_==" instead of "==" for comparisons will restore the old behavior. The standard == on xml elements now attempts to behave in such a way that symmetry and hashCode contracts will be preserved. It's probably not 100% there yet, but I can tell you this: it is closer today than it was yesterday. Review by community.
Diffstat (limited to 'test/files/jvm/xml02.scala')
-rw-r--r--test/files/jvm/xml02.scala16
1 files changed, 8 insertions, 8 deletions
diff --git a/test/files/jvm/xml02.scala b/test/files/jvm/xml02.scala
index 0cbeb27ce2..11f77cc90f 100644
--- a/test/files/jvm/xml02.scala
+++ b/test/files/jvm/xml02.scala
@@ -18,10 +18,10 @@ object Test extends TestConsoleMain {
object XmlEx extends TestCase("attributes") with Assert {
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("@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&amp;x\"></hello>", bx.toString)
}
}
@@ -29,8 +29,8 @@ object Test extends TestConsoleMain {
object XmlEy extends TestCase("attributes with namespace") with Assert {
override def runTest = {
val z = ax \ "@{the namespace from outer space}foo"
- assertTrue("@six", ax \ "@{the namespace from outer space}foo" == "baz")
- assertTrue("@eight", cx \ "@{the namespace from outer space}foo" == "baz")
+ assertTrue("@six", (ax \ "@{the namespace from outer space}foo") xml_== "baz")
+ assertTrue("@eight", (cx \ "@{the namespace from outer space}foo") xml_== "baz")
try {
ax \ "@"
@@ -58,8 +58,8 @@ object Test extends TestConsoleMain {
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" == "bar" => true; })
- assertTrue(Utility.trim(cx) match { case n @ <z:hello>crazy text world</z:hello> if n \ "@foo" == "bar" => true; })
+ 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; })
}
}