1Do what is EASIEST. Having a test at all is more important than,
2say, pretty failure output.
4To add a test, open Main.hs, and add an entry to tests, e.g.:
6 tests :: [TestEnv -> Test]
9 , TestLabel "Foo" . testFoo
12 testFoo :: TestEnv -> Test
13 testFoo TestEnv{..} = TestCase $ do
15 2013 <- getCurrentYear
18Mnemonic for HUnit @=? and @?= operators:
20 * `?` is the value whose correctness is in question
22 * `=` is the expected value
24If you move a test to a separate module, don't forget to add it to
25"other-modules" in postgresql-simple.cabal . Otherwise, the module will be
26left out of the tarball generated by `cabal sdist`, and tests will fail to
27build when installing from Hackage.
29'TestEnv' (defined in Common.hs) contains information for accessing the
30database. `TestEnv{..}` is a record wildcard which brings the following
31definitions into scope:
34 withConn :: (Connection -> IO a) -> IO a
36'conn' is a database connection shared by all the tests.
37'withConn' can be used to open additional connections (to the same database).
39'Test' is basically a tree of 'Assertion's, where 'Assertion' is just a type
40alias for IO (). See the [HUnit documentation][1] for more information.
42 [1]: http://hackage.haskell.org/packages/archive/HUnit/latest/doc/html/Test-HUnit-Base.html
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list