Skip to content
Snippets Groups Projects
Commit 326bc86f authored by Hans-Peter Deifel's avatar Hans-Peter Deifel
Browse files

Only check examples with a corresponding .out file

This allows files to exists in the examples directory that don't have
a ".out" file. These are now ignored in the test suite. Such files
could be documentation or ephemeral tests.
parent f0ecb444
Branches
No related tags found
No related merge requests found
......@@ -157,3 +157,4 @@ test-suite examples
, hspec
, directory
, text
, extra
......@@ -5,6 +5,7 @@ module Main (main) where
import Control.Monad.ST
import Data.List
import Data.List.Extra (dropSuffix)
import qualified Data.Text as T
import System.Directory
import Test.Hspec
......@@ -16,7 +17,7 @@ import MA.PartitionPrinter
main :: IO ()
main = do
let exampleDir = "examples/"
files <- filter (not . isOutput) <$> listDirectory exampleDir
files <- filter isOutput <$> listDirectory exampleDir
hspec $ testFiles (map (exampleDir ++) files)
outSuffix :: String
......@@ -29,7 +30,9 @@ testFiles :: [FilePath] -> Spec
testFiles = mapM_ testFile
testFile :: FilePath -> Spec
testFile file = specify file $ do
testFile outfile =
let file = dropSuffix outSuffix outfile
in specify file $ do
output <- readFile (file ++ outSuffix)
process file `shouldReturn` output
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment