Skip to content

Commit d69f7b6

Browse files
committed
Simplify DocTestMain thanks to doctest-parallel-0.2.2
Manually filtering out auto-generated modules like `Paths_` is no longer needed with doctest-parallel-0.2.2.
1 parent 0512ce1 commit d69f7b6

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

hackage-server.cabal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,4 +572,5 @@ test-suite DocTests
572572

573573
build-depends:
574574
, lib-server
575-
, doctest-parallel ^>= 0.2.1
575+
, doctest-parallel ^>= 0.2.2
576+
-- doctest-parallel-0.2.2 is the first to filter out autogen-modules

tests/DocTestMain.hs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
-- | `doctest-parallel` runner for `hackage-server` library.
22
module Main where
33

4-
import Data.List
5-
( isPrefixOf )
64
import System.Environment
75
( getArgs )
8-
9-
import Distribution.ModuleName
10-
( components )
11-
126
import Test.DocTest
137
( mainFromLibrary )
148
import Test.DocTest.Helpers
15-
( Library(..), extractSpecificCabalLibrary, findCabalPackage )
9+
( extractSpecificCabalLibrary, findCabalPackage )
1610

1711
-- | Doctest @hackage-server:lib-server@.
1812
main :: IO ()
@@ -21,7 +15,4 @@ main = do
2115
pkg <- findCabalPackage "hackage-server"
2216
-- Need to give the library name, otherwise the parser does not find it.
2317
lib <- extractSpecificCabalLibrary (Just "lib-server") pkg
24-
-- Need to filter out the @Paths_*@ modules, as they are not found by doctest-parallel.
25-
let f = not . ("Paths_" `isPrefixOf`) . head . components
26-
let lib' = lib{ libModules = filter f $ libModules lib }
27-
mainFromLibrary lib' args
18+
mainFromLibrary lib args

0 commit comments

Comments
 (0)