-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split tests into internal and external
- external test uses only exposed API Also - move library under src/ (using `.` is bad practice) - remove -fno-ignore-asserts from tests, they did nothing (this is not transitive flag)
- Loading branch information
Showing
6 changed files
with
57 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module Main (main) where | ||
|
||
import Control.Exception (SomeException, try) | ||
import System.IO.BlockIO | ||
import Test.Tasty | ||
import Test.Tasty.HUnit | ||
|
||
main :: IO () | ||
main = defaultMain tests | ||
|
||
tests :: TestTree | ||
tests = testGroup "test" | ||
[ testCase "example_initClose" example_initClose | ||
, testCase "example_closeIsIdempotent" example_closeIsIdempotent | ||
] | ||
|
||
example_initClose :: Assertion | ||
example_initClose = do | ||
ctx <- initIOCtx defaultIOCtxParams | ||
closeIOCtx ctx | ||
|
||
example_closeIsIdempotent :: Assertion | ||
example_closeIsIdempotent = do | ||
ctx <- initIOCtx defaultIOCtxParams | ||
closeIOCtx ctx | ||
eith <- try (closeIOCtx ctx) | ||
case eith of | ||
Left e -> | ||
assertFailure ("Close on a closed context threw an error : " <> show (e :: SomeException)) | ||
Right () -> | ||
pure () |