Hello community, here is the log from the commit of package doctest for openSUSE:Factory checked in at 2017-08-31 20:49:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/doctest (Old) and /work/SRC/openSUSE:Factory/.doctest.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "doctest" Thu Aug 31 20:49:52 2017 rev:5 rq:513183 version:0.11.4 Changes: -------- --- /work/SRC/openSUSE:Factory/doctest/doctest.changes 2017-07-05 23:57:53.852803823 +0200 +++ /work/SRC/openSUSE:Factory/.doctest.new/doctest.changes 2017-08-31 20:49:52.510936276 +0200 @@ -1,0 +2,5 @@ +Thu Jul 27 14:07:54 UTC 2017 - psimons@suse.com + +- Update to version 0.11.4. + +------------------------------------------------------------------- Old: ---- doctest-0.11.3.tar.gz New: ---- doctest-0.11.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ doctest.spec ++++++ --- /var/tmp/diff_new_pack.rJN2lc/_old 2017-08-31 20:49:53.290826803 +0200 +++ /var/tmp/diff_new_pack.rJN2lc/_new 2017-08-31 20:49:53.298825680 +0200 @@ -19,7 +19,7 @@ %global pkg_name doctest %bcond_with tests Name: %{pkg_name} -Version: 0.11.3 +Version: 0.11.4 Release: 0 Summary: Test interactive Haskell examples License: MIT ++++++ doctest-0.11.3.tar.gz -> doctest-0.11.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-0.11.3/doctest.cabal new/doctest-0.11.4/doctest.cabal --- old/doctest-0.11.3/doctest.cabal 2017-06-15 10:12:28.000000000 +0200 +++ new/doctest-0.11.4/doctest.cabal 2017-07-23 06:03:31.000000000 +0200 @@ -1,5 +1,5 @@ name: doctest -version: 0.11.3 +version: 0.11.4 synopsis: Test interactive Haskell examples description: The doctest program checks examples in source code comments. It is modeled after doctest for Python diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-0.11.3/src/Options.hs new/doctest-0.11.4/src/Options.hs --- old/doctest-0.11.3/src/Options.hs 2017-06-15 10:12:28.000000000 +0200 +++ new/doctest-0.11.4/src/Options.hs 2017-07-23 06:03:31.000000000 +0200 @@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-} +{-# LANGUAGE DeriveFunctor #-} module Options ( Result(..) , Run(..) @@ -24,12 +25,13 @@ usage :: String usage = unlines [ "Usage:" - , " doctest [ --no-magic | GHC OPTION | MODULE ]..." + , " doctest [ --fast | --no-magic | GHC OPTION | MODULE ]..." , " doctest --help" , " doctest --version" , " doctest --info" , "" , "Options:" + , " --fast disable :reload between example groups" , " --help display this help and exit" , " --version output version information and exit" , " --info output machine-readable version information and exit" @@ -55,8 +57,8 @@ , ("ghc", ghc) ]) ++ "\n]\n" -data Result = Output String | Result Run - deriving (Eq, Show) +data Result a = Output String | Result a + deriving (Eq, Show, Functor) type Warning = String @@ -64,20 +66,26 @@ runWarnings :: [Warning] , runOptions :: [String] , runMagicMode :: Bool +, runFastMode :: Bool } deriving (Eq, Show) -parseOptions :: [String] -> Result +parseOptions :: [String] -> Result Run parseOptions args | "--help" `elem` args = Output usage | "--info" `elem` args = Output info | "--version" `elem` args = Output versionInfo - | otherwise = case stripOptGhc <$> stripNoMagic args of - (magicMode, (warning, xs)) -> Result (Run (maybeToList warning) xs magicMode) + | otherwise = case fmap stripOptGhc . stripFast <$> stripNoMagic args of + (magicMode, (fastMode, (warning, xs))) -> + Result (Run (maybeToList warning) xs magicMode fastMode) stripNoMagic :: [String] -> (Bool, [String]) -stripNoMagic args = (noMagic `notElem` args, filter (/= noMagic) args) - where - noMagic = "--no-magic" +stripNoMagic = stripFlag False "--no-magic" + +stripFast :: [String] -> (Bool, [String]) +stripFast = stripFlag True "--fast" + +stripFlag :: Bool -> String -> [String] -> (Bool, [String]) +stripFlag enableIt flag args = ((flag `elem` args) == enableIt, filter (/= flag) args) stripOptGhc :: [String] -> (Maybe Warning, [String]) stripOptGhc = go diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-0.11.3/src/Run.hs new/doctest-0.11.4/src/Run.hs --- old/doctest-0.11.3/src/Run.hs 2017-06-15 10:12:28.000000000 +0200 +++ new/doctest-0.11.4/src/Run.hs 2017-07-23 06:03:31.000000000 +0200 @@ -2,7 +2,7 @@ module Run ( doctest #ifdef TEST -, doctest_ +, doctestWithFastMode , Summary , expandDirs #endif @@ -43,7 +43,7 @@ doctest :: [String] -> IO () doctest args0 = case parseOptions args0 of Output s -> putStr s - Result (Run warnings args_ magicMode) -> do + Result (Run warnings args_ magicMode fastMode) -> do mapM_ (hPutStrLn stderr) warnings hFlush stderr @@ -60,7 +60,7 @@ addDistArgs <- getAddDistArgs return (addDistArgs $ packageDBArgs ++ expandedArgs) - r <- doctest_ args `E.catch` \e -> do + r <- doctestWithFastMode fastMode args `E.catch` \e -> do case fromException e of Just (UsageError err) -> do hPutStrLn stderr ("doctest: " ++ err) @@ -123,11 +123,11 @@ isSuccess :: Summary -> Bool isSuccess s = sErrors s == 0 && sFailures s == 0 -doctest_ :: [String] -> IO Summary -doctest_ args = do +doctestWithFastMode :: Bool -> [String] -> IO Summary +doctestWithFastMode fastMode args = do -- get examples from Haddock comments modules <- getDocTests args Interpreter.withInterpreter args $ \repl -> withCP65001 $ do - runModules repl modules + runModules fastMode repl modules diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-0.11.3/src/Runner.hs new/doctest-0.11.4/src/Runner.hs --- old/doctest-0.11.3/src/Runner.hs 2017-06-15 10:12:28.000000000 +0200 +++ new/doctest-0.11.4/src/Runner.hs 2017-07-23 06:03:31.000000000 +0200 @@ -52,11 +52,11 @@ (Summary x1 x2 x3 x4) `mappend` (Summary y1 y2 y3 y4) = Summary (x1 + y1) (x2 + y2) (x3 + y3) (x4 + y4) -- | Run all examples from a list of modules. -runModules :: Interpreter -> [Module [Located DocTest]] -> IO Summary -runModules repl modules = do +runModules :: Bool -> Interpreter -> [Module [Located DocTest]] -> IO Summary +runModules fastMode repl modules = do isInteractive <- hIsTerminalDevice stderr ReportState _ _ s <- (`execStateT` ReportState 0 isInteractive mempty {sExamples = c}) $ do - forM_ modules $ runModule repl + forM_ modules $ runModule fastMode repl -- report final summary gets (show . reportStateSummary) >>= report @@ -107,8 +107,8 @@ liftIO (hPutStr stderr str) -- | Run all examples from given module. -runModule :: Interpreter -> Module [Located DocTest] -> Report () -runModule repl (Module module_ setup examples) = do +runModule :: Bool -> Interpreter -> Module [Located DocTest] -> Report () +runModule fastMode repl (Module module_ setup examples) = do Summary _ _ e0 f0 <- gets reportStateSummary @@ -124,9 +124,11 @@ where reload :: IO () reload = do - -- NOTE: It is important to do the :reload first! There was some odd bug - -- with a previous version of GHC (7.4.1?). - void $ Interpreter.safeEval repl ":reload" + unless fastMode $ + -- NOTE: It is important to do the :reload first! See + -- https://ghc.haskell.org/trac/ghc/ticket/5904, which results in a + -- panic on GHC 7.4.1 if you do the :reload second. + void $ Interpreter.safeEval repl ":reload" void $ Interpreter.safeEval repl $ ":m *" ++ module_ setup_ :: IO ()
participants (1)
-
root@hilbert.suse.de