Skip to content

Loading…

Output less clutter on failures #17

Closed
sol opened this Issue · 0 comments

1 participant

@sol
Owner

Let's look at an example.

module Foo where

-- | A failing example
--
-- >>> 23
-- 42
foo :: a
foo = undefined

-- | An other failing example
--
-- >>> putStrLn "foo\nbar"
-- foo
-- baz
bar :: a
bar = undefined

Running doctest Foo.hs produces the following output.

There are 2 tests, with 2 total interactions.
### Failure in Foo.hs:5: expression `23'
expected: ["42"]
 but got: ["23"]
### Failure in Foo.hs:12: expression `putStrLn "foo\nbar"'
expected: ["foo","baz"]
 but got: ["foo","bar"]
Examples: 2  Tried: 2  Errors: 0  Failures: 2

And I think it would be nice to get this instead.

There are 2 tests, with 2 total interactions.
### Failure in Foo.hs:5: expression `23'
expected: 42
 but got: 23
### Failure in Foo.hs:12: expression `putStrLn "foo\nbar"'
expected: foo
          baz
 but got: foo
          bar
Examples: 2  Tried: 2  Errors: 0  Failures: 2

If any line contains any trailing whitespace, we would still need to print quotes.

@sol sol closed this in 81b4836
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.