This file is indexed.

/usr/share/doc/libghc-hspec-doc/html/Test-Hspec.html is in libghc-hspec-doc 0.9.1.1-1.

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
<!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.Hspec</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Test-Hspec.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Test-Hspec.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">hspec-0.9.1.1: Behavior Driven Development for Haskell</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>Safe-Infered</td></tr></table><p class="caption">Test.Hspec</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Hspec is a Behaviour-Driven Development tool for Haskell programmers. BDD is an approach
 to software development that combines Test-Driven Development, Domain Driven Design, and
 Acceptance Test-Driven Planning. Hspec helps you do the TDD part of that equation, focusing
 on the documentation and design aspects of TDD.
</p><p>Hspec (and the preceding intro) are based on the Ruby library RSpec. Much of what applies to
 RSpec also applies to Hspec. Hspec ties together <em>descriptions</em> of behavior and <em>examples</em> of
 that behavior. The examples can also be run as tests and the output summarises what needs to
 be implemented.
</p><p>The three functions you'll use the most are <code><a href="Test-Hspec.html#v:hspec">hspec</a></code>, <code><a href="Test-Hspec.html#v:describe">describe</a></code>, and <code><a href="Test-Hspec.html#v:it">it</a></code>. Here is an
 example of functions that format and unformat phone numbers and the specs for them.
</p><pre> import Test.Hspec
 import Test.Hspec.QuickCheck
 import Test.Hspec.HUnit
 import Test.QuickCheck hiding (property)
 import Test.HUnit

 main = hspec mySpecs
</pre><p>Since the specs are often used to tell you what to implement, it's best to start with
 undefined functions. Once we have some specs, then you can implement each behavior
 one at a time, ensuring that each behavior is met and there is no undocumented behavior.
</p><pre> unformatPhoneNumber :: String -&gt; String
 unformatPhoneNumber number = undefined

 formatPhoneNumber :: String -&gt; String
 formatPhoneNumber number = undefined
</pre><p>The <code><a href="Test-Hspec.html#v:describe">describe</a></code> function takes a list of behaviors and examples bound together with the <code><a href="Test-Hspec.html#v:it">it</a></code> function
</p><pre> mySpecs = describe &quot;unformatPhoneNumber&quot; [
</pre><p>A boolean expression can act as a behavior's example.
</p><pre>   it &quot;removes dashes, spaces, and parenthesies&quot;
       (unformatPhoneNumber &quot;(555) 555-1234&quot; == &quot;5555551234&quot;),
</pre><p>The <code><a href="Test-Hspec.html#v:pending">pending</a></code> function marks a behavior as pending an example. The example doesn't count as failing.
</p><pre>   it &quot;handles non-US phone numbers&quot;
       (pending &quot;need to look up how other cultures format phone numbers&quot;),
</pre><p>An HUnit <code>Test</code> can act as a behavior's example. (must import <code>Test.Hspec.HUnit</code>)
</p><pre>   it &quot;removes the \&quot;ext\&quot; prefix of the extension&quot;
       (TestCase $ let expected = &quot;5555551234135&quot;
                       actual   = unformatPhoneNumber &quot;(555) 555-1234 ext 135&quot;
                   in assertEqual &quot;remove extension&quot; expected actual),
</pre><p>An <code>IO()</code> action is treated like an HUnit <code>TestCase</code>. (must import <code>Test.Hspec.HUnit</code>)
</p><pre>   it &quot;converts letters to numbers&quot;
       (do
         let expected = &quot;6862377&quot;
         let actual   = unformatPhoneNumber &quot;NUMBERS&quot;
         assertEqual &quot;letters to numbers&quot; expected actual),
</pre><p>The <code>property</code> function allows a QuickCheck property to act as an example. (must import <code>Test.Hspec.QuickCheck</code>)
</p><pre>   it &quot;can add and remove formatting without changing the number&quot;
       (property $ forAll phoneNumber $
         \ n -&gt; unformatPhoneNumber (formatPhoneNumber n) == n)
   ]

 phoneNumber :: Gen String
 phoneNumber = do
   nums &lt;- elements [7,10,11,12,13,14,15]
   vectorOf nums (elements &quot;0123456789&quot;)
</pre></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span>  <a href="#t:Spec">Spec</a> </li><li class="src short"><span class="keyword">data</span>  <a href="#t:Result">Result</a> </li><li class="src short"><span class="keyword">type</span> <a href="#t:Specs">Specs</a> = [<a href="Test-Hspec.html#t:Spec">Spec</a>]</li><li class="src short"><a href="#v:describe">describe</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -&gt; [[<a href="Test-Hspec.html#t:Spec">Spec</a>]] -&gt; [<a href="Test-Hspec.html#t:Spec">Spec</a>]</li><li class="src short"><a href="#v:it">it</a> :: <a href="Test-Hspec-Core.html#t:Example">Example</a> a =&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -&gt; a -&gt; [<a href="Test-Hspec.html#t:Spec">Spec</a>]</li><li class="src short"><a href="#v:hspec">hspec</a> :: <a href="Test-Hspec.html#t:Specs">Specs</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/System-IO.html#t:IO">IO</a> [<a href="Test-Hspec.html#t:Spec">Spec</a>]</li><li class="src short"><a href="#v:hspecB">hspecB</a> :: <a href="Test-Hspec.html#t:Specs">Specs</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:hspecX">hspecX</a> ::  <a href="Test-Hspec.html#t:Specs">Specs</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/System-IO.html#t:IO">IO</a> a</li><li class="src short"><a href="#v:pending">pending</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -&gt; <a href="Test-Hspec.html#t:Result">Result</a></li><li class="src short"><a href="#v:descriptions">descriptions</a> :: [[<a href="Test-Hspec.html#t:Spec">Spec</a>]] -&gt; [<a href="Test-Hspec.html#t:Spec">Spec</a>]</li><li class="src short"><a href="#v:hHspec">hHspec</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/GHC-IO-Handle.html#t:Handle">Handle</a> -&gt; <a href="Test-Hspec.html#t:Specs">Specs</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/System-IO.html#t:IO">IO</a> <a href="Test-Hspec.html#t:Specs">Specs</a></li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:Spec" class="def">Spec</a>  <a href="src/Test-Hspec-Core.html#Spec" class="link">Source</a></p><div class="doc"><p>Everything needed to specify and show a specific behavior.
</p></div></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:Result" class="def">Result</a>  <a href="src/Test-Hspec-Core.html#Result" class="link">Source</a></p><div class="doc"><p>The result of running an example.
</p></div><div class="subs instances"><p id="control.i:Result" class="caption collapser" onclick="toggleSection('i:Result')">Instances</p><div id="section.i:Result" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Eq.html#t:Eq">Eq</a> <a href="Test-Hspec.html#t:Result">Result</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Test-Hspec-Core.html#t:Example">Example</a> <a href="Test-Hspec.html#t:Result">Result</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:Specs" class="def">Specs</a> = [<a href="Test-Hspec.html#t:Spec">Spec</a>]<a href="src/Test-Hspec-Runner.html#Specs" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:describe" class="def">describe</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -&gt; [[<a href="Test-Hspec.html#t:Spec">Spec</a>]] -&gt; [<a href="Test-Hspec.html#t:Spec">Spec</a>]<a href="src/Test-Hspec-Core.html#describe" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:it" class="def">it</a> :: <a href="Test-Hspec-Core.html#t:Example">Example</a> a =&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -&gt; a -&gt; [<a href="Test-Hspec.html#t:Spec">Spec</a>]<a href="src/Test-Hspec-Core.html#it" class="link">Source</a></p><div class="doc"><p>Create a set of specifications for a specific type being described.
 Once you know what you want specs for, use this.
</p><pre> describe &quot;abs&quot; [
   it &quot;returns a positive number given a negative number&quot;
     (abs (-1) == 1)
   ]
</pre></div></div><div class="top"><p class="src"><a name="v:hspec" class="def">hspec</a> :: <a href="Test-Hspec.html#t:Specs">Specs</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/System-IO.html#t:IO">IO</a> [<a href="Test-Hspec.html#t:Spec">Spec</a>]<a href="src/Test-Hspec-Runner.html#hspec" class="link">Source</a></p><div class="doc"><p>Create a document of the given specs and write it to stdout.
</p></div></div><div class="top"><p class="src"><a name="v:hspecB" class="def">hspecB</a> :: <a href="Test-Hspec.html#t:Specs">Specs</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a><a href="src/Test-Hspec-Runner.html#hspecB" class="link">Source</a></p><div class="doc"><p>Use in place of hspec to also give a <code>Bool</code> success indication
</p></div></div><div class="top"><p class="src"><a name="v:hspecX" class="def">hspecX</a> ::  <a href="Test-Hspec.html#t:Specs">Specs</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/System-IO.html#t:IO">IO</a> a<a href="src/Test-Hspec-Runner.html#hspecX" class="link">Source</a></p><div class="doc"><p>Use in place of <code>hspec</code> to also exit the program with an <code>ExitCode</code>
</p></div></div><div class="top"><p class="src"><a name="v:pending" class="def">pending</a><a href="src/Test-Hspec-Core.html#pending" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>An explanation for why this behavior is pending.
</p></td></tr><tr><td class="src">-&gt; <a href="Test-Hspec.html#t:Result">Result</a></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p>Declare an example as not successful or failing but pending some other work.
 If you want to report on a behavior but don't have an example yet, use this.
</p><pre> describe &quot;fancyFormatter&quot; [
   it &quot;can format text in a way that everyone likes&quot;
     (pending &quot;waiting for clarification from the designers&quot;)
   ]
</pre></div></div><div class="top"><p class="src"><a name="v:descriptions" class="def">descriptions</a> :: [[<a href="Test-Hspec.html#t:Spec">Spec</a>]] -&gt; [<a href="Test-Hspec.html#t:Spec">Spec</a>]<a href="src/Test-Hspec-Core.html#descriptions" class="link">Source</a></p><div class="doc"><p>Combine a list of descriptions.
</p></div></div><div class="top"><p class="src"><a name="v:hHspec" class="def">hHspec</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/GHC-IO-Handle.html#t:Handle">Handle</a> -&gt; <a href="Test-Hspec.html#t:Specs">Specs</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/System-IO.html#t:IO">IO</a> <a href="Test-Hspec.html#t:Specs">Specs</a><a href="src/Test-Hspec-Runner.html#hHspec" class="link">Source</a></p><div class="doc"><p>Create a document of the given specs and write it to the given handle.
</p><pre> writeReport filename specs = withFile filename WriteMode (\ h -&gt; hHspec h specs)
</pre></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.10.0</p></div></body></html>