Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapted import XQuery function tests #768

Merged
merged 2 commits into from
Dec 6, 2024
Merged

Adapted import XQuery function tests #768

merged 2 commits into from
Dec 6, 2024

Conversation

ndw
Copy link
Contributor

@ndw ndw commented Dec 5, 2024

My implementation can only import XQuery library modules. I've adapted the relevant XQuery import function tests to import library modules. I think I got them all correct, but it was a bit of a tedious task. I can't run tests 25, 26, or 31, so those might be wrong.

@xml-project I'd be curious if you can run them and if they all pass...

@ndw ndw requested a review from xml-project December 5, 2024 18:10
@ndw
Copy link
Contributor Author

ndw commented Dec 6, 2024

Several of these tests throw err:XS0107 but in light of the change we made for ab-function-library-importable-004, shouldn't these throw err:XD0050 as well?

@ndw
Copy link
Contributor Author

ndw commented Dec 6, 2024

Perhaps not, as they're supposed to be detected statically...

@xml-project
Copy link
Member

@ndw I have problems to pass some of these tests as they imply that err:XS0107 can be caughed. My processor can catch static errors. I will try to rewrite them for me so I can test the essence of the tests.

@ndw
Copy link
Contributor Author

ndw commented Dec 6, 2024

I think this is another case where what we really need is a dynamic XPath error (See xproc/3.0-specification#1117). There are two options (looking at nw-import-functions-002 for example):

  1. The error should be detected statically and the pipeline shouldn't compile. That's probably not the best answer because a user might have fallback (using try/catch) for the case where a function wasn't provided.
  2. The error should be detected dynamically (which is, in fact, what I'm doing ), in which case it's illogical for it to be an XS error.

Let's see if we can sort out the error codes. But I'll merge this in the short term.

@ndw ndw merged commit e862929 into xproc:master Dec 6, 2024
@xml-project
Copy link
Member

@ndw

The error should be detected statically and the pipeline shouldn't compile. That's probably not the best answer because a user might have fallback (using try/catch) for the case where a function wasn't provided.

I think the current way to do this is using fn:function-lookup () or in the more general case p:function-library-importable().

In general I would agree that errors from calling invisble functions should be a dynamic error. Since we have function items and variables in XPath 3.1, lot of the errors will be detectable only dynamically.

@xml-project
Copy link
Member

xml-project commented Dec 6, 2024 via email

@ndw ndw deleted the xquery-lib branch December 6, 2024 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants