|
xquery version "3.1";
|
|
|
|
(: the tested library module :)
|
|
import module "x-urn:test:do-nothing"
|
|
at "test/do-nothing.xqm";
|
|
|
|
(: XSpec library modules providing tools :)
|
|
import module "http://www.jenitennison.com/xslt/xspec"
|
|
at "src/common/common-utils.xqm";
|
|
import module "urn:x-xspec:common:deep-equal"
|
|
at "src/common/deep-equal.xqm";
|
|
import module "urn:x-xspec:common:report-sequence"
|
|
at "src/common/report-sequence.xqm";
|
|
|
|
declare namespace x = "http://www.jenitennison.com/xslt/xspec";
|
|
declare namespace xs = "http://www.w3.org/2001/XMLSchema";
|
|
declare option Q{http://www.w3.org/2010/xslt-xquery-serialization}parameter-document "src/common/xml-report-serialization-parameters.xml";
|
|
declare variable $Q{http://www.jenitennison.com/xslt/xspec}xspec-uri as xs:anyURI := (
|
|
xs:anyURI("test/catch/no-by-default.xspec")
|
|
);
|
|
|
|
(: generated from the x:scenario element :)
|
|
declare function local:scenario1(
|
|
) as element(Q{http://www.jenitennison.com/xslt/xspec}scenario)
|
|
{
|
|
element { QName('http://www.jenitennison.com/xslt/xspec', 'scenario') } {
|
|
attribute { QName('', 'id') } { 'scenario1' },
|
|
attribute { QName('', 'xspec') } { 'test/catch/no-by-default.xspec' },
|
|
element { QName('http://www.jenitennison.com/xslt/xspec', 'label') } {
|
|
text { 'By default' }
|
|
},
|
|
element { QName('', 'input-wrap') } {
|
|
element { QName('http://www.jenitennison.com/xslt/xspec', 'x:call') } {
|
|
namespace { "xs" } { 'http://www.w3.org/2001/XMLSchema' },
|
|
attribute { QName('', 'function') } { 'error' },
|
|
element { QName('http://www.jenitennison.com/xslt/xspec', 'x:param') } {
|
|
namespace { "xs" } { 'http://www.w3.org/2001/XMLSchema' },
|
|
attribute { QName('', 'select') } { 'xs:QName(''my-error-code'')' }
|
|
}
|
|
}},
|
|
let $Q{urn:x-xspec:compile:impl}param-d53e1 := (
|
|
xs:QName('my-error-code')
|
|
)
|
|
let $Q{http://www.jenitennison.com/xslt/xspec}result as item()* := (
|
|
error($Q{urn:x-xspec:compile:impl}param-d53e1)
|
|
)
|
|
let $local:actual-result-report := Q{urn:x-xspec:common:report-sequence}report-sequence($Q{http://www.jenitennison.com/xslt/xspec}result, 'result')
|
|
|
|
(: invoke each compiled x:expect :)
|
|
let $local:returned-from-scenario1-expect1 := local:scenario1-expect1(
|
|
$Q{http://www.jenitennison.com/xslt/xspec}result
|
|
)
|
|
return (
|
|
$local:actual-result-report,
|
|
$local:returned-from-scenario1-expect1
|
|
)
|
|
}
|
|
};
|
|
|
|
(: generated from the x:expect element :)
|
|
declare function local:scenario1-expect1(
|
|
$Q{http://www.jenitennison.com/xslt/xspec}result as item()*
|
|
) as element(Q{http://www.jenitennison.com/xslt/xspec}test)
|
|
{
|
|
let $Q{urn:x-xspec:compile:impl}expect-d50e5 (:expected result:) := (
|
|
()
|
|
)
|
|
let $local:successful as xs:boolean :=
|
|
Q{urn:x-xspec:common:deep-equal}deep-equal($Q{urn:x-xspec:compile:impl}expect-d50e5, $Q{http://www.jenitennison.com/xslt/xspec}result, '')
|
|
return
|
|
element { QName('http://www.jenitennison.com/xslt/xspec', 'test') } {
|
|
attribute { QName('', 'id') } { 'scenario1-expect1' },
|
|
attribute { QName('', 'successful') } { $local:successful },
|
|
element { QName('http://www.jenitennison.com/xslt/xspec', 'label') } {
|
|
text { 'error in SUT should not be caught' }
|
|
},
|
|
Q{urn:x-xspec:common:report-sequence}report-sequence($Q{urn:x-xspec:compile:impl}expect-d50e5, 'expect')
|
|
}
|
|
};
|
|
|
|
(: the query body of this main module, to run the suite :)
|
|
(: set up the result document (the report) :)
|
|
document {
|
|
element { QName('http://www.jenitennison.com/xslt/xspec', 'report') } {
|
|
attribute { QName('', 'xspec') } { 'test/catch/no-by-default.xspec' },
|
|
attribute { QName('', 'query') } { 'x-urn:test:do-nothing' },
|
|
attribute { QName('', 'query-at') } { 'test/do-nothing.xqm' },
|
|
attribute { QName('', 'date') } { current-dateTime() },
|
|
(: invoke each compiled top-level x:scenario :)
|
|
let $local:returned-from-scenario1 := local:scenario1(
|
|
)
|
|
return (
|
|
$local:returned-from-scenario1
|
|
)
|
|
}
|
|
}
|