summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-07-05 14:46:37 +0000
committerPaul Phillips <paulp@improving.org>2009-07-05 14:46:37 +0000
commit67881bbca054809bc97af17cce1134affa02398f (patch)
treed355ff34616800e72d919e6a60ab28657f1a262d /test/files/run
parente373d268a5a15daab4ee2aef8f45eccca908b026 (diff)
downloadscala-67881bbca054809bc97af17cce1134affa02398f.tar.gz
scala-67881bbca054809bc97af17cce1134affa02398f.tar.bz2
scala-67881bbca054809bc97af17cce1134affa02398f.zip
Fixes and test cases for #2124 and #2125.
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/bug2124.check1
-rw-r--r--test/files/run/bug2124.scala25
-rw-r--r--test/files/run/bug2125.check1
-rw-r--r--test/files/run/bug2125.scala25
4 files changed, 52 insertions, 0 deletions
diff --git a/test/files/run/bug2124.check b/test/files/run/bug2124.check
new file mode 100644
index 0000000000..2b8840209f
--- /dev/null
+++ b/test/files/run/bug2124.check
@@ -0,0 +1 @@
+<p><lost></lost><q></q></p>
diff --git a/test/files/run/bug2124.scala b/test/files/run/bug2124.scala
new file mode 100644
index 0000000000..ae16e66706
--- /dev/null
+++ b/test/files/run/bug2124.scala
@@ -0,0 +1,25 @@
+import scala.xml._
+
+import scala.xml.transform._
+
+object Test {
+ val sampleXml = <p><lost/><t><s><r></r></s></t></p>
+
+ def main(args: scala.Array[String]) {
+
+ println(new RuleTransformer(new RewriteRule {
+
+ override def transform(n: Node): NodeSeq = {
+ val result = n match {
+ case <t>{_*}</t> => <q/>
+
+ case n => n
+
+ }
+// println ("Rewriting '" +n+ "' to: '" + result+ "'")
+
+ result
+ }
+ }).transform(sampleXml))
+ }
+} \ No newline at end of file
diff --git a/test/files/run/bug2125.check b/test/files/run/bug2125.check
new file mode 100644
index 0000000000..2b8840209f
--- /dev/null
+++ b/test/files/run/bug2125.check
@@ -0,0 +1 @@
+<p><lost></lost><q></q></p>
diff --git a/test/files/run/bug2125.scala b/test/files/run/bug2125.scala
new file mode 100644
index 0000000000..053798e3db
--- /dev/null
+++ b/test/files/run/bug2125.scala
@@ -0,0 +1,25 @@
+import scala.xml._
+
+import scala.xml.transform._
+
+object Test {
+
+ val sampleXml = <xml:group><p><lost/><t><s><r></r></s></t></p></xml:group>
+
+ def main(args: scala.Array[String]) {
+ println(new RuleTransformer(new RewriteRule {
+
+ override def transform(n: Node): NodeSeq = {
+
+ val result = n match {
+
+ case <t>{_*}</t> => <q/>
+
+ case n => n
+ }
+// println ("Rewriting '" +n+ "' to: '" + result+ "'")
+ result
+ }
+ }).transform(sampleXml))
+ }
+} \ No newline at end of file