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 17188 - [QT3TS] environment-variable-001
Summary: [QT3TS] environment-variable-001
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 3 & XPath 3 Test Suite (show other bugs)
Version: Working drafts
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Liam R E Quin
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-25 13:09 UTC by Tim Mills
Modified: 2012-05-31 08:15 UTC (History)
1 user (show)

See Also:


Attachments

Description Tim Mills 2012-05-25 13:09:01 UTC
The test

  <test>fn:exists(fn:available-environment-variable#1)</test>

was probably meant to be

  <test>fn:exists(environment-variable#1)</test>
Comment 1 Tim Mills 2012-05-25 13:11:49 UTC
Also environment-variable-002 is wrong.

fn:function-lookup(fn:environment-variable, 1)

should be

fn:function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'environment-variable'), 1)
Comment 2 Tim Mills 2012-05-25 13:14:03 UTC
Also environment-variable-003 and 004 were probably meant to refer to fn:environment-variable and not available-environment-variables.
Comment 3 Liam R E Quin 2012-05-25 13:56:16 UTC
Darn, I'm checking how I tested them with BaseX. Well, testing wouldn't tell me I had a wrong function name (the joys of paste) and maybe BaseX is more tolerant..

We should have a separate test that makes sure functions that require QNames don't also accept strings, e.g. function-lookup(function-lookup#0) should presumably be an error. Or we should allow string (which I'd prefer I think) although not function items :)

Well, I've committed the changes, thanks for the report!

If the test work now please close the bug.
Comment 4 Tim Mills 2012-05-25 14:46:01 UTC
In test environment-variable-006

let $all := fn:available-environment-variables()
          return empty($all) or
              ($all = "QTTEST2"
               and (fn:environment-variable("QTTEST2") eq "other")
               and (not("other" eq "42")))

I think you may have forgotten a call to environment-variable, in particular near,

 "other" eq "42"

!


In fn-available-environment-variables-002, there's a bracket in the wrong place.

not(fn:empty(fn:function-lookup(
          fn:QName('http://www.w3.org/2005/xpath-functions',
          'available-environment-variables', 0))))

should be

not(fn:empty(fn:function-lookup(
          fn:QName('http://www.w3.org/2005/xpath-functions',
          'available-environment-variables'), 0)))
Comment 5 Liam R E Quin 2012-05-25 15:05:54 UTC
I think you may have forgotten a call to environment-variable, in particular
> near,
> 
>  "other" eq "42"

No, that's deliberate, although maybe I should have commented it, and it's almost certainly not really necessary, I doubt we'll have malicious implementations around.

It weeds out implementations that say sring1 eq "string2" is always constant. Maybe needsless paranoia on my part.


> In fn-available-environment-variables-002, there's a bracket in the wrong place.
fixed, thanks!
Comment 6 Tim Mills 2012-05-25 15:25:04 UTC
(In reply to comment #5)
> I think you may have forgotten a call to environment-variable, in particular
> > near,
> > 
> >  "other" eq "42"
> 
> No, that's deliberate, although maybe I should have commented it, and it's
> almost certainly not really necessary, I doubt we'll have malicious
> implementations around.
> 
> It weeds out implementations that say sring1 eq "string2" is always constant.
> Maybe needsless paranoia on my part.

Then perhaps the expected result is wrong?

Either

a) $all is empty - query will return true
b) $all contains QTTEST2, QTTEST2 maps to "other" and "other" isn't the same as "42" - query will return true.

But the expected result is false.
Comment 7 Liam R E Quin 2012-05-30 02:22:37 UTC
fixed - maybe my career as a test-writer will be short-lived! :-)

(although I hope not) true was indeed intended. Thanks!
Comment 8 Tim Mills 2012-05-31 08:15:28 UTC
Confirmed fixed.