Skip Menu |

This queue is for tickets about the Test-XML-Ordered CPAN distribution.

Report information
The Basics
Id: 88994
Status: resolved
Priority: 0/
Queue: Test-XML-Ordered

People
Owner: Nobody in particular
Requestors: NGLENN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.0.5
Fixed in: (no value)



Subject: compare attributes (and other types of nodes?)
The following passes, and I definitely do not think it should: use Test::More; plan tests => 1; use Test::XML::Ordered qw(is_xml_ordered); is_xml_ordered( [string => '<xml stuff="foo"/>'], [string => '<xml/>'], 'XML structure' ); The attribute is ignored altogether, which I feel is very bad. This is not documented, and the only compared module, Test::XML, does catch this error.
On Fri Sep 27 00:31:14 2013, NGLENN wrote: Show quoted text
> The following passes, and I definitely do not think it should: > use Test::More; > plan tests => 1; > use Test::XML::Ordered qw(is_xml_ordered); > is_xml_ordered( > [string => '<xml stuff="foo"/>'], > [string => '<xml/>'], > 'XML structure' > ); > > The attribute is ignored altogether, which I feel is very bad. This is > not documented, and the only compared module, Test::XML, does catch > this error.
Hi NGLENN, thanks for the report. I'll try to investigate. Regards, -- Shlomi Fish
On Fri Sep 27 00:48:47 2013, SHLOMIF wrote: Show quoted text
> On Fri Sep 27 00:31:14 2013, NGLENN wrote:
> > The following passes, and I definitely do not think it should: > > use Test::More; > > plan tests => 1; > > use Test::XML::Ordered qw(is_xml_ordered); > > is_xml_ordered( > > [string => '<xml stuff="foo"/>'], > > [string => '<xml/>'], > > 'XML structure' > > ); > > > > The attribute is ignored altogether, which I feel is very bad. This is > > not documented, and the only compared module, Test::XML, does catch > > this error.
> > Hi NGLENN, > > thanks for the report. I'll try to investigate. > > Regards, > > -- Shlomi Fish >
This should be fixed in Test-XML-Ordered-0.0.6 which was just uploaded to CPAN, so I'm resolving this ticket. Apparently, previously the comparison ignored attributes. Regards, -- Shlomi Fish
Thank you for getting to this so quickly! The following still passes, however: use Test::More; plan tests => 1; use Test::XML::Ordered qw(is_xml_ordered); is_xml_ordered( [string => '<xml stuff="foo"/>'], [string => '<xml stuff="bar"/>'], 'XML structure' ); Also, since I put "and other types of nodes?" in parentheses, I decided to check the other types that didn't seem accounted for (PIs and comments). The current behavior for both of these is to fail when the node is present in one document and not in the other (because a comparison of the node type is done), but to ignore the value, which I believe is incorrect. The following passes: use Test::More; plan tests => 1; use Test::XML::Ordered qw(is_xml_ordered); is_xml_ordered( [string => '<xml><?FOO stuff?></xml>'], [string => '<xml><?FOO bar?></xml>'], 'XML structure' ); This one also passes: use Test::More; plan tests => 1; use Test::XML::Ordered qw(is_xml_ordered); is_xml_ordered( [string => '<xml><!--stuff--></xml>'], [string => '<xml><!--bar--></xml>'], 'XML structure' ); It's possible that you'll want to ignore comments altogether, though, but even then the current behavior is incorrect (failing when comment is present in one and not the other).
Hi Nathan, On Sat Sep 28 13:55:16 2013, NGLENN wrote: Show quoted text
> Thank you for getting to this so quickly! The following still passes, > however: >
all of these counter-examples are pertinent here, but they belong in different bug reports/tickets. Are you going to file them or do you want me to do it? Regards, -- Shlomi Fish [SNIPPED]
I can do it. I kinda thought that the attribute one would be in the same ticket, since comparing attributes was what the original ticket was about. On Sat Oct 05 01:41:01 2013, SHLOMIF wrote: Show quoted text
> Hi Nathan, > > all of these counter-examples are pertinent here, but they belong in > different bug reports/tickets. Are you going to file them or do you > want me to do it? > > Regards, > > -- Shlomi Fish > > [SNIPPED]