From 2416fb741615f4f2b729559b235876bf5c524194 Mon Sep 17 00:00:00 2001 From: buraq Date: Tue, 22 Jun 2004 21:22:15 +0000 Subject: namespace --- test/files/jvm/xmlLiterals.scala | 44 ++++++++-------- test/files/jvm/xmlstuff.scala | 110 +++++++++++++++++++-------------------- 2 files changed, 77 insertions(+), 77 deletions(-) (limited to 'test/files/jvm') diff --git a/test/files/jvm/xmlLiterals.scala b/test/files/jvm/xmlLiterals.scala index 6db3f3d823..d908a49349 100644 --- a/test/files/jvm/xmlLiterals.scala +++ b/test/files/jvm/xmlLiterals.scala @@ -49,10 +49,10 @@ object Test { val x3 = xx3.toString(); /* ws in element content */ assertEquals( noWS( x3 ), - Elem(0,"hello",e, - Elem(0,"world",e), - Elem(0,"test",e), - Elem(0,"mars",e)).toString() ); + Elem("","hello",e, + Elem("","world",e), + Elem("","test",e), + Elem("","mars",e)).toString() ); Console.println("ws trimming in patterns"); @@ -72,11 +72,11 @@ object Test { .toString(); assertEquals( noWS( z ), noWS( - Elem(0,"html",e, - Elem(0,"body",e, - Elem(0,"h1",e,Text("Hello World")), - Elem(0,"p",e,Text("Check the "), - Elem(0,"a", e,Text("scala")) + Elem("","html",e, + Elem("","body",e, + Elem("","h1",e,Text("Hello World")), + Elem("","p",e,Text("Check the "), + Elem("","a", e,Text("scala")) % Pair("href","scala.epfl.ch"), Text("page!")) ) % Pair("background","#FFFFFF") @@ -100,16 +100,16 @@ object Test { /* === embedded Scala blocks === */ def computeDate() = { - Elem(0,"date", e, Text("now!")); + Elem("","date", e, Text("now!")); } /* embedding Scala strings as text and elements */ val sc = { "World" }{ Text("42") }{ computeDate() }; assertEquals( sc.child.elements.toList, - List( Text("World"), Text("42"), Elem(0, "date", e,Text("now!") ) ) ); + List( Text("World"), Text("42"), Elem("", "date", e,Text("now!") ) ) ); assertEquals( sc.toString(), - Elem(0,"hello",e,Text("World42"),Elem(0,"date",e,Text("now!"))).toString() ); + Elem("","hello",e,Text("World42"),Elem("","date",e,Text("now!"))).toString() ); def foo( m:Node ):String = m match { case => "hello node" @@ -132,11 +132,11 @@ object Test { ; assertEquals( noWS( rows.toList.toString() ), - noWS( List(Elem(0,"tr",e, - Elem(0,"td",e,Text("1.1")),Elem(0,"td",e,Text("1.2")) + noWS( List(Elem("","tr",e, + Elem("","td",e,Text("1.1")),Elem("","td",e,Text("1.2")) ), - Elem(0,"tr",e, - Elem(0,"td",e,Text("2.1")),Elem(0,"td",e,Text("2.2")) + Elem("","tr",e, + Elem("","td",e,Text("2.1")),Elem("","td",e,Text("2.2")) ) ).toString() ) ); @@ -144,9 +144,9 @@ object Test { val rows3 = a b c d ; // these are not equal as comments are valid XML Info items. - assertEquals( rows2, Elem(0,"tr",e,Comment(" an XML comment "),ProcInstr("pinotext",None),ProcInstr("pi",Some("text")))); + assertEquals( rows2, Elem("","tr",e,Comment(" an XML comment "),ProcInstr("pinotext",None),ProcInstr("pi",Some("text")))); - assertEquals( rows3, Elem(0,"tr",e,Text("a"),Comment(" an XML comment "),Text("b"),ProcInstr("pinotext",None),Text("c"),ProcInstr("pi",Some("text")),Text("d"))); + assertEquals( rows3, Elem("","tr",e,Text("a"),Comment(" an XML comment "),Text("b"),ProcInstr("pinotext",None),Text("c"),ProcInstr("pi",Some("text")),Text("d"))); } @@ -192,8 +192,8 @@ object Test03Servlet { case { xs @ _* }
=> { beautify( xs )}
- case Elem(0, label, _, xs @ _* ) => - new Elem(0, label, beautify( xs ):_*) + case Elem("", label, _, xs @ _* ) => + new Elem("", label, beautify( xs ):_*) case _ => n } @@ -247,14 +247,14 @@ object Test03Servlet { Console.println( onlyOne ); val tryBrace = Now escaped {{ braces } ; - assertEquals( tryBrace, Elem(0,"try",e,Text("Now escaped { braces }"))); + assertEquals( tryBrace, Elem("","try",e,Text("Now escaped { braces }"))); val tryBrace2 = cool ?; assertEquals( tryBrace2.attribute("myAttrib"), "7" ); /* Scala comments are not allowed in XML literals. see neg(2) */ val zzz = /* no comment */; - assertEquals( zzz, Elem(0,"hello", e, Text("/* no comment */"))); + assertEquals( zzz, Elem("","hello", e, Text("/* no comment */"))); } diff --git a/test/files/jvm/xmlstuff.scala b/test/files/jvm/xmlstuff.scala index bf08aa348e..2617110372 100644 --- a/test/files/jvm/xmlstuff.scala +++ b/test/files/jvm/xmlstuff.scala @@ -28,8 +28,8 @@ object Test with Application { val c = new Node { def label = "hello"; - val namespaceCode = 0; - def child = List(Elem(0,"world",e)); + def namespace = ""; + def child = List(Elem("","world",e)); def attribute = e; }; @@ -46,10 +46,10 @@ object Test with Application { val i = new InputSource( new StringReader( x2 )); val x2p = XML.load( i ); - assertEquals(x2p, Elem(0,"book",e, - Elem(0,"author",e,Text("Peter Buneman")), - Elem(0,"author",e,Text("Dan Suciu")), - Elem(0,"title",e,Text("Data on ze web")))); + assertEquals(x2p, Elem("","book",e, + Elem("","author",e,Text("Peter Buneman")), + Elem("","author",e,Text("Dan Suciu")), + Elem("","title",e,Text("Data on ze web")))); val xmlFile2 = "Peter BunemanDan SuciuData on ze webJohn MitchellFoundations of Programming Languages"; val isrc2 = new InputSource( new StringReader( xmlFile2 ) ); @@ -59,9 +59,9 @@ object Test with Application { Console.println("xpath \\"); - assertSameElements( parsedxml1 \ "_" , List( Elem(0,"world",e) ) ); + assertSameElements( parsedxml1 \ "_" , List( Elem("","world",e) ) ); - assertSameElements( parsedxml1 \ "world", List( Elem(0,"world",e) ) ); + assertSameElements( parsedxml1 \ "world", List( Elem("","world",e) ) ); /* Console.println( parsedxml2 \ "_" ); @@ -74,13 +74,13 @@ object Test with Application { parsedxml2 \ "_" , List( - Elem(0,"book", e, - Elem(0,"author",e,Text("Peter Buneman")), - Elem(0,"author",e,Text("Dan Suciu")), - Elem(0,"title",e,Text("Data on ze web"))), - Elem(0,"book",e, - Elem(0,"author",e,Text("John Mitchell")), - Elem(0,"title",e,Text("Foundations of Programming Languages")))) + Elem("","book", e, + Elem("","author",e,Text("Peter Buneman")), + Elem("","author",e,Text("Dan Suciu")), + Elem("","title",e,Text("Data on ze web"))), + Elem("","book",e, + Elem("","author",e,Text("John Mitchell")), + Elem("","title",e,Text("Foundations of Programming Languages")))) ); assertEquals( (parsedxml2 \ "author").length, 0 ); @@ -88,13 +88,13 @@ object Test with Application { parsedxml2 \ "book", List( - Elem(0,"book",e, - Elem(0,"author",e,Text("Peter Buneman")), - Elem(0,"author",e,Text("Dan Suciu")), - Elem(0,"title",e,Text("Data on ze web"))), - Elem(0,"book",e, - Elem(0,"author",e,Text("John Mitchell")), - Elem(0,"title",e,Text("Foundations of Programming Languages"))) + Elem("","book",e, + Elem("","author",e,Text("Peter Buneman")), + Elem("","author",e,Text("Dan Suciu")), + Elem("","title",e,Text("Data on ze web"))), + Elem("","book",e, + Elem("","author",e,Text("John Mitchell")), + Elem("","title",e,Text("Foundations of Programming Languages"))) ) ); @@ -103,11 +103,11 @@ object Test with Application { parsedxml2 \ "_" \ "_", List( - Elem(0,"author",e,Text("Peter Buneman")), - Elem(0,"author",e,Text("Dan Suciu")), - Elem(0,"title",e,Text("Data on ze web")), - Elem(0,"author",e,Text("John Mitchell")), - Elem(0,"title",e,Text("Foundations of Programming Languages")) + Elem("","author",e,Text("Peter Buneman")), + Elem("","author",e,Text("Dan Suciu")), + Elem("","title",e,Text("Data on ze web")), + Elem("","author",e,Text("John Mitchell")), + Elem("","title",e,Text("Foundations of Programming Languages")) ) ); @@ -116,9 +116,9 @@ object Test with Application { parsedxml2 \ "_" \ "author", List( - Elem(0,"author",e,Text("Peter Buneman")), - Elem(0,"author",e,Text("Dan Suciu")), - Elem(0,"author",e,Text("John Mitchell")) + Elem("","author",e,Text("Peter Buneman")), + Elem("","author",e,Text("Dan Suciu")), + Elem("","author",e,Text("John Mitchell")) ) ); @@ -132,9 +132,9 @@ object Test with Application { parsedxml2 \\ "author", List( - Elem(0,"author",e,Text("Peter Buneman")), - Elem(0,"author",e,Text("Dan Suciu")), - Elem(0,"author",e,Text("John Mitchell")) + Elem("","author",e,Text("Peter Buneman")), + Elem("","author",e,Text("Dan Suciu")), + Elem("","author",e,Text("John Mitchell")) ) ); @@ -144,30 +144,30 @@ object Test with Application { new NodeSeq(List( parsedxml2 )) \\ "_", List( - Elem(0,"bib",e, - Elem(0,"book",e, - Elem(0,"author",e,Text("Peter Buneman")), - Elem(0,"author",e,Text("Dan Suciu")), - Elem(0,"title",e,Text("Data on ze web"))), - Elem(0,"book",e, - Elem(0,"author",e,Text("John Mitchell")), - Elem(0,"title",e,Text("Foundations of Programming Languages")))), - Elem(0,"book",e, - Elem(0,"author",e,Text("Peter Buneman")), - Elem(0,"author",e,Text("Dan Suciu")), - Elem(0,"title",e,Text("Data on ze web"))), - Elem(0,"author",e,Text("Peter Buneman")), + Elem("","bib",e, + Elem("","book",e, + Elem("","author",e,Text("Peter Buneman")), + Elem("","author",e,Text("Dan Suciu")), + Elem("","title",e,Text("Data on ze web"))), + Elem("","book",e, + Elem("","author",e,Text("John Mitchell")), + Elem("","title",e,Text("Foundations of Programming Languages")))), + Elem("","book",e, + Elem("","author",e,Text("Peter Buneman")), + Elem("","author",e,Text("Dan Suciu")), + Elem("","title",e,Text("Data on ze web"))), + Elem("","author",e,Text("Peter Buneman")), Text("Peter Buneman"), - Elem(0,"author",e,Text("Dan Suciu")), + Elem("","author",e,Text("Dan Suciu")), Text("Dan Suciu"), - Elem(0,"title",e,Text("Data on ze web")), + Elem("","title",e,Text("Data on ze web")), Text("Data on ze web"), - Elem(0,"book",e, - Elem(0,"author",e,Text("John Mitchell")), - Elem(0,"title",e,Text("Foundations of Programming Languages"))), - Elem(0,"author",e,Text("John Mitchell")), + Elem("","book",e, + Elem("","author",e,Text("John Mitchell")), + Elem("","title",e,Text("Foundations of Programming Languages"))), + Elem("","author",e,Text("John Mitchell")), Text("John Mitchell"), - Elem(0,"title",e,Text("Foundations of Programming Languages")), + Elem("","title",e,Text("Foundations of Programming Languages")), Text("Foundations of Programming Languages") ) ); @@ -178,8 +178,8 @@ object Test with Application { parsedxml2 \\ "title", List( - Elem(0,"title",e,Text("Data on ze web")), - Elem(0,"title",e,Text("Foundations of Programming Languages"))) + Elem("","title",e,Text("Data on ze web")), + Elem("","title",e,Text("Foundations of Programming Languages"))) ); -- cgit v1.2.3