<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="/fileset-011.xml"
        name="fileset-011.xml"
        expected="pass">
   <t:info>
      <t:title>fileset-011</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2025-06-12</t:date>
            <t:author>
               <t:name>Norm Tovey-Walsh</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Created test.</p>
            </t:description>
         </t:revision>
      </t:revision-history>
   </t:info>
   <t:description xmlns="http://www.w3.org/1999/xhtml">
      <p>Tests contains-regexp, with encoding.</p>
   </t:description>
   <t:file-environment>
      <t:folder path="dates/jan"/>
      <t:file path="dates/jan/one.txt" last-modified="2025-01-01T01:01:00Z">one</t:file>
      <t:file path="dates/jan/two.txt" last-modified="2025-01-01T01:01:00Z">ONE two</t:file>
      <t:file path="dates/jan/three.txt" last-modified="2025-01-01T01:01:00Z">TWO three</t:file>
      <t:folder path="dates/jun"/>
      <t:file path="dates/jun/one.txt" last-modified="2025-06-01T06:01:00Z">one</t:file>
      <t:file path="dates/jun/two.txt" last-modified="2025-06-01T06:01:05Z">ONE two</t:file>
      <t:file path="dates/jun/three.txt" last-modified="2025-06-01T06:01:10Z">TWO three</t:file>
      <t:folder path="compare/a"/>
      <t:file path="compare/a/one.txt" last-modified="2025-01-01T01:01:00Z">one</t:file>
      <t:file path="compare/a/two.txt" last-modified="2025-01-01T01:01:00Z">two</t:file>
      <t:file path="compare/a/three.txt" last-modified="2025-01-01T01:01:00Z">three</t:file>
      <t:file path="compare/a/four.txt" last-modified="2025-01-01T01:01:00Z">four</t:file>
      <t:folder path="compare/b"/>
      <t:file path="compare/b/one.txt" last-modified="2025-01-01T01:01:00Z">one</t:file>
      <t:file path="compare/b/two.txt" last-modified="2025-02-02T01:01:00Z">two</t:file>
      <t:file path="compare/b/three.txt" last-modified="2025-01-01T01:01:00Z">THREE</t:file>
      <t:folder path="hier"/>
      <t:folder path="hier/one"/>
      <t:folder path="hier/one/two"/>
      <t:folder path="hier/one/two/three"/>
      <t:file path="hier/one/a.txt"/>
      <t:file path="hier/one/b.txt"/>
      <t:file path="hier/one/c.txt"/>
      <t:file path="hier/one/d.txt"/>
      <t:file path="hier/one/two/a.txt"/>
      <t:file path="hier/one/two/b.txt"/>
      <t:file path="hier/one/two/c.txt"/>
      <t:file path="hier/one/backup~"/>
      <!-- not d -->
      <t:file path="hier/one/two/three/a.txt"/>
      <t:file path="hier/one/two/three/b.txt"/>
      <t:file path="hier/one/two/three/c.txt"/>
      <t:file path="hier/one/two/three/d.other"/>
      <t:folder path="hier/one/.git"/>
      <t:file path="hier/one/.git/something">something</t:file>
      <t:folder path="glob/a"/>
      <t:file path="glob/a/a.txt"/>
      <t:file path="glob/a/b.txt"/>
      <t:file path="glob/a/c.txt"/>
      <t:file path="glob/a/d.txt"/>
      <t:folder path="glob/b"/>
      <t:file path="glob/b/a.out"/>
      <t:file path="glob/b/b.other"/>
      <t:file path="glob/b/c.out"/>
      <t:folder path="package/input/a/b/c"/>
      <t:file path="package/input/a/b/c/d.txt"/>
      <t:file path="package/input/a/b/c/e.txt"/>
      <t:folder path="package/output"/>
      <t:file path="package/output/a.b.c.d.html"/>
      <t:folder path="encoding"/>
      <t:file path="encoding/iso-8859-1.txt" encoding="ISO-8859-1">Copyright © “some date”.</t:file>
      <t:file path="encoding/utf-8.txt">Copyright © “some date”.</t:file>
      <t:folder path="content-types"/>
      <t:file path="content-types/doc.xml"/>
      <t:file path="content-types/doc.txt"/>
      <t:file path="content-types/pipe.xpl"/>
      <t:file path="content-types/image.svg"/>
      <t:file path="encoding/utf-8.txt">Copyright © “some date”.</t:file>
      <t:folder path="size"/>
      <t:file path="size/zero.txt"/>
      <t:file path="size/one.txt">1</t:file>
      <t:file path="size/two.txt">12</t:file>
      <t:file path="size/ten.txt">1234567890</t:file>
      <t:file path="size/one-hundred.txt">123456789
234567891
345678912
456789123
567891234
567891234
678912345
789123456
891234567
912345678
</t:file>
      <t:file path="size/one-thousand.txt">123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
</t:file>
      <t:file path="size/ten-twentyfour.txt">123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
12345678901234567890123
</t:file>
   </t:file-environment>
   <t:pipeline>
      <p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions"
                      xmlns:p="http://www.w3.org/ns/xproc"
                      name="main"
                      version="3.0">
         <p:import href="https://xmlcalabash.com/ext/library/fileset.xpl"/>
         <p:output port="result" sequence="true"/>
         <cx:fileset path="../testfolder/encoding">
            <p:with-input>
               <fileset>
                  <contains-regexp expression="Copy.* ©" encoding="ISO-8859-1"/>
               </fileset>
            </p:with-input>
         </cx:fileset>
      </p:declare-step>
   </t:pipeline>
   <t:schematron>
      <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 is wrong.</s:assert>
            </s:rule>
         </s:pattern>
         <s:pattern>
            <s:rule context="/c:directory">
               <s:assert test="ends-with(@xml:base, '/testfolder/encoding/')">The base URI is wrong.</s:assert>
               <s:assert test="count(c:file) = 1">Wrong number of files</s:assert>
               <s:assert test="c:file[@name = 'iso-8859-1.txt']">The wrong file was selected.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
   <t:result name="fileset-011.xml">
      <c:directory xmlns:c="http://www.w3.org/ns/xproc-step"
                   xml:base="file:///woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/extra-suite/test-suite/testfolder/encoding/"
                   name="encoding">
         <c:file xml:base="iso-8859-1.txt" name="iso-8859-1.txt"/>
      </c:directory>
   </t:result>
</t:test>
