From d4e3c78e738e37a0ba5fa5eb8b5196a8556d2c53 Mon Sep 17 00:00:00 2001 From: buraq Date: Fri, 25 Jun 2004 17:29:50 +0000 Subject: namespaces --- test/files/jvm/xmlLiterals.scala | 6 ++--- test/files/jvm/xmlstuff.check | 9 +++++++ test/files/jvm/xmlstuff.scala | 52 ++++++++++++++++++++++++++++++++++++++-- 3 files changed, 62 insertions(+), 5 deletions(-) (limited to 'test/files/jvm') 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(Blabla) +41 21 693 68 67 +41 79 602 23 23 +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 = )); + /* patterns */ + Console.println("patterns"); + assertEquals( match { case => true; case _ => false; }, + true); + + assertEquals( + + + match { case + + => true; + case _ => false; }, + true); + + assertEquals( + + crazy text world + match { case + crazy text world + => true; + case _ => false; }, + true); + + /* namespaces */ + Console.println("namespaces"); + val cuckoo = + + + ; + assertEquals( cuckoo.namespace, "http://cuckoo.com"); + for( val n <- cuckoo.child ) { + assertEquals( n.namespace, "http://cuckoo.com"); + } + + /* + assertEquals( true, cuckoo match { + case + + + => true; + case _ => false; }); +*/ + assertEquals( false, cuckoo match { + case + + + => true; + case _ => false; }); } -- cgit v1.2.3