Testing serialization options

Hello implementors,

I've taken a stab at creating tests for a few of the serialization
options. It's tricky because what needs to be tested is *the
serialization of the result* and not the result itself. To that end,
here's what the tests look like:

<t:test xmlns:t="http://xproc.org/ns/testsuite"
        xmlns:p="http://www.w3.org/ns/xproc"
        xmlns:c="http://www.w3.org/ns/xproc-step"
        xmlns:err="http://www.w3.org/ns/xproc-error">

<t:title>Serialization test doctype-system-001</t:title>

<t:input port='source' href="../doc/s-input.xml"/>

<t:pipeline>
<p:declare-step name="main">
  <p:input port="source"/>
  <p:output port="uri"/>

  <p:store href="file:///tmp/doctype-system-001.xml"
	   doctype-system="http://tests.xproc.org/tests/doc/s-input.dtd"/>

  <p:string-replace match="c:result/text()">
    <p:input port="source">
      <p:inline><c:result>uri</c:result></p:inline>
    </p:input>
    <p:with-option name="replace"
		   select="concat('&quot;',p:base-uri(/),'&quot;')">
      <p:pipe step="main" port="source"/>
    </p:with-option>
  </p:string-replace>

</p:declare-step>
</t:pipeline>

<t:compare-pipeline>
<p:declare-step name="main">
<p:input port="uri"/>
<p:output port="result"/>

<p:exec name="diff"
	command="serdiff"
	source-is-xml="false"
	result-is-xml="false">
  <p:input port="source"><p:empty/></p:input>
  <p:with-option name="args"
	         select="concat('/tmp/doctype-system-001.xml ',
			        p:resolve-uri('../serialization/results/doctype-system-001.xml',
                                              /c:result))">
    <p:pipe step="main" port="uri"/>
  </p:with-option>
</p:exec>

<p:identity>
  <p:input port="source">
    <p:pipe step="diff" port="exit-status"/>
  </p:input>
</p:identity>

</p:declare-step>
</t:compare-pipeline>

<t:output port="result"><c:result>0</c:result></t:output>

</t:test>

The way this works is like this:

1. The main pipeline uses p:store to write the results into /tmp 
2. It passes that location to the compare pipeline
3. The compare pipeline uses serdiff to compare the serialized forms

You can find my very crude initial implementation of serdiff at
http://tests.xproc.org/tests/bin/serdiff

The idea is that over time serdiff can grow to filter out the
non-essential differences between outputs. Right now, it just does a
straight compare.

Comments, thoughts, other implementors results against the
serialization tests most welcome.


                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com> | Democracy consists of choosing your
http://nwalsh.com/            | dictators, after they've told you what
                              | you think it is you want to hear.--Alan
                              | Corenk

Received on Sunday, 14 June 2009 18:56:36 UTC