/usr/share/doc/libghc-hunit-doc/html/Test-HUnit.html is in libghc-hunit-doc 1.3.1.2-3.
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 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Test.HUnit</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="file:///usr/share/javascript/mathjax/MathJax.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Test-HUnit.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Test-HUnit.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">HUnit-1.3.1.2: A unit testing framework for Haskell</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>Safe</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Test.HUnit</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>HUnit is a unit testing framework for Haskell, inspired by the JUnit tool
for Java. This guide describes how to use HUnit, assuming you are familiar
with Haskell, though not necessarily with JUnit.</p><p>In the Haskell module where your tests will reside, import module
<code>Test.HUnit</code>:</p><pre> import Test.HUnit
</pre><p>Define test cases as appropriate:</p><pre> test1 = TestCase (assertEqual "for (foo 3)," (1,2) (foo 3))
test2 = TestCase (do (x,y) <- partA 3
assertEqual "for the first result of partA," 5 x
b <- partB y
assertBool ("(partB " ++ show y ++ ") failed") b)
</pre><p>Name the test cases and group them together:</p><pre> tests = TestList [TestLabel "test1" test1, TestLabel "test2" test2]
</pre><p>Run the tests as a group. At a Haskell interpreter prompt, apply the function
<code>runTestTT</code> to the collected tests. (The <em>TT</em> suggests <em>T</em>ext orientation
with output to the <em>T</em>erminal.)</p><pre> > runTestTT tests
Cases: 2 Tried: 2 Errors: 0 Failures: 0
>
</pre><p>If the tests are proving their worth, you might see:</p><pre> > runTestTT tests
### Failure in: 0:test1
for (foo 3),
expected: (1,2)
but got: (1,3)
Cases: 2 Tried: 2 Errors: 0 Failures: 1
>
</pre><p>You can specify tests even more succinctly using operators and overloaded
functions that HUnit provides:</p><pre> tests = test [ "test1" ~: "(foo 3)" ~: (1,2) ~=? (foo 3),
"test2" ~: do (x, y) <- partA 3
assertEqual "for the first result of partA," 5 x
partB y @? "(partB " ++ show y ++ ") failed" ]
</pre><p>Assuming the same test failures as before, you would see:</p><pre> > runTestTT tests
### Failure in: 0:test1:(foo 3)
expected: (1,2)
but got: (1,3)
Cases: 2 Tried: 2 Errors: 0 Failures: 1
>
</pre></div></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src">module <a href="Test-HUnit-Base.html">Test.HUnit.Base</a></p></div><div class="top"><p class="src">module <a href="Test-HUnit-Text.html">Test.HUnit.Text</a></p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.2</p></div></body></html>
|