packages feed

doctest 0.4.2 → 0.5.0

raw patch · 5 files changed

+29/−16 lines, 5 filesdep +directory

Dependencies added: directory

Files

LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2009, 2010, 2011 Simon Hengel <simon.hengel@wiktory.org>+Copyright (c) 2009-2012 Simon Hengel <sol@typeful.net>  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
doctest.cabal view
@@ -1,6 +1,5 @@ name:                doctest-version:             0.4.2-stability:           experimental+version:             0.5.0 synopsis:            Test interactive Haskell examples description:         The doctest program checks examples in source code comments.                      It is modeled after doctest for Python@@ -8,18 +7,19 @@                      .                      Documentation is at <https://github.com/sol/doctest-haskell#readme>. category:            Testing+bug-reports:         https://github.com/sol/doctest-haskell/issues homepage:            https://github.com/sol/doctest-haskell#readme license:             MIT license-file:        LICENSE-copyright:           (c) 2009-2011 Simon Hengel-author:              Simon Hengel-maintainer:          simon.hengel@wiktory.org+copyright:           (c) 2009-2012 Simon Hengel+author:              Simon Hengel <sol@typeful.net>+maintainer:          Simon Hengel <sol@typeful.net> build-type:          Simple cabal-version:       >= 1.6  source-repository head     type:            git-    location:        git://github.com/sol/doctest-haskell.git+    location:        https://github.com/sol/doctest-haskell  library     ghc-options:     -Wall@@ -40,6 +40,7 @@                      , ghc-paths  == 0.1.*                      , HUnit      == 1.2.*                      , process    == 1.0.*+                     , directory  executable doctest     ghc-options:     -Wall -threaded@@ -60,3 +61,4 @@                      , ghc-paths  == 0.1.*                      , HUnit      == 1.2.*                      , process    == 1.0.*+                     , directory
src/HaddockBackend/Markup.hs view
@@ -35,11 +35,7 @@ docForDeclName (declDoc, argsDoc)  = argsExamples:declExamples   where     declExamples = extractFromMap argsDoc-    argsExamples = extractFromMaybe declDoc--extractFromMaybe :: Maybe (Doc name) -> [Example]-extractFromMaybe (Just doc) = extract doc-extractFromMaybe Nothing    = []+    argsExamples = maybe [] extract declDoc  extractFromMap :: Map key (Doc name) -> [[Example]] extractFromMap m = map extract $ Map.elems m@@ -60,7 +56,7 @@       markupMonospaced    = id,       markupUnorderedList = concat,       markupOrderedList   = concat,-      markupDefList       = concat . map combineTuple,+      markupDefList       = concatMap combineTuple,       markupCodeBlock     = id,       markupURL           = const [],       markupAName         = const [],
src/Interpreter.hs view
@@ -7,6 +7,7 @@ import System.IO import System.Process import System.Exit+import System.Directory (getPermissions, executable) import Control.Monad(when) import Control.Exception (bracket) import Data.Char@@ -30,6 +31,13 @@  newInterpreter :: [String] -> IO Interpreter newInterpreter flags = do++  -- in a perfect world this permission check should never fail, but I know of+  -- at least one case where it did..+  x <- getPermissions ghc+  when (not $ executable x) $ do+    fail $ ghc ++ " is not executable!"+   (Just stdin_, Just stdout_, Nothing, processHandle ) <- createProcess $ (proc ghc myFlags) {std_in = CreatePipe, std_out = CreatePipe, std_err = UseHandle stdout}   setMode stdin_   setMode stdout_
src/Main.hs view
@@ -1,6 +1,8 @@ module Main where -import Test.HUnit (runTestTT, Test(..))+import Test.HUnit (runTestTT, Test(..), Counts(..))+import System.Exit (exitSuccess, exitFailure)+import System.IO  import HaddockBackend.Api import Options@@ -18,6 +20,9 @@     let haddockFlags = haddockOptions options     docTests <- getDocTests haddockFlags files +    let (tCount, iCount) = (length docTests, length (concatMap interactions docTests))+    hPutStrLn stderr $ "There are " ++ show tCount ++ " tests, with " ++ show iCount ++ " total interactions."+     if DumpOnly `elem` options       then do         -- dump to stdout@@ -25,5 +30,7 @@       else do         -- map to unit tests         let tests = TestList $ map (toTestCase repl) docTests-        _ <- runTestTT tests-        return ()+        Counts _ _ errCount failCount <- runTestTT tests+        if errCount == 0 && failCount == 0+          then exitSuccess+          else exitFailure