This repository has been archived on 2024-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
fradrive-old/test/Utils/PathPieceSpec.hs
2021-06-02 17:24:24 +02:00

19 lines
606 B
Haskell

module Utils.PathPieceSpec where
import TestImport
import Utils.PathPiece
spec :: Spec
spec = describe "pathPieceJoined" $ do
it "is a prism" . property $ \(NonEmpty (pack -> joinPP)) -> isPrism $ pathPieceJoined joinPP
it "behaves as expected on some examples" $ do
let test xs t = do
review (pathPieceJoined "--") xs `shouldBe` t
preview (pathPieceJoined "--") t `shouldBe` Just xs
test ["foo", "bar"] "foo--bar"
test ["foo--bar", "baz"] "foo----bar--baz"
test ["baz", "foo--bar"] "baz--foo----bar"
test ["baz--quux", "foo--bar"] "baz----quux--foo----bar"