Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.3.7
-
None
-
None
-
Ubuntu 13.04, Groovy Console.
Description
I've migrated from Grails 2.2.5 (Groovy 2.0.8) to Grails 2.4.4 (Groovy 2.3.7) and some of my tests related to XmlSlurper start fail.
Maybe it's normal behavior for now, but doesn't look so. Here is an simple example which easily can be run in groovy console.
def testedXml = ''' <a> <b> <c>some cool text</c> </b> </a> ''' def root = new XmlSlurper().parseText(testedXml) def dNode = root.b.c.d //Use-case #1 assert dNode.isEmpty() assert dNode.parent().name() == 'c' def cNode = dNode.parent() assert cNode.name() == 'c' // assume that node 'c' has node 'b' as parent assert cNode.parent().name() == 'b' // FAILED! //Use-case #2 // Even if we try to convert from NodeParents to exect node. cNode = dNode.parent().getAt(0) assert cNode.name() == 'c' // assume that parent for node 'c' is 'b' assert cNode.parent().name() == 'b'// FAILED!