diff options
Diffstat (limited to 'test/files/jvm/xmlLiterals.scala')
-rw-r--r-- | test/files/jvm/xmlLiterals.scala | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/test/files/jvm/xmlLiterals.scala b/test/files/jvm/xmlLiterals.scala index 73d6627b1c..e47fa11126 100644 --- a/test/files/jvm/xmlLiterals.scala +++ b/test/files/jvm/xmlLiterals.scala @@ -48,11 +48,13 @@ object Test { val x3 = xx3.toString(); /* ws in element content */ + //Console.println("tmp1:"+x3); + //Console.println("tmp2:"+Elem(null,"mars",e,null).toString() ); assertEquals( noWS( x3 ), - Elem("","hello",e, - Elem("","world",e), - Elem("","test",e), - Elem("","mars",e)).toString() ); + Elem(null,"hello",e,null, + Elem(null,"world",e,null), + Elem(null,"test",e,null), + Elem(null,"mars",e,null)).toString() ); Console.println("ws trimming in patterns"); @@ -72,14 +74,14 @@ object Test { </html>.toString(); assertEquals( noWS( z ), noWS( - Elem("","html",e, - Elem("","body",e, - Elem("","h1",e,Text("Hello World")), - Elem("","p",e,Text("Check the "), - Elem("","a", e,Text("scala")) - % (Attribute("","href","scala.epfl.ch")), + Elem(null,"html",e,null, + Elem(null,"body",e,null, + Elem(null,"h1",e,null,Text("Hello World")), + Elem(null,"p",e,null,Text("Check the "), + Elem(null,"a", e,null,Text("scala")) + % (new UnprefixedAttribute("href","scala.epfl.ch",Null)), Text("page!")) - ) % Attribute("", "background","#FFFFFF") + ) % new UnprefixedAttribute("background","#FFFFFF",Null) ).toString() )); @@ -100,16 +102,16 @@ object Test { /* === embedded Scala blocks === */ def computeDate() = { - Elem("","date", e, Text("now!")); + Elem(null,"date", e, null, Text("now!")); } /* embedding Scala strings as text and elements */ val sc = <hello>{ "World" }{ Text("42") }{ computeDate() }</hello>; assertEquals( sc.child.elements.toList, - List( Text("World"), Text("42"), Elem("", "date", e,Text("now!") ) ) ); + List( Text("World"), Text("42"), Elem(null, "date", e,null, Text("now!") ) ) ); assertEquals( sc.toString(), - Elem("","hello",e,Text("World42"),Elem("","date",e,Text("now!"))).toString() ); + Elem(null,"hello",e,null,Text("World42"),Elem(null,"date",e,null, Text("now!"))).toString() ); def foo( m:Node ):String = m match { case <hello/> => "hello node" @@ -132,11 +134,11 @@ object Test { </tr>; assertEquals( noWS( rows.toList.toString() ), - noWS( List(Elem("","tr",e, - Elem("","td",e,Text("1.1")),Elem("","td",e,Text("1.2")) + noWS( List(Elem(null,"tr",e,null, + Elem(null,"td",e,null,Text("1.1")),Elem(null,"td",e,null, Text("1.2")) ), - Elem("","tr",e, - Elem("","td",e,Text("2.1")),Elem("","td",e,Text("2.2")) + Elem(null,"tr",e,null, + Elem(null,"td",e,null,Text("2.1")),Elem(null,"td",e,null,Text("2.2")) ) ).toString() ) ); @@ -144,9 +146,9 @@ object Test { val rows3 = <tr> a <!-- an XML comment --> b <?pinotext?> c <?pi text?> d </tr>; // these are not equal as comments are valid XML Info items. - assertEquals( rows2, Elem("","tr",e,Comment(" an XML comment "),ProcInstr("pinotext",""),ProcInstr("pi","text"))); + assertEquals( rows2, Elem(null,"tr",e,null,Comment(" an XML comment "),ProcInstr("pinotext",""),ProcInstr("pi","text"))); - assertEquals( rows3, Elem("","tr",e,Text("a"),Comment(" an XML comment "),Text("b"),ProcInstr("pinotext",""),Text("c"),ProcInstr("pi","text"),Text("d"))); + assertEquals( rows3, Elem(null,"tr",e,null,Text("a"),Comment(" an XML comment "),Text("b"),ProcInstr("pinotext",""),Text("c"),ProcInstr("pi","text"),Text("d"))); } @@ -198,8 +200,8 @@ object Test03Servlet { case <table>{ xs @ _* }</table> => <table align="center">{ beautify( xs )}</table> - case Elem("", label, _, xs @ _* ) => - new Elem("", label, beautify( xs ):_*) + case Elem(null, label, _, _, xs @ _* ) => + new Elem(null, label, e, null, beautify( xs ):_*) case _ => n } @@ -228,8 +230,7 @@ object Test03Servlet { */ def doGetXML() = { beautify( page( List( format( getMessage( "message" ) )) )); - /* page( List( format( theMessage ))); */ - + //page( List( format( theMessage ))); } def main( args:Array[String] ) = { @@ -253,14 +254,14 @@ object Test03Servlet { Console.println( onlyOne ); val tryBrace = <try>Now escaped {{ braces } </try>; - assertEquals( tryBrace, Elem("","try",e,Text("Now escaped { braces }"))); + assertEquals( tryBrace, Elem(null,"try",e,null,Text("Now escaped { braces }"))); val tryBrace2 = <try myAttrib={(3+4).toString() }> cool ?</try>; assertEquals( tryBrace2.attribute("myAttrib"), "7" ); /* Scala comments are not allowed in XML literals. see neg(2) */ val zzz = <hello>/* no comment */</hello>; - assertEquals( zzz, Elem("","hello", e, Text("/* no comment */"))); + assertEquals( zzz, Elem(null,"hello", e,null, Text("/* no comment */"))); } @@ -280,10 +281,6 @@ object Test03Servlet { </bar:foo>; Console.println( foo ); - val h = new scala.collection.mutable.HashMap[String,String](); - h("www.bar.com") = "bar"; - h("www.baz.com") = ""; - Console.println( Utility.toXML(foo, h) ); } |