<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="cmdline-004.xml"
        name="cmdline-004.xml"
        expected="pass">
   <t:info>
      <t:title>cmdline-004</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2026-02-22</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>Simple test of the command-line testing framework.</p>
   </t:description>
   <t:pipeline arguments="--pipe --output-multiplex:output.mime">
      <p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
                      xmlns:xs="http://www.w3.org/2001/XMLSchema"
                      version="3.0"
                      name="main">
         <p:output port="result" primary="true"/>
         <p:output port="alternate" pipe="@alt"/>
         <p:identity name="alt">
            <p:with-input>
               <doc>alternate</doc>
            </p:with-input>
         </p:identity>
         <p:identity>
            <p:with-input>
               <doc>primary</doc>
            </p:with-input>
         </p:identity>
      </p:declare-step>
   </t:pipeline>
   <t:schematron>
      <s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
         <s:pattern>
            <s:rule context="/">
               <s:assert test="directory">The root is wrong.</s:assert>
            </s:rule>
         </s:pattern>
         <s:pattern>
            <s:rule context="/directory">
               <s:assert test="count(*) = 2">Wrong number of results</s:assert>
               <s:assert test="mime[@uri='output.mime']">No MIME</s:assert>
               <s:assert test="file[@uri='_stdout']">No stdout</s:assert>
            </s:rule>
         </s:pattern>
         <s:pattern>
            <s:rule context="/directory/mime">
               <s:assert test="count(part) = 2">Wrong number of parts</s:assert>
               <s:assert test="empty(part[@port='alternate']/body/headers/node())">Alternate is wrong</s:assert>
               <s:assert test="part[@port='alternate']/body/doc[. = 'alternate']">Alternate is wrong</s:assert>
               <s:assert test="empty(part[@port='result']/body/headers/node())">Result is wrong</s:assert>
               <s:assert test="part[@port='result']/body/doc[. = 'primary']">Result is wrong</s:assert>
            </s:rule>
         </s:pattern>
         <s:pattern>
            <s:rule context="/directory/file[@uri='_stdout']">
               <s:assert test="string(.) = ''">Stdout should be empty</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
</t:test>
