Skip to content

Fix attribute comparison#18

Open
h4l wants to merge 4 commits into
kbiedrzycki:masterfrom
h4l:fix-attribute-comparison
Open

Fix attribute comparison#18
h4l wants to merge 4 commits into
kbiedrzycki:masterfrom
h4l:fix-attribute-comparison

Conversation

@h4l

@h4l h4l commented Sep 23, 2019

Copy link
Copy Markdown

This is a fix for #17

The pd library 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.

h4l added 4 commits September 20, 2019 08:24
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.
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.

1 participant