Skip to content

fixup unittests and handling of non-element nodes in <include>, <if>, <macro>#48

Merged
codebot merged 5 commits intoros:indigo-develfrom
ubi-agni:fixup_unittests
Feb 19, 2015
Merged

fixup unittests and handling of non-element nodes in <include>, <if>, <macro>#48
codebot merged 5 commits intoros:indigo-develfrom
ubi-agni:fixup_unittests

Conversation

@rhaschke
Copy link
Copy Markdown
Contributor

Non-element nodes in <include>, <if>, <macro> tags were not copied. This was not noticed, because unittesting didn't consider non-element nodes either. Hence,

  • Replaced function elements_match(a,b) by nodes_match(a,b), considering text, cdata, and comment nodes and their content. (8dfa543)
  • Added test cases to check handling of non-element nodes in <if> and <macro>. (8dfa543)
  • Fixed writexml, which didn't wrote text nodes when other siblings exist. (Noticed with comment + text.) (28be222)
  • Fixed handling of non-element nodes. (91f5357)

The new handling of non-element nodes, invalidates the pr2 gold standard, because a lot more comments are maintained. To allow proper validation, modified nodes_match(a,b) to ignore comments again (394b8e6).
Finally, updated the pr2 gold standard and disabled ignoring of comments (59605fb).

- so far only element nodes (with its attributes) were considered
- now also consider TEXT, CDATA, and COMMENT nodes
- added function text_matches (normalizing consecutive whitespace to a single space)

added some new unit tests
- test_consider_non_elements:
  non-element nodes are not yet considered in <if> and <macro>
-> print all text, but skip whitespace-only text nodes
New handling of non-element nodes invalidates pr2 gold standard (adding
a lot more comments). To allow validation, allow to ignore all
comments in comparison (as before).
@codebot
Copy link
Copy Markdown
Contributor

codebot commented Feb 19, 2015

Thank you for these improvements. I think everybody was already expecting things to behave like this, and (for whatever reason) these bugs were not noticed yet. It's interesting how the "new" PR2 example has all of the top-level included comments plastered at the beginning of the file. I guess that is due to the non-ordered processing of include files, which you fixed in the next pull request.

codebot added a commit that referenced this pull request Feb 19, 2015
fixup unittests and handling of non-element nodes in <include>, <if>, <macro>
@codebot codebot merged commit 748223f into ros:indigo-devel Feb 19, 2015
@rhaschke rhaschke deleted the fixup_unittests branch April 23, 2015 08:29
@rhaschke rhaschke mentioned this pull request Jun 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants