Add some simple traversal tests

At first I misunderstood how libxml2 work, so I've tried to fix `parse_str()` to prevent memory corruption or leak. This commit is a by-product of the work, because there were no test cases like that before.

These tests are trivial, but they might be possible to prevent a regression.