haskelltestingcabalcabal-install

Entry point for test suite with multiple files in Cabal project?


New to Cabal, so sorry if this is obvious, but I obviously want to have more than one file in my Cabal project's test suite, yet the .cabal file is insisting on being given an entrypoint. What do I put for this?

For example, if I have two modules in my library and want to test each in their own test file. One is no more important than the other, so how do I go about making one of the files an entrypoint?


Solution

  • You could make two test suites.

    test-suite A
        main-is: test-module-A.hs
    
    test-suite B
        main-is: test-module-B.hs
    

    Or you could make a single suite that imports both test modules.

    test-suite both
        main-is: test-both.hs
        other-modules: TestA, TestB