<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="/nw-p-run-002.xml"
        name="nw-p-run-002.xml"
        expected="pass"
        features="p-run">
   <t:info xmlns:err="http://www.w3.org/ns/xproc-error">
      <t:title>nw p-run-002</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2026-07-18</t:date>
            <t:author>
               <t:name>Norm Tovey-Walsh</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Added tests for p:run</p>
            </t:description>
         </t:revision>
      </t:revision-history>
   </t:info>
   <t:description xmlns="http://www.w3.org/1999/xhtml"
                  xmlns:err="http://www.w3.org/ns/xproc-error">
      <p>Test passing map to step with p:run</p>
   </t:description>
   <t:pipeline xmlns:err="http://www.w3.org/ns/xproc-error">
      <p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
         <p:output port="result"/>
         <p:variable name="params" as="array(*)" select="array{1,2,3}"/>
         <p:run name="run-fix">
            <p:with-input href="../pipelines/invoked-arr.xpl"/>
            <p:run-input port="source" primary="true">
               <p:empty/>
            </p:run-input>
            <p:run-option name="parameters" select="$params"/>
            <p:output port="result" primary="true"/>
         </p:run>
      </p:declare-step>
   </t:pipeline>
   <t:schematron xmlns:err="http://www.w3.org/ns/xproc-error">
      <s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
         <s:ns prefix="fn" uri="http://www.w3.org/2005/xpath-functions"/>
         <s:pattern>
            <s:rule context="/">
               <s:assert test="fn:array">The root element is not fn:array.</s:assert>
               <s:assert test="count(fn:array/fn:number) = 3">Wrong number of items.</s:assert>
               <s:assert test="fn:array/fn:number[1] = 1">First item is wrong.</s:assert>
               <s:assert test="fn:array/fn:number[2] = 2">Second item is wrong.</s:assert>
               <s:assert test="fn:array/fn:number[3] = 3">Third item is wrong.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
   <t:result name="nw-p-run-002.xml">
      <array xmlns="http://www.w3.org/2005/xpath-functions">
         <number>1</number>
         <number>2</number>
         <number>3</number>
      </array>
   </t:result>
</t:test>
