From 08d08d4b0616286e5344d9aa9cc585a871ebc232 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 23 Nov 2012 13:39:02 -0500 Subject: [PATCH] Use filemanip to automatically doctest all source files. --- numerical-analysis.cabal | 3 ++- test/Doctests.hs | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) 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 -- 2.43.2