sol / doctest

An implementation of Python's doctest for Haskell
http://hackage.haskell.org/package/doctest
MIT License
371 stars 72 forks source link

Could we have multiline expectations? #419

Open philderbeast opened 7 months ago

philderbeast commented 7 months ago

Could we have multiline expectations (when GHC gets multiline strings https://github.com/ghc-proposals/ghc-proposals/pull/569)?

-- >>> render . docProjectConfigPath $ ProjectConfigPath $ "D.config" :| ["C.config", "B.config", "A.project" ]
-- "D.config\n  imported by: C.config\n  imported by: B.config\n  imported by: A.project"

This would then become something like;

-- >>> render . docProjectConfigPath $ ProjectConfigPath $ "D.config" :| ["C.config", "B.config", "A.project" ]
-- """
-- D.config
--  imported by: C.config
--  imported by: B.config
--  imported by: A.project
-- """

The snippet is taken from https://github.com/haskell/cabal/pull/9578.

sol commented 3 months ago

@philderbeast with GHC 9.10.1 out, can this output be produced by GHCi? If yes, then I think it should already work, if no then it may be out-of-scope for doctest. doctest is a tool to verify that example GHCi sessions work. It's a documentation tool, not primarily a testing tool. Hspec is a better option for testing.