This file is indexed.

/usr/share/doc/libantelope-java/manual/bk03ch04.html is in libantelope-java-doc 3.5.1-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 4. Assert Task</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="Antelope Users Guide"><link rel="up" href="bk03.html" title="Additional Ant Tasks"><link rel="prev" href="bk03ch03.html" title="Chapter 3. Installation"><link rel="next" href="bk03ch05.html" title="Chapter 5. If Task"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 4. Assert Task</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk03ch03.html">Prev</a> </td><th width="60%" align="center">Additional Ant Tasks</th><td width="20%" align="right"> <a accesskey="n" href="bk03ch05.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 4. Assert Task"><div class="titlepage"><div><div><h2 class="title"><a name="Assert"></a>Chapter 4. Assert Task</h2></div></div></div>
@style@
    <p>
The Assert task adds an assertion capability to Ant projects. This task works in a manner very similar to the Java <code class="computeroutput">assert</code> keyword, and provides a limited "design by contract" facility to Ant. This is very useful for testing build scripts prior to putting them into production.
</p><p>
The Assert task verifies that a given property has a
given value and throws a BuildException if the property value is not as expected
or the property does not exist.
</p><p>
Also like Java's <code class="computeroutput">assert</code> keyword, the Assert task must be 'turned on' using the property <code class="computeroutput">ant.enable.asserts</code>. If not set, or is set to <code class="computeroutput">false</code>, the Assert task works exactly like the Sequential task. If the <a class="link" href="bk03ch09.html" title="Chapter 9. Variable Task">Variable task</a> is used to define this property, then it can be turned on and off as needed throughout a build.
</p><p>
This task can hold other tasks including Assert.
</p><p>
The Assert task may contain one 'bool' element. The 'bool' element is identical to the ConditionTask, but unlike the ConditionTask, is actually a Task. The 'bool' element can contain all the conditions permitted by the ConditionTask, plus the <a class="link" href="bk03ch05s02.html" title="More Conditions">IsPropertyTrue</a>, <a class="link" href="bk03ch05s02.html" title="More Conditions">IsPropertyFalse</a>,
<a class="link" href="bk03ch05s02.html" title="More Conditions">StartsWith</a>,
<a class="link" href="bk03ch05s02.html" title="More Conditions">EndsWith</a>,
<a class="link" href="bk03ch05s02.html" title="More Conditions">IsGreaterThan</a>,
<a class="link" href="bk03ch05s02.html" title="More Conditions">IsLessThan</a>,
<a class="link" href="bk03ch05s02.html" title="More Conditions">DateTimeBefore</a>,
<a class="link" href="bk03ch05s02.html" title="More Conditions">DateTimeDifference</a>,
<a class="link" href="bk03ch05s02.html" title="More Conditions">MathEquals</a> conditions.
See the <a class="link" href="bk03ch05.html" title="Chapter 5. If Task">If task</a> for examples of using these conditionals.
</p><p>
To use this task in your build files, include a task definition like this:
</p><p>
</p><pre class="programlisting">

    &lt;taskdef name="assert" classname="ise.antelope.tasks.Assert"/&gt;
    &lt;property name="ant.enable.asserts" value="true"/&gt;

</pre><p>
</p><p>
</p><div class="table"><a name="id2514709"></a><p class="title"><b>Table 4.1. Assert Task Attributes</b></p><div class="table-contents"><table summary="Assert Task Attributes" border="1"><colgroup><col><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Default</th><th>Required</th></tr></thead><tbody><tr><td>name</td><td>The name of the property to test for.</td><td>none</td><td>Yes</td></tr><tr><td>exists</td><td>Test for existence or non-existence of the property.</td><td>True</td><td>No</td></tr><tr><td>value</td><td>The value to test for, implies 'exists=true'. If the value in the project is different than this value, a BuildException will be thrown and the build will stop.</td><td>none</td><td>No</td></tr><tr><td>execute</td><td>Should the tasks contained in this task be executed? It may be useful to set this to false when testing build files.</td><td>True</td><td>No</td></tr><tr><td>failonerror</td><td>Should the build halt if the assertion fails? Setting this to false is contrary to the intented use of assertions, but may be useful in certain situations. </td><td>True</td><td>No</td></tr><tr><td>message</td><td>A message to include with the output in the event of this assert failing.</td><td>none</td><td>No</td></tr><tr><td>level</td><td>A "level" for the assert, similar to debug levels.  Valid values are 'error', 'warning', 'info', 'debug'.</td><td>error</td><td>No</td></tr></tbody></table></div></div><p><br class="table-break">

</p><p>
As stated above, the Assert task may contain a nested "bool" task, otherwise,
the Assert task does not support any nested
elements apart from Ant tasks. Any valid Ant task may be embedded within the
assert task.
</p><p>
The "level" attribute is only (so far) useful when Assert is used in conjunction with the <a class="link" href="bk03ch26.html" title="Chapter 26. TestCase Task">Testcase task</a>. Setting this attribute to "warning", "info", or "debug" will force "failonerror" to false.
</p><p>
In the following example, the first <code class="computeroutput">assert</code> task checks that the <code class="computeroutput">wait</code> property exists and does not execute the <code class="computeroutput">echo</code> and <code class="computeroutput">sleep</code> tasks. The second <code class="computeroutput">assert</code> task checks that the <code class="computeroutput">wait</code> property exists, has a value of 2, and executes the <code class="computeroutput">echo</code> task.
</p><p>
</p><pre class="programlisting">

     &lt;property name="wait" value="2"/&gt;
     &lt;assert name="wait" execute="false"&gt;
        &lt;echo&gt;
            Waiting ${wait} seconds...
            Click the red button to stop waiting.
        &lt;/echo&gt;
        &lt;sleep seconds="${wait}"/&gt;
     &lt;/assert&gt;
     &lt;assert name="wait" value="2" execute="true"&gt;
        &lt;echo&gt;done waiting!&lt;/echo&gt;
     &lt;/assert&gt;

</pre><p>
</p><p>
The next example shows Assert being used in a unit test for the "limit" task:
</p><pre class="programlisting">

  &lt;property name="ant.enable.asserts" value="true"/&gt;
  &lt;target name="test2"&gt;
    &lt;!-- should not stop 'sleep' task, should print out '_passed_' --&gt;
    &lt;stopwatch name="timer"/&gt;
    &lt;limit maxwait="5"&gt;
        &lt;sleep seconds="1"/&gt;
        &lt;echo&gt;_passed_&lt;/echo&gt;
    &lt;/limit&gt;
    &lt;stopwatch name="timer" action="total"/&gt;
    &lt;assert message="Too much time."&gt;
        &lt;bool&gt;
            &lt;islessthan arg1="${timer}" arg2="2"/&gt;
        &lt;/bool&gt;
    &lt;/assert&gt;
  &lt;/target&gt;

</pre><p>
</p><p>
If the <code class="computeroutput">ant.enable.asserts</code> property is set to false, then in the above example, the <code class="computeroutput">echo</code>, <code class="computeroutput">sleep</code>, and <code class="computeroutput">echo</code> tasks will all execute.
</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk03ch03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="bk03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk03ch05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 3. Installation </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 5. If Task</td></tr></table></div></body></html>