`f:set-args' respects and echoes adjacent data by references

Was previously clobbered.
master
Mike Gerwitz 2014-12-04 03:20:16 -05:00
parent e93283c608
commit 658edd8717
2 changed files with 31 additions and 1 deletions

View File

@ -211,7 +211,11 @@
<sequence select="$desc/*" />
</f:ref>
<sequence select="$args" />
<!-- be sure to retain the adjacent data (which is offset by the
_original_ reference length) -->
<sequence select="$args,
subsequence( $fnref,
$desc/@length + 1 )" />
</function>

View File

@ -375,6 +375,32 @@
sequence"
test="f:length( $x:result ) = count( $x:result )" />
</scenario>
<scenario label="operating adjacent to other data">
<call function="f:set-args">
<param name="fnref" select="$test-fn,
$args/foo:a,
$args/foo:b" />
<param name="args" select="(1, 2)" />
</call>
<expect label="retains target QName"
test="f:QName( $x:result ) = f:QName( $test-fn )" />
<expect label="reduces arity by number of arguments"
test="f:arity( $x:result ) = f:arity( $test-fn ) - 2" />
<!-- notice that the length _does not_ reflect adjacent data -->
<expect label="produces length equal to length of constructed
sequence, sans adjacent data"
test="f:length( $x:result ) = count( $x:result ) - 2" />
<variable name="rlength" select="count( $x:result )" />
<expect label="retains adjacent data by reference"
test="$x:result[ $rlength - 1 ] is $args/foo:a
and $x:result[ $rlength ] is $args/foo:b" />
</scenario>
</scenario>