69 lines
2.1 KiB
XML
69 lines
2.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!--
|
|
Tests arity calculations
|
|
|
|
Copyright (C) 2014 LoVullo Associates, Inc.
|
|
|
|
This file is part of hoxsl.
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
-->
|
|
|
|
<description xmlns="http://www.jenitennison.com/xslt/xspec"
|
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
xmlns:x="http://www.jenitennison.com/xslt/xspec"
|
|
xmlns:f="http://www.lovullo.com/hoxsl/apply"
|
|
xmlns:foo="http://www.lovullo.com/_junk"
|
|
stylesheet="../../src/apply/arity.xsl">
|
|
|
|
|
|
<scenario label="f:arity">
|
|
<scenario label="given a proper function reference">
|
|
<variable name="test-arity"
|
|
select="5" />
|
|
|
|
<!-- test our format directly; do not rely on the
|
|
apply-gen code -->
|
|
<variable name="fnref">
|
|
<f:ref arity="{$test-arity}">
|
|
<foo:bar />
|
|
</f:ref>
|
|
</variable>
|
|
|
|
<call function="f:arity">
|
|
<param name="fnref"
|
|
select="$fnref" />
|
|
</call>
|
|
|
|
<expect label="provides function arity"
|
|
test="$x:result = $test-arity" />
|
|
</scenario>
|
|
|
|
|
|
<scenario label="given a function reference with no defined arity">
|
|
<variable name="fnref">
|
|
<f:ref><foo:bar /></f:ref>
|
|
</variable>
|
|
|
|
<call function="f:arity">
|
|
<param name="fnref"
|
|
select="$fnref" />
|
|
</call>
|
|
|
|
<expect label="returns -1"
|
|
test="$x:result = -1" />
|
|
</scenario>
|
|
</scenario>
|
|
</description>
|