summaryrefslogtreecommitdiffstats
path: root/src/boost/tools/boostbook/xsl/testing/testsuite.xsl
blob: b12eef66726583b8c81c95c4452aa163832e356e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?xml version="1.0" encoding="utf-8"?>
<!--
   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
  
   Distributed under the Boost Software License, Version 1.0.
   (See accompanying file LICENSE_1_0.txt or copy at
   http://www.boost.org/LICENSE_1_0.txt)
  -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">
  <xsl:template match="testsuite">
    <section>
      <xsl:choose>
        <xsl:when test="@id">
          <xsl:attribute name="id">
            <xsl:value-of select="@id"/>
          </xsl:attribute>
        </xsl:when>
        <xsl:when test="../@id">
          <xsl:attribute name="id">
            <xsl:value-of select="concat(../@id, '.tests')"/>
          </xsl:attribute>
        </xsl:when>
      </xsl:choose>

      <title>Testsuite</title>

      <xsl:if test="compile-test|link-test|run-test">
        <section>
          <xsl:if test="@id">
            <xsl:attribute name="id">
              <xsl:value-of select="@id"/>
              <xsl:text>.acceptance</xsl:text>
            </xsl:attribute>
          </xsl:if>

          <title>Acceptance tests</title>
          <informaltable>
            <tgroup cols="3">
              <colspec colnum="2" colwidth="1in"/>
              <thead>
                <row>
                  <entry>Test</entry>
                  <entry>Type</entry>
                  <entry>Description</entry>
                  <entry>If failing...</entry>
                </row>
              </thead>
              <tbody>
                <xsl:apply-templates select="compile-test|link-test|run-test"/>
              </tbody>
            </tgroup>
          </informaltable>
        </section>          
      </xsl:if>
      
      <xsl:if test="compile-fail-test|link-fail-test|run-fail-test">
        <section>
          <xsl:if test="@id">
            <xsl:attribute name="id">
              <xsl:value-of select="@id"/>
              <xsl:text>.negative</xsl:text>
            </xsl:attribute>
          </xsl:if>
          <title>Negative tests</title>
          <informaltable>
            <tgroup cols="3">
              <colspec colnum="2" colwidth="1in"/>
              <thead>
                <row>
                  <entry>Test</entry>
                  <entry>Type</entry>
                  <entry>Description</entry>
                  <entry>If failing...</entry>
                </row>
              </thead>
              <tbody>
                <xsl:apply-templates 
                  select="compile-fail-test|link-fail-test|run-fail-test"/>
              </tbody>
            </tgroup>
          </informaltable>
        </section>
      </xsl:if> 
    </section>
  </xsl:template>

  <xsl:template match="compile-test|link-test|run-test|
                       compile-fail-test|link-fail-test|run-fail-test">
    <row>
      <entry>
        <simpara>
          <ulink>
            <xsl:attribute name="url">
              <xsl:value-of 
                select="concat('../../libs/',
                               ancestor::library/attribute::dirname, '/test/',
                               @filename)"/>
            </xsl:attribute>
            <xsl:value-of select="@filename"/>
          </ulink>
        </simpara>
      </entry>
      <entry>
        <simpara>
          <xsl:value-of select="substring-before(local-name(.), '-test')"/>
        </simpara>
      </entry>
      <entry><xsl:apply-templates select="purpose/*"/></entry>
      <entry><xsl:apply-templates select="if-fails/*"/></entry>
    </row>
  </xsl:template>

  <xsl:template match="snippet">
    <xsl:variable name="snippet-name" select="@name"/>
    <xsl:apply-templates select="//programlisting[@name=$snippet-name]"/>
  </xsl:template>
</xsl:stylesheet>