Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix XPath index calculation for XML comparison #1273

Merged
merged 3 commits into from Mar 21, 2020

Conversation

@lg2de
Copy link
Contributor

lg2de commented Mar 20, 2020

Last year I provided rework of the assertion failure message when comparing XML by introducing XPath index.
Now I found that the current implementation can generate invalid XPath. The index could should apply to the parent.

This PR replaces #1272 to target 5.X

Input

Compare

<root>
  <xml1 />
  <xml1><xml2 /><xml2 a=\"x\" /></xml1>
  <xml1>
    <xml2 />
    <xml2 a=\"x\" />
  </xml1>
</root>

with

<root>
  <xml1 />
  <xml1><xml2 /><xml2 a=\"x\" /></xml1>
  <xml1>
    <xml2 />
    <xml2 a=\"y\" /> <!-- note the different attribute -->
  </xml1>
</root>

Expected behavior

Expected attribute "a" at "/root/xml1[3]/xml2[2]" to have value "y", but found "x".

Actual behavior

Expected attribute "a" at "/root/xml1[3]/xml2[4]" to have value "y", but found "x".

@dennisdoomen dennisdoomen requested a review from jnyrup Mar 20, 2020
Copy link
Collaborator

jnyrup left a comment

Just to small typos and thanks for adding the missing release notes 👍

docs/_pages/releases.md Outdated Show resolved Hide resolved
docs/_pages/releases.md Outdated Show resolved Hide resolved
docs/_pages/releases.md Outdated Show resolved Hide resolved
docs/_pages/releases.md Outdated Show resolved Hide resolved
@lg2de lg2de force-pushed the lg2de:XmlAssert5X branch from e6ab77d to 357578e Mar 20, 2020
@jnyrup
jnyrup approved these changes Mar 20, 2020
@jnyrup jnyrup merged commit 4787885 into fluentassertions:master Mar 21, 2020
1 check passed
1 check passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
@lg2de lg2de deleted the lg2de:XmlAssert5X branch Mar 21, 2020
@dennisdoomen

This comment has been minimized.

Copy link
Member

dennisdoomen commented Mar 21, 2020

@lg2de would you be willing to create a pull request from master to develop that resolves the conflicts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.