Fix attribute comparison#18
Open
h4l wants to merge 4 commits into
Open
Conversation
It's now more robust, pretty-data didn't normalise XML properly (e.g. wrapped attributes were not normalised). Now all whitespace is stripped and the document elements re-indented (though respecting xml:space="preserve"). The XML is serialised with C14N (https://www.w3.org/TR/2001/REC-xml-c14n-20010315) making it safe to compare as character strings. This fixes: kbiedrzycki#17
Integration tests are run with $ yarn run integration-test The integration tests check that the package can be installed and used. (i.e. the matcher function exists and works as expected). In particular it checks that the behaviour is correct when invalid XML is compared, as it's hard to reliably test that in the normal unit tests. The module is packed into a tgz which is installed in a fresh environment (unconnected to the project repo), which is used to run the integration tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a fix for #17
The
pdlibrary didn't reformat attributes, so differences in attributes were being picked up as actual differences when diffing lines.I re-implemented the XML formatting stage prior to diffing; it's more robust now (e.g. uses XML Canonicalisation when serialising) and should be easier to tweak in the future if required.