File: doctests.hs

package info (click to toggle)
haskell-vector 0.13.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 996 kB
  • sloc: haskell: 11,004; ansic: 6; makefile: 3
file content (38 lines) | stat: -rw-r--r-- 1,333 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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 = 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"
        ]
      ]