/usr/share/doc/libghc-chell-doc/html/chell.txt is in libghc-chell-doc 0.4.0.1-6.
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 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | -- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A simple and intuitive library for automated testing.
--
-- Chell is a simple and intuitive library for automated testing. It
-- natively supports assertion-based testing, and can use companion
-- libraries such as <tt>chell-quickcheck</tt> to support more complex
-- testing strategies.
--
-- An example test suite, which verifies the behavior of artithmetic
-- operators.
--
-- <pre>
-- {-# LANGUAGE TemplateHaskell #-}
--
-- import Test.Chell
--
-- tests_Math :: Suite
-- tests_Math = suite "math"
-- [ test_Addition
-- , test_Subtraction
-- ]
--
-- test_Addition :: Test
-- test_Addition = assertions "addition" $ do
-- $expect (equal (2 + 1) 3)
-- $expect (equal (1 + 2) 3)
--
-- test_Subtraction :: Test
-- test_Subtraction = assertions "subtraction" $ do
-- $expect (equal (2 - 1) 1)
-- $expect (equal (1 - 2) (-1))
--
-- main :: IO ()
-- main = defaultMain [tests_Math]
-- </pre>
--
-- <pre>
-- $ ghc --make chell-example.hs
-- $ ./chell-example
-- PASS: 2 tests run, 2 tests passed
-- </pre>
@package chell
@version 0.4.0.1
-- | Chell is a simple and intuitive library for automated testing. It
-- natively supports assertion-based testing, and can use companion
-- libraries such as <tt>chell-quickcheck</tt> to support more complex
-- testing strategies.
--
-- An example test suite, which verifies the behavior of artithmetic
-- operators.
--
-- <pre>
-- {-# LANGUAGE TemplateHaskell #-}
--
-- import Test.Chell
--
-- suite_Math :: Suite
-- suite_Math = <a>suite</a> "math"
-- [ test_Addition
-- , test_Subtraction
-- ]
--
-- test_Addition :: Test
-- test_Addition = <a>assertions</a> "addition" $ do
-- $<a>expect</a> (<a>equal</a> (2 + 1) 3)
-- $<a>expect</a> (<a>equal</a> (1 + 2) 3)
--
-- test_Subtraction :: Test
-- test_Subtraction = <a>assertions</a> "subtraction" $ do
-- $<a>expect</a> (<a>equal</a> (2 - 1) 1)
-- $<a>expect</a> (<a>equal</a> (1 - 2) (-1))
--
-- main :: IO ()
-- main = <a>defaultMain</a> [suite_Math]
--
-- </pre>
--
-- <pre>
-- $ ghc --make chell-example.hs
-- $ ./chell-example
-- PASS: 2 tests run, 2 tests passed
-- </pre>
module Test.Chell
-- | A simple default main function, which runs a list of tests and logs
-- statistics to stdout.
defaultMain :: [Suite] -> IO ()
-- | A suite is a named collection of tests.
--
-- Note: earlier versions of Chell permitted arbitrary nesting of test
-- suites. This feature proved too unwieldy, and was removed. A similar
-- result can be achieved with <a>suiteTests</a>; see the documentation
-- for <a>suite</a>.
data Suite
-- | Define a new <a>Suite</a>, with the given name and children.
--
-- Note: earlier versions of Chell permitted arbitrary nesting of test
-- suites. This feature proved too unwieldy, and was removed. A similar
-- result can be achieved with <a>suiteTests</a>:
--
-- <pre>
-- test_Addition :: Test
-- test_Subtraction :: Test
-- test_Show :: Test
--
-- suite_Math :: Suite
-- suite_Math = <a>suite</a> "math"
-- [ test_Addition
-- , test_Subtraction
-- ]
--
-- suite_Prelude :: Suite
-- suite_Prelude = <a>suite</a> "prelude"
-- (
-- [ test_Show
-- ]
-- ++ suiteTests suite_Math
-- )
--
-- </pre>
suite :: String -> [Test] -> Suite
-- | Get a suite's name. Suite names may be any string, but are typically
-- plain ASCII so users can easily type them on the command line.
--
-- <pre>
-- $ ghci chell-example.hs
-- Ok, modules loaded: Main.
--
-- *Main> suiteName tests_Math
-- "math"
-- </pre>
suiteName :: Suite -> String
-- | Get the full list of tests contained within this <a>Suite</a>. Each
-- test is given its full name within the test hierarchy, where names are
-- separated by periods.
--
-- <pre>
-- $ ghci chell-example.hs
-- Ok, modules loaded: Main.
--
-- *Main> suiteTests tests_Math
-- [Test "math.addition",Test "math.subtraction"]
-- </pre>
suiteTests :: Suite -> [Test]
class SuiteOrTest a
-- | Conditionally skip tests. Use this to avoid commenting out tests which
-- are currently broken, or do not work on the current platform.
--
-- <pre>
-- tests :: Suite
-- tests = <a>suite</a> "tests"
-- [ test_Foo
-- , <a>skipIf</a> builtOnUnix test_WindowsSpecific
-- , test_Bar
-- ]
--
-- </pre>
skipIf :: SuiteOrTest a => Bool -> a -> a
-- | Conditionally skip tests, depending on the result of a runtime check.
-- The predicate is checked before each test is started.
--
-- <pre>
-- tests :: Suite
-- tests = <a>suite</a> "tests"
-- [ test_Foo
-- , <a>skipWhen</a> noNetwork test_PingGoogle
-- , test_Bar
-- ]
--
-- </pre>
skipWhen :: SuiteOrTest a => IO Bool -> a -> a
-- | See <a>assertions</a>.
data Assertions a
-- | Convert a sequence of pass/fail assertions into a runnable test.
--
-- <pre>
-- test_Equality :: Test
-- test_Equality = assertions "equality" $ do
-- $assert (1 == 1)
-- $assert (equal 1 1)
-- </pre>
assertions :: String -> Assertions a -> Test
-- | See <a>assert</a> and <a>expect</a>.
class IsAssertion a
-- | A single pass/fail assertion. Failed assertions include an explanatory
-- message.
data Assertion
-- | See <a>Assertion</a>.
assertionPassed :: Assertion
-- | See <a>Assertion</a>.
assertionFailed :: String -> Assertion
assert :: Q Exp
expect :: Q Exp
die :: Q Exp
trace :: Q Exp
-- | Attach a note to a test run. Notes will be printed to stdout and
-- included in reports, even if the test fails or aborts. Notes are
-- useful for debugging failing tests.
note :: String -> String -> Assertions ()
-- | Register an IO action to be run after the test completes. This action
-- will run even if the test failed or aborted.
afterTest :: IO () -> Assertions ()
requireLeft :: Q Exp
requireRight :: Q Exp
-- | Assert that two values are equal.
equal :: (Show a, Eq a) => a -> a -> Assertion
-- | Assert that two values are not equal.
notEqual :: (Eq a, Show a) => a -> a -> Assertion
-- | Assert that two values are within some delta of each other.
equalWithin :: (Real a, Show a) => a -> a -> a -> Assertion
-- | Assert that some value is <tt>Just</tt>.
just :: Maybe a -> Assertion
-- | Assert that some value is <tt>Nothing</tt>.
nothing :: Show a => Maybe a -> Assertion
-- | Assert that some value is <tt>Left</tt>.
left :: Show b => Either a b -> Assertion
-- | Assert that some value is <tt>Right</tt>.
right :: Show a => Either a b -> Assertion
-- | Assert that some computation throws an exception matching the provided
-- predicate. This is mostly useful for exception types which do not have
-- an instance for <tt>Eq</tt>, such as <tt><a>ErrorCall</a></tt>.
throws :: Exception err => (err -> Bool) -> IO a -> IO Assertion
-- | Assert that some computation throws an exception equal to the given
-- exception. This is better than just checking that the correct type was
-- thrown, because the test can also verify the exception contains the
-- correct information.
throwsEq :: (Eq err, Exception err, Show err) => err -> IO a -> IO Assertion
-- | Assert a value is greater than another.
greater :: (Ord a, Show a) => a -> a -> Assertion
-- | Assert a value is greater than or equal to another.
greaterEqual :: (Ord a, Show a) => a -> a -> Assertion
-- | Assert a value is less than another.
lesser :: (Ord a, Show a) => a -> a -> Assertion
-- | Assert a value is less than or equal to another.
lesserEqual :: (Ord a, Show a) => a -> a -> Assertion
-- | Assert that two containers have the same items, in any order.
sameItems :: (Foldable container, Show item, Ord item) => container item -> container item -> Assertion
-- | Assert that two containers have the same items, in the same order.
equalItems :: (Foldable container, Show item, Ord item) => container item -> container item -> Assertion
-- | Class for types which can be treated as text; see <a>equalLines</a>.
class IsText a
-- | Assert that two pieces of text are equal. This uses a diff algorithm
-- to check line-by-line, so the error message will be easier to read on
-- large inputs.
equalLines :: (Ord a, IsText a) => a -> a -> Assertion
-- | Variant of <a>equalLines</a> which allows a user-specified
-- line-splitting predicate.
equalLinesWith :: Ord a => (a -> [String]) -> a -> a -> Assertion
-- | A <a>Test</a> is, essentially, an IO action that returns a
-- <a>TestResult</a>. Tests are aggregated into suites (see
-- <a>Suite</a>).
data Test
-- | Define a test, with the given name and implementation.
test :: String -> (TestOptions -> IO TestResult) -> Test
-- | Get the name a test was given when it was defined; see <a>test</a>.
testName :: Test -> String
-- | Run a test, wrapped in error handlers. This will return
-- <a>TestAborted</a> if the test throws an exception or times out.
runTest :: Test -> TestOptions -> IO TestResult
-- | The result of running a test.
--
-- To support future extensions to the testing API, any users of this
-- module who pattern-match against the <a>TestResult</a> constructors
-- should include a default case. If no default case is provided, a
-- warning will be issued.
data TestResult
-- | The test passed, and generated the given notes.
TestPassed :: [(String, String)] -> TestResult
-- | The test did not run, because it was skipped with <a>skipIf</a> or
-- <a>skipWhen</a>.
TestSkipped :: TestResult
-- | The test failed, generating the given notes and failures.
TestFailed :: [(String, String)] -> [Failure] -> TestResult
-- | The test aborted with an error message, and generated the given notes.
TestAborted :: [(String, String)] -> String -> TestResult
-- | Contains details about a test failure.
data Failure
-- | An empty <a>Failure</a>; use the field accessors to populate this
-- value.
failure :: Failure
-- | If given, the location of the failing assertion, expectation, etc.
--
-- <a>failureLocation</a> is a field accessor, and can be used to update
-- a <a>Failure</a> value.
failureLocation :: Failure -> Maybe Location
-- | If given, a message which explains why the test failed.
--
-- <a>failureMessage</a> is a field accessor, and can be used to update a
-- <a>Failure</a> value.
failureMessage :: Failure -> String
-- | Contains details about a location in the test source file.
data Location
-- | An empty <a>Location</a>; use the field accessors to populate this
-- value.
location :: Location
-- | A path to a source file, or empty if not provided.
--
-- <a>locationFile</a> is a field accessor, and can be used to update a
-- <a>Location</a> value.
locationFile :: Location -> String
-- | A Haskell module name, or empty if not provided.
--
-- <a>locationModule</a> is a field accessor, and can be used to update a
-- <a>Location</a> value.
locationModule :: Location -> String
-- | A line number, or Nothing if not provided.
--
-- <a>locationLine</a> is a field accessor, and can be used to update a
-- <a>Location</a> value.
locationLine :: Location -> Maybe Integer
-- | Test options are passed to each test, and control details about how
-- the test should be run.
data TestOptions
-- | Default test options.
--
-- <pre>
-- $ ghci
-- Prelude> import Test.Chell
--
-- Test.Chell> testOptionSeed defaultTestOptions
-- 0
--
-- Test.Chell> testOptionTimeout defaultTestOptions
-- Nothing
-- </pre>
defaultTestOptions :: TestOptions
-- | Get the RNG seed for this test run. The seed is generated once, in
-- <tt>defaultMain</tt>, and used for all tests. It is also logged to
-- reports using a note.
--
-- When using <tt>defaultMain</tt>, users may specify a seed using the
-- <tt>--seed</tt> command-line option.
--
-- <a>testOptionSeed</a> is a field accessor, and can be used to update a
-- <a>TestOptions</a> value.
testOptionSeed :: TestOptions -> Int
-- | An optional timeout, in millseconds. Tests which run longer than this
-- timeout will be aborted.
--
-- When using <tt>defaultMain</tt>, users may specify a timeout using the
-- <tt>--timeout</tt> command-line option.
--
-- <a>testOptionTimeout</a> is a field accessor, and can be used to
-- update a <a>TestOptions</a> value.
testOptionTimeout :: TestOptions -> Maybe Int
instance GHC.Show.Show Test.Chell.Assertion
instance GHC.Classes.Eq Test.Chell.Assertion
instance Test.Chell.IsAssertion Test.Chell.Assertion
instance Test.Chell.IsAssertion GHC.Types.Bool
instance Test.Chell.IsAssertion a => Test.Chell.IsAssertion (GHC.Types.IO a)
instance GHC.Base.Functor Test.Chell.Assertions
instance GHC.Base.Applicative Test.Chell.Assertions
instance GHC.Base.Monad Test.Chell.Assertions
instance Control.Monad.IO.Class.MonadIO Test.Chell.Assertions
instance Test.Chell.IsText GHC.Base.String
instance Test.Chell.IsText Data.Text.Internal.Text
instance Test.Chell.IsText Data.Text.Internal.Lazy.Text
instance Test.Chell.IsText Data.ByteString.Internal.ByteString
instance Test.Chell.IsText Data.ByteString.Lazy.Internal.ByteString
|