Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to doctest-parallel #28

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ source-repository-package
location: https://github.com/martijnbastiaan/haskell-hedgehog.git
tag: f7d25b0a1927b7c06d69535d5dcfcade560ec624
subdir: hedgehog

write-ghc-environment-files: always
8 changes: 1 addition & 7 deletions clash-protocols.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -201,4 +195,4 @@ test-suite doctests
base,
clash-protocols,
process,
doctest >= 0.17 && < 0.18
doctest-parallel >= 0.2 && < 0.3
1 change: 1 addition & 0 deletions src/Protocols.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module Protocols
, StallAck(..)
, simulateC
, simulateCS
, simulateCSE
, def

-- * Circuit notation plugin
Expand Down
3 changes: 3 additions & 0 deletions src/Protocols/Df.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/Protocols/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import Data.Tuple (swap)
import GHC.Generics (Generic)

{- $setup
>>> import qualified Clash.Prelude as C
>>> import Protocols
-}

Expand Down
25 changes: 3 additions & 22 deletions tests/doctests.hs
Original file line number Diff line number Diff line change
@@ -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