~ubuntu-branches/ubuntu/utopic/asciidoc/utopic

« back to all changes in this revision

Viewing changes to examples/website/testasciidoc.html

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Wirt
  • Date: 2010-11-27 23:19:57 UTC
  • mfrom: (1.1.12 upstream) (3.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20101127231957-jxdmrk7z7lkcqy3l
Tags: 8.6.3-1
* New upstream version (Closes: #595324)
* Support asciidoc API (Closes: #526351)
* Depend on python >= 2.4 (Closes: #571303)
* Do not compress .txt files (Closes: #592423)
* Enhance asciidoc manpage (Closes: #499497)
* Move some of the Recommends (vim-addon-manager, source-highlight) to 
  Suggests (Closes: #564015)
* Bump standards version (No changes)
* Add README.Source file

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2
 
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3
 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4
 
<head>
5
 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
 
<meta name="generator" content="AsciiDoc 8.5.2" />
7
 
<link rel="stylesheet" href="./xhtml11.css" type="text/css" />
8
 
<link rel="stylesheet" href="./xhtml11-quirks.css" type="text/css" />
9
 
<link rel="stylesheet" href="./layout1.css" type="text/css" />
10
 
<script type="text/javascript">
11
 
/*<![CDATA[*/
12
 
window.onload = function(){asciidoc.footnotes(); asciidoc.toc(1);}
13
 
/*]]>*/
14
 
</script>
15
 
<script type="text/javascript" src="./asciidoc-xhtml11.js"></script>
16
 
<title>AsciiDoc Tests</title>
17
 
</head>
18
 
<body style="max-width:70em">
19
 
<div id="layout-banner">
20
 
  <div id="layout-title">AsciiDoc</div>
21
 
  <div id="layout-description">Text based document generation</div>
22
 
</div>
23
 
<table>
24
 
<tr valign="top">
25
 
<td id="layout-menu">
26
 
  <div>&#187;<a href="index.html">Home</a></div>
27
 
  <div>&#187;<a href="manpage.html">Man&nbsp;Page</a></div>
28
 
  <div>&#187;<a href="userguide.html">User&nbsp;Guide</a></div>
29
 
  <div>&#187;<a href="INSTALL.html">Installation</a></div>
30
 
  <div>&#187;<a href="faq.html">FAQ</a></div>
31
 
  <div>&#187;<a href="a2x.1.html">a2x</a></div>
32
 
  <div>&#187;<a href="asciidocapi.html">API</a></div>
33
 
  <div>&#187;<a href="http://powerman.name/doc/asciidoc">Cheatsheet</a></div>
34
 
  <div>&#187;<a href="testasciidoc.html">Tests</a></div>
35
 
  <div>&#187;<a href="CHANGELOG.html">ChangeLog</a></div>
36
 
  <div>&#187;<a href="support.html">Support</a></div>
37
 
  <div id="page-source">&#187;<a href="testasciidoc.txt">Page&nbsp;Source</a></div>
38
 
</td>
39
 
<td>
40
 
<div id="layout-content">
41
 
<div id="header">
42
 
<h1>AsciiDoc Tests</h1>
43
 
<div id="toc">
44
 
  <div id="toctitle">Table of Contents</div>
45
 
  <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
46
 
</div>
47
 
</div>
48
 
<div id="content">
49
 
<div id="preamble">
50
 
<div class="sectionbody">
51
 
<div class="paragraph"><p>AsciiDoc includes <em>testasciidoc</em>, a Python script runs a set of
52
 
AsciiDoc conformance tests. <em>testasciidoc</em> runs through a list of
53
 
AsciiDoc source files, generates backend outputs and then compares
54
 
them to expected result files. The whole process is driven by a
55
 
configuration file containing a list of user configurable test
56
 
specifications.</p></div>
57
 
</div>
58
 
</div>
59
 
<h2 id="_rationale">Rationale</h2>
60
 
<div class="sectionbody">
61
 
<div class="paragraph"><p>When modifying AsciiDoc configuration files or source code it&#8217;s very
62
 
easy to introduce regression errors. <em>testasciidoc</em> is a tool for
63
 
writing many and varied test cases that can be run after changes have
64
 
been made in order to verify that existing behavior has not been
65
 
broken.</p></div>
66
 
<div class="paragraph"><p>The <em>testasciidoc</em> <em>update</em> command automates the (re)generation of
67
 
expected test result data.  Result data regeneration has to be
68
 
performed after changes to test case source files or after legitimate
69
 
changes to the AsciiDoc output formats&#8201;&#8212;&#8201;doing this manually is
70
 
prohibitively tedious.</p></div>
71
 
</div>
72
 
<h2 id="_running_testasciidoc">Running testasciidoc</h2>
73
 
<div class="sectionbody">
74
 
<div class="paragraph"><p>The <tt>testasciidoc.py</tt> script and the default <tt>testasciidoc.conf</tt>
75
 
configuration file are located in the AsciiDoc distribution <tt>tests</tt>
76
 
directory.</p></div>
77
 
<div class="paragraph"><p>To view the command usage run:</p></div>
78
 
<div class="listingblock">
79
 
<div class="content">
80
 
<pre><tt>$ python tests/testasciidoc.py
81
 
Usage: testasciidoc.py [OPTIONS] COMMAND
82
 
 
83
 
Run AsciiDoc conformance tests specified in configuration FILE.
84
 
 
85
 
Commands:
86
 
  list                          List tests
87
 
  run [NUMBER] [BACKEND]        Execute tests
88
 
  update [NUMBER] [BACKEND]     Regenerate and update test data
89
 
 
90
 
Options:
91
 
  -f, --conf-file=CONF_FILE
92
 
        Use configuration file CONF_FILE (default configuration file is
93
 
        testasciidoc.conf in testasciidoc.py directory)
94
 
  --force
95
 
        Update all test data overwriting existing data</tt></pre>
96
 
</div></div>
97
 
<div class="paragraph"><p>To view the list of tests in the default <tt>testasciidoc.conf</tt>
98
 
configuration file run the <em>list</em> command:</p></div>
99
 
<div class="listingblock">
100
 
<div class="content">
101
 
<pre><tt>$ python tests/testasciidoc.py list
102
 
1: Test cases
103
 
2: Tables
104
 
3: Source highlighter
105
 
4: Example article
106
 
5: Example book
107
 
6: Example multi-part book
108
 
7: !User Guide</tt></pre>
109
 
</div></div>
110
 
<div class="paragraph"><p>The <em>!</em> prefix signals that a test is currently disabled.</p></div>
111
 
<div class="paragraph"><p>Before running the tests you will need to regenerate the expected
112
 
outputs by running the <em>update</em> command:</p></div>
113
 
<div class="listingblock">
114
 
<div class="content">
115
 
<pre><tt>$ python tests/testasciidoc.py update
116
 
WRITING: tests/data/testcases-html4.html
117
 
WRITING: tests/data/testcases-xhtml11.html
118
 
WRITING: tests/data/testcases-docbook.xml
119
 
 :
120
 
WRITING: tests/data/book-multi-docbook.xml</tt></pre>
121
 
</div></div>
122
 
<div class="paragraph"><p>Now you can run the tests:</p></div>
123
 
<div class="listingblock">
124
 
<div class="content">
125
 
<pre><tt>$ python tests/testasciidoc.py run
126
 
1: Test cases
127
 
SOURCE: asciidoc: tests/data/testcases.txt
128
 
PASSED: html4: tests/data/testcases-html4.html
129
 
PASSED: xhtml11: tests/data/testcases-xhtml11.html
130
 
PASSED: docbook: tests/data/testcases-docbook.xml
131
 
 :
132
 
6: Example multi-part book
133
 
SOURCE: asciidoc: doc/book-multi.txt
134
 
PASSED: html4: tests/data/book-multi-html4.html
135
 
PASSED: xhtml11: tests/data/book-multi-xhtml11.html
136
 
PASSED: docbook: tests/data/book-multi-docbook.xml
137
 
 
138
 
TOTAL PASSED:  18</tt></pre>
139
 
</div></div>
140
 
<div class="admonitionblock">
141
 
<table><tr>
142
 
<td class="icon">
143
 
<img src="./images/icons/note.png" alt="Note" />
144
 
</td>
145
 
<td class="content">
146
 
<div class="ulist"><ul>
147
 
<li>
148
 
<p>
149
 
<em>testasciidoc</em> requires AsciiDoc is located in your environment
150
 
  search path, if not you&#8217;ll need to set the <tt>ASCIIDOC_PY</tt> environment
151
 
  variable to point to <tt>asciidoc.py</tt>.
152
 
</p>
153
 
</li>
154
 
<li>
155
 
<p>
156
 
If you don&#8217;t have GNU source-highlight installed you should disable
157
 
  the <em>Tables</em> and <em>Source highlighter</em> tests in the
158
 
  <tt>tests/testasciidoc.conf</tt> configuration file.
159
 
</p>
160
 
</li>
161
 
</ul></div>
162
 
</td>
163
 
</tr></table>
164
 
</div>
165
 
</div>
166
 
<h2 id="_testasciidoc_commands">testasciidoc commands</h2>
167
 
<div class="sectionbody">
168
 
<div class="dlist"><dl>
169
 
<dt class="hdlist1">
170
 
<em>list</em>
171
 
</dt>
172
 
<dd>
173
 
<p>
174
 
  List test numbers and titles.  A <em>!</em> title prefix signals that a
175
 
  test is currently disabled.
176
 
</p>
177
 
</dd>
178
 
<dt class="hdlist1">
179
 
<em>run</em>
180
 
</dt>
181
 
<dd>
182
 
<p>
183
 
  Read and execute tests from the test configuration file. A test
184
 
  specifies AsciiDoc test case source file and command options.  The
185
 
  test compares generated outputs to expected outputs and any
186
 
  differences displayed as a diff.  You can run selected tests by
187
 
  specifying the test number and/or backend after the <tt>run</tt> command.
188
 
  Examples:
189
 
</p>
190
 
<div class="literalblock">
191
 
<div class="content">
192
 
<pre><tt>python tests/testasciidoc.py run
193
 
python tests/testasciidoc.py run 3
194
 
python tests/testasciidoc.py run html4
195
 
python tests/testasciidoc.py run 3 html4</tt></pre>
196
 
</div></div>
197
 
</dd>
198
 
<dt class="hdlist1">
199
 
<em>update</em>
200
 
</dt>
201
 
<dd>
202
 
<p>
203
 
  Generates and updates missing and out of date test output data
204
 
  files, this eliminates one of the most time consuming aspect of test
205
 
  management.  Use the <tt>--force</tt> option to force updates.
206
 
  Examples:
207
 
</p>
208
 
<div class="literalblock">
209
 
<div class="content">
210
 
<pre><tt>python tests/testasciidoc.py update
211
 
python tests/testasciidoc.py --force update 4</tt></pre>
212
 
</div></div>
213
 
</dd>
214
 
</dl></div>
215
 
<div class="admonitionblock">
216
 
<table><tr>
217
 
<td class="icon">
218
 
<img src="./images/icons/note.png" alt="Note" />
219
 
</td>
220
 
<td class="content">You can run or update disabled tests by explicitly specifying
221
 
the test number.</td>
222
 
</tr></table>
223
 
</div>
224
 
</div>
225
 
<h2 id="_test_configuration_file">Test configuration file</h2>
226
 
<div class="sectionbody">
227
 
<div class="paragraph"><p>The tests configuration file format consists of one or more test specs
228
 
separated by a line of one or more percent characters. Each test spec
229
 
consists of an optional test title and description followed by one or
230
 
more optional directives (a directive starts with a percent
231
 
character).  A <em>directive</em> consists begins with a line containing a <em>%</em>
232
 
character followed by a directive name followed by zero or more lines
233
 
of directive data.</p></div>
234
 
<h3 id="_test_spec_format">Test spec format</h3><div style="clear:left"></div>
235
 
<div class="listingblock">
236
 
<div class="content">
237
 
<pre><tt>Optional test title
238
 
Optional test description...
239
 
 
240
 
% name
241
 
Optional base output file name. Defaults to base source file name.
242
 
 
243
 
% source
244
 
AsciiDoc source file name.
245
 
 
246
 
% backends
247
 
Optional list of backends to be tested(default is all backends).
248
 
% options
249
 
Optional list of command-line option tuples.
250
 
 
251
 
% attributes
252
 
Optional dictionary of attribute values.</tt></pre>
253
 
</div></div>
254
 
<div class="paragraph"><p>Example test spec:</p></div>
255
 
<div class="listingblock">
256
 
<div class="content">
257
 
<pre><tt>Example book
258
 
 
259
 
% options
260
 
['--section-numbers',('--doctype','book')]
261
 
 
262
 
% attributes
263
 
# Exclude date from document footer.
264
 
{'docdate':None}
265
 
 
266
 
% source
267
 
../doc/book.txt</tt></pre>
268
 
</div></div>
269
 
<div class="admonitionblock">
270
 
<table><tr>
271
 
<td class="icon">
272
 
<img src="./images/icons/tip.png" alt="Tip" />
273
 
</td>
274
 
<td class="content">Take a look at the default <tt>tests/testasciidoc.conf</tt>
275
 
configuration file that comes with AsciiDoc.</td>
276
 
</tr></table>
277
 
</div>
278
 
<div class="ulist"><ul>
279
 
<li>
280
 
<p>
281
 
Tests can be disabled by prefixing the test title with an
282
 
  exclamation <em>!</em> character.
283
 
</p>
284
 
</li>
285
 
<li>
286
 
<p>
287
 
All relative file names are relative to the configuration file
288
 
  directory.
289
 
</p>
290
 
</li>
291
 
<li>
292
 
<p>
293
 
Multiple tests must by separated by a <tt>%</tt> separator line (one or
294
 
  more percent characters).
295
 
</p>
296
 
</li>
297
 
<li>
298
 
<p>
299
 
Lines starting with a percent character specify a test <em>directive</em>
300
 
  and may be followed by zero or more lines of directive data.
301
 
</p>
302
 
</li>
303
 
<li>
304
 
<p>
305
 
Directive data lines cannot start with a percent character.
306
 
</p>
307
 
</li>
308
 
<li>
309
 
<p>
310
 
Lines starting with a <tt>#</tt> hash character are ignored.
311
 
</p>
312
 
</li>
313
 
<li>
314
 
<p>
315
 
The <em>source</em> directive data is a single line containing the
316
 
  AsciiDoc source file name.
317
 
</p>
318
 
</li>
319
 
<li>
320
 
<p>
321
 
The <em>options</em> directive data is a Python list of <tt>(name,value)</tt>
322
 
  tuples specifying AsciiDoc command-line options. A string item is
323
 
  equivalent to a <tt>(name,None)</tt> tuple.
324
 
</p>
325
 
</li>
326
 
<li>
327
 
<p>
328
 
The <em>attributes</em> directive data specifies a Python dictionary
329
 
  containing AsciiDoc attributes to be passed to AsciiDoc.
330
 
</p>
331
 
</li>
332
 
</ul></div>
333
 
<h3 id="_globals_directive">globals directive</h3><div style="clear:left"></div>
334
 
<div class="paragraph"><p>An optional <em>globals</em> directive can precede all test specs, the
335
 
globals directive data is a Python dictionary containing global
336
 
values.  Currently the only global is <em>datadir</em>, the directory
337
 
containing expected output files (defaults to configuration file
338
 
directory). For example:</p></div>
339
 
<div class="listingblock">
340
 
<div class="content">
341
 
<pre><tt>% globals
342
 
{'datadir': 'data'}</tt></pre>
343
 
</div></div>
344
 
<div class="paragraph"><p>Expected output test data files are stored in the <em>datadir</em> and are
345
 
named after the corresponding AsciiDoc input source file.  For example
346
 
if the AsciiDoc file name is <tt>article.txt</tt> then the corresponding
347
 
backend output files will be <tt>article-html4.html</tt>,
348
 
<tt>article-xhtml11.html</tt>, <tt>article-docbook.xml</tt> (stored in the <em>datadir</em>
349
 
directory).</p></div>
350
 
</div>
351
 
</div>
352
 
<div id="footnotes"><hr /></div>
353
 
<div id="footer">
354
 
<div id="footer-text">
355
 
Version 8.5.2<br />
356
 
Last updated 2009-12-07 17:25:00 NZDT
357
 
</div>
358
 
<div id="footer-badges">
359
 
<a href="http://validator.w3.org/check?uri=referer">
360
 
  <img style="border:0;width:88px;height:31px"
361
 
    src="http://www.w3.org/Icons/valid-xhtml11-blue"
362
 
    alt="Valid XHTML 1.1" height="31" width="88" />
363
 
</a>
364
 
<a href="http://jigsaw.w3.org/css-validator/">
365
 
  <img style="border:0;width:88px;height:31px"
366
 
    src="http://jigsaw.w3.org/css-validator/images/vcss-blue"
367
 
    alt="Valid CSS!" />
368
 
</a>
369
 
<a href="http://www.mozilla.org/products/firefox/">
370
 
  <img style="border:none; width:110px; height:32px;"
371
 
       src="http://www.spreadfirefox.com/community/images/affiliates/Buttons/110x32/safer.gif"
372
 
       alt="Get Firefox!" />
373
 
</a>
374
 
</div>
375
 
</div>
376
 
</div>
377
 
</td>
378
 
</tr>
379
 
</table>
380
 
</body>
381
 
</html>