@@ -3,9 +3,28 @@ starts the HUnit text-based test controller.
4To add a new module to the test suite, do the following:
4To add a new module to the test suite, do the following:
6− * Create a new module that exports a function of type Connection -> Test.
6+ * Create a new module that exports a function of type TestEnv -> Test.
9+ module Foo (testFoo) where
13+ testFoo :: TestEnv -> Test
14+ testFoo TestEnv{..} = ...
16+ 'TestEnv' (defined in Common.hs) contains information for accessing the
17+ database. `TestEnv{..}` is a record wildcard which brings the following
18+ definitions into scope:
21+ withConn :: (Connection -> IO a) -> IO a
23+ 'conn' is a database connection shared by all the tests.
24+ 'withConn' can be used to open additional connections (to the same database).
7 'Test' is basically a tree of 'Assertion's, where 'Assertion' is just a type
26 'Test' is basically a tree of 'Assertion's, where 'Assertion' is just a type
8− alias for IO (). See Bytea.hs for reference.
27+ alias for IO (). See the HLint documentation for more information.
10 * Add an entry to 'tests' in Main.hs (along with the corresponding
29 * Add an entry to 'tests' in Main.hs (along with the corresponding
11 module import) so the test driver will know about the new module.
30 module import) so the test driver will know about the new module.