From 4fc26f654c17ba31aa96281993fa146dde02dbb3 Mon Sep 17 00:00:00 2001 From: Martijn Bastiaan Date: Fri, 25 Feb 2022 12:07:20 +0100 Subject: [PATCH] Switch to doctest-parallel --- cabal.project | 2 ++ clash-protocols.cabal | 8 +------- src/Protocols.hs | 1 + src/Protocols/Df.hs | 3 +++ src/Protocols/Internal.hs | 1 + tests/doctests.hs | 25 +++---------------------- 6 files changed, 11 insertions(+), 29 deletions(-) diff --git a/cabal.project b/cabal.project index 93e00d27..42530dcd 100644 --- a/cabal.project +++ b/cabal.project @@ -18,3 +18,5 @@ source-repository-package location: https://github.com/martijnbastiaan/haskell-hedgehog.git tag: f7d25b0a1927b7c06d69535d5dcfcade560ec624 subdir: hedgehog + +write-ghc-environment-files: always diff --git a/clash-protocols.cabal b/clash-protocols.cabal index 770f590e..ee3fe709 100644 --- a/clash-protocols.cabal +++ b/clash-protocols.cabal @@ -92,12 +92,6 @@ common common-options ghc-typelits-extra, ghc-typelits-knownnat -custom-setup - setup-depends: - base >= 4.11 && <5, - Cabal >= 2.4, - cabal-doctest >= 1.0.1 && <1.1 - -- library inline-circuit-notation -- visibility: private -- hs-source-dirs: deps/circuit-notation/src @@ -201,4 +195,4 @@ test-suite doctests base, clash-protocols, process, - doctest >= 0.17 && < 0.18 + doctest-parallel >= 0.2 && < 0.3 diff --git a/src/Protocols.hs b/src/Protocols.hs index 427e6a47..bea0cb17 100644 --- a/src/Protocols.hs +++ b/src/Protocols.hs @@ -44,6 +44,7 @@ module Protocols , StallAck(..) , simulateC , simulateCS + , simulateCSE , def -- * Circuit notation plugin diff --git a/src/Protocols/Df.hs b/src/Protocols/Df.hs index 5bb053a5..13ca133f 100644 --- a/src/Protocols/Df.hs +++ b/src/Protocols/Df.hs @@ -82,6 +82,9 @@ import Protocols.DfLike (DfLike) import qualified Protocols.DfLike as DfLike -- $setup +-- >>> :m -Prelude +-- >>> import Prelude hiding (filter, zipWith) +-- >>> import qualified Clash.Prelude as C -- >>> import Protocols -- >>> import Clash.Prelude (Vec(..)) -- >>> import qualified Prelude as P diff --git a/src/Protocols/Internal.hs b/src/Protocols/Internal.hs index 07c4d2e1..edac0e6b 100644 --- a/src/Protocols/Internal.hs +++ b/src/Protocols/Internal.hs @@ -25,6 +25,7 @@ import Data.Tuple (swap) import GHC.Generics (Generic) {- $setup +>>> import qualified Clash.Prelude as C >>> import Protocols -} diff --git a/tests/doctests.hs b/tests/doctests.hs index 9d942d7b..42074528 100644 --- a/tests/doctests.hs +++ b/tests/doctests.hs @@ -1,26 +1,7 @@ module Main where -import Prelude -import Build_doctests (flags, pkgs, module_sources) -import Test.DocTest (doctest) -import System.Environment (lookupEnv) -import System.Process - -getGlobalPackageDb :: IO String -getGlobalPackageDb = readProcess "ghc" ["--print-global-package-db"] "" +import System.Environment (getArgs) +import Test.DocTest (mainFromCabal) main :: IO () -main = do - inNixShell <-lookupEnv "IN_NIX_SHELL" - extraFlags <- - case inNixShell of - Nothing -> pure [] - Just _ -> pure . ("-package-db="++) <$> getGlobalPackageDb - - let - pluginFlags = - [ "-fplugin", "GHC.TypeLits.KnownNat.Solver" - , "-fplugin", "GHC.TypeLits.Normalise" - , "-fplugin", "GHC.TypeLits.Extra.Solver" ] - - doctest (flags ++ extraFlags ++ pkgs ++ pluginFlags ++ module_sources) +main = mainFromCabal "clash-protocols" =<< getArgs