@@ -14,6 +14,7 @@ import module namespace helper = "http://marklogic.com/roxy/test-helper" at "/te
1414declare namespace t="http://marklogic.com/roxy/test" ;
1515
1616declare variable $FS-PATH as xs:string := if (xdmp:platform () eq "winnt" ) then "\" else "/" ;
17+ declare variable $XSL-PATTERN as xs:string := "\.xslt?$" ;
1718declare variable $TEST-SUITES-ROOT := "/test/suites/" ;
1819declare variable $db-id as xs:unsignedLong := xdmp:modules-database ();
1920declare variable $root as xs:string := xdmp:modules-root ();
@@ -45,14 +46,14 @@ declare function list()
4546 $path)
4647 let $main-formats as xs:string* :=
4748 if ($db-id = 0 ) then
48- xdmp:filesystem-directory (fn:concat ($root, $FS-PATH, "test/formats" ))/dir:entry[dir:type = "file" and fn:not (dir:filename = $test-ignore-list)]/dir:filename[fn:ends-with (., ".xsl" )]
49+ xdmp:filesystem-directory (fn:concat ($root, $FS-PATH, "test/formats" ))/dir:entry[dir:type = "file" and fn:not (dir:filename = $test-ignore-list)]/dir:filename[fn:matches (., $XSL-PATTERN )]
4950 else
5051 let $uris := helper:list-from-database ($db-id, $root, (), 'formats' )
5152 return
5253 fn:distinct-values (
5354 for $uri in $uris
5455 let $path := fn:replace ($uri, fn:concat ($root, "test/formats/" ), "" )
55- where $path ne "" and fn:not (fn:contains ($path, "/" )) and fn:not ($path = $test-ignore-list) and (fn:ends-with ($path, ".xsl" ))
56+ where $path ne "" and fn:not (fn:contains ($path, "/" )) and fn:not ($path = $test-ignore-list) and (fn:matches ($path, $XSL-PATTERN ))
5657 return
5758 $path)
5859 return (
@@ -70,19 +71,6 @@ declare function list()
7071 where $path ne "" and fn:not (fn:contains ($path, "/" )) and fn:not ($path = $test-ignore-list) and (fn:ends-with ($path, ".xqy" ) or fn:ends-with ($path, ".sjs" ))
7172 return
7273 $path)
73- let $formats as xs:string* :=
74- if ($db-id = 0 ) then
75- xdmp:filesystem-directory (fn:concat ($root, $FS-PATH, "test/suites/" , $suite, "/formats" ))/dir:entry[dir:type = "file" and fn:not (dir:filename = $test-ignore-list)]/dir:filename[fn:ends-with (., ".xsl" )]
76- else
77- let $uris := helper:list-from-database (
78- $db-id, $root, fn:concat ($suite, '/formats/' ), 'suites' )
79- return
80- fn:distinct-values (
81- for $uri in $uris
82- let $path := fn:replace ($uri, fn:concat ($root, "test/suites/" , $suite, "/formats/" ), "" )
83- where $path ne "" and fn:not (fn:contains ($path, "/" )) and fn:not ($path = $test-ignore-list) and (fn:ends-with ($path, ".xsl" ))
84- return
85- $path)
8674 where $tests
8775 return
8876 element t:suite {
@@ -93,16 +81,7 @@ declare function list()
9381 element t:test {
9482 attribute path {$test}
9583 }
96- },
97- if ($formats) then
98- element t:formats {
99- for $format in $formats
100- return
101- element t:format {
102- attribute path {$format}
103- }
104- }
105- else ()
84+ }
10685 },
10786 if ($main-formats) then
10887 element t:formats {
@@ -256,12 +235,15 @@ declare function format($result as element(), $format as xs:string, $suite as xs
256235 if ($format eq "junit" ) then
257236 format-junit ($suite)
258237 else
259- let $format-uris := helper:list-from-database ($db-id, $root, (), 'formats' )
260- let $suite-format-uris := helper:list-from-database ($db-id, $root, $suite || '/formats/' , 'suites' )
238+ let $format-uris :=
239+ if ($db-id = 0 ) then
240+ xdmp:filesystem-directory (fn:concat ($root, $FS-PATH, "test/formats" ))/dir:entry[dir:type = "file" ]/dir:filename[fn:matches (., $XSL-PATTERN)]
241+ else
242+ helper:list-from-database ($db-id, $root, (), 'formats' )
261243 let $xsl-match :=
262- for $uri in ( $format-uris, $suite-format-uris)
244+ for $uri in $format-uris
263245 return
264- if (fn:matches (fn:tokenize ($uri, '/' )[fn:last ()], '^' || $format || '(\.xsl)?$' )) then $uri
246+ if (fn:matches (fn:tokenize ($uri, '/' )[fn:last ()], '^' || $format || $XSL-PATTERN )) then $uri
265247 else ()
266248 return
267249 if ($xsl-match) then
0 commit comments