diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/bug2276.check | 8 | ||||
-rw-r--r-- | test/files/run/bug2276.scala | 24 |
2 files changed, 32 insertions, 0 deletions
diff --git a/test/files/run/bug2276.check b/test/files/run/bug2276.check new file mode 100644 index 0000000000..95f51c8e29 --- /dev/null +++ b/test/files/run/bug2276.check @@ -0,0 +1,8 @@ +<root> + <subnode> + <version>2</version> + </subnode> + <contents> + <version>2</version> + </contents> + </root> diff --git a/test/files/run/bug2276.scala b/test/files/run/bug2276.scala new file mode 100644 index 0000000000..815e88e429 --- /dev/null +++ b/test/files/run/bug2276.scala @@ -0,0 +1,24 @@ +import scala.xml._ +import scala.xml.transform._ + +object Test extends Application { + val inputXml : Node = + <root> + <subnode> + <version>1</version> + </subnode> + <contents> + <version>1</version> + </contents> + </root> + + object t1 extends RewriteRule { + override def transform(n: Node): Seq[Node] = n match { + case <version>{x}</version> if x.toString.toInt < 4 => <version>{x.toString.toInt+1}</version> + case other => other + } + } + + val ruleTransformer = new RuleTransformer(t1) + println(ruleTransformer(inputXml)) +}
\ No newline at end of file |