I have a Cabal test target:
test-suite Tests
type: exitcode-stdio-1.0
main-is: Main.hs
hs-source-dirs: test, src
build-depends: base, …
default-language: Haskell2010
And a simple testing Main.hs
:
import Test.HUnit
testSanity = TestCase $ assertEqual "Should fail" 2 1
main = runTestTT testSanity
Now running cabal test
passes:
Test suite Tests: RUNNING...
Test suite Tests: PASS
Test suite logged to: dist/test/Project-0.1.0-Tests.log
1 of 1 test suites (1 of 1 test cases) passed.
Even though there are failures correctly logged in the test suite log:
Test suite Tests: RUNNING...
Cases: 1 Tried: 0 Errors: 0 Failures: 0
### Failure:
Should fail
expected: 2
but got: 1
Cases: 1 Tried: 1 Errors: 0 Failures: 1
Test suite Tests: PASS
Test suite logged to: dist/test/Project-0.1.0-Tests.log
What am I doing wrong?