This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 3337 - K-NodeSame-2, K-NodeBefore-2 and K-NodeAfter-2 can also execute without errors
Summary: K-NodeSame-2, K-NodeBefore-2 and K-NodeAfter-2 can also execute without errors
Status: CLOSED FIXED
Alias: None
Product: XML Query Test Suite
Classification: Unclassified
Component: XML Query Test Suite (show other bugs)
Version: 0.9.4
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Frans Englich
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-16 12:20 UTC by Alberto Massari
Modified: 2006-06-27 18:55 UTC (History)
0 users

See Also:


Attachments

Description Alberto Massari 2006-06-16 12:20:46 UTC
These tests compare () with a non-node item, and expect the error XPTY0004; but the specs say:

3.5.3 Node Comparisons
...
If either operand is an empty sequence, the result of the comparison is an empty sequence, and the implementation need not evaluate the other operand or apply the operator. However, an implementation may choose to evaluate the other operand in order to determine whether it raises an error.

So an implementation may not see the "1" as the second operand, and report () as the result.
The queries should be rewritten as "(() is 1) eq ()" in order to avoid an empty file as result, and expect either XPTY0004 as an error or "true" as result
Comment 1 Frans Englich 2006-06-16 16:10:22 UTC
Hi Alberto,

I believe you are correct in that these tests are wrong, that they can evaluate successfully as well. Actually, K-NodeSame-1, K-NodeBefore-1 and K-NodeAfter-1 have the same error, they just have their operands in the opposite order.

However, I doubt the proposed solution, (() is 1) eq (), would work because, '() eq ()' doesn't evaluate to "true", but to the empty sequence. See 3.5.1 Value Comparisons, the second bullet point. I think a correct fix is: empty(() is 1)

Nevertheless, I could of course very well be wrong on this, so feel free to comment.

Frans
Comment 2 Alberto Massari 2006-06-16 16:25:34 UTC
Hi Frans,
you are right on the behavior of 'eq'; you can choose to use empty(), or you can choose to do 'instance of empty-sequence()'. Either way should work fine.

Thanks,
Alberto
Comment 3 Frans Englich 2006-06-16 17:08:30 UTC
Fixed in CVS. Thanks for reporting this.

Frans
Comment 4 Frans Englich 2006-06-27 18:55:54 UTC
Since this report was resolved as suggested, I am changing status to CLOSED. Feel free to reopen if the resolution was incorrectly implemented, for example.


Frans