<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="/nw-p-run-001.xml"
        name="nw-p-run-001.xml"
        expected="pass"
        features="p-run">
   <t:info xmlns:err="http://www.w3.org/ns/xproc-error">
      <t:title>nw p-run-001</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="map(*)" select="map{'foo': 'bar'}"/>
         <p:run name="run-fix">
            <p:with-input href="../pipelines/invoked-map.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:map">The root element is not fn:map.</s:assert>
               <s:assert test="fn:map/fn:string[@key='foo'] = 'bar'">Map is incorrect.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
   <t:result name="nw-p-run-001.xml">
      <map xmlns="http://www.w3.org/2005/xpath-functions">
         <string key="foo">bar</string>
      </map>
   </t:result>
</t:test>
