summaryrefslogtreecommitdiff
path: root/test/transform
diff options
context:
space:
mode:
authorJames Shaw <jshaw@netsurf-browser.org>2007-08-09 21:04:37 +0000
committerJames Shaw <jshaw@netsurf-browser.org>2007-08-09 21:04:37 +0000
commit484832b785c41eddbd599cce7709836be100df40 (patch)
treebe5385c7e21545db3ad9275c17a80e8b4557c932 /test/transform
parent10afab0eeb1957771398c8552275635850e87efc (diff)
downloadlibdom-484832b785c41eddbd599cce7709836be100df40.tar.gz
libdom-484832b785c41eddbd599cce7709836be100df40.tar.bz2
Add assertTrue and assertFalse templates; add boolean primitive to ctypes.xml. Bugfix get-ctype to translate primitive typename when specified.
svn path=/trunk/dom/; revision=3494
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>