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

Run doctests for co-log-core #54

Merged
merged 5 commits into from
Oct 6, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions co-log-core/co-log-core.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,10 @@ library
default-language: Haskell2010
default-extensions: InstanceSigs
other-extensions: CPP

test-suite doctest
build-depends: base, doctest ^>= 0.16.0
default-language: Haskell2010
hs-source-dirs: tests
main-is: doctest.hs
type: exitcode-stdio-1.0
1 change: 1 addition & 0 deletions co-log-core/src/Colog/Core/Action.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE InstanceSigs #-}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This extension is enabled by default for whole project. It's very useful! So I think that instead of adding it to every manually, you can just write:

main = Doctest.doctest [ "-XInstanceSigs", "src" ]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good call! I didn't realize you could pass GHC options to doctest.

{-# LANGUAGE ViewPatterns #-}

{- | Implements core data types and combinators for logging actions.
Expand Down
4 changes: 4 additions & 0 deletions co-log-core/tests/doctest.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Main ( main ) where
import qualified Test.DocTest as Doctest
main :: IO ()
main = Doctest.doctest [ "src" ]