summaryrefslogtreecommitdiff
path: root/test/files/jvm
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/jvm')
-rw-r--r--test/files/jvm/backendBugUnapply.check2
-rw-r--r--test/files/jvm/backendBugUnapply.scala17
-rw-r--r--test/files/jvm/serialization-new.check54
-rw-r--r--test/files/jvm/serialization-new.scala67
-rw-r--r--test/files/jvm/serialization.check54
-rw-r--r--test/files/jvm/serialization.scala65
-rwxr-xr-xtest/files/jvm/t0632.check12
-rw-r--r--test/files/jvm/t0632.scala22
-rwxr-xr-xtest/files/jvm/t1118.check11
-rwxr-xr-xtest/files/jvm/t1118.scala21
-rw-r--r--test/files/jvm/t560bis.check2
-rw-r--r--test/files/jvm/t560bis.scala21
-rw-r--r--test/files/jvm/unittest_xml.scala101
-rwxr-xr-xtest/files/jvm/xml01.check8
-rw-r--r--test/files/jvm/xml01.scala182
-rw-r--r--test/files/jvm/xml02.check0
-rw-r--r--test/files/jvm/xml02.scala78
-rwxr-xr-xtest/files/jvm/xml03syntax.check27
-rw-r--r--test/files/jvm/xml03syntax.scala97
-rw-r--r--test/files/jvm/xml04embed.check3
-rw-r--r--test/files/jvm/xml04embed.scala10
-rw-r--r--test/files/jvm/xmlattr.check18
-rw-r--r--test/files/jvm/xmlattr.scala70
-rw-r--r--test/files/jvm/xmlmore.check10
-rw-r--r--test/files/jvm/xmlmore.scala29
-rw-r--r--test/files/jvm/xmlpull.scala31
-rw-r--r--test/files/jvm/xmlstuff.check22
-rw-r--r--test/files/jvm/xmlstuff.scala181
28 files changed, 1 insertions, 1214 deletions
diff --git a/test/files/jvm/backendBugUnapply.check b/test/files/jvm/backendBugUnapply.check
deleted file mode 100644
index 9d1e7b29c2..0000000000
--- a/test/files/jvm/backendBugUnapply.check
+++ /dev/null
@@ -1,2 +0,0 @@
-baz
-null
diff --git a/test/files/jvm/backendBugUnapply.scala b/test/files/jvm/backendBugUnapply.scala
deleted file mode 100644
index 45ee6f7d4f..0000000000
--- a/test/files/jvm/backendBugUnapply.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-object Test {
- import scala.xml.{Node,UnprefixedAttribute}
-
- def domatch(x:Node) =
- x match {
- case Node("foo", UnprefixedAttribute("bar", z, _), _*) => z
- case _ => null
- }
-
- def main(args: Array[String]): Unit = {
- println(domatch(<foo bar="baz"><hi/></foo>))
- println(domatch(<foo bingo="donkey"><hi/></foo>))
- //
- // assert(domatch(<foo bar="baz"><hi/></foo>).toString == "baz")
- // assert(domatch(<foo bar="baz2"><hi/></foo>) == null)//, domatch(<foo bar="baz2"><hi/></foo>))
- }
-}
diff --git a/test/files/jvm/serialization-new.check b/test/files/jvm/serialization-new.check
index f886cfe29c..e2d2e4aee6 100644
--- a/test/files/jvm/serialization-new.check
+++ b/test/files/jvm/serialization-new.check
@@ -220,60 +220,6 @@ x = TrieMap(1 -> one, 2 -> two, 3 -> three)
y = TrieMap(1 -> one, 2 -> two, 3 -> three)
x equals y: true, y equals x: true
-x = xml:src="hello"
-y = xml:src="hello"
-x equals y: true, y equals x: true
-
-x = <title></title>
-y = <title></title>
-x equals y: true, y equals x: true
-
-x = <html><title>title</title><body></body></html>
-y = <html><title>title</title><body></body></html>
-x equals y: true, y equals x: true
-
-x = <html>
- <body>
- <table cellpadding="2" cellspacing="0">
- <tr>
- <th>Last Name</th>
- <th>First Name</th>
- </tr>
- <tr>
- <td> Tom </td>
- <td> 20 </td>
- </tr><tr>
- <td> Bob </td>
- <td> 22 </td>
- </tr><tr>
- <td> James </td>
- <td> 19 </td>
- </tr>
- </table>
- </body>
- </html>
-y = <html>
- <body>
- <table cellpadding="2" cellspacing="0">
- <tr>
- <th>Last Name</th>
- <th>First Name</th>
- </tr>
- <tr>
- <td> Tom </td>
- <td> 20 </td>
- </tr><tr>
- <td> Bob </td>
- <td> 22 </td>
- </tr><tr>
- <td> James </td>
- <td> 19 </td>
- </tr>
- </table>
- </body>
- </html>
-x equals y: true, y equals x: true
-
x = Tim
y = Tim
x equals y: true, y equals x: true
diff --git a/test/files/jvm/serialization-new.scala b/test/files/jvm/serialization-new.scala
index 1522fc8e27..1b5e856645 100644
--- a/test/files/jvm/serialization-new.scala
+++ b/test/files/jvm/serialization-new.scala
@@ -419,70 +419,6 @@ object Test3_mutable {
}
}
-
-//############################################################################
-// Test classes in package "scala.xml"
-
-object Test4_xml {
- import scala.xml.{Attribute, Document, Elem, Null, PrefixedAttribute, Text}
-
- case class Person(name: String, age: Int)
-
- try {
- // Attribute
- val a1 = new PrefixedAttribute("xml", "src", Text("hello"), Null)
- val _a1: Attribute = read(write(a1))
- check(a1, _a1)
-
- // Document
- val d1 = new Document
- d1.docElem = <title></title>
- d1.encoding = Some("UTF-8")
- val _d1: Document = read(write(d1))
- check(d1, _d1)
-
- // Elem
- val e1 = <html><title>title</title><body></body></html>;
- val _e1: Elem = read(write(e1))
- check(e1, _e1)
-
- class AddressBook(a: Person*) {
- private val people: List[Person] = a.toList
- def toXHTML =
- <table cellpadding="2" cellspacing="0">
- <tr>
- <th>Last Name</th>
- <th>First Name</th>
- </tr>
- { for (p <- people) yield
- <tr>
- <td> { p.name } </td>
- <td> { p.age.toString() } </td>
- </tr> }
- </table>;
- }
-
- val people = new AddressBook(
- Person("Tom", 20),
- Person("Bob", 22),
- Person("James", 19))
-
- val e2 =
- <html>
- <body>
- { people.toXHTML }
- </body>
- </html>;
- val _e2: Elem = read(write(e2))
- check(e2, _e2)
- }
- catch {
- case e: Exception =>
- println("Error in Test4_xml: " + e)
- throw e
- }
-}
-
//############################################################################
// Test user-defined classes WITHOUT nesting
@@ -594,11 +530,10 @@ object Test8 {
// Test code
object Test {
- def main(args: Array[String]) {
+ def main(args: Array[String]): Unit = {
Test1_scala
Test2_immutable
Test3_mutable
- Test4_xml
Test5
Test6
Test7
diff --git a/test/files/jvm/serialization.check b/test/files/jvm/serialization.check
index f886cfe29c..e2d2e4aee6 100644
--- a/test/files/jvm/serialization.check
+++ b/test/files/jvm/serialization.check
@@ -220,60 +220,6 @@ x = TrieMap(1 -> one, 2 -> two, 3 -> three)
y = TrieMap(1 -> one, 2 -> two, 3 -> three)
x equals y: true, y equals x: true
-x = xml:src="hello"
-y = xml:src="hello"
-x equals y: true, y equals x: true
-
-x = <title></title>
-y = <title></title>
-x equals y: true, y equals x: true
-
-x = <html><title>title</title><body></body></html>
-y = <html><title>title</title><body></body></html>
-x equals y: true, y equals x: true
-
-x = <html>
- <body>
- <table cellpadding="2" cellspacing="0">
- <tr>
- <th>Last Name</th>
- <th>First Name</th>
- </tr>
- <tr>
- <td> Tom </td>
- <td> 20 </td>
- </tr><tr>
- <td> Bob </td>
- <td> 22 </td>
- </tr><tr>
- <td> James </td>
- <td> 19 </td>
- </tr>
- </table>
- </body>
- </html>
-y = <html>
- <body>
- <table cellpadding="2" cellspacing="0">
- <tr>
- <th>Last Name</th>
- <th>First Name</th>
- </tr>
- <tr>
- <td> Tom </td>
- <td> 20 </td>
- </tr><tr>
- <td> Bob </td>
- <td> 22 </td>
- </tr><tr>
- <td> James </td>
- <td> 19 </td>
- </tr>
- </table>
- </body>
- </html>
-x equals y: true, y equals x: true
-
x = Tim
y = Tim
x equals y: true, y equals x: true
diff --git a/test/files/jvm/serialization.scala b/test/files/jvm/serialization.scala
index a64b7115fa..2bb9db3f72 100644
--- a/test/files/jvm/serialization.scala
+++ b/test/files/jvm/serialization.scala
@@ -420,70 +420,6 @@ object Test3_mutable {
}
}
-
-//############################################################################
-// Test classes in package "scala.xml"
-
-object Test4_xml {
- import scala.xml.{Attribute, Document, Elem, Null, PrefixedAttribute, Text}
-
- case class Person(name: String, age: Int)
-
- try {
- // Attribute
- val a1 = new PrefixedAttribute("xml", "src", Text("hello"), Null)
- val _a1: Attribute = read(write(a1))
- check(a1, _a1)
-
- // Document
- val d1 = new Document
- d1.docElem = <title></title>
- d1.encoding = Some("UTF-8")
- val _d1: Document = read(write(d1))
- check(d1, _d1)
-
- // Elem
- val e1 = <html><title>title</title><body></body></html>;
- val _e1: Elem = read(write(e1))
- check(e1, _e1)
-
- class AddressBook(a: Person*) {
- private val people: List[Person] = a.toList
- def toXHTML =
- <table cellpadding="2" cellspacing="0">
- <tr>
- <th>Last Name</th>
- <th>First Name</th>
- </tr>
- { for (p <- people) yield
- <tr>
- <td> { p.name } </td>
- <td> { p.age.toString() } </td>
- </tr> }
- </table>;
- }
-
- val people = new AddressBook(
- Person("Tom", 20),
- Person("Bob", 22),
- Person("James", 19))
-
- val e2 =
- <html>
- <body>
- { people.toXHTML }
- </body>
- </html>;
- val _e2: Elem = read(write(e2))
- check(e2, _e2)
- }
- catch {
- case e: Exception =>
- println("Error in Test4_xml: " + e)
- throw e
- }
-}
-
//############################################################################
// Test user-defined classes WITHOUT nesting
@@ -600,7 +536,6 @@ object Test {
Test1_scala
Test2_immutable
Test3_mutable
- Test4_xml
Test5
Test6
Test7
diff --git a/test/files/jvm/t0632.check b/test/files/jvm/t0632.check
deleted file mode 100755
index 681bc9da92..0000000000
--- a/test/files/jvm/t0632.check
+++ /dev/null
@@ -1,12 +0,0 @@
-<foo x="&amp;"/>
-<foo x="&amp;"/>
-<foo x="&amp;"/>
-<foo x="&amp;"/>
-<foo x="&amp;amp;"/>
-<foo x="&amp;amp;"/>
-<foo x="&amp;amp;"/>
-<foo x="&amp;amp;"/>
-<foo x="&amp;&amp;"/>
-<foo x="&amp;&amp;"/>
-<foo x="&amp;&amp;"/>
-<foo x="&amp;&amp;"/>
diff --git a/test/files/jvm/t0632.scala b/test/files/jvm/t0632.scala
deleted file mode 100644
index a2bb5aa7f4..0000000000
--- a/test/files/jvm/t0632.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-object Test {
-import scala.io.Source.fromString
-import scala.xml.parsing.ConstructingParser.fromSource
-import scala.xml.TopScope
- def parse(s:String) = fromSource(fromString(s), false).element(TopScope)
- def main(argv : Array[String]) : Unit = {
-
- println(parse("<foo x='&amp;'/>"))
- println(xml.XML.loadString("<foo x='&amp;'/>"))
- println(<foo x="&amp;"/>)
- println(<foo x={ "&" }/>)
-
- println(xml.XML.loadString("<foo x='&amp;amp;'/>"))
- println(parse("<foo x='&amp;amp;'/>"))
- println(<foo x="&amp;amp;"/>)
- println(<foo x={ "&amp;" }/>)
- println(xml.XML.loadString("<foo x='&amp;&amp;'/>"))
- println(parse("<foo x='&amp;&amp;'/>"))
- println(<foo x="&amp;&amp;"/>)
- println(<foo x={ "&&" }/>)
- }
-}
diff --git a/test/files/jvm/t1118.check b/test/files/jvm/t1118.check
deleted file mode 100755
index d676b413c9..0000000000
--- a/test/files/jvm/t1118.check
+++ /dev/null
@@ -1,11 +0,0 @@
-
-<hi/> <!-- literal short -->
-<there></there> <!-- literal long -->
-<guys who="you all"></guys> <!-- literal long with attribute-->
-<hows it="going"/> <!-- literal short with attribute -->
-<this>is pretty cool</this> <!-- literal not empty -->
-
-<emptiness></emptiness> <!--programmatic long-->
-<vide/> <!--programmatic short-->
-<elem attr="value"/> <!--programmatic short with attribute-->
-<elem2 attr2="value2"></elem2> <!--programmatic long with attribute-->
diff --git a/test/files/jvm/t1118.scala b/test/files/jvm/t1118.scala
deleted file mode 100755
index 3c86547241..0000000000
--- a/test/files/jvm/t1118.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-import scala.xml._
-
-object Test {
- def main(args: Array[String]) {
- println(<xml:group>
-<hi/> <!-- literal short -->
-<there></there> <!-- literal long -->
-<guys who="you all"></guys> <!-- literal long with attribute-->
-<hows it="going"/> <!-- literal short with attribute -->
-<this>is pretty cool</this> <!-- literal not empty -->
-</xml:group>)
-
- println(Elem(null, "emptiness", Null, TopScope, false) ++ Text(" ") ++ Comment("programmatic long"))
-
- println(Elem(null, "vide", Null, TopScope, true) ++ Text(" ") ++ Comment("programmatic short"))
-
- println(Elem(null, "elem", Attribute("attr", Text("value"), Null), TopScope, true) ++ Text(" ") ++ Comment ("programmatic short with attribute"))
-
- println(Elem(null, "elem2", Attribute("attr2", Text("value2"), Null), TopScope, false) ++ Text(" ") ++ Comment ("programmatic long with attribute"))
- }
-} \ No newline at end of file
diff --git a/test/files/jvm/t560bis.check b/test/files/jvm/t560bis.check
deleted file mode 100644
index 91eb4c19a2..0000000000
--- a/test/files/jvm/t560bis.check
+++ /dev/null
@@ -1,2 +0,0 @@
-cool!
-cool!
diff --git a/test/files/jvm/t560bis.scala b/test/files/jvm/t560bis.scala
deleted file mode 100644
index 21eb8dde28..0000000000
--- a/test/files/jvm/t560bis.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-object Test {
-import scala.xml._;
-
- def bar(args: Seq[String]) = args match {
- case Seq(a,b,c,d @ _*) => Console.println("cool!")
- case _ => Console.println("bah")
- }
- def foo(args: List[String]) =
- Elem(null,"bla",Null, TopScope, minimizeEmpty = true, (args map {x => Text(x)}):_*) match {
- case Elem(_,_,_,_,Text("1"),_*) =>
- Console.println("cool!")
- case _ =>
- Console.println("bah")
- }
-
- def main(args: Array[String]) = {
- val li = List("1","2","3","4")
- bar(li)
- foo(li)
- }
-}
diff --git a/test/files/jvm/unittest_xml.scala b/test/files/jvm/unittest_xml.scala
deleted file mode 100644
index 106334e625..0000000000
--- a/test/files/jvm/unittest_xml.scala
+++ /dev/null
@@ -1,101 +0,0 @@
-import scala.xml.{ MetaData, Null, Utility, PrefixedAttribute, UnprefixedAttribute }
-
-object Test {
-
- def main(args:Array[String]) = {
- MetaDataTest.run()
- UtilityTest.run()
- }
-
- object MetaDataTest {
-
- import scala.xml.{ TopScope, NamespaceBinding, Node, Atom, Text }
-
- def domatch(x:Node): Node = {
- x match {
- case Node("foo", md @ UnprefixedAttribute(_, value, _), _*) if !value.isEmpty =>
- md("bar")(0)
- case _ => new Atom(3)
- }
- }
-
- def run() {
-
- var x: MetaData = Null
- var s: NamespaceBinding = TopScope
-
- // testing method def apply(uri:String, scp:NamespaceBinding, k:String): Seq[Node]
- // def apply(k:String): Seq[Node]
-
- assert(null == x("za://foo.com", s, "bar" ), "absent element (prefixed) 1")
- assert(null == x("bar"), "absent element (unprefix) 1")
-
- assert(None == x.get("za://foo.com", s, "bar" ), "absent element (prefixed) 2")
- assert(None == x.get("bar"), "absent element (unprefix) 2")
-
- x = new PrefixedAttribute("zo","bar", new Atom(42), x)
- s = new NamespaceBinding("zo","za://foo.com",s)
-
- assert(new Atom(42) == x("za://foo.com", s, "bar" ), "present element (prefixed) 3")
- assert(null == x("bar"), "present element (unprefix) 3")
-
- assert(Some(new Atom(42)) == x.get("za://foo.com", s, "bar" ), "present element (prefixed) 4")
- assert(None == x.get("bar"), "present element (unprefix) 4")
-
- x = new UnprefixedAttribute("bar","meaning", x)
-
- assert(null == x(null, s, "bar"), "present element (prefixed) 5")
- assert(Text("meaning") == x("bar"), "present element (unprefix) 5")
-
- assert(None == x.get(null, s, "bar" ), "present element (prefixed) 6")
- assert(Some(Text("meaning")) == x.get("bar"), "present element (unprefix) 6")
-
- val z = <foo bar="gar"/>
- val z2 = <foo/>
-
- assert(Text("gar") == domatch(z), "attribute extractor 1")
- assert(new Atom(3) == domatch(z2), "attribute extractor 2")
-
- }
- }
-
- object UtilityTest {
- def run() {
- assert(Utility.isNameStart('b'))
- assert(!Utility.isNameStart(':'))
-
- val x = <foo>
- <toomuchws/>
- </foo>
-
- val y = xml.Utility.trim(x)
-
- assert(1 == (y match { case <foo><toomuchws/></foo> => 1 }), "trim 1")
-
- val x2 = <foo>
- <toomuchws> a b b a </toomuchws>
- </foo>
-
- val y2 = xml.Utility.trim(x2)
-
- assert(2 == (y2 match { case <foo><toomuchws>a b b a</toomuchws></foo> => 2 }), "trim 2")
-
- val z = <bar>''</bar>
- val z1 = z.toString
-
- assert("<bar>''</bar>" == z1, "apos unescaped")
-
- val q = xml.Utility.sort(<a g='3' j='2' oo='2' a='2'/>)
- assert(" a=\"2\" g=\"3\" j=\"2\" oo=\"2\"" == xml.Utility.sort(q.attributes).toString)
-
- val pp = new xml.PrettyPrinter(80,5)
- assert("<a a=\"2\" g=\"3\" j=\"2\" oo=\"2\"/>" == pp.format(q))
-
- <hi>
- <there/>
- <guys/>
- </hi>.hashCode // Bug #777
- }
- }
-
-}
diff --git a/test/files/jvm/xml01.check b/test/files/jvm/xml01.check
deleted file mode 100755
index d78e6df410..0000000000
--- a/test/files/jvm/xml01.check
+++ /dev/null
@@ -1,8 +0,0 @@
-equality
-xpath \
-xpath \\ DESCENDANTS
-<book><author>Peter Buneman</author><author>Dan Suciu</author><title>Data on ze web</title></book>
--- group nodes
-<f><a/><b/><c/></f>
-<a/><f><a/><b/><c/></f><a/><b/><c/>
-attribute value normalization
diff --git a/test/files/jvm/xml01.scala b/test/files/jvm/xml01.scala
deleted file mode 100644
index 2b456f5ff5..0000000000
--- a/test/files/jvm/xml01.scala
+++ /dev/null
@@ -1,182 +0,0 @@
-import java.io.StringReader
-import org.xml.sax.InputSource
-
-import scala.xml._
-
-object Test extends App {
- def Elem(prefix: String, label: String, attributes: MetaData, scope: NamespaceBinding, child: Node*): Elem =
- scala.xml.Elem.apply(prefix, label, attributes, scope, minimizeEmpty = true, child: _*)
- val e: scala.xml.MetaData = Null //Node.NoAttributes
- val sc: scala.xml.NamespaceBinding = TopScope
-
- val xmlFile1 = "<hello><world/></hello>";
- val isrc1 = new InputSource(new StringReader(xmlFile1))
- val parsedxml1 = XML.load(isrc1)
- val isrc11 = new InputSource(new StringReader(xmlFile1))
- val parsedxml11 = XML.load(isrc11)
-
- val c = new Node {
- def label = "hello"
- override def hashCode() =
- Utility.hashCode(prefix, label, attributes.hashCode(), scope.hashCode(), child);
- def child = Elem(null, "world", e, sc);
- //def attributes = e;
- override def text = ""
- }
-
- println("equality")
- assert(c == parsedxml11)
- assert(parsedxml1 == parsedxml11)
- assert(List(parsedxml1) sameElements List(parsedxml11))
- assert(Array(parsedxml1).toList sameElements List(parsedxml11))
-
- val x2 = "<book><author>Peter Buneman</author><author>Dan Suciu</author><title>Data on ze web</title></book>";
-
- val i = new InputSource(new StringReader(x2))
- val x2p = XML.load(i)
-
- assert(x2p == Elem(null, "book" , e, sc,
- Elem(null, "author", e, sc,Text("Peter Buneman")),
- Elem(null, "author", e, sc,Text("Dan Suciu")),
- Elem(null, "title" , e, sc,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))
- val parsedxml2 = XML.load(isrc2)
-
- println("xpath \\")
-
- assert(parsedxml1 \ "_" sameElements List(Elem(null,"world", e, sc)))
-
- assert(parsedxml1 \ "world" sameElements List(Elem(null,"world", e, sc)))
-
- assert(
- (parsedxml2 \ "_") sameElements List(
- Elem(null,"book", e, sc,
- Elem(null,"author", e, sc, Text("Peter Buneman")),
- Elem(null,"author", e, sc, Text("Dan Suciu")),
- Elem(null,"title" , e, sc, Text("Data on ze web"))),
- Elem(null,"book",e,sc,
- Elem(null,"author",e,sc,Text("John Mitchell")),
- Elem(null,"title",e,sc,Text("Foundations of Programming Languages"))))
- )
- assert((parsedxml2 \ "author").isEmpty)
-
- assert(
- (parsedxml2 \ "book") sameElements List(
- Elem(null,"book",e,sc,
- Elem(null,"author", e, sc, Text("Peter Buneman")),
- Elem(null,"author", e, sc, Text("Dan Suciu")),
- Elem(null,"title" , e, sc, Text("Data on ze web"))),
- Elem(null,"book",e,sc,
- Elem(null,"author", e, sc, Text("John Mitchell")),
- Elem(null,"title" , e, sc, Text("Foundations of Programming Languages")))
- )
- )
-
- assert(
- (parsedxml2 \ "_" \ "_") sameElements List(
- Elem(null,"author", e, sc, Text("Peter Buneman")),
- Elem(null,"author", e, sc, Text("Dan Suciu")),
- Elem(null,"title" , e, sc, Text("Data on ze web")),
- Elem(null,"author", e, sc, Text("John Mitchell")),
- Elem(null,"title" , e, sc, Text("Foundations of Programming Languages"))
- )
- )
-
- assert(
- (parsedxml2 \ "_" \ "author") sameElements List(
- Elem(null,"author", e, sc, Text("Peter Buneman")),
- Elem(null,"author", e, sc, Text("Dan Suciu")),
- Elem(null,"author", e, sc, Text("John Mitchell"))
- )
- )
-
- assert((parsedxml2 \ "_" \ "_" \ "author").isEmpty)
-
- Console.println("xpath \\\\ DESCENDANTS");
-
- assert(
- (parsedxml2 \\ "author") sameElements List(
- Elem(null,"author", e, sc, Text("Peter Buneman")),
- Elem(null,"author", e, sc, Text("Dan Suciu")),
- Elem(null,"author", e, sc, Text("John Mitchell"))
- )
- )
-
- assert(
- (parsedxml2 \\ "title") sameElements List(
- Elem(null,"title", e, sc, Text("Data on ze web")),
- Elem(null,"title", e, sc, Text("Foundations of Programming Languages")))
- )
-
-
- println(
- (parsedxml2 \\ "book" ){ n:Node => (n \ "title") xml_== "Data on ze web" }
- )
-
- assert(
- ((new NodeSeq { val theSeq = List( parsedxml2 ) }) \\ "_") sameElements List(
- Elem(null,"bib",e,sc,
- Elem(null,"book",e,sc,
- Elem(null, "author", e, sc, Text("Peter Buneman")),
- Elem(null, "author", e, sc, Text("Dan Suciu")),
- Elem(null, "title" , e, sc, Text("Data on ze web"))),
- Elem(null,"book",e,sc,
- Elem(null,"author",e,sc,Text("John Mitchell")),
- Elem(null,"title",e,sc,Text("Foundations of Programming Languages")))),
- Elem(null,"book",e,sc,
- Elem(null,"author",e,sc,Text("Peter Buneman")),
- Elem(null,"author",e,sc,Text("Dan Suciu")),
- Elem(null,"title",e,sc,Text("Data on ze web"))),
- Elem(null,"author",e,sc,Text("Peter Buneman")),
- Elem(null,"author",e,sc,Text("Dan Suciu")),
- Elem(null,"title",e,sc,Text("Data on ze web")),
- Elem(null,"book",e,sc,
- Elem(null,"author",e,sc,Text("John Mitchell")),
- Elem(null,"title",e,sc,Text("Foundations of Programming Languages"))),
- Elem(null,"author",e,sc,Text("John Mitchell")),
- Elem(null,"title",e,sc,Text("Foundations of Programming Languages"))
- )
- )
-
- // test group node
- Console println "-- group nodes"
- val zx1: Node = Group { <a/><b/><c/> }
- val zy1 = <f>{zx1}</f>
- Console println zy1.toString()
-
- val zx2: Node = Group { List(<a/>,zy1,zx1) }
- Console println zx2.toString()
-
- val zz1 = <xml:group><a/><b/><c/></xml:group>
-
- assert(zx1 xml_== zz1)
- assert(zz1.length == 3)
-
- // unparsed
-
- println("attribute value normalization")
- val xmlAttrValueNorm = "<personne id='p0003' nom='&#x015e;ahingöz' />";
- {
- val isrcA = new InputSource( new StringReader(xmlAttrValueNorm) );
- val parsedxmlA = XML.load(isrcA);
- val c = (parsedxmlA \ "@nom").text.charAt(0);
- assert(c == '\u015e');
- }
- // buraq: if the following test fails with 'character x not allowed', it is
- // related to the mutable variable in a closures in MarkupParser.parsecharref
- {
- val isr = scala.io.Source.fromString(xmlAttrValueNorm);
- val pxmlB = scala.xml.parsing.ConstructingParser.fromSource(isr,false);
- val parsedxmlB = pxmlB.element(TopScope);
- val c = (parsedxmlB \ "@nom").text.charAt(0);
- assert(c == '\u015e');
- }
-
- // #60 test by round trip
-
- val p = scala.xml.parsing.ConstructingParser.fromSource(scala.io.Source.fromString("<foo bar:attr='&amp;'/>"),true)
- val n = p.element(new scala.xml.NamespaceBinding("bar","BAR",scala.xml.TopScope))(0)
- assert( n.attributes.get("BAR", n, "attr").nonEmpty)
-}
diff --git a/test/files/jvm/xml02.check b/test/files/jvm/xml02.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/jvm/xml02.check
+++ /dev/null
diff --git a/test/files/jvm/xml02.scala b/test/files/jvm/xml02.scala
deleted file mode 100644
index b830a0e694..0000000000
--- a/test/files/jvm/xml02.scala
+++ /dev/null
@@ -1,78 +0,0 @@
-object Test {
-
- def main(args: Array[String]) {
- XmlEx.run()
- XmlEy.run()
- XmlPat.run()
- DodgyNamespace.run()
- }
-
- import scala.xml.{NodeSeq, Utility}
- import NodeSeq.seqToNodeSeq
-
- val ax = <hello foo="bar" x:foo="baz" xmlns:x="the namespace from outer space">
- <world/>
- </hello>
-
- val cx = <z:hello foo="bar" xmlns:z="z" x:foo="baz" xmlns:x="the namespace from outer space">
- crazy text world
- </z:hello>
-
- val bx = <hello foo="bar&amp;x"></hello>
-
- object XmlEx {
-
- def run() {
- assert((ax \ "@foo") xml_== "bar") // uses NodeSeq.view!
- assert((ax \ "@foo") xml_== xml.Text("bar")) // dto.
- assert((bx \ "@foo") xml_== "bar&x") // dto.
- assert((bx \ "@foo") xml_sameElements List(xml.Text("bar&x")))
- assert("<hello foo=\"bar&amp;x\"></hello>" == bx.toString)
- }
- }
-
- object XmlEy {
- def run() {
- val z = ax \ "@{the namespace from outer space}foo"
- assert((ax \ "@{the namespace from outer space}foo") xml_== "baz")
- assert((cx \ "@{the namespace from outer space}foo") xml_== "baz")
-
- try {
- ax \ "@"
- assert(false)
- } catch {
- case _: IllegalArgumentException =>
- }
- try {
- ax \ "@{"
- assert(false)
- } catch {
- case _: IllegalArgumentException =>
- }
- try {
- ax \ "@{}"
- assert(false)
- } catch {
- case _: IllegalArgumentException =>
- }
-
- }
- }
-
- object XmlPat {
- def run() {
- assert(<hello/> match { case <hello/> => true; case _ => false; })
- assert(<x:ga xmlns:x="z"/> match { case <x:ga/> => true; case _ => false; });
- assert(Utility.trim(cx) match { case n @ <hello>crazy text world</hello> if (n \ "@foo") xml_== "bar" => true; })
- assert(Utility.trim(cx) match { case n @ <z:hello>crazy text world</z:hello> if (n \ "@foo") xml_== "bar" => true; })
- }
- }
-
- object DodgyNamespace {
- def run() {
- val x = <flog xmlns:ee="http://ee.com"><foo xmlns:dog="http://dog.com"><dog:cat/></foo></flog>
- assert(x.toString.matches(".*xmlns:dog=\"http://dog.com\".*"));
- }
- }
-
-}
diff --git a/test/files/jvm/xml03syntax.check b/test/files/jvm/xml03syntax.check
deleted file mode 100755
index 599cbad686..0000000000
--- a/test/files/jvm/xml03syntax.check
+++ /dev/null
@@ -1,27 +0,0 @@
-true
-true
-true
-<hello>world</hello>
-true
-<hello>1.5</hello>
-true
-<hello>5</hello>
-true
-<hello>true</hello>
-true
-<hello>5</hello>
-true
-<hello>27</hello>
-true
-<hello>1 2 3 4</hello>
-1
-2
-3
-4
-<hello>2 4</hello>
-2
-4
-
-node=<elem key="<b>hello</b>"/>, key=Some(<b>hello</b>)
-node=<elem/>, key=None
-<a>Š</a>
diff --git a/test/files/jvm/xml03syntax.scala b/test/files/jvm/xml03syntax.scala
deleted file mode 100644
index 41663681c7..0000000000
--- a/test/files/jvm/xml03syntax.scala
+++ /dev/null
@@ -1,97 +0,0 @@
-import scala.xml._
-
-object Test {
-
- private def handle[A](x: Node): A = {
- println(x)
- x.child(0).asInstanceOf[Atom[A]].data
- }
-
- def main(args: Array[String]) {
- test1()
- test2()
- test3()
- }
-
- private def test1() {
- val xNull = <hello>{null}</hello> // these used to be Atom(unit), changed to empty children
-
- println(xNull.child sameElements Nil)
-
- val x0 = <hello>{}</hello> // these used to be Atom(unit), changed to empty children
- val x00 = <hello>{ }</hello> // dto.
-
- val xa = <hello>{ "world" }</hello>
-
-
- println(x0.child sameElements Nil)
- println(x00.child sameElements Nil)
- println(handle[String](xa) == "world")
-
- val xb = <hello>{ 1.5 }</hello>
-
- println(handle[Double](xb) == 1.5)
-
- val xc = <hello>{ 5 }</hello>
-
- println(handle[Int](xc) == 5)
-
- val xd = <hello>{ true }</hello>
-
- println(handle[Boolean](xd) == true)
-
- val xe = <hello>{ 5:Short }</hello>
-
- println(handle[Short](xe) == (5:Short))
-
- val xf = <hello>{ val x = 27; x }</hello>
-
- println(handle[Int](xf) == 27)
-
- val xg = <hello>{ List(1,2,3,4) }</hello>
-
- println(xg)
- for (z <- xg.child) {
- println(z.toString() + {if (z.isInstanceOf[Text]) "(is text node ' ')" else ""})
- }
-
- val xh = <hello>{ for(x <- List(1,2,3,4) if x % 2 == 0) yield x }</hello>
-
- println(xh)
- for (z <- xh.child) {
- println(z.toString() + {if (z.isInstanceOf[Text]) "(is text node ' ')" else ""})
- }
- println
- }
-
- /** see SVN r13821 (emir): support for <elem key={x:Option[Seq[Node]]} />,
- * so that Options can be used for optional attributes.
- */
- private def test2() {
- val x1: Option[Seq[Node]] = Some(<b>hello</b>)
- val n1 = <elem key={x1} />;
- println("node="+n1+", key="+n1.attribute("key"))
-
- val x2: Option[Seq[Node]] = None
- val n2 = <elem key={x2} />;
- println("node="+n2+", key="+n2.attribute("key"))
- }
-
- private def test3() {
- // this demonstrates how to handle entities
- val s = io.Source.fromString("<a>&nbsp;</a>")
- object parser extends xml.parsing.ConstructingParser(s, false /*ignore ws*/) {
- override def replacementText(entityName: String): io.Source = {
- entityName match {
- case "nbsp" => io.Source.fromString("\u0160");
- case _ => super.replacementText(entityName);
- }
- }
- nextch; // !!important, to initialize the parser
- }
- val parsed = parser.element(TopScope) // parse the source as element
- // alternatively, we could call document()
- println(parsed)
- }
-
-}
diff --git a/test/files/jvm/xml04embed.check b/test/files/jvm/xml04embed.check
deleted file mode 100644
index e71e645149..0000000000
--- a/test/files/jvm/xml04embed.check
+++ /dev/null
@@ -1,3 +0,0 @@
-{
-}
-{}{}{}
diff --git a/test/files/jvm/xml04embed.scala b/test/files/jvm/xml04embed.scala
deleted file mode 100644
index fa453e4295..0000000000
--- a/test/files/jvm/xml04embed.scala
+++ /dev/null
@@ -1,10 +0,0 @@
-object Test {
- def main(args: Array[String]) {
- val ya = <x>{{</x>
- println(ya.text)
- val ua = <x>}}</x>
- println(ua.text)
- val za = <x>{{}}{{}}{{}}</x>
- println(za.text)
- }
-}
diff --git a/test/files/jvm/xmlattr.check b/test/files/jvm/xmlattr.check
deleted file mode 100644
index a87420d86c..0000000000
--- a/test/files/jvm/xmlattr.check
+++ /dev/null
@@ -1,18 +0,0 @@
-true
-true
-true
-true
-true
-true
-removal of duplicates for unprefixed attributes in append = 1
-true
-true
-true
-true
-true
-true
-true
-true
-true
-<b x="&amp;"/>
-<b x="&amp;"/>
diff --git a/test/files/jvm/xmlattr.scala b/test/files/jvm/xmlattr.scala
deleted file mode 100644
index 6423268ba7..0000000000
--- a/test/files/jvm/xmlattr.scala
+++ /dev/null
@@ -1,70 +0,0 @@
-import xml.{ NodeSeq, Null, Text, UnprefixedAttribute }
-
-object Test {
-
- def main(args: Array[String]) {
- UnprefixedAttributeTest()
- AttributeWithOptionTest()
- AttributeOutputTest()
- AttributeOperatorTest()
- }
-
- object UnprefixedAttributeTest {
- def apply() {
- val x = new UnprefixedAttribute("foo","bar", Null)
- println(Some(Text("bar")) == x.get("foo"))
- println(Text("bar") == x("foo"))
- println(None == x.get("no_foo"))
- println(null == x("no_foo"))
-
- val y = x.remove("foo")
- println(Null == y)
-
- val z = new UnprefixedAttribute("foo", null:NodeSeq, x)
- println(None == z.get("foo"))
-
- var appended = x append x append x append x
- var len = 0; while (appended ne Null) {
- appended = appended.next
- len = len + 1
- }
- println("removal of duplicates for unprefixed attributes in append = " + len)
- }
- }
-
- object AttributeWithOptionTest {
- def apply() {
- val x = new UnprefixedAttribute("foo", Some(Text("bar")), Null)
-
- println(Some(Text("bar")) == x.get("foo"))
- println(Text("bar") == x("foo"))
- println(None == x.get("no_foo"))
- println(null == x("no_foo"))
-
- val attr1 = Some(Text("foo value"))
- val attr2 = None
- val y = <b foo={attr1} bar={attr2} />
- println(Some(Text("foo value")) == y.attributes.get("foo"));
- println(Text("foo value") == y.attributes("foo"))
- println(None == y.attributes.get("bar"))
- println(null == y.attributes("bar"))
-
- val z = new UnprefixedAttribute("foo", None, x)
- println(None == z.get("foo"))
- }
- }
-
- object AttributeOutputTest {
- def apply() {
- println(<b x="&amp;"/>)
- println(<b x={"&"}/>)
- }
- }
-
- object AttributeOperatorTest {
- def apply() {
- val xml = <foo bar="apple" />
- assert(xml \@ "bar" == "apple")
- }
- }
-}
diff --git a/test/files/jvm/xmlmore.check b/test/files/jvm/xmlmore.check
deleted file mode 100644
index 29f144c89f..0000000000
--- a/test/files/jvm/xmlmore.check
+++ /dev/null
@@ -1,10 +0,0 @@
-<!-- thissa comment -->
-<?this is a pi foo bar = && {{ ?>
-
- &quot;Come, come again, whoever you are, come!
-Heathen, fire worshipper or idolatrous, come!
-Come even if you broke your penitence a hundred times,
-Ours is the portal of hope, come as you are.&quot;
- Mevlana Celaleddin Rumi
-<foo><br /></foo>
-End Test
diff --git a/test/files/jvm/xmlmore.scala b/test/files/jvm/xmlmore.scala
deleted file mode 100644
index 04d0a6c759..0000000000
--- a/test/files/jvm/xmlmore.scala
+++ /dev/null
@@ -1,29 +0,0 @@
-object myBreak extends scala.xml.Unparsed("<br />")
-
-object Test extends App {
- val com = <!-- thissa comment -->
- val pi = <?this is a pi foo bar = && {{ ?>
- val crz = <![CDATA[
- "Come, come again, whoever you are, come!
-Heathen, fire worshipper or idolatrous, come!
-Come even if you broke your penitence a hundred times,
-Ours is the portal of hope, come as you are."
- Mevlana Celaleddin Rumi]]>
-
- val nazim = <foo>{myBreak}</foo> // shows use of unparsed
-
- Console println com
- Console println pi
- Console println crz // this guy will escaped, and rightly so
- Console println nazim
- Console println "End Test"
-
- <x:foo xmlns:x="gaga"/> match {
- case scala.xml.QNode("gaga","foo",md,child@_*) =>
- }
-
- <x:foo xmlns:x="gaga"/> match {
- case scala.xml.Node("foo",md,child@_*) =>
- }
-
-}
diff --git a/test/files/jvm/xmlpull.scala b/test/files/jvm/xmlpull.scala
deleted file mode 100644
index 9ba7d4cf02..0000000000
--- a/test/files/jvm/xmlpull.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-import scala.xml._
-import scala.xml.pull._
-import scala.io.Source
-
-object Test {
-
- val src = Source.fromString("<hello><world/>!</hello>")
-
- def main(args: Array[String]) {
- var er = new XMLEventReader(src)
- er.next match {
- case EvElemStart(_, "hello", _, _) => //println("1")
- }
- er.next match {
- case EvElemStart(_, "world", _, _) => //println("2")
- }
- er.next match {
- case EvElemEnd(_, "world") => //println("3")
- }
- er.next match {
- case EvText("!") => //println("4")
- }
- er.next match {
- case EvElemEnd(_, "hello") => //println("5")
- }
- // you get the picture...
- er.stop // allow thread to be garbage-collected
- //println("6")
- }
-}
-
diff --git a/test/files/jvm/xmlstuff.check b/test/files/jvm/xmlstuff.check
deleted file mode 100644
index e1222479f7..0000000000
--- a/test/files/jvm/xmlstuff.check
+++ /dev/null
@@ -1,22 +0,0 @@
-NodeSeq
-<result>
- <title>Blabla</title>
- <remarks> Hallo Welt. </remarks>
-</result><result>
- <title>Blubabla</title>
- <remarks> Hello Blu </remarks>
-</result><result>
- <title>Blubabla</title>
- <remarks> rem 2 </remarks>
-</result>
-List(<book><title>Blabla</title></book>)
-<result>
- <name>John</name>
- <street> Elm Street</street>
- <city>Dolphin City</city>
- <phone where="work"> +41 21 693 68 67</phone>
- <phone where="mobile">+41 79 602 23 23</phone>
-</result>
-namespaces
-validation - elements
-validation - attributes
diff --git a/test/files/jvm/xmlstuff.scala b/test/files/jvm/xmlstuff.scala
deleted file mode 100644
index 45234c7139..0000000000
--- a/test/files/jvm/xmlstuff.scala
+++ /dev/null
@@ -1,181 +0,0 @@
-import java.io.StringReader
-import org.xml.sax.InputSource
-import scala.xml.{Node, NodeSeq, Elem, Text, XML}
-
-object Test {
-
- /** returns true if exception was thrown */
- def catcher(att: Function1[Unit, scala.xml.MetaData]): Boolean = {
- var ex = false
- try {
- att.apply({})
- } catch {
- case scala.xml.MalformedAttributeException(msg) =>
- println(msg)
- ex = true
- }
- ex
- }
-
- def main(args: Array[String]) {
-
- println("NodeSeq")
-
- val p = <foo>
- <bar gt='ga' value="3"/>
- <baz bazValue="8"/>
- <bar value="5" gi='go'/>
- </foo>;
-
- val pelems_1 = for (x <- p \ "bar"; y <- p \ "baz" ) yield {
- Text(x.attributes("value").toString + y.attributes("bazValue").toString+ "!")
- };
- val pelems_2 = new NodeSeq { val theSeq = List(Text("38!"),Text("58!")) };
- assert(pelems_1 sameElements pelems_2)
-
- assert(Text("8") sameElements (p \\ "@bazValue"))
-
- val books =
- <bks>
- <book><title>Blabla</title></book>
- <book><title>Blubabla</title></book>
- <book><title>Baaaaaaalabla</title></book>
- </bks>;
-
- val reviews =
- <reviews>
- <entry><title>Blabla</title>
- <remarks>
- Hallo Welt.
- </remarks>
- </entry>
- <entry><title>Blubabla</title>
- <remarks>
- Hello Blu
- </remarks>
- </entry>
- <entry><title>Blubabla</title>
- <remarks>
- rem 2
- </remarks>
- </entry>
- </reviews>;
-
- println( new scala.xml.PrettyPrinter(80, 5).formatNodes (
- for (t <- books \\ "title";
- r <- reviews \\ "entry"
- if (r \ "title") xml_== t) yield
- <result>
- { t }
- { r \ "remarks" }
- </result>
- ));
-
- // example
- println(
- for (t @ <book><title>Blabla</title></book> <- new NodeSeq { val theSeq = books.child }.toList)
- yield t
- );
- val phoneBook =
- <phonebook>
- <descr>
- This is the <b>phonebook</b> of the
- <a href="http://acme.org">ACME</a> corporation.
- </descr>
- <entry>
- <name>John</name>
- <phone where="work"> +41 21 693 68 67</phone>
- <phone where="mobile">+41 79 602 23 23</phone>
- </entry>
- </phonebook>;
-
-
- val addrBook =
- <addrbook>
- <descr>
- This is the <b>addressbook</b> of the
- <a href="http://acme.org">ACME</a> corporation.
- </descr>
- <entry>
- <name>John</name>
- <street> Elm Street</street>
- <city>Dolphin City</city>
- </entry>
- </addrbook>;
-
- println( new scala.xml.PrettyPrinter(80, 5).formatNodes (
- for (t <- addrBook \\ "entry";
- r <- phoneBook \\ "entry"
- if (t \ "name") xml_== (r \ "name")) yield
- <result>
- { t.child }
- { r \ "phone" }
- </result>
- ));
-
-
- /* namespaces */
- // begin tmp
- println("namespaces")
- val cuckoo = <cuckoo xmlns="http://cuckoo.com">
- <foo/>
- <bar/>
- </cuckoo>;
- assert(cuckoo.namespace == "http://cuckoo.com")
- for (n <- cuckoo \ "_" ) {
- //println("n = "+n);
- //println("n.prefix = "+n.prefix);
- //.println("n.scope = "+n.scope);
- assert( n.namespace == "http://cuckoo.com")
- }
-
- println("validation - elements")
- val vtor = new scala.xml.dtd.ElementValidator();
- {
- import scala.xml.dtd.ELEMENTS
- import scala.xml.dtd.ContentModel._
- vtor.setContentModel(
- ELEMENTS(
- Sequ(
- Letter(ElemName("bar")),
- Star(Letter(ElemName("baz"))) )));
-
- }
- assert(vtor( <foo><bar/><baz/><baz/></foo> ))
-
- {
- import scala.xml.dtd.MIXED
- import scala.xml.dtd.ContentModel._
-
- vtor.setContentModel(
- MIXED(
- Alt(Letter(ElemName("bar")),
- Letter(ElemName("baz")),
- Letter(ElemName("bal")))));
- }
-
- assert(vtor(<foo><bar/><baz/><baz/></foo> ))
- assert(vtor(<foo>ab<bar/>cd<baz/>ed<baz/>gh</foo> ))
- assert(!vtor(<foo> <ugha/> <bugha/> </foo> ))
-
- println("validation - attributes")
- vtor.setContentModel(null)
- vtor.setMetaData(List())
- assert(!vtor( <foo bar="hello"/> ))
-
- {
- import scala.xml.dtd._
- vtor setMetaData List(AttrDecl("bar", "CDATA", IMPLIED))
- }
- assert(!vtor(<foo href="http://foo.com" bar="hello"/>))
- assert(vtor(<foo bar="hello"/>))
-
- {
- import scala.xml.dtd._
- vtor.setMetaData(List(AttrDecl("bar","CDATA",REQUIRED)))
- }
- assert(!vtor( <foo href="http://foo.com" /> ))
- assert( vtor( <foo bar="http://foo.com" /> ))
-
- }
-}