summaryrefslogtreecommitdiff
path: root/test/transform
diff options
context:
space:
mode:
Diffstat (limited to 'test/transform')
-rw-r--r--test/transform/ctypes.xml1
-rw-r--r--test/transform/test-to-c.xsl28
2 files changed, 28 insertions, 1 deletions
diff --git a/test/transform/ctypes.xml b/test/transform/ctypes.xml
index 148b1c4..579e317 100644
--- a/test/transform/ctypes.xml
+++ b/test/transform/ctypes.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" ?>
<types>
<primitive idl="int" c="int"/>
+ <primitive idl="boolean" c="bool"/>
<type idl="Attr" c="dom_attr"/>
<type idl="Document" c="dom_document">
diff --git a/test/transform/test-to-c.xsl b/test/transform/test-to-c.xsl
index 8c8f2cb..f530264 100644
--- a/test/transform/test-to-c.xsl
+++ b/test/transform/test-to-c.xsl
@@ -558,9 +558,32 @@ Assert templates
<!-- TODO: what does the @id string do, and do we need it here? -->
<xsl:text>
assert(</xsl:text><xsl:value-of select="@actual"/><xsl:text> == NULL);
- </xsl:text>
+</xsl:text>
+</xsl:template>
+
+<xsl:template match="*[local-name() = 'assertTrue']" mode="body">
+ <!-- TODO: what does the @id string do, and do we need it here? -->
+ <xsl:text>
+ assert(</xsl:text><xsl:value-of select="@actual"/><xsl:text> == true);
+</xsl:text>
</xsl:template>
+<xsl:template match="*[local-name() = 'assertFalse']" mode="body">
+ <!-- TODO: what does the @id string do, and do we need it here? -->
+ <xsl:text>
+ assert(</xsl:text><xsl:value-of select="@actual"/><xsl:text> == false);
+</xsl:text>
+</xsl:template>
+
+<!--
+TODO: somehow want to reuse this for <equals> tests.
+The problem is that <equals> is nested inside <if>, and for DOMStrings,
+a temporary string must be created first.
+
+Perhaps the <if> template could <xsl:apply-templates/> in two modes.
+The first generates temporary variables, and the second generates the equality
+test itself.
+ -->
<xsl:template match="*[local-name() = 'assertEquals']" mode="body">
<xsl:variable name="vardefs" select="//*[local-name() = 'var']"/>
@@ -710,6 +733,9 @@ Helper templates
<xsl:when test="$ctypes/types/type[@idl = $type]/@c">
<xsl:value-of select="$ctypes/types/type[@idl = $type]/@c"/>
</xsl:when>
+ <xsl:when test="$ctypes/types/primitive[@idl = $type]/@c">
+ <xsl:value-of select="$ctypes/types/primitive[@idl = $type]/@c"/>
+ </xsl:when>
<xsl:otherwise>
<xsl:value-of select="$type"/>
</xsl:otherwise>