{-# LANGUAGE CPP #-}
module GetDataFileName (
withTestFileProperty,
(<:<),
)
where
import Control.Monad.IO.Class
import Hedgehog.Internal.Property
import Prelude
#ifdef CARDANO_CRYPTO_TEST
import Paths_cardano_crypto_test (getDataFileName)
addPrefix :: FilePath -> FilePath
addPrefix :: FilePath -> FilePath
addPrefix = forall a. a -> a
id
#else
import Paths_cardano_crypto_wrapper (getDataFileName)
import System.FilePath
addPrefix :: FilePath -> FilePath
addPrefix fp = "test" </> fp
#endif
withTestFileProperty :: FilePath -> (FilePath -> Property) -> Property
withTestFileProperty :: FilePath -> (FilePath -> Property) -> Property
withTestFileProperty FilePath
fp FilePath -> Property
mkProperty = PropertyConfig -> PropertyT IO () -> Property
Property PropertyConfig
config forall a b. (a -> b) -> a -> b
$ do
FilePath
actualFilePath <- forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ FilePath -> IO FilePath
getDataFileName forall a b. (a -> b) -> a -> b
$ FilePath -> FilePath
addPrefix FilePath
fp
Property -> PropertyT IO ()
propertyTest forall a b. (a -> b) -> a -> b
$ FilePath -> Property
mkProperty FilePath
actualFilePath
where
config :: PropertyConfig
config = Property -> PropertyConfig
propertyConfig forall a b. (a -> b) -> a -> b
$ FilePath -> Property
mkProperty FilePath
""
(<:<) :: (FilePath -> Property) -> FilePath -> Property
<:< :: (FilePath -> Property) -> FilePath -> Property
(<:<) = forall a b c. (a -> b -> c) -> b -> a -> c
flip FilePath -> (FilePath -> Property) -> Property
withTestFileProperty