<?xml version="1.0" encoding="UTF-8"?>
<t:test expected="pass"
        xmlns:t="http://xproc.org/ns/testsuite/3.0">
  <t:info>
    <t:title>yaml-002</t:title>
    <t:revision-history>
      <t:revision>
        <t:date>2025-01-03</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 YAML can be parsed.</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:output port="result"/>

      <p:identity>
        <p:with-input>
          <p:inline content-type="application/json" expand-text="false">
{"test": 1, "simple": true, "offsets": [1,2,3]}
          </p:inline>
        </p:with-input>
      </p:identity>
      <p:cast-content-type content-type="application/yaml"/>
      <p:cast-content-type content-type="text/plain"/>
      <p:wrap-sequence wrapper="doc"/>
    </p:declare-step>
  </t:pipeline>
  <t:schematron>
    <s:schema queryBinding="xslt2"
              xmlns:s="http://purl.oclc.org/dsdl/schematron">
      <s:pattern>
        <s:rule context="/">
          <s:assert test="doc">The result isn’t a doc.</s:assert>
        </s:rule>
      </s:pattern>
      <s:pattern>
        <s:rule context="/doc">
          <s:assert test="contains(., 'test: 1')">There’s no test.</s:assert>
          <s:assert test="contains(., 'simple: true')">There’s no simple.</s:assert>
          <s:assert test="contains(., '&#10;- 1&#10;')">There’s no array value 1.</s:assert>
        </s:rule>
      </s:pattern>
    </s:schema>
  </t:schematron>
</t:test>
