Changes

Jump to navigation Jump to search
197 bytes added ,  20:23, 23 May 2014
<pre class='brush:xquery'>
module namespace test = 'http://basex.org/modules/xqunit-tests';
 
(:~ Initializing function, which is called once before all tests. :)
declare %unit:before-module function unittest:before-all-tests() {
()
};
(:~ Initializing function, which is called once after all tests. :)
declare %unit:after-module function unittest:after-all-tests() {
()
};
(:~ Initializing function, which is called before each test. :)
declare %unit:before function unittest:before() {
()
};
(:~ Initializing function, which is called after each test. :)
declare %unit:after function unittest:after() {
()
};
(:~ Function demonstrating a successful test. :)
declare %unit:test function unittest:assert-success() {
unit:assert(<a/>)
};
(:~ Function demonstrating a failure using unit:assert. :)
declare %unit:test function unittest:assert-failure() {
unit:assert((), 'Empty sequence.')
};
(:~ Function demonstrating a failure using unit:assert-equals. :)
declare %unit:test function unittest:assert-equals-failure() {
unit:assert-equals(4 + 5, 6)
};
(:~ Function demonstrating an unexpected success. :)
declare %unit:test("expected", "FORG0001") function unittest:unexpected-success() {
()
};
(:~ Function demonstrating an expected failure. :)
declare %unit:test("expected", "FORG0001") function unittest:expected-failure() {
1 + <a/>
};
(:~ Function demonstrating the creation of a failure. :)
declare %unit:test function unittest:failure() {
unit:fail("Failure!")
};
(:~ Function demonstrating an error. :)
declare %unit:test function unittest:error() {
1 + <a/>
};
(:~ Skipping a test. :)
declare %unit:test %unit:ignore("Skipped!") function unittest:skipped() {
()
};
 
()
</pre>
<pre class='brush:xml'>
<testsuites time="PT0.03S"> <testsuite name="file:///CD:/UsersBaseX/code/basex/basex-core/src/usertest/Desktopresources/xtest.xqxqm" time="PT0SPT0.029S" tests="8" failures="4" errors="1" skipped="1"> <testcase name="assert-success" time="PT0SPT0.005S"/> <testcase name="assert-failure" time="PT0SPT0.003S"> <failure line="2830" column="15" type="UNIT0001">Empty sequence.</failure> </testcase> <testcase name="assert-equals-failure" time="PT0SPT0.003S"> <failure line="3335" column="22"> <returned item="1">9</returned> <expected item="1">6</expected> </failure> </testcase> <testcase name="unexpected-success" time="PT0SPT0.003S"> <failure> <expected>FORG0001</expected> </failure> </testcase> <testcase name="expected-failure" time="PT0SPT0.002S"/> <testcase name="failure" time="PT0SPT0.003S"> <failure line="4850" column="13" type="UNIT0001">Failure!</failure> </testcase> <testcase name="error" time="PT0SPT0.002S"> <error line="5355" column="6" type="FORG0001">Invalid xs:double cast: "".</error> </testcase> <testcase name="skipped" skipped="Skipped!" time="PT0S"/> </testsuite></testsuites>
</pre>
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu