hnix-store/hnix-store-tests/tests/StorePathSpec.hs

32 lines
844 B
Haskell
Raw Normal View History

module StorePathSpec where
2023-11-19 23:29:26 +03:00
import Test.Hspec (Spec, describe)
import Test.Hspec.QuickCheck (prop)
2023-11-19 23:29:26 +03:00
import Test.Hspec.Nix (roundtrips)
import System.Nix.Arbitrary ()
import System.Nix.StorePath
import qualified Data.Attoparsec.Text
spec :: Spec
spec = do
describe "StorePath" $ do
prop "roundtrips using parsePath . storePathToRawFilePath" $
2023-11-19 23:29:26 +03:00
\storeDir ->
roundtrips
(storePathToRawFilePath storeDir)
(parsePath storeDir)
prop "roundtrips using parsePathFromText . storePathToText" $
2023-11-19 23:29:26 +03:00
\storeDir ->
roundtrips
(storePathToText storeDir)
(parsePathFromText storeDir)
prop "roundtrips using pathParser . storePathToText" $
2023-11-19 23:29:26 +03:00
\storeDir ->
roundtrips
(storePathToText storeDir)
(Data.Attoparsec.Text.parseOnly $ pathParser storeDir)