mirror of
https://github.com/typeable/file-embed.git
synced 2024-09-11 07:45:30 +03:00
Added test suite
This commit is contained in:
parent
94748acc94
commit
0bc86a5f0a
25
runtests.hs
Normal file
25
runtests.hs
Normal file
@ -0,0 +1,25 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
import Test.Hspec
|
||||
import Test.Hspec.HUnit
|
||||
import Test.HUnit
|
||||
|
||||
import Data.FileEmbed
|
||||
import qualified Data.ByteString as S
|
||||
import Data.List (sort)
|
||||
|
||||
myeq x y = do
|
||||
y' <- y
|
||||
x @=? y'
|
||||
|
||||
main = hspec $ descriptions
|
||||
[ describe "embedFile"
|
||||
[ it "handles text files" $ $(embedFile "sample/bar") `myeq` S.readFile "sample/bar"
|
||||
, it "handles binary files" $ $(embedFile "sample/binary") `myeq` S.readFile "sample/binary"
|
||||
]
|
||||
, describe "getDir"
|
||||
[ it "takes all non-hidden files" $ ["bar", "baz", "bin", "binary"] `myeq` (fmap (sort . map fst) $ getDir "sample")
|
||||
]
|
||||
, describe "embedDir"
|
||||
[ it "handles text and binary files" $ $(embedDir "sample") `myeq` getDir "sample"
|
||||
]
|
||||
]
|
0
sample/.hidden
Normal file
0
sample/.hidden
Normal file
BIN
sample/binary
Normal file
BIN
sample/binary
Normal file
Binary file not shown.
After Width: | Height: | Size: 512 B |
Loading…
Reference in New Issue
Block a user