web: run unit tests at startup.. it's handy for development, and why not
This commit is contained in:
		
							parent
							
								
									95f461fc94
								
							
						
					
					
						commit
						2bdeb2bf6e
					
				@ -23,6 +23,7 @@ import Text.Printf
 | 
				
			|||||||
import Yesod.Helpers.Static
 | 
					import Yesod.Helpers.Static
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import Hledger.Cli
 | 
					import Hledger.Cli
 | 
				
			||||||
 | 
					import Hledger.Cli.Tests (runTestsOrExit)
 | 
				
			||||||
import Hledger.Data
 | 
					import Hledger.Data
 | 
				
			||||||
import Prelude hiding (putStr, putStrLn)
 | 
					import Prelude hiding (putStr, putStrLn)
 | 
				
			||||||
import Hledger.Utils.UTF8 (putStr, putStrLn)
 | 
					import Hledger.Utils.UTF8 (putStr, putStrLn)
 | 
				
			||||||
@ -67,6 +68,8 @@ main = do
 | 
				
			|||||||
-- | The web command.
 | 
					-- | The web command.
 | 
				
			||||||
web :: [Opt] -> [String] -> Journal -> IO ()
 | 
					web :: [Opt] -> [String] -> Journal -> IO ()
 | 
				
			||||||
web opts args j = do
 | 
					web opts args j = do
 | 
				
			||||||
 | 
					  putStrLn $ "Running self-tests..."
 | 
				
			||||||
 | 
					  runTestsOrExit opts args
 | 
				
			||||||
  created <- createFilesIfMissing
 | 
					  created <- createFilesIfMissing
 | 
				
			||||||
  if created
 | 
					  if created
 | 
				
			||||||
   then do
 | 
					   then do
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user