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

interaction between hint and doctest #70

Closed
gelisam opened this issue Jan 6, 2014 · 5 comments
Closed

interaction between hint and doctest #70

gelisam opened this issue Jan 6, 2014 · 5 comments

Comments

@gelisam
Copy link

gelisam commented Jan 6, 2014

Looks like issue #11 is back. I see in that thread that the root cause was in ghc, maybe I should report it there instead? Anyway, on to the actual bug report.

In a file called Main.hs:

import Test.DocTest
import Language.Haskell.Interpreter

-- |
-- >>> True
-- True
main :: IO ()
main = do
    _ <- runInterpreter $ interpret "()" (as :: ())
    doctest ["Main.hs"]
    return ()

The program fails with Main.hs: Too late for parseStaticFlags: call it before newSession. But there is an easy workaround: if I swap the calls to runInterpreter and doctest, I get Examples: 1 Tried: 1 Errors: 0 Failures: 0, as expected.

(By the way, doctest is my favorite testing framework ever! And it makes so much more sense to use that strategy in Haskell than in python.)

@sol
Copy link
Owner

sol commented Jan 6, 2014

Hey, I'm on holiday until January 20th. I'll into it when I'm back ;)

BTW, exact versions of everything could useful.

@gelisam
Copy link
Author

gelisam commented Jan 6, 2014

$ doctest --version
doctest version 0.9.10
using version 7.6.3 of the GHC API
using /usr/local/Cellar/ghc/7.6.3/bin/ghc-7.6.3
$ cabal info hint | grep installed:
    Versions installed: 0.3.3.7

@gelisam
Copy link
Author

gelisam commented Jan 6, 2014

The issue also occurs with the oldest versions of doctest and hint I can install without reinstalling ghc:

$ doctest --version
doctest version 0.8.0.1
using version 7.6.3 of the GHC API
$ cabal info hint | grep installed:
    Versions installed: 0.3.3.5

@gelisam
Copy link
Author

gelisam commented May 9, 2014

The issue was indeed in ghc, closing.
The problem disappeared when I switched to 7.8:

$ doctest --version
doctest version 0.9.11
using version 7.8.2 of the GHC API
$ runhaskell-7.6 Main.hs
Main.hs: Too late for parseStaticFlags: call it before newSession
$ runhaskell-7.8 Main.hs
Examples: 1  Tried: 1  Errors: 0  Failures: 0

@gelisam gelisam closed this as completed May 9, 2014
@sol
Copy link
Owner

sol commented May 10, 2014

Ok, cool :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants