-
Notifications
You must be signed in to change notification settings - Fork 109
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
Coloured reporting and Template Haskell runner #1
Conversation
@@ -34,15 +34,17 @@ source-repository head | |||
library | |||
build-depends: | |||
base >= 3 && < 5 | |||
, base64-bytestring >= 1.0 && < 1.1 | |||
, ansi-terminal >= 0.6 && < 0.7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it would be less convenient, but I wonder whether it would be worth splitting up the project into core, runner-terminal, example, etc. I suspect that will be too annoying for the first release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think it's probably worth waiting until there is a concrete burden before doing this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not too worried about ansi-terminal
as a dependency, it's absolutely micro and only depends libraries which already ship with GHC itself (unix
/ Win32
depending on the platform).
Updated screenshots or output would be good in the doc. :) |
Next level. 💯 |
else if elem "--no-color" args then | ||
pure False | ||
else | ||
liftIO $ hSupportsANSI stdout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with your env variable suggestion, this getArgs
is pretty brutal.
hSupportANSI
will be correct for 99% of users though 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately it doesn't work with cabal test
(and hence mafia test
) !! :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so the only way to get colours is to say mafia test -- --test-option=--color
, but yeah an env var would do the trick too, works fine in ghci
this is amazing 🔥 |
…-result Refine wilson bounds function
This significantly improves the test runner, adding coloured output 🌈 and some template haskell code for discovering properties.
The property discovery is a little hacky, but it does deal with multi-line comments, so the following will not be picked up as a property:
The failure output pulls in the source code of the property and annotates it with the generated test data, as well as "calling out" which of your propositions actually failed. I can imagine this will be useful when you have a
conjoin
like thing with many possible ways in which you can fail:The source code annotation relies on the GHC 8.0
CallStack
API, so I'm going to need to figure out something to do as a stop gap for use in GHC 7.10. I'll probably just go back to printing the forall's in a list along with their types if compiling for 7.10.Ignore the churn on the
Example.hs
file, I was just playing with things to see what different failures would look like in the test runner. Hopefully the source code annotation stuff scales to larger examples, I'm not sure, but I think it should be ok.My todo list before doing the first Hackage release is basically just adding examples for working with
IO
,ResourceT
andExceptT
to see if there's any issues with Template Haskell property discovery stuff and the interface for monadic tests.