• Edward Z. Yang's avatar
    Rewrite the package test suite. · e94552e8
    Edward Z. Yang authored
    I've rewritten the test suite to be more concise and "correct by
    construction".  The primary method that this is achieved by
    is introducing the 'TestM' monad, which carries around the
    important state for the tests so that (1) we don't have to
    pass it as an argument all around, and (2) we can automatically
    make the correct decisions about how to do things.  This new
    method emphasises "configuration by convention": we assume
    that a test-case named "Foo" has its test packages in the
    directory "tests/PackageTests/Foo".
    A secondary change is that all command functions automatically fail if
    they have a non-zero exit code (unless you use the 'shouldFail'
    combinator which inverts the sense.)  This saves a lot of typing
    on test-cases.  (In fact, I've reorganized all of the commands
    related here.)
    In the process, I've tightened up the logic for how to find the
    LocalBuildInfo of the Cabal we've testing, so we should now
    reliably be testing the inplace Cabal library, and not the
    system library (as was often the case.)
    Because things are a lot shorter, there is no good reason to
    make Check modules except for the biggest test cases.  Most
    test-cases have been folded into PackageTests.Tests; if you
    have a small test-case you should just put it there.
    Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>