{"action":"created","issue":{"url":"https://api.github.com/repos/sol/doctest/issues/106","labels_url":"https://api.github.com/repos/sol/doctest/issues/106/labels{/name}","comments_url":"https://api.github.com/repos/sol/doctest/issues/106/comments","events_url":"https://api.github.com/repos/sol/doctest/issues/106/events","html_url":"https://github.com/sol/doctest/issues/106","id":86855194,"number":106,"title":"Expose API for integrating with other test suites","user":{"login":"munro","id":500774,"avatar_url":"https://avatars.githubusercontent.com/u/500774?v=3","gravatar_id":"","url":"https://api.github.com/users/munro","html_url":"https://github.com/munro","followers_url":"https://api.github.com/users/munro/followers","following_url":"https://api.github.com/users/munro/following{/other_user}","gists_url":"https://api.github.com/users/munro/gists{/gist_id}","starred_url":"https://api.github.com/users/munro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/munro/subscriptions","organizations_url":"https://api.github.com/users/munro/orgs","repos_url":"https://api.github.com/users/munro/repos","events_url":"https://api.github.com/users/munro/events{/privacy}","received_events_url":"https://api.github.com/users/munro/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-10T06:15:09Z","updated_at":"2015-06-10T07:32:57Z","closed_at":null,"body":"Just setup Tasty so I could run HSpec and doctests, except to find out that doctest can't plug into other test suites. [1] :sob: \r\n\r\nLooking at the Tasty API, what it needs to expose is pretty simple—\r\n\r\n* Test name :: String\r\n* If the test passed / failed\r\n* Description :: String (containing pass message, or fail message)\r\n\r\nFrom this example doctest ...\r\n\r\n```haskell\r\n-- | Parse a number\r\n-- >>> parse (parseNumber) \"fail\" \"1231231.12312312313120000\"\r\n-- Right (Number \"1231231.12312312313120000\")\r\n-- >>> parse (parseNumber) \"fail\" \"-1231231.12312312313120000\"\r\n-- Right (Number \"-1231231.12312312313120000\")\r\n-- >>> parse (parseNumber <|> operator) \"fail\" \"-    \"\r\n-- Right (Operator \"-\")\r\n```\r\n\r\n... we could infer the same test API.\r\n\r\n* Test name = `\"Parse a number\"`\r\n* Pass, empty description\r\n* Or on fail, standard doctest error—\r\n\r\n```\r\n### Failure in YourBadCode.hs:1337: expression `parse (parseNumber) \"fail\" \"1231231.12312312313120000\"'\r\nexpected: Right (Number \"1231231.12312312313120000\")\r\n but got: The right thing\r\n```\r\n\r\nOr we could expose more of the doctest test API, so the runner has more control over how to display everything.  I'm actual more partial to doing this!\r\n\r\n```haskell\r\ndata TestExpression = TestExpression\r\n    { line :: Integer\r\n    , expression :: String\r\n    , expected :: String\r\n    , returned :: String\r\n    }\r\n\r\ndata Test = Test\r\n    { file :: String\r\n    , line :: Integer\r\n    , comment :: String\r\n    , expressions :: [TestExpression] }\r\n```\r\n\r\n\r\n------\r\n\r\nThe next step would be to figure out an API to export the tests from, so they can then be translated to another test runner.  What do you think about the following—\r\n\r\n```haskell\r\nmodule Test.DocTest where\r\n\r\ndoctestTests :: [String] -> IO [Test]\r\n```\r\n\r\nLooking at the code, I can already start to see where I would plug this in, and make the current runner just sit on top of the API.\r\n\r\nLet me know what you think!\r\n\r\n:heart: doctest\r\n\r\n[1] http://www.reddit.com/r/haskell/comments/1s0t1f/24_days_of_hackage_tasty/cdsvu7n"},"comment":{"url":"https://api.github.com/repos/sol/doctest/issues/comments/110633308","html_url":"https://github.com/sol/doctest/issues/106#issuecomment-110633308","issue_url":"https://api.github.com/repos/sol/doctest/issues/106","id":110633308,"user":{"login":"sol","id":461132,"avatar_url":"https://avatars.githubusercontent.com/u/461132?v=3","gravatar_id":"","url":"https://api.github.com/users/sol","html_url":"https://github.com/sol","followers_url":"https://api.github.com/users/sol/followers","following_url":"https://api.github.com/users/sol/following{/other_user}","gists_url":"https://api.github.com/users/sol/gists{/gist_id}","starred_url":"https://api.github.com/users/sol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sol/subscriptions","organizations_url":"https://api.github.com/users/sol/orgs","repos_url":"https://api.github.com/users/sol/repos","events_url":"https://api.github.com/users/sol/events{/privacy}","received_events_url":"https://api.github.com/users/sol/received_events","type":"User","site_admin":false},"created_at":"2015-06-10T07:32:57Z","updated_at":"2015-06-10T07:32:57Z","body":"@munro I'm excited to hear that you like both `doctest` and `tasty`.  I'll write a more through reply when I can free up some time.\r\n\r\nBut one quick question, both `tasty` and `hspec` are testing frameworks.  If you are already happy with `hspec`, what is your motivation to run your `hspec` tests through `tasty`?\r\n\r\nHave you looked at [automatic spec discovery](http://hspec.github.io/hspec-discover.html).  You loose this functionality if you use `hspec` in combination with `tasty`.  In addition, both `doctest` and `hspec` work with GHC 7.*, while tasty requires GHC 7.4+.\r\n\r\nWhat exact features of `tasty` are you after?"}}