Tests cx:find with a grep query.
Test find-002.xml is expected to pass.
<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions" xmlns:p="http://www.w3.org/ns/xproc" name="main" version="3.0" expand-text="false">
<p:import href="https://xmlcalabash.com/ext/library/find.xpl"/>
<p:output port="result"/>
<cx:find path="../documents/find" grep="price"/>
</p:declare-step>
<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
<s:ns prefix="c" uri="http://www.w3.org/ns/xproc-step"/>
<s:pattern>
<s:rule context="/">
<s:assert test="c:directory">The root isn’t a directory.</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="/c:directory">
<s:assert test="ends-with(@xml:base, '/documents/find/')">Wrong path.</s:assert>
<s:assert test="count(c:file) = 3">Wrong number of files in find/</s:assert>
<s:assert test="count(c:directory) = 1">Wrong number of directories in find/</s:assert>
<s:assert test="c:file[@name='bookstore.json']">No bookstore.json</s:assert>
<s:assert test="c:file[@name='bookstore.xml']">No bookstore.xml</s:assert>
<s:assert test="c:file[@name='mobydick.xml']">No mobydick.xml</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="/c:directory/c:directory">
<s:assert test="count(c:file) = 1">Wrong number of files in find/alt/</s:assert>
<s:assert test="c:file[@name='mobydick.altx']">No alt/mobydick.altx</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Created test.