Coder Social home page Coder Social logo

tests fails with GHC 7.8 about doctest HOT 26 CLOSED

sol avatar sol commented on June 9, 2024
tests fails with GHC 7.8

from doctest.

Comments (26)

aavogt avatar aavogt commented on June 9, 2024

In ghci 7.8 RC1, this works:

let f x y = reverse [x,y] == [y,x]
$(polyQuickCheck (mkName "f")) -- sent as a new statement

from doctest.

kazu-yamamoto avatar kazu-yamamoto commented on June 9, 2024

@aavogt Thanks. With many tries, I created the patch above.
@sol The keyword "in" does not work. So, patch is like this.

This patch works well both with GHC 7.6.3 and GHC 7.8.
With GHC 7.6.3, all tests are passed.
With GHC 7.8, the following test cases still fail:

1) Interpreter.eval gives an error message for identifiers that are not in scope
predicate failed on: "\n<interactive>:16:1: Not in scope: \8216foo\8217\n"

2) Main.doctest template-haskell
template-haskell ["Foo.hs"]
expected: Examples: 2  Tried: 2  Errors: 0  Failures: 0
 but got: Examples: 2  Tried: 2  Errors: 0  Failures: 1

3) Main, doctest (regression tests), template-haskell-bugfix
template-haskell-bugfix ["Main.hs"]
expected: Examples: 2  Tried: 2  Errors: 0  Failures: 0
 but got: Examples: 2  Tried: 2  Errors: 0  Failures: 1

from doctest.

kazu-yamamoto avatar kazu-yamamoto commented on June 9, 2024
  1. is trivial. Fixed.

from doctest.

kazu-yamamoto avatar kazu-yamamoto commented on June 9, 2024

The rest two are relating to:
https://ghc.haskell.org/trac/ghc/ticket/8831

What we can do is just waiting.

from doctest.

kazu-yamamoto avatar kazu-yamamoto commented on June 9, 2024

OK. The coming GHC 7.8 fixed this.

@sol Please release the next version.

from doctest.

sol avatar sol commented on June 9, 2024

@kazu-yamamoto I'm happy to release a new version, but do we still need 35879d5? If not, I'd prefer to remove it.

from doctest.

kazu-yamamoto avatar kazu-yamamoto commented on June 9, 2024

A good question! I reverted it and tried make test. Unfortunately, 14 test cases of spec failed. So, I think it is necessary.

from doctest.

sol avatar sol commented on June 9, 2024

@kazu-yamamoto Ok, just release 0.9.11 to Hackage. Can you give it a quick try?

from doctest.

kazu-yamamoto avatar kazu-yamamoto commented on June 9, 2024

OK. doctest v0.9.11 works with GHC 7.8 for my purpose. Thanks.

from doctest.

kazu-yamamoto avatar kazu-yamamoto commented on June 9, 2024

Good news. Repo of GHC now has a tag "ghc-7.8.1-release". All tests of doctest head are passed with this GHC 7.8.1.

from doctest.

sol avatar sol commented on June 9, 2024

Cool :)

So we can close this?

from doctest.

kazu-yamamoto avatar kazu-yamamoto commented on June 9, 2024

Yes!

from doctest.

dmcclean avatar dmcclean commented on June 9, 2024

Interestingly I seem to have hit the same problem or a very similar one. See the Travis log at https://travis-ci.org/dmcclean/intervals/builds/24157318

I am using GHC 7.8.2 and doctest 0.9.11, but I still got:

interactive>:591:3:
Not in scope: ‘polyQuickCheck’
In the splice: $(polyQuickCheck (mkName "doctest_prop"))

<interactive>:591:3:
GHC stage restriction:
‘polyQuickCheck’ is used in a top-level splice or annotation,
and must be imported, not defined locally
In the expression: polyQuickCheck (mkName "doctest_prop")
In the splice: $(polyQuickCheck (mkName "doctest_prop"))

<interactive>:591:19:
Not in scope: ‘mkName’
In the splice: $(polyQuickCheck (mkName "doctest_prop"))

Examples: 203 Tried: 203 Errors: 0 Failures: 1
Test suite doctests: FAIL

from doctest.

kazu-yamamoto avatar kazu-yamamoto commented on June 9, 2024

So, which commit of "intervals" fixes the problem?

I cannot reproduce this.

from doctest.

dmcclean avatar dmcclean commented on June 9, 2024

None for me. The only way I know of to fix it is to delete the one -- prop> comment.

from doctest.

dmcclean avatar dmcclean commented on June 9, 2024

An interesting thing is that the only change I made between build 22 and build 23 was switching from GHC 7.6.3 to 7.8.2 (on a hunch based on this thread that it might help). It didn't fix the problem, but it did change the error message.

Here's the one under 7.6.3:

<interactive>:329:3: Not in scope: `polyQuickCheck'

<interactive>:329:19: Not in scope: `mkName'

Examples: 203 Tried: 203 Errors: 0 Failures: 1
Test suite doctests: FAIL

from doctest.

dmcclean avatar dmcclean commented on June 9, 2024

I was able to reproduce it both on my local machine and on Travis's VM.

I also thought that maybe the implicit lambda in the property was the issue, so I changed it to -- prop> True and then to -- prop> \x -> True and got the same error messages.

from doctest.

sol avatar sol commented on June 9, 2024

This is an issue (or missing feature) with the custom Setup.lhs (AFAICT).

from doctest.

sol avatar sol commented on June 9, 2024

@dmcclean you can fix this by adding "-packageQuickCheck" and "-hide-all-packages" to tests/doctests.hsc (or alternatively add those dependencies to the corresponding test-suite section in your cabal file).

from doctest.

ekmett avatar ekmett commented on June 9, 2024

Except then the version won't get fixed.

from doctest.

sol avatar sol commented on June 9, 2024

Yes, true, we could make doctest depend on QuickCheck and template-haskell (with the reasoning that doctest won't work properly without these packages). That would fixate the versions. Not sure if that is the right approach.

from doctest.

dmcclean avatar dmcclean commented on June 9, 2024

Thanks very much for the help guys.
The suggested workaround works fine for me.

from doctest.

tonymorris avatar tonymorris commented on June 9, 2024

I have resolved this issue on 7.8.3 by adding a dependency on template-haskell >= 2.8 in the test-suite of the cabal file.

from doctest.

cheecheeo avatar cheecheeo commented on June 9, 2024

Is this something worth mentioning in the README?

from doctest.

sol avatar sol commented on June 9, 2024

@cheecheeo If you think this improves the situation than I'd happy to apply a patch.

from doctest.

gelisam avatar gelisam commented on June 9, 2024

Google led me here after encountering one of the error messages quoted above:

<interactive>:39:3:
    Not in scope: ‘polyQuickCheck’
    In the splice: $(polyQuickCheck (mkName "doctest_prop"))

<interactive>:39:3:
    GHC stage restriction:
      ‘polyQuickCheck’ is used in a top-level splice or annotation,
      and must be imported, not defined locally
    In the expression: polyQuickCheck (mkName "doctest_prop")
    In the splice: $(polyQuickCheck (mkName "doctest_prop"))

The solution (which wasn't immediately clear from this thread) was to perform a cabal install QuickCheck before executing doctest.

from doctest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.