diff options
author | Pjotr Prins | 2017-08-20 09:22:43 +0000 |
---|---|---|
committer | Pjotr Prins | 2017-08-20 09:22:43 +0000 |
commit | 2e76646998df0ca1b7d160329c0f3ac8cdda2fe0 (patch) | |
tree | 8a1ba0770e2344469c58290d4192db186d9439cb /contrib/shunit2-2.0.3/doc/shunit2.html | |
parent | 7fc4e3c0a0d6e32ca6685647e107473f1d96c3e5 (diff) | |
download | pangemma-2e76646998df0ca1b7d160329c0f3ac8cdda2fe0.tar.gz |
Move shunit2 into ./contrib and add catch-1.8.7
Diffstat (limited to 'contrib/shunit2-2.0.3/doc/shunit2.html')
-rw-r--r-- | contrib/shunit2-2.0.3/doc/shunit2.html | 218 |
1 files changed, 218 insertions, 0 deletions
diff --git a/contrib/shunit2-2.0.3/doc/shunit2.html b/contrib/shunit2-2.0.3/doc/shunit2.html new file mode 100644 index 0000000..b3c1e83 --- /dev/null +++ b/contrib/shunit2-2.0.3/doc/shunit2.html @@ -0,0 +1,218 @@ +<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>shUnit2</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.72.0"><meta name="description" content="shUnit2 is a unit test framework for Bourne based shell scripts, and it is designed to work in a similar manner to JUnit, PyUnit, etc."></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book" lang="en-US"><div class="titlepage"><div><div><h1 class="title"><a name="shUnit2"></a>shUnit2 version 2.0.3</h1></div><div><div class="authorgroup"><div class="author"><h3 class="author"><span class="firstname">Kate</span> <span class="surname">Ward</span></h3><div class="affiliation"><div class="address"><p><br> + <code class="email"><<a href="mailto:kate.ward@forestent.com">kate.ward@forestent.com</a>></code><br> + </p></div></div></div></div></div><div><p class="pubdate">2007-07-12</p></div><div><div class="revhistory"><table border="1" width="100%" summary="Revision history"><tr><th align="left" valign="top" colspan="3"><b>Revision History</b></th></tr><tr><td align="left">Revision 2.0.3</td><td align="left">2007-07-12</td><td align="left">Kate Ward <kate.ward@forestent.com></td></tr><tr><td align="left">Revision 2.0.2</td><td align="left">2007-04-22</td><td align="left">Kate Ward <kate.ward@forestent.com></td></tr><tr><td align="left">Revision 2.0.1</td><td align="left">2007-02-21</td><td align="left">Kate Ward <kate.ward@forestent.com></td></tr><tr><td align="left">Revision 2.0.0</td><td align="left">2007-02-20</td><td align="left">Kate Ward <kate.ward@forestent.com></td></tr></table></div></div><div><div class="abstract"><p class="title"><b>Abstract</b></p><p><a href="http://sourceforge.net/projects/shunit2" target="_top">shUnit2</a> is a unit test framework for Bourne based shell scripts, and it is designed to work in a similar manner to <a href="http://www.junit.org/" target="_top">JUnit</a>, <a href="http://pyunit.sourceforge.net/" target="_top">PyUnit</a>, etc.</p></div></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="#introduction">1. Introduction</a></span></dt><dd><dl><dt><span class="section"><a href="#credits">1. Credits / Contributors</a></span></dt><dt><span class="section"><a href="#feedback">2. Feedback</a></span></dt></dl></dd><dt><span class="chapter"><a href="#quickstart">2. Quickstart</a></span></dt><dt><span class="chapter"><a href="#shelldoc">3. Function Reference</a></span></dt><dd><dl><dt><span class="section"><a href="#shelldoc-section-asserts">1. asserts</a></span></dt><dt><span class="section"><a href="#shelldoc-section-failures">2. failures</a></span></dt><dt><span class="section"><a href="#shelldoc-section-suites">3. suites</a></span></dt></dl></dd></dl></div><div class="list-of-tables"><p><b>List of Tables</b></p><dl><dt>3.1. <a href="#shelldoc-function-asserts">asserts</a></dt><dt>3.2. <a href="#shelldoc-function-failures">failures</a></dt><dt>3.3. <a href="#shelldoc-function-suites">suites</a></dt></dl></div><div class="chapter" lang="en-US"><div class="titlepage"><div><div><h2 class="title"><a name="introduction"></a>Chapter 1. Introduction</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#credits">1. Credits / Contributors</a></span></dt><dt><span class="section"><a href="#feedback">2. Feedback</a></span></dt></dl></div><p>shUnit2 is a unit test framework for Bourne based shell scripts, and it is designed to work in a similar manner to <a href="http://www.junit.org/" target="_top">JUnit</a>, <a href="http://pyunit.sourceforge.net/" target="_top">PyUnit</a>, etc.</p><p>shUnit2 was originally developed to provide a consistent testing solution for <a href="http://log4sh.sourceforge.net/" target="_top">log4sh</a>, a shell based logging framework similar to log4j. During the development of that product, the problem of having things work just fine under one shell (<code class="filename">/bin/bash</code> on Linux to be specific), and then not working under another shell (<code class="filename">/bin/sh</code> on Solaris), kept coming up. Although there were several simple tests ran, they were not adaquate and did not catch very many corner cases. The decision was finally made to write a proper unit test framework after after multiple brown-bag releases were made.</p><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><b>Tested Operating Systems</b></p></div><div class="itemizedlist"><ul type="disc"><li><p><a href="http://www.cygwin.com/" target="_top">Cygwin</a></p></li><li><p><a href="http://www.freebsd.org/" target="_top">FreeBSD</a> (user supported)</p></li><li><p>Linux (<a href="http://www.gentoo.org/" target="_top">Gentoo</a>, <a href="http://www.ubuntu.com/" target="_top">Ubuntu</a>)</p></li><li><p><a href="http://www.apple.com/macosx/" target="_top">Mac OS X</a></p></li><li><p><a href="http://www.sun.com/software/solaris/" target="_top">Solaris</a> 8, 9, 10</p></li></ul></div></blockquote></div><div class="blockquote"><blockquote class="blockquote"><div class="blockquote-title"><p><b>Tested Shells</b></p></div><div class="itemizedlist"><ul type="disc"><li><p>Bourne Shell (<span><strong class="command">sh</strong></span>)</p></li><li><p><a href="http://www.gnu.org/software/bash/" target="_top">BASH</a> - GNU Bourne Again SHell (<span><strong class="command">bash</strong></span>)</p></li><li><p><a href="http://gondor.apana.org.au/~herbert/dash/" target="_top">DASH</a> (<span><strong class="command">dash</strong></span>)</p></li><li><p><a href="http://www.kornshell.com/" target="_top">Korn Shell</a> (<span><strong class="command">ksh</strong></span>)</p></li><li><p><a href="http://web.cs.mun.ca/~michael/pdksh/" target="_top">pdksh</a> - Public Domain Korn Shell (<span><strong class="command">pdksh</strong></span>)</p></li></ul></div></blockquote></div><p>See the appropriate Release Notes (<code class="filename">doc/RELEASE_NOTES-X.X.X.txt</code>) for this release for the actual versions tested.</p><div class="section" lang="en-US"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="credits"></a>1. Credits / Contributors</h2></div></div></div><p>A list of contributors to shUnit2 can be found in the source archive as <code class="filename">doc/contributors.txt</code>. I want to personally thank all those who have contributed to make this a better tool.</p></div><div class="section" lang="en-US"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="feedback"></a>2. Feedback</h2></div></div></div><p>Feedback is most certainly welcome for this document. Send your additions, comments and criticisms to the following email address: <code class="email"><<a href="mailto:kate.ward@forestent.com">kate.ward@forestent.com</a>></code>.</p></div></div><div class="chapter" lang="en-US"><div class="titlepage"><div><div><h2 class="title"><a name="quickstart"></a>Chapter 2. Quickstart</h2></div></div></div><p>This chapter will give a very quick start to running unit tests with shUnit2. More information is located in other chapters.</p><p>Here is a quick sample script to show how easy it is to write a unit test in shell. It expects that you have a copy of <span><strong class="command">shunit2</strong></span> in the same directory as the script.</p><pre class="programlisting"> + +#! /bin/sh + +testEquality() +{ + assertEquals 1 1 +} + +# load shunit2 +. ./shunit2 + + </pre><p>Running the unit test should give results similar to the following.</p><pre class="screen"> + +# +# Performing tests +# +testEquality + +# +# Test report +# +tests passed: 1 +tests failed: 0 +tests total: 1 +success rate: 100% + + </pre><p>Wohoo! You've just run your first successful unit test. So, what just happened? Quite a bit really, and it all happened simply by sourcing the <span><strong class="command">shunit2</strong></span> script. The basic functionality for the script above goes like this.</p><p>When shUnit2 is sourced, it first looks to see if a <code class="function">suite()</code> function has been declared. If it exists, it is called as it is expected to contain a list of tests to be executed. If it doesn't exist (and it doesn't in the above example), shUnit2 will look on its own for any functions that start with the string <code class="literal">test</code>, and adds those to an internal list of tests to execute. Once a list of test functions to be run has been determined, shunit2 will go to work.</p><p>Before any tests are executed, shUnit2 again looks for a function, this time one named <code class="function">oneTimeSetUp()</code>. If it exists, it will be run. This function is normally used to setup the environment for all tests to be run. Things like creating directories for output or setting environment variables are good to place here. Just so you know, you can also declare a corresponding function named <code class="function">oneTimeTearDown()</code> function that does the same thing, but once all the tests have been completed. It is good for removing temporary directories, etc.</p><p>shUnit2 is now ready to run tests. Before doing so though, it again looks for another function that might be declared, one named <code class="function">setUp()</code>. If the function exists, it will be run before each test. It is good for resetting the environment so that each test starts with a clean slate. At this stage, the first test is finally run. The success of the test is recorded for a report that will be generated later. After the test is run, shUnit2 looks for a final function that might be declared, one named <code class="function">tearDown()</code>. If it exists, it will be run after each test. It is a good place for cleaning up after each test, maybe doing things like removing files that were created, or removing directories. This set of steps, setUp() > test() > tearDown(), is repeated for all of the available tests.</p><p>Once all the work is done, shUnit2 will generate the nice report you saw above. A summary of all the successes and failures will be given so that you know how well your code is doing.</p><p>We should now try adding a test that fails. Change your unit test to look like this.</p><pre class="programlisting"> + +#! /bin/sh + +testEquality() +{ + assertEquals 1 1 +} + +testPartyLikeItIs1999() +{ + year=`date '+%Y'` + assertEquals "It's not 1999 :-( This is ${year}." \ + '1999' "${year}" +} + +# load shunit2 +. ./shunit2 + + </pre><p>So, what did you get? I guess it told you that this isn't 1999. Bummer, eh? Hopefully, you noticed a couple of things that were different about the second test. First, we added an optional message that the user will see if the assert fails. Second, we did comparisons of strings instead of integers as in the first test. It doesn't matter whether you are testing for equality of strings or integers. Both work equally well with shUnit2.</p><p>Hopefully, this is enough to get you started with unit testing. If you want a ton more examples, take a look at the tests provided with <a href="http://log4sh.sourceforge.net/" target="_top">log4sh</a>. Examples of much more advanced usage can be seen there. shUnit2 was after all written to help with the unit testing problems that log4sh had.</p></div><div class="chapter" lang="en-US"><div class="titlepage"><div><div><h2 class="title"><a name="shelldoc"></a>Chapter 3. Function Reference</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#shelldoc-section-asserts">1. asserts</a></span></dt><dt><span class="section"><a href="#shelldoc-section-failures">2. failures</a></span></dt><dt><span class="section"><a href="#shelldoc-section-suites">3. suites</a></span></dt></dl></div><div class="section" lang="en-US"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="shelldoc-section-asserts"></a>1. asserts</h2></div></div></div><div class="table"><a name="shelldoc-function-asserts"></a><p class="title"><b>Table 3.1. asserts</b></p><div class="table-contents"><table summary="asserts" border="1"><colgroup><col><col></colgroup><tbody><tr valign="top"><td align="right" valign="top"> + <span class="emphasis"><em>void</em></span> + </td><td valign="top"> + <div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef"> + <b class="fsfunc">assertEquals</b> + (</code></td><td><var class="pdparam">[message]</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">expected</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">actual</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string </code> </td><td><code><var class="pdparam">[message]</var>;</code></td></tr><tr><td><code>string </code> </td><td><code><var class="pdparam">expected</var>;</code></td></tr><tr><td><code>string </code> </td><td><code><var class="pdparam">actual</var>;</code></td></tr></table></div> + <p>Asserts that <span class="emphasis"><em>expected</em></span> and + <span class="emphasis"><em>actual</em></span> are equal to one another. The message is + optional.</p> + </td></tr><tr valign="top"><td align="right" valign="top"> + <span class="emphasis"><em>void</em></span> + </td><td valign="top"> + <div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef"> + <b class="fsfunc">assertNull</b> + (</code></td><td><var class="pdparam">[message]</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">value</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string </code> </td><td><code><var class="pdparam">[message]</var>;</code></td></tr><tr><td><code>string </code> </td><td><code><var class="pdparam">value</var>;</code></td></tr></table></div> + <p>Asserts that <span class="emphasis"><em>value</em></span> is <code class="literal">null</code>, + or in shell terms a zero-length string. The message is optional.</p> + </td></tr><tr valign="top"><td align="right" valign="top"> + <span class="emphasis"><em>void</em></span> + </td><td valign="top"> + <div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef"> + <b class="fsfunc">assertNotNull</b> + (</code></td><td><var class="pdparam">[message]</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">value</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string </code> </td><td><code><var class="pdparam">[message]</var>;</code></td></tr><tr><td><code>string </code> </td><td><code><var class="pdparam">value</var>;</code></td></tr></table></div> + <p>Asserts that <span class="emphasis"><em>value</em></span> is <span class="strong"><strong>not</strong></span><code class="literal">null</code>, or in shell terms not + a zero-length string. The message is optional.</p> + </td></tr><tr valign="top"><td align="right" valign="top"> + <span class="emphasis"><em>void</em></span> + </td><td valign="top"> + <div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef"> + <b class="fsfunc">assertSame</b> + (</code></td><td><var class="pdparam">[message]</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">expected</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">actual</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string </code> </td><td><code><var class="pdparam">[message]</var>;</code></td></tr><tr><td><code>string </code> </td><td><code><var class="pdparam">expected</var>;</code></td></tr><tr><td><code>string </code> </td><td><code><var class="pdparam">actual</var>;</code></td></tr></table></div> + <p>This function is functionally equivalent to + <code class="function">assertEquals</code>.</p> + </td></tr><tr valign="top"><td align="right" valign="top"> + <span class="emphasis"><em>void</em></span> + </td><td valign="top"> + <div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef"> + <b class="fsfunc">assertNotSame</b> + (</code></td><td><var class="pdparam">[message]</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">unexpected</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">actual</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string </code> </td><td><code><var class="pdparam">[message]</var>;</code></td></tr><tr><td><code>string </code> </td><td><code><var class="pdparam">unexpected</var>;</code></td></tr><tr><td><code>string </code> </td><td><code><var class="pdparam">actual</var>;</code></td></tr></table></div> + <p>Asserts that <span class="emphasis"><em>unexpected</em></span> and + <span class="emphasis"><em>actual</em></span> are <span class="strong"><strong>not</strong></span> + equal to one another. The message is optional.</p> + </td></tr><tr valign="top"><td align="right" valign="top"> + <span class="emphasis"><em>void</em></span> + </td><td valign="top"> + <div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef"> + <b class="fsfunc">assertTrue</b> + (</code></td><td><var class="pdparam">[message]</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">condition</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string </code> </td><td><code><var class="pdparam">[message]</var>;</code></td></tr><tr><td><code>string </code> </td><td><code><var class="pdparam">condition</var>;</code></td></tr></table></div> + <p>Asserts that a given shell test condition is true. The message is + optional.</p> + <p>Testing whether something is true or false is easy enough by using + the assertEquals/assertNotSame functions. Shell supports much more + complicated tests though, and a means to support them was needed. As such, + this function tests that conditions are true or false through evaluation + rather than just looking for a true or false.</p> + <div class="funcsynopsis"> + The following test will succeed: <pre class="funcsynopsisinfo">assertTrue "[ 34 -gt 23 ]"</pre> + The following test will fail with a message: <pre class="funcsynopsisinfo">assertTrue "test failed" "[ -r '/non/existent/file' ]"</pre></div> + </td></tr><tr valign="top"><td align="right" valign="top"> + <span class="emphasis"><em>void</em></span> + </td><td valign="top"> + <div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef"> + <b class="fsfunc">assertFalse</b> + (</code></td><td><var class="pdparam">[message]</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">condition</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string </code> </td><td><code><var class="pdparam">[message]</var>;</code></td></tr><tr><td><code>string </code> </td><td><code><var class="pdparam">condition</var>;</code></td></tr></table></div> + <p>Asserts that a given shell test condition is false. The message is + optional.</p> + <p>Testing whether something is true or false is easy enough by using + the assertEquals/assertNotSame functions. Shell supports much more + complicated tests though, and a means to support them was needed. As such, + this function tests that conditions are true or false through evaluation + rather than just looking for a true or false.</p> + <div class="funcsynopsis"> + The following test will succeed: <pre class="funcsynopsisinfo">assertFalse "[ 'apples' = 'oranges' ]"</pre> + The following test will fail with a message: <pre class="funcsynopsisinfo">assertFalse "test failed" "[ 1 -eq 1 -a 2 -eq 2 ]"</pre></div> + </td></tr></tbody></table></div></div><br class="table-break"></div><div class="section" lang="en-US"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="shelldoc-section-failures"></a>2. failures</h2></div></div></div><div class="table"><a name="shelldoc-function-failures"></a><p class="title"><b>Table 3.2. failures</b></p><div class="table-contents"><table summary="failures" border="1"><colgroup><col><col></colgroup><tbody><tr valign="top"><td align="right" valign="top"> + <span class="emphasis"><em>void</em></span> + </td><td valign="top"> + <div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef"> + <b class="fsfunc">fail</b> + (</code></td><td><var class="pdparam">[message]</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string </code> </td><td><code><var class="pdparam">[message]</var>;</code></td></tr></table></div> + <p>Fails the test immediately, with the optional message.</p> + </td></tr><tr valign="top"><td align="right" valign="top"> + <span class="emphasis"><em>void</em></span> + </td><td valign="top"> + <div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef"> + <b class="fsfunc">failNotEquals</b> + (</code></td><td><var class="pdparam">[message]</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">unexpected</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">actual</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string </code> </td><td><code><var class="pdparam">[message]</var>;</code></td></tr><tr><td><code>string </code> </td><td><code><var class="pdparam">unexpected</var>;</code></td></tr><tr><td><code>string </code> </td><td><code><var class="pdparam">actual</var>;</code></td></tr></table></div> + <p>Fails the test if <span class="emphasis"><em>unexpected</em></span> and + <span class="emphasis"><em>actual</em></span> are <span class="strong"><strong>not</strong></span> + equal to one another. The message is optional.</p> + </td></tr><tr valign="top"><td align="right" valign="top"> + <span class="emphasis"><em>void</em></span> + </td><td valign="top"> + <div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef"> + <b class="fsfunc">failSame</b> + (</code></td><td><var class="pdparam">[message]</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string </code> </td><td><code><var class="pdparam">[message]</var>;</code></td></tr></table></div> + <p>Indicate test failure because arguments were not the same. The + message is optional.</p> + </td></tr><tr valign="top"><td align="right" valign="top"> + <span class="emphasis"><em>void</em></span> + </td><td valign="top"> + <div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef"> + <b class="fsfunc">failNotSame</b> + (</code></td><td><var class="pdparam">[message]</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">expected</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">actual</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string </code> </td><td><code><var class="pdparam">[message]</var>;</code></td></tr><tr><td><code>string </code> </td><td><code><var class="pdparam">expected</var>;</code></td></tr><tr><td><code>string </code> </td><td><code><var class="pdparam">actual</var>;</code></td></tr></table></div> + <p>Fails the test if <span class="emphasis"><em>expected</em></span> and + <span class="emphasis"><em>actual</em></span> are equal to one another. The message is + optional.</p> + </td></tr></tbody></table></div></div><br class="table-break"></div><div class="section" lang="en-US"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="shelldoc-section-suites"></a>3. suites</h2></div></div></div><div class="table"><a name="shelldoc-function-suites"></a><p class="title"><b>Table 3.3. suites</b></p><div class="table-contents"><table summary="suites" border="1"><colgroup><col><col></colgroup><tbody><tr valign="top"><td align="right" valign="top"> + <span class="emphasis"><em>void</em></span> + </td><td valign="top"> + <div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef"> + <b class="fsfunc">suite</b> + (</code></td><td><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code></code> </td><td><code>;</code></td></tr></table></div> + <p>This function can be optionally overridden by the user in their test + suite.</p> + <p>If this function exists, it will be called when + <span><strong class="command">shunit2</strong></span> is sourced. If it does not exist, shUnit2 will + search the parent script for all functions beginning with the word + <code class="literal">test</code>, and they will be added dynamically to the test + suite.</p> + </td></tr><tr valign="top"><td align="right" valign="top"> + <span class="emphasis"><em>void</em></span> + </td><td valign="top"> + <div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef"> + <b class="fsfunc">suite_addTest</b> + (</code></td><td><var class="pdparam">function</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string </code> </td><td><code><var class="pdparam">function</var>;</code></td></tr></table></div> + <p>This function adds a function name to the list of tests scheduled for + execution as part of this test suite. This function should only be called + from within the <code class="function">suite()</code> function.</p> + </td></tr><tr valign="top"><td align="right" valign="top"> + <span class="emphasis"><em>void</em></span> + </td><td valign="top"> + <div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef"> + <b class="fsfunc">oneTimeSetUp</b> + (</code></td><td><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code></code> </td><td><code>;</code></td></tr></table></div> + <p>This function can be be optionally overridden by the user in their + test suite.</p> + <p>If this function exists, it will be called once before any tests are + run. It is useful to prepare a common environment for all tests.</p> + </td></tr><tr valign="top"><td align="right" valign="top"> + <span class="emphasis"><em>void</em></span> + </td><td valign="top"> + <div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef"> + <b class="fsfunc">oneTimeTearDown</b> + (</code></td><td><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code></code> </td><td><code>;</code></td></tr></table></div> + <p>This function can be be optionally overridden by the user in their + test suite.</p> + <p>If this function exists, it will be called once after all tests are + completed. It is useful to clean up the environment after all tests.</p> + </td></tr><tr valign="top"><td align="right" valign="top"> + <span class="emphasis"><em>void</em></span> + </td><td valign="top"> + <div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef"> + <b class="fsfunc">setUp</b> + (</code></td><td><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code></code> </td><td><code>;</code></td></tr></table></div> + <p>This function can be be optionally overridden by the user in their + test suite.</p> + <p>If this function exists, it will be called before each test is run. + It is useful to reset the environment before each test.</p> + </td></tr><tr valign="top"><td align="right" valign="top"> + <span class="emphasis"><em>void</em></span> + </td><td valign="top"> + <div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef"> + <b class="fsfunc">tearDown</b> + (</code></td><td><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code></code> </td><td><code>;</code></td></tr></table></div> + <p>This function can be be optionally overridden by the user in their + test suite.</p> + <p>If this function exists, it will be called after each test completes. + It is useful to clean up the environment after each test.</p> + </td></tr></tbody></table></div></div><br class="table-break"></div></div></div></body></html> |