Changes

Jump to navigation Jump to search
266 bytes removed ,  16:19, 7 December 2023
| '''Examples'''
|
* The following test does will be successful, as it does nothing (and, hence, nothing wrong):<syntaxhighlight pre lang="'xquery"'>
declare %unit:test function local:void() { () };
</syntaxhighlightpre>
* The following test will be successful, as the function body will raise <code>err:XPTY0004</code>:
<syntaxhighlight pre lang="'xquery"'>
declare %unit:test('expected', "err:XPTY0004") function local:add() {
123 + 'strings and integers cannot be added'
};
</syntaxhighlightpre>
|}
|
* The first function will be evaluated before the actual test:
<syntaxhighlight pre lang="'xquery"'>
declare %updating %unit:before("local:check") function local:before-check() {
db:create('test-db')
unit:assert(db:exists('test-db'))
};
</syntaxhighlightpre>
|}
{| width='100%'
|- valign="top"
| width='120' | '''SignaturesSignature'''|{{Func|unit:assert|$test as item()*|empty-sequence()}}<br/pre>{{Func|unit:assert|( $test as item()*, $info as item()| := ()) as empty-sequence()}}<br/pre>
|- valign="top"
| '''Summary'''
{| width='100%'
|- valign="top"
| width='120' | '''SignaturesSignature'''|{{Func|unit:assert-equals|$returned as item()*, $expected as item()*|empty-sequence()}}<br/pre>{{Func|unit:assert-equals|( $returned as item()*, $expected as item()*, $info as item()| := ()) as empty-sequence()}}<br/pre>
|- valign="top"
| '''Summary'''
{| width='100%'
|- valign="top"
| width='120' | '''SignaturesSignature'''|{{Func|unit:fail||empty-sequence()}}<br/pre>{{Func|unit:fail|( $info as item()| := ()) as empty-sequence()}}<br/pre>
|- valign="top"
| '''Summary'''
==Query==
<syntaxhighlight pre lang="'xquery"'>
module namespace test = 'http://basex.org/modules/xqunit-tests';
()
};
</syntaxhighlightpre>
By running {{Code|TEST tests.xqm}}, the following report will be generated (timings may differ):
==Result==
<syntaxhighlight pre lang="xml">
<testsuites time="PT0.256S">
<testsuite name="file:///C:/Users/user/Desktop/test.xqm" time="PT0.212S" tests="8" failures="4" errors="1" skipped="1">
</testsuite>
</testsuites>
</syntaxhighlightpre>
=Errors=
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu