[Bug 3532] fn-collection tests

http://www.w3.org/Bugs/Public/show_bug.cgi?id=3532





------- Comment #10 from davidc@nag.co.uk  2006-07-25 16:46 -------
> When we added tests for fn:collection, we decided to use the same mechanism,

The problem is that it's not the same mechanism, it just looks similar, and
it's being  used for an entirely different purpose.

In the rest of the test suite the implementer is _allowed_ to edit the query if
necessary (it is very unlikely to be necessary as support for external
variables is mandatory, so just running the query as is, while supplying the
variable values should work in all cases)

In the case of the doc and collection functions the implementer is _forced_ to
edit the query as the query, as distributed, does not test the specified
feature.

As pointed out in comment #5 the edits required to make this work in the case
of
fn-collection-10 are _far_ more invasive than edits required in other cases.
the edits are not resticted to just editing a variable definition between the
marker comments to supply a value, every occurrence of the variable in the
whole test has to be replaced by a call to collection()

In my test harnes I (effectively) edit the query to say

declare variable $input-context := collection('zzzz')


let $c1 := $input-context
let $c2 := $input-context 
....

But then as Michael points out, collection() is only being called once so the
test is not testing its stability. Instead the test must be edited to say



let $c1 := collection('zzzz')
let $c2 := collection('zzzz')

with the edits happening within the expression body I don't think it's
reasonable to expect the test harness to do this.

Why can't the doc and collection tests have the much simpler structure so that
they look like

(: Name: fn-collection-10 :)
(: Description: Test that two uses of fn:collection are stable.:)

(: insert-start :)
declare variable $input-uri external;
(: insert-end :)

let $c1 := collection($input-uri)
let $c2 := collection($input-uri)
for $c at $p in $c1
return $c is $c2[$p]


so that, as in all other cases, it is not _necessary_ to edit the query text,
and it is sufficient just to pass in a value for the external variable (which
the catalog would specify needs to be set to a system specific uri denoting the
collection)

David

Received on Tuesday, 25 July 2006 16:46:16 UTC