Tests that YAML can be parsed.
Test yaml-001.xml is expected to pass.
<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions" xmlns:err="http://www.w3.org/ns/xproc-error" xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
<p:output port="result"/>
<p:identity>
<p:with-input>
<p:inline content-type="application/yaml">
name: build-pr
on:
pull_request_target:
types: [assigned, opened, edited, synchronize, reopened]
branches:
- main
</p:inline>
</p:with-input>
</p:identity>
<p:cast-content-type content-type="application/xml"/>
</p:declare-step>
<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 result isn’t a map.</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="/fn:map">
<s:assert test="fn:string[@key='name'] = 'build-pr'">The name is wrong.</s:assert>
<s:assert test="fn:map[@key='on']">There’s no ‘on’ map.</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="/fn:map/fn:map[@key='on']">
<s:assert test="fn:map[@key='pull_request_target']">There’s no pull request target map.</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="/fn:map/fn:map[@key='on']/fn:map[@key='pull_request_target']">
<s:assert test="fn:array[@key='types']">There’s no types array.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Created test.