<?xml version="1.0" encoding="UTF-8"?>
<t:test xmlns:cxerr="http://xmlcalabash.com/ns/error"
        xmlns:t="http://xproc.org/ns/testsuite/3.0"
        expected="fail" code="cxerr:XI0038">
  <t:info>
    <t:title>cache-006</t:title>
    <t:revision-history>
      <t:revision>
        <t:date>2026-05-10</t:date>
        <t:author>
          <t:name>Norm Tovey-Walsh</t:name>
        </t:author>
        <t:description xmlns="http://www.w3.org/1999/xhtml">
          <p>Fixed title.</p>
        </t:description>
      </t:revision>
      <t:revision>
        <t:date>2024-11-29</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 that the document can be removed from the cache.</p>
  </t:description>
  <t:pipeline>
    <p:declare-step version="3.0"
                    xmlns:err="http://www.w3.org/ns/xproc-error"
                    xmlns:cx="http://xmlcalabash.com/ns/extensions"
                    xmlns:p="http://www.w3.org/ns/xproc">
      <p:import href="https://xmlcalabash.com/ext/library/cache.xpl"/>
      <p:output port="result"/>

      <cx:cache-delete name="cache-delete"
                       fail-if-not-in-cache="true"
                       href="https://xmlcalabash.com/does/not/exist.xml">
        <p:with-input>
          <irrelevant/>
        </p:with-input>
      </cx:cache-delete>

      <p:try>
        <p:xinclude depends="cache-delete">
          <p:with-input>
            <doc xmlns:xi="http://www.w3.org/2001/XInclude">
              <xi:include href="https://xmlcalabash.com/does/not/exist.xml"/>
            </doc>
          </p:with-input>
        </p:xinclude>
        <p:catch code="err:XC0029">
          <p:identity>
            <p:with-input>
              <correct/>
            </p:with-input>
          </p:identity>
        </p:catch>
      </p:try>
    </p:declare-step>
  </t:pipeline>
</t:test>
