summaryrefslogtreecommitdiff
path: root/test/files/jvm
diff options
context:
space:
mode:
authorburaq <buraq@epfl.ch>2004-06-14 10:52:37 +0000
committerburaq <buraq@epfl.ch>2004-06-14 10:52:37 +0000
commita278f799614f22ddf3c2f035e0282120c2b8862d (patch)
treebe8f42538b7b7ec22a2e70b3a7e6ce595e317ef0 /test/files/jvm
parente56821baaf295980ff236373879a7c48ecc35d6f (diff)
downloadscala-a278f799614f22ddf3c2f035e0282120c2b8862d.tar.gz
scala-a278f799614f22ddf3c2f035e0282120c2b8862d.tar.bz2
scala-a278f799614f22ddf3c2f035e0282120c2b8862d.zip
namespaces
Diffstat (limited to 'test/files/jvm')
-rw-r--r--test/files/jvm/xmlLiterals.scala44
-rw-r--r--test/files/jvm/xmlstuff.scala109
2 files changed, 77 insertions, 76 deletions
diff --git a/test/files/jvm/xmlLiterals.scala b/test/files/jvm/xmlLiterals.scala
index c751a5c8a7..85cd3f47cf 100644
--- a/test/files/jvm/xmlLiterals.scala
+++ b/test/files/jvm/xmlLiterals.scala
@@ -48,10 +48,10 @@ object Test {
assertEquals( noWS( x3 ),
- Elem("hello",e,
- Elem("world",e),
- Elem("test",e),
- Elem("mars",e)).toString() );
+ Elem(0,"hello",e,
+ Elem(0,"world",e),
+ Elem(0,"test",e),
+ Elem(0,"mars",e)).toString() );
/* === attributes === */
@@ -64,11 +64,11 @@ 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"))
+ 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"))
% Pair("href","scala.epfl.ch"),
Text("page!"))
) % Pair("background","#FFFFFF")
@@ -92,16 +92,16 @@ object Test {
/* === embedded Scala blocks === */
def computeDate() = {
- Elem("date", e, Text("now!"));
+ Elem(0,"date", e, 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(0, "date", e,Text("now!") ) ) );
assertEquals( sc.toString(),
- Elem("hello",e,Text("World42"),Elem("date",e,Text("now!"))).toString() );
+ Elem(0,"hello",e,Text("World42"),Elem(0,"date",e,Text("now!"))).toString() );
def foo( m:Node ):String = m match {
case <hello/> => "hello node"
@@ -124,11 +124,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(0,"tr",e,
+ Elem(0,"td",e,Text("1.1")),Elem(0,"td",e,Text("1.2"))
),
- Elem("tr",e,
- Elem("td",e,Text("2.1")),Elem("td",e,Text("2.2"))
+ Elem(0,"tr",e,
+ Elem(0,"td",e,Text("2.1")),Elem(0,"td",e,Text("2.2"))
)
).toString() )
);
@@ -136,9 +136,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",None),ProcInstr("pi",Some("text"))));
+ assertEquals( rows2, Elem(0,"tr",e,Comment(" an XML comment "),ProcInstr("pinotext",None),ProcInstr("pi",Some("text"))));
- assertEquals( rows3, Elem("tr",e,Text("a"),Comment(" an XML comment "),Text("b"),ProcInstr("pinotext",None),Text("c"),ProcInstr("pi",Some("text")),Text("d")));
+ 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")));
}
@@ -184,8 +184,8 @@ object Test03Servlet {
case <table>{ xs @ _* }</table> =>
<table align="center">{ beautify( xs )}</table>
- case Elem( label, _, xs @ _* ) =>
- new Elem( label, beautify( xs ):_*)
+ case Elem(0, label, _, xs @ _* ) =>
+ new Elem(0, label, beautify( xs ):_*)
case _ => n
}
@@ -239,14 +239,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(0,"try",e,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(0,"hello", e, Text("/* no comment */")));
}
diff --git a/test/files/jvm/xmlstuff.scala b/test/files/jvm/xmlstuff.scala
index 95295838af..09bfcd084b 100644
--- a/test/files/jvm/xmlstuff.scala
+++ b/test/files/jvm/xmlstuff.scala
@@ -28,7 +28,8 @@ object Test with Application {
val c = new Node {
def label = "hello";
- def child = List(Elem("world",e));
+ val namespaceCode = 0;
+ def child = List(Elem(0,"world",e));
def attribute = e;
};
@@ -45,10 +46,10 @@ object Test with Application {
val i = new InputSource( new StringReader( x2 ));
val x2p = XML.load( i );
- 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"))));
+ 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"))));
val xmlFile2 = "<bib><book><author>Peter Buneman</author><author>Dan Suciu</author><title>Data on ze web</title></book><book><author>John Mitchell</author><title>Foundations of Programming Languages</title></book></bib>";
val isrc2 = new InputSource( new StringReader( xmlFile2 ) );
@@ -58,9 +59,9 @@ object Test with Application {
Console.println("xpath \\");
- assertSameElements( parsedxml1 \ "_" , List( Elem("world",e) ) );
+ assertSameElements( parsedxml1 \ "_" , List( Elem(0,"world",e) ) );
- assertSameElements( parsedxml1 \ "world", List( Elem("world",e) ) );
+ assertSameElements( parsedxml1 \ "world", List( Elem(0,"world",e) ) );
/*
Console.println( parsedxml2 \ "_" );
@@ -73,13 +74,13 @@ object Test with Application {
parsedxml2 \ "_" ,
List(
- 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(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"))))
);
assertEquals( (parsedxml2 \ "author").length, 0 );
@@ -87,13 +88,13 @@ object Test with Application {
parsedxml2 \ "book",
List(
- 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(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")))
)
);
@@ -102,11 +103,11 @@ object Test with Application {
parsedxml2 \ "_" \ "_",
List(
- 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"))
+ 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"))
)
);
@@ -115,9 +116,9 @@ object Test with Application {
parsedxml2 \ "_" \ "author",
List(
- Elem("author",e,Text("Peter Buneman")),
- Elem("author",e,Text("Dan Suciu")),
- Elem("author",e,Text("John Mitchell"))
+ Elem(0,"author",e,Text("Peter Buneman")),
+ Elem(0,"author",e,Text("Dan Suciu")),
+ Elem(0,"author",e,Text("John Mitchell"))
)
);
@@ -131,9 +132,9 @@ object Test with Application {
parsedxml2 \\ "author",
List(
- Elem("author",e,Text("Peter Buneman")),
- Elem("author",e,Text("Dan Suciu")),
- Elem("author",e,Text("John Mitchell"))
+ Elem(0,"author",e,Text("Peter Buneman")),
+ Elem(0,"author",e,Text("Dan Suciu")),
+ Elem(0,"author",e,Text("John Mitchell"))
)
);
@@ -143,30 +144,30 @@ object Test with Application {
new NodeSeq(List( parsedxml2 )) \\ "_",
List(
- 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")),
+ 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")),
Text("Peter Buneman"),
- Elem("author",e,Text("Dan Suciu")),
+ Elem(0,"author",e,Text("Dan Suciu")),
Text("Dan Suciu"),
- Elem("title",e,Text("Data on ze web")),
+ Elem(0,"title",e,Text("Data on ze web")),
Text("Data on ze web"),
- Elem("book",e,
- Elem("author",e,Text("John Mitchell")),
- Elem("title",e,Text("Foundations of Programming Languages"))),
- Elem("author",e,Text("John Mitchell")),
+ 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")),
Text("John Mitchell"),
- Elem("title",e,Text("Foundations of Programming Languages")),
+ Elem(0,"title",e,Text("Foundations of Programming Languages")),
Text("Foundations of Programming Languages")
)
);
@@ -177,8 +178,8 @@ object Test with Application {
parsedxml2 \\ "title",
List(
- Elem("title",e,Text("Data on ze web")),
- Elem("title",e,Text("Foundations of Programming Languages")))
+ Elem(0,"title",e,Text("Data on ze web")),
+ Elem(0,"title",e,Text("Foundations of Programming Languages")))
);