This file is indexed.

/usr/share/doc/libghc-test-framework-th-doc/html/test-framework-th.txt is in libghc-test-framework-th-doc 0.2.4-7build1.

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
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Automagically generate the HUnit- and Quickcheck-bulk-code using Template Haskell.
--   
--   <tt>test-framework-th</tt> contains two interesting functions:
--   <tt>defaultMainGenerator</tt> and <tt>testGroupGenerator</tt>.
--   
--   <tt>defaultMainGenerator</tt> will extract all functions beginning
--   with case_, prop_ or test_in the module and put them in a testGroup.
--   
--   <pre>
--   -- file SomeModule.hs
--   ( -# LANGUAGE TemplateHaskell #- )
--   module SomeModule where
--   import Test.Framework.TH
--   import Test.Framework
--   import Test.HUnit
--   import Test.Framework.Providers.HUnit
--   import Test.Framework.Providers.QuickCheck2
--   
--   -- observe this line!
--   main = $(defaultMainGenerator)
--   case_1 = do 1 @=? 1
--   case_2 = do 2 @=? 2
--   prop_reverse xs = reverse (reverse xs) == xs
--      where types = xs::[Int]
--   </pre>
--   
--   is the same as
--   
--   <pre>
--   -- file SomeModule.hs
--   ( -# LANGUAGE TemplateHaskell #- )
--   module SomeModule where
--   import Test.Framework.TH
--   import Test.Framework
--   import Test.HUnit
--   import Test.Framework.Providers.HUnit
--   import Test.Framework.Providers.QuickCheck2
--   
--   -- observe this line!
--   main =
--     defaultMain [
--       testGroup "SomeModule" [ testCase "1" case_1, testCase "2" case_2, testProperty "reverse" prop_reverse]
--       ]
--   
--   case_1 = do 1 @=? 1
--   case_2 = do 2 @=? 2
--   prop_reverse xs = reverse (reverse xs) == xs
--      where types = xs::[Int]
--   </pre>
--   
--   <tt>testGroupGenerator</tt> is like <tt>defaultMainGenerator</tt> but
--   without <tt>defaultMain</tt>. It is useful if you need a function for
--   the testgroup (e.g. if you want to be able to call the testgroup from
--   another module).
@package test-framework-th
@version 0.2.4

module Test.Framework.TH

-- | Generate the usual code and extract the usual functions needed in
--   order to run HUnit<i>Quickcheck</i>Quickcheck2. All functions
--   beginning with case_, prop_ or test_ will be extracted.
--   
--   <pre>
--   {-# OPTIONS_GHC -fglasgow-exts -XTemplateHaskell #-}
--   module MyModuleTest where
--   import Test.HUnit
--   import MainTestGenerator
--   
--   main = $(defaultMainGenerator)
--   
--   case_Foo = do 4 @=? 4
--   
--   case_Bar = do "hej" @=? "hej"
--   
--   prop_Reverse xs = reverse (reverse xs) == xs
--     where types = xs :: [Int]
--   
--   test_Group =
--       [ testCase "1" case_Foo
--       , testProperty "2" prop_Reverse
--       ]
--   </pre>
--   
--   will automagically extract prop_Reverse, case_Foo, case_Bar and
--   test_Group and run them as well as present them as belonging to the
--   testGroup <tt>MyModuleTest</tt> such as
--   
--   <pre>
--   me: runghc MyModuleTest.hs 
--   MyModuleTest:
--     Reverse: [OK, passed 100 tests]
--     Foo: [OK]
--     Bar: [OK]
--     Group:
--       1: [OK]
--       2: [OK, passed 100 tests]
--   
--            Properties  Test Cases   Total       
--    Passed  2           3            5          
--    Failed  0           0            0           
--    Total   2           3            5
--   </pre>
defaultMainGenerator :: ExpQ
defaultMainGenerator2 :: ExpQ

-- | Generate the usual code and extract the usual functions needed for a
--   testGroup in HUnit<i>Quickcheck</i>Quickcheck2. All functions
--   beginning with case_, prop_ or test_ will be extracted.
--   
--   <pre>
--   -- file SomeModule.hs
--   fooTestGroup = $(testGroupGenerator)
--   main = defaultMain [fooTestGroup]
--   case_1 = do 1 @=? 1
--   case_2 = do 2 @=? 2
--   prop_p xs = reverse (reverse xs) == xs
--    where types = xs :: [Int]
--   </pre>
--   
--   is the same as
--   
--   <pre>
--   -- file SoomeModule.hs
--   fooTestGroup = testGroup "SomeModule" [testProperty "p" prop_1, testCase "1" case_1, testCase "2" case_2]
--   main = defaultMain [fooTestGroup]
--   case_1 = do 1 @=? 1
--   case_2 = do 2 @=? 2
--   prop_1 xs = reverse (reverse xs) == xs
--    where types = xs :: [Int]
--   </pre>
testGroupGenerator :: ExpQ