forked from haskell/vector
-
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.
I don't know what am I doing really. But doctests now work
- Loading branch information
Showing
3 changed files
with
42 additions
and
6 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
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 |
---|---|---|
@@ -1,4 +1,38 @@ | ||
import Test.DocTest (doctest) | ||
|
||
-- Doctests are weirdly fragile. For example running tests for module | ||
-- A (D.V.Unboxed.Base) could cause tests in unrelated woudle B | ||
-- (D.V.Storable) to start failing with weird errors. | ||
-- | ||
-- In order to avoid this one would want to run doctests with | ||
-- per-module granularity but this cause another sort of problems! | ||
-- When we load only single module and use import doctests then some | ||
-- data types may come from built library and some from ghci session. | ||
-- | ||
-- This could be remedied by running doctests for groups of modules. | ||
-- This _is_ convoluted setup but doctests now works for GHC9.4 | ||
main :: IO () | ||
main = doctest [ "-Iinclude" , "-Iinternal" , "-XHaskell2010" , "src/Data" ] | ||
main = mapM_ run modGroups | ||
where | ||
run mods = do | ||
mapM_ putStrLn mods | ||
doctest $ ["-Iinclude", "-Iinternal", "-XHaskell2010"] ++ mods | ||
-- | ||
modGroups = | ||
[ [ "src/Data/Vector/Storable/Mutable.hs" | ||
, "src/Data/Vector/Storable.hs" | ||
] | ||
, [ "src/Data/Vector.hs" | ||
, "src/Data/Vector/Mutable.hs" | ||
] | ||
, [ "src/Data/Vector/Generic.hs" | ||
, "src/Data/Vector/Generic/Mutable.hs" | ||
] | ||
, [ "src/Data/Vector/Primitive.hs" | ||
, "src/Data/Vector/Primitive/Mutable.hs" | ||
] | ||
, [ "src/Data/Vector/Unboxed.hs" | ||
, "src/Data/Vector/Unboxed/Mutable.hs" | ||
, "src/Data/Vector/Unboxed/Base.hs" | ||
] | ||
] |