2,546 bytes added
, 17:04, 8 March 2013
This [[Module Library|XQuery Module]] contains functions to running XQUnit annotated functions in XQuery modules.
=Conventions=
Both functions and errors in this module are assigned to the {{Code|http://basex.org/modules/xqunit}} namespace, which is statically bound to the {{Code|xqunit}} prefix.<br/>
=Functions=
==xqunit:assert==
{| width='100%'
|-
| width='90' | '''Signatures'''
|{{Func|xqunit:assert|$test as item()*|empty-sequence()}}<br />{{Func|xqunit:assert|$test as item()*, $message as xs:string|empty-sequence()}}<br />
|-
| '''Summary'''
|Asserts that the effective boolean value of the specified test is true and returns an empty sequence. Otherwise, raises an error.
|-
| '''Errors'''
|{{Error|XQUNIT0001|#Errors}} the assertion failed.<br/>{{Error|XQUNIT0002|#Errors}} the evaluated code raised an XQuery error.
|}
==xqunit:fail==
{| width='100%'
|-
| width='90' | '''Signatures'''
|{{Func|xqunit:fail|$message as xs:string|empty-sequence()}}<br />
|-
| '''Summary'''
|Raises an XQUnit error with the specified message.
|-
| '''Errors'''
|{{Error|XQUNIT0001|#Errors}} default error raised by this function.
|}
==xqunit:test==
{| width='100%'
|-
| width='90' | '''Signatures'''
|{{Func|xqunit:test||element(testsuite)*}}<br />
|-
| '''Summary'''
|Runs all functions in the current module that are annotated with {{Code|xqunit}} annotations.<br />A test report is generated and returned, which resembles the format returned by other xUnit testing frameworks, such as the Maven Surefire Plugin.
|}
==xqunit:test-libraries==
{| width='100%'
|-
| width='90' | '''Signatures'''
|{{Func|xqunit:test-libraries|$uris as xs:string*|element(testsuites)}}<br />
|-
| '''Summary'''
|Runs all functions in the specified modules that are annotated with {{Code|xqunit}} annotations.<br />A test report is generated and returned, which resembles the format returned by other xUnit testing frameworks, such as the Maven Surefire Plugin.
|}
=Errors=
{| width='100%' class="wikitable" width="100%"
! width="5%"|Code
! width="95%"|Description
|-
|{{Code|XQUNIT0001}}
|An assertion failed, or [#xqunit:fail|xqunit:fail()] was called.
|-
|{{Code|XQUNIT0002}}
|An error was raised within an XQUnit test function.
|-
|{{Code|XQUNIT0003}}
|A test function must have no arguments.
|-
|{{Code|XQUNIT0004}}
|A test function must not be updating.
|-
|{{Code|XQUNIT0005}}
|An annotation was declared twice.
|-
|{{Code|XQUNIT0006}}
|An annotation has invalid arguments.
|}
=Changelog=
This module was introduced with Version 7.7.
[[Category:XQuery]]