Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion integration/Setup.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -Wall #-}

import Control.Applicative
Expand Down Expand Up @@ -33,7 +34,16 @@ collectTests pkgRoot roots =
findAllTests :: FilePath -> IO [(String, String, String, String)]
findAllTests root = do
paths <- findPaths root
concat <$> traverse (findModuleTests root) paths
concat <$> traverse (findModuleTests root) (filter (not . noise) paths)

-- don't touch emacs auto-save or backup files
noise :: FilePath -> Bool
noise (last . splitDirectories -> fn) = autosave fn || backup fn
where
backup = (== '~') . last
autosave ('.' : '#' : _) = True
autosave ('#' : _) = True -- (if you want to make this pattern more strict: there is also a '#' at the end.)
autosave _ = False

findModuleTests :: FilePath -> FilePath -> IO [(String, String, String, String)]
findModuleTests root path = do
Expand Down Expand Up @@ -94,6 +104,7 @@ collectTestsInModule pkgRoot fn = do
where
extractComment :: Comment -> String
extractComment (Comment _ _ s) = s

testName :: Name (SrcSpanInfo, [Comment]) -> Maybe (String, String, String)
testName name =
let (n', comments) =
Expand All @@ -105,7 +116,9 @@ collectTestsInModule pkgRoot fn = do
let (summary, rest) = collectDescription comments
in pure (n', summary, rest)
else Nothing

absolutePath = pkgRoot </> fn

-- All of the haskell-src-exts supported extensions that we are using.
-- Several that are in the cabal file couldn't be directly copied over,
-- but they aren't causing trouble at the moment.
Expand Down