summaryrefslogtreecommitdiff
path: root/test/files/jvm/xmlstuff.scala
diff options
context:
space:
mode:
authorburaq <buraq@epfl.ch>2004-06-25 17:29:50 +0000
committerburaq <buraq@epfl.ch>2004-06-25 17:29:50 +0000
commitd4e3c78e738e37a0ba5fa5eb8b5196a8556d2c53 (patch)
treeeda1c098f09aa6283333550d05a86d541a030f6a /test/files/jvm/xmlstuff.scala
parentf3129f0da6487fd6a33fc40ee1d19a1c6c5de06b (diff)
downloadscala-d4e3c78e738e37a0ba5fa5eb8b5196a8556d2c53.tar.gz
scala-d4e3c78e738e37a0ba5fa5eb8b5196a8556d2c53.tar.bz2
scala-d4e3c78e738e37a0ba5fa5eb8b5196a8556d2c53.zip
namespaces
Diffstat (limited to 'test/files/jvm/xmlstuff.scala')
-rw-r--r--test/files/jvm/xmlstuff.scala52
1 files changed, 50 insertions, 2 deletions
diff --git a/test/files/jvm/xmlstuff.scala b/test/files/jvm/xmlstuff.scala
index 2617110372..f05548aa96 100644
--- a/test/files/jvm/xmlstuff.scala
+++ b/test/files/jvm/xmlstuff.scala
@@ -6,7 +6,7 @@ import scala.xml.{Node,NodeSeq,Elem,Text};
object Test with Application {
- val e = scala.collection.immutable.TreeMap.Empty[String,String];
+ val e = Node.NoAttributes;
/*
def eq( a:Seq[Node], b:Seq[Node] ):boolean = {
@@ -30,7 +30,7 @@ object Test with Application {
def label = "hello";
def namespace = "";
def child = List(Elem("","world",e));
- def attribute = e;
+ def attributes = e;
};
assertSameElements( List( 3 ), List( 3 ));
@@ -274,5 +274,53 @@ val addrBook =
</result>
));
+ /* patterns */
+ Console.println("patterns");
+ assertEquals(<hello/> match { case <hello/> => true; case _ => false; },
+ true);
+
+ assertEquals(
+ <hello foo="bar">
+ <world/>
+ </hello> match { case <hello>
+ <world/>
+ </hello> => true;
+ case _ => false; },
+ true);
+
+ assertEquals(
+ <hello foo="bar">
+ crazy text world
+ </hello> match { case <hello>
+ crazy text world
+ </hello> => true;
+ case _ => false; },
+ true);
+
+ /* namespaces */
+ Console.println("namespaces");
+ val cuckoo = <cuckoo xmlns="http://cuckoo.com">
+ <foo/>
+ <bar/>
+ </cuckoo>;
+ assertEquals( cuckoo.namespace, "http://cuckoo.com");
+ for( val n <- cuckoo.child ) {
+ assertEquals( n.namespace, "http://cuckoo.com");
+ }
+
+ /*
+ assertEquals( true, cuckoo match {
+ case <cuckoo xmlns="http://cuckoo.com">
+ <foo/>
+ <bar/>
+ </cuckoo> => true;
+ case _ => false; });
+*/
+ assertEquals( false, cuckoo match {
+ case <cuckoo>
+ <foo/>
+ <bar/>
+ </cuckoo> => true;
+ case _ => false; });
}