You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2020/07/28 03:22:56 UTC

[groovy] branch GROOVY_2_5_X updated: GROOVY-9664: Groovy 3.0 does not work with Groovy 2 code using groovy.xml.XmlUtil (test back-ported as a control)

This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch GROOVY_2_5_X
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/GROOVY_2_5_X by this push:
     new a87810a  GROOVY-9664: Groovy 3.0 does not work with Groovy 2 code using groovy.xml.XmlUtil (test back-ported as a control)
a87810a is described below

commit a87810afe36bd4b7cc8d5649b36d0603b7fd3509
Author: Paul King <pa...@asert.com.au>
AuthorDate: Tue Jul 28 12:50:57 2020 +1000

    GROOVY-9664: Groovy 3.0 does not work with Groovy 2 code using groovy.xml.XmlUtil (test back-ported as a control)
---
 .../src/test/groovy/groovy/bugs/Groovy4285Bug.groovy     | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/subprojects/groovy-xml/src/test/groovy/groovy/bugs/Groovy4285Bug.groovy b/subprojects/groovy-xml/src/test/groovy/groovy/bugs/Groovy4285Bug.groovy
index 90250e4..86fb803 100644
--- a/subprojects/groovy-xml/src/test/groovy/groovy/bugs/Groovy4285Bug.groovy
+++ b/subprojects/groovy-xml/src/test/groovy/groovy/bugs/Groovy4285Bug.groovy
@@ -37,4 +37,20 @@ class Groovy4285Bug extends GroovyShellTestCase {
         assert serializedXml.contains('<foo>')
         assert serializedXml.contains('bar')
     }
+
+    // GROOVY-9664
+    void testXMLSerializationOfLegacyGPathResultObject() {
+        assertScript '''
+            import groovy.util.slurpersupport.NodeChild
+            import groovy.xml.XmlUtil
+
+            String xml = '<xml xmlns="http://example.com/ns"><abc><xyz>true</xyz></abc></xml>'
+            String name = 'abc'
+
+            NodeChild parsed = new XmlSlurper().parseText(xml)
+            def node = parsed."$name"
+
+            assert XmlUtil.serialize(node).contains('xyz>true</')
+        '''
+    }
 }