From: Michael Orlitzky Date: Fri, 23 Nov 2012 18:39:02 +0000 (-0500) Subject: Use filemanip to automatically doctest all source files. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=08d08d4b0616286e5344d9aa9cc585a871ebc232;p=numerical-analysis.git Use filemanip to automatically doctest all source files. --- diff --git a/numerical-analysis.cabal b/numerical-analysis.cabal index 28eba57..e08978d 100644 --- a/numerical-analysis.cabal +++ b/numerical-analysis.cabal @@ -57,7 +57,8 @@ test-suite doctests base == 4.5.*, numbers == 3000.1.*, -- Additional test dependencies. - doctest == 0.9.* + doctest == 0.9.*, + filemanip == 0.3.6.* -- It's not entirely clear to me why I have to reproduce all of this. ghc-options: diff --git a/test/Doctests.hs b/test/Doctests.hs index 3ce1b4a..3cfd2a8 100644 --- a/test/Doctests.hs +++ b/test/Doctests.hs @@ -2,8 +2,12 @@ module Main where import Test.DocTest +import System.FilePath.Find ((==?), always, extension, find) + +find_sources :: IO [FilePath] +find_sources = find always (extension ==? ".hs") "src/" main :: IO () -main = doctest ["--optghc=-isrc", - "src/Roots/Simple.hs", - "src/Roots/Fast.hs"] +main = do + sources <- find_sources + doctest $ ["-isrc"] ++ sources