Comments (5)
As I describe here sjakobi/bsb-http-chunked#38 (comment), if I invoke ghci
the same way as doctest
is invoked, I get the same error. So as far as I can tell, this is not a bug (by design, doctest
tries to mimic ghci
).
I'm closing this, but please don't be shy to open a new issue if you think there is something that we can do in doctest
to improve the situation.
from doctest.
@sjakobi invoking doctest
via cabal repl
works for me:
$ cabal install doctest --overwrite-policy=always && cabal build && cabal repl --build-depends=QuickCheck --build-depends=template-haskell --with-ghc=doctest
Examples: 5 Tried: 5 Errors: 0 Failures: 0
Starting with doctest-0.20.0
that's how I recommend to use doctest
with cabal-v2
.
from doctest.
So as Ryan explains in https://gitlab.haskell.org/ghc/ghc/-/issues/20833#note_398289, the problem seems to be that the doctests invoked via cabal test
end up using the default GHC2021 language variant, which leads to the type error in bsb-http-chunked
.
To me that seems like a bug somewhere in cabal test
or doctest
. It's good that the workaround with cabal repl
exists, but I hope that doctests will eventually be properly supported in cabal test
again.
EDIT: For reference: haskell/cabal#4500 contains some discussion on better doctest
support in cabal
.
from doctest.
To me that seems like a bug somewhere in
cabal test
ordoctest
.
@sjakobi I'm not convinced that this is the case. doctest
behaves the same as ghci
, which is by design.
cabal test
on the other hand merely runs your tests/Doctests.hs
. I don't think it is in a position to influence how doctest
is invoked.
What I assume is that you just need to pass -XHaskell2010
to doctest
. Specifically, change tests/Doctests.hs
to:
import Test.DocTest
main :: IO ()
main = doctest ["-isrc", "-XHaskell2010", "Data/ByteString/Builder/HTTP/Chunked.hs"]
(untested)
I still think that with doctest-0.20.0
the most reliabl way to use doctest
is via cabal repl
. Because this delegates the handling of all the details to cabal
. So specifically this should work:
cabal install doctest --overwrite-policy=always && cabal build && cabal repl --build-depends=QuickCheck --build-depends=template-haskell --with-ghc=doctest
from doctest.
What I assume is that you just need to pass
-XHaskell2010
todoctest
.
Thank you, @sol! I had totally forgotten to check how these doctests are invoked.
I still think that with
doctest-0.20.0
the most reliabl way to usedoctest
is viacabal repl
.
This is good to know, but I'd really to prefer to be able to run the tests with just cabal test
. The main problems I see with the cabal repl
command is that I'd need to communicate this with contributors, and I'd also need to customize the CI configs which I usually just generate with haskell-ci
.
I'd love to have good support for doctests built into cabal
though. Maybe this cabal repl
command or something like it can be built into cabal as a part of a new type: doctest
test type?!
from doctest.
Related Issues (20)
- Support GHC 9.2 HOT 2
- doctest extracts examples from code blocks
- New major version? HOT 1
- I could discuss if you wouldn't limit discussion. HOT 1
- "not in scope" errors when running with GHC 9 + stack test; redux HOT 20
- Disable test without changing rendering HOT 1
- 0.20.0 doesn't build on ghc 9.4.2 HOT 6
- Invalid platform constants HOT 2
- Error related to OverloadedLists not reported as such HOT 3
- Extra `type-defaults` warnings (from `OverloadedStrings`) make doctests fail HOT 10
- Build failure on GHC 9.6 HOT 1
- How to pass `--fast` when going via `cabal repl`? HOT 1
- `doctest` in multi-GHC setting HOT 6
- One test fails with GHC 9.6.1 HOT 1
- Ci: ubuntu-18.04 will be discontinued soon HOT 1
- Can I focus doctest on a particular function in a module or can I exclude functions from being tested? HOT 2
- GHC 9.4.5, doctest 0.22.0 `$setup import …` does only work with `cabal repl --with-ghc=doctest` HOT 1
- `cabal test` integration (GHC 9.4.5) HOT 7
- cabal repl --enable-multi-repl --with-ghc=doctest fails with "unrecognized option `-unit'" HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from doctest.