summaryrefslogtreecommitdiff
path: root/test/files/jvm
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
parentf3129f0da6487fd6a33fc40ee1d19a1c6c5de06b (diff)
downloadscala-d4e3c78e738e37a0ba5fa5eb8b5196a8556d2c53.tar.gz
scala-d4e3c78e738e37a0ba5fa5eb8b5196a8556d2c53.tar.bz2
scala-d4e3c78e738e37a0ba5fa5eb8b5196a8556d2c53.zip
namespaces
Diffstat (limited to 'test/files/jvm')
-rw-r--r--test/files/jvm/xmlLiterals.scala6
-rw-r--r--test/files/jvm/xmlstuff.check9
-rw-r--r--test/files/jvm/xmlstuff.scala52
3 files changed, 62 insertions, 5 deletions
diff --git a/test/files/jvm/xmlLiterals.scala b/test/files/jvm/xmlLiterals.scala
index d908a49349..65abd50094 100644
--- a/test/files/jvm/xmlLiterals.scala
+++ b/test/files/jvm/xmlLiterals.scala
@@ -11,7 +11,7 @@ import scala.collection.immutable ;
object Test {
- val e = immutable.TreeMap.Empty[String,String];
+ val e = Node.NoAttributes;
/* a helper function to compare up to whitespace */
@@ -77,9 +77,9 @@ object Test {
Elem("","h1",e,Text("Hello World")),
Elem("","p",e,Text("Check the "),
Elem("","a", e,Text("scala"))
- % Pair("href","scala.epfl.ch"),
+ % (Attribute("","href","scala.epfl.ch")),
Text("page!"))
- ) % Pair("background","#FFFFFF")
+ ) % Attribute("", "background","#FFFFFF")
).toString()
));
diff --git a/test/files/jvm/xmlstuff.check b/test/files/jvm/xmlstuff.check
index b348451a28..397a8970d6 100644
--- a/test/files/jvm/xmlstuff.check
+++ b/test/files/jvm/xmlstuff.check
@@ -38,3 +38,12 @@ List(<book><title>Blabla</title></book>)
<phone where="work">+41 21 693 68 67</phone>
<phone where="mobile">+41 79 602 23 23</phone>
</result>
+patterns
+passed ok
+passed ok
+passed ok
+namespaces
+passed ok
+passed ok
+passed ok
+passed ok
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; });
}