lib: doctests: add --verbose and --slow flags to executable
--slow turns off doctest's --fast flag, which skips reloading between tests. --verbose shows progress output as tests are run, if doctest 0.16.0+ is installed (and I believe will be harmless otherwise)
This commit is contained in:
		
							parent
							
								
									8a4fb59aaa
								
							
						
					
					
						commit
						ed93807ee5
					
				| @ -156,6 +156,7 @@ tests: | ||||
|     dependencies: | ||||
|     - Glob >=0.7 | ||||
|     - doctest >=0.8 | ||||
|     # doctest >=0.16.0 needed to show verbose progress output | ||||
|     # doctest with ghc 8.4 on mac requires a workaround: | ||||
|     # ~$ locate HSinteger-gmp-1.0.2.0.o | ||||
|     # /Users/simon/.stack/programs/x86_64-osx/ghc-8.4.3/lib/ghc-8.4.2/integer-gmp-1.0.2.0/HSinteger-gmp-1.0.2.0.o | ||||
|  | ||||
| @ -1,14 +1,20 @@ | ||||
| {-# LANGUAGE PackageImports #-} | ||||
| 
 | ||||
| import Data.List | ||||
| import System.Environment | ||||
| import "Glob" System.FilePath.Glob | ||||
| import Test.DocTest | ||||
| 
 | ||||
| main = do | ||||
|   args <- getArgs | ||||
|   fs1 <- glob "Hledger/**/*.hs" | ||||
|   fs2 <- glob "Text/**/*.hs" | ||||
|   --fs3 <- glob "other/ledger-parse/**/*.hs" | ||||
|   let fs = filter (not . isInfixOf "/.") $ ["Hledger.hs"] ++ fs1 ++ fs2 | ||||
|   doctest $  | ||||
|     "--fast" :  -- https://github.com/sol/doctest#a-note-on-performance  | ||||
|     -- show verbose progress output | ||||
|     (if "--verbose" `elem` args then ("--verbose" :) else id) $  | ||||
|     -- don't reload environment per test (opposite of doctest's --fast, | ||||
|     -- https://github.com/sol/doctest#a-note-on-performance) | ||||
|     (if "--slow" `elem` args then id else ("--fast" :)) $ | ||||
|     fs | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user