[Bug 7036] New: bug in test case K2-NameTest-84 ?


           Summary: bug in test case K2-NameTest-84 ?
           Product: XML Query Test Suite
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XML Query Test Suite
        AssignedTo: andrew.eisenberg@us.ibm.com
        ReportedBy: bogdanb+w3c+bugzilla@gmail.com
         QAContact: public-qt-comments@w3.org

Hello! I'm using a version of the test suite taken from the CVS about a week
ago. I might be misusing it, I apologize if that's the case.

Test case “K2-NameTest-84” (in cat/NameTest.xml) reads:

(: Test: K2-NameTest-84                                  :)
(: Written by: Frans Englich                             :)
(: Date: 2007-11-22T11:31:21+01:00                       :)
(: Purpose: Axis names are reserved function names.      :)
declare default function namespace "http://www.example.com/";
    declare function element()
(: end test case quote :)

The test case expects the error XPST0003 (i.e., the expression is not a valid
instance of the XQuery grammar), but does not cite any spec for that. I fail to
find anything relevant in both the XQuery 1.0 and 1.1 (draft) specs.

As far as I can tell, Appendix 3 “Reserved Function Names” (in both specs)
refers only to function calls. Furthermore, it does not actually specify an
interdiction but an impossibility: it only disambiguates the grammar, which is
why there is no error code given.

Production “FunctionDecl” (number 26 in 1.0 and 32 in 1.1) doesn't have the
“reserved-function-names” annotation. The extra-grammatical constraint
specifies that “it is not legal syntax for a user to invoke functions with
unprefixed names which match any of the names in A.3”. (Note that this
specifically says “invoking”, not “declaring”, a function.)

By my reading, the query above defines the function “element” in namespace
“http://www.example.com”, and then goes on and returns the value of
“./child::element()” (i.e., the body is a PathExpr consisting of a single
AbbrevForwardStep with an ElementTest).

The correct error code would be XPDY0002, since the context element is not
defined; however, one supposes that's not what the test case attempts to test.
The syntax error expected could only arise if the function's arity would be
greater than zero, and it were called with an argument that is not a QName.

Note that while the function cannot be called in the test case as written, a
function declared with an unprefixed but reserved name can actually called, for
instance as below:

(: example :)
declare default function namespace "http://www.example.com/";
declare namespace NS = "http://www.example.com/";
declare function element() { 1 };
(: end example :)

I suggest to change the test to the following:

(: suggestion :)
declare default function namespace "http://www.example.com/";
declare function element($arg) { $arg };
(: end example :)

Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Sunday, 21 June 2009 03:48:23 UTC