TODO this is outdated (2016-01)
The unit tests are built into the darcs-test binary, which you can run by doing a
To run the tests as thoroughly as before the switch to test-framework, you do
dist/build/unit/unit --maximum-unsuitable-generated-tests=5000 && dist/build/unit/unit -t 'Checking again we can do merges using QuickCheck' -a 1000.
Main module of the unit test executable is
src/test.hs. This file imports the QuickCheck and HUnit test suites embedded into the various modules of the Darcs source code.
The darcs unit tests use the test-framework package for executing the tests and handling command-line flags.
There are some QuickCheck-based tests in
src/unit.lhs, which are converted to test-framework
Tests by the
There are also non-QuickCheck tests in the Darcs.Patch.Test hierarchy. Such a test has type
[String], counterintuitively. The test returns an empty list if it succeeds and strings explaining the failures if it fails. There is a
testStringList to convert such tests to Test.Framework
Test via HUnit.
If you want to add new tests, add them within the module you are testing, and make sure the module exports a
testSuite :: Test function that calls all the tests for that module. The module
Darcs.Email is an example of this approach.
For the tests that reside in
src/Darcs/Patch/Test, there are five modules:
Darcs.Patch.Test.Unitcontains the big list of test patches (
patch_unit_tests) and some properties
Darcs.Patch.Test.Propertiescontains some properties
Darcs.Patch.Test.Utilcontains generators and
Arbitraryinstances for darcs’s data types, and some properties.
Arbitraryinstances and QuickCheck-related helper functions.
Darcs.Patch.Test.Checkcontains the definition of a
PatchCheckstate monad for tracking repository state, used by