This repository has been archived by the owner on Nov 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
On failed assertion, return a stack trace instead of throwing an exce…
…ption
- Loading branch information
Showing
13 changed files
with
93 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import module namespace test="http://marklogic.com/roxy/test-helper" at "/test/test-helper.xqy"; | ||
import module namespace tlib = "http://marklogic.com/roxy/unit-test-tests" at "lib/testing-lib.xqy"; | ||
|
||
declare function local:case1() | ||
{ | ||
test:assert-not-exists("a") | ||
}; | ||
|
||
test:assert-not-exists(()), | ||
test:assert-throws-error(xdmp:function(xs:QName("local:case1")), "ASSERT-NOT-EXISTS-FAILED") | ||
tlib:test-for-failure(local:case1(), "ASSERT-NOT-EXISTS-FAILED") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import module namespace test="http://marklogic.com/roxy/test-helper" at "/test/test-helper.xqy"; | ||
import module namespace tlib = "http://marklogic.com/roxy/unit-test-tests" at "lib/testing-lib.xqy"; | ||
|
||
declare function local:case1() | ||
{ | ||
test:fail('i failed') | ||
}; | ||
|
||
test:assert-throws-error(xdmp:function(xs:QName("local:case1")), "USER-FAIL") | ||
tlib:test-for-failure(local:case1(), "USER-FAIL") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
xquery version "1.0-ml"; | ||
|
||
module namespace tlib = "http://marklogic.com/roxy/unit-test-tests"; | ||
|
||
import module namespace test="http://marklogic.com/roxy/test-helper" at "/test/test-helper.xqy"; | ||
|
||
declare option xdmp:mapping "false"; | ||
|
||
(: | ||
: Call a function and verify that a function generates the failure XML. | ||
:) | ||
declare function tlib:test-for-failure($actual, $error-name as xs:string?) | ||
{ | ||
test:assert-equal("{http://marklogic.com/roxy/test}result", xdmp:key-from-QName(fn:node-name($actual))), | ||
test:assert-equal("fail", $actual/@type/fn:string()), | ||
if ($error-name) then | ||
test:assert-equal($error-name, $actual/error:error/error:name/fn:string()) | ||
else () | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters