1
1
mirror of https://github.com/qfpl/applied-fp-course.git synced 2024-11-26 14:43:53 +03:00
applied-fp-course/level03
Sean Chalmers 554bdc1e08 Add mention of fromIntegral function.
Per #28 , added some wording for the `fromIntegral` function.

Removed the 'aside' for `ghcid` as this was causing more problems
than it was solving. Too many install / usage dramas.

Added a snippet for loading a repl with test libraries and packages
loaded. Because I had completely forgotten how to do that.
2018-02-02 10:44:53 +10:00
..
bin Updates based on course run feedback. 2018-01-16 12:36:57 +10:00
src/FirstApp Updates based on course run feedback. 2018-01-16 12:36:57 +10:00
tests Remove obsolete test comment 2018-01-17 13:49:47 +11:00
changelog.md change changelog files to lowercase 2017-09-01 11:17:26 +10:00
default.nix Overhauled nix file setup to be more like the other QFPL projects. 2017-09-18 10:14:29 +10:00
level03.cabal Upgrade CI so we test building with stack as well 2018-02-02 09:59:55 +10:00
level03.nix Updates based on course run feedback. 2018-01-16 12:36:57 +10:00
LICENCE update copyright notice 2017-09-12 11:51:26 +10:00
README.md Add mention of fromIntegral function. 2018-02-02 10:44:53 +10:00
Setup.hs Added third stage exercise 2017-08-09 15:59:16 +10:00
stack.yaml Update to stackage LTS 10 (GHC 8.2.2) 2018-01-31 12:20:33 +11:00
test.json Updates based on course run feedback. 2018-01-16 12:36:57 +10:00

Level 03

In this exercise we're going to add some tests to our application. Because types are awesome, and tests are pretty good. But types AND tests is pretty much perfect.

These tests will not be awe inspiring, this exercise is primarily to introduce you to adding tests to your Haskell application. The setup of the Cabal file is already completed for you, but will be covered.

As is to be expected, there are multiple testing frameworks and packages available but we will only cover one here. We will use the HSpec framework, with the hspec-wai package to make our lives a bit easier.

NB: Including Test Library Dependencies

For a cabal sandbox:

$ cabal sandbox init
$ cabal install --only-dependencies --enable-tests
$ cabal configure --enable-tests

For a stack environment:

$ stack build --test

To load the tests in the REPL:

# Cabal
$ cabal repl level04-tests

# Stack
$ stack ghci level04:level04-tests

Start in tests/Test.hs.