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

Make doctests work for multiline docs #234

Open
wende opened this issue Nov 28, 2017 · 0 comments
Open

Make doctests work for multiline docs #234

wende opened this issue Nov 28, 2017 · 0 comments

Comments

@wende
Copy link
Owner

wende commented Nov 28, 2017

Right now the docests will work only if

  1. They are in a single new line
  2. They have a == equation at the top

While it covers about 70% of the cases, it would be nice to be able to write tests which are multiline, where only the last one is a test, and previous ones are setups.

Example:

{- Maps a function

    f = (+) 1          -- These two should be
    list = [1, 2, 3]   -- put under let..in
    myMap f list == [2, 3, 4]  -- this is the final test

    myMap ((*) 2) list -- This is a second test
-}
myMap : (a -> b) -> List a -> List b
myMap f list =
  case list of
    [] -> []
    x :: xs -> f x :: myMap f xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant