Skip Menu |

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

Report information
The Basics
Id: 12853
Status: new
Priority: 0/
Queue: Test-XML

People
Owner: Nobody in particular
Requestors: edward [...] debian.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)

Attachments
test-xml-xpath-number-patch



Subject: is_xpath doesn't compare numbers correctly
Distribution name and version: Test-XML-0.06 Perl version: v5.8.6 Operating System vendor and version: FreeBSD 5.3-RELEASE Mininal test case: is_xpath( '<foo>bar</foo>', 'count(/foo)', 1 ); Output: not ok 1 # Failed test (./test.pl at line 6) # got: '1' # expected: '1' # evaluating: count(/foo) # against: <foo>bar</foo> Normally when using is_xpath the got value evaluates to an XML::XPath::Literal which can be compared with the expected string. In this case it evaluates to an XML::XPath::Number. Here is some Test::Builder code that demonstrates the problem: my $Test = Test::Builder->new; $Test->is_eq(XML::XPath::Literal->new("bar"), "bar"); # PASS $Test->is_eq(XML::XPath::Number->new(1), 1); # FAIL $Test->is_num(XML::XPath::Number->new(1), 1); # PASS So maybe you need to run $Test->is_eq if you get an XML::XPath::Literal and run $Test->is_num if you get an XML::XPath::Number. I've attached a patch with a Test case and a fix.
Download test-xml-xpath-number-patch
application/octet-stream 2k

Message body not shown because it is not plain text.