hspec-expectations-lens-0.3.0.0: Hspec expectations for the lens stuff

Safe HaskellNone

Test.Hspec.Expectations.Lens

Contents

Description

Hspec expectations for the lens stuff

Synopsis

Expectations

shouldHave :: Show s => s -> Getting Any s a -> ExpectationSource

s `shouldHave` l sets the expectation that Fold l has non-zero number of targets in the structure s

 s `shouldBe` t ≡ s `shouldHave` only t
 shouldHave :: Show s => s -> Getter     s a -> Expectation
 shouldHave :: Show s => s -> Fold       s a -> Expectation
 shouldHave :: Show s => s -> Iso'       s a -> Expectation
 shouldHave :: Show s => s -> Lens'      s a -> Expectation
 shouldHave :: Show s => s -> Traversal' s a -> Expectation
 shouldHave :: Show s => s -> Prism'     s a -> Expectation

shouldNotHave :: Show s => s -> Getting All s a -> ExpectationSource

s `shouldNotHave` l sets the expectation that Fold l has exactly zero targets in the structue s

 shouldNotHave :: Show s => s -> Getter     s a -> Expectation
 shouldNotHave :: Show s => s -> Fold       s a -> Expectation
 shouldNotHave :: Show s => s -> Iso'       s a -> Expectation
 shouldNotHave :: Show s => s -> Lens'      s a -> Expectation
 shouldNotHave :: Show s => s -> Traversal' s a -> Expectation
 shouldNotHave :: Show s => s -> Prism'     s a -> Expectation

shouldView :: (Show s, Show a, Eq a) => s -> a -> Getting a s a -> ExpectationSource

s `shouldView` t `through` l sets the expectation that you can see target t in the structure s though a Getter l

 shouldView ::           (Show s, Show a, Eq a) => s -> a -> Getter     s a -> Expectation
 shouldView :: (Monoid m, Show s, Show a, Eq a) => s -> a -> Fold       s m -> Expectation
 shouldView ::           (Show s, Show a, Eq a) => s -> a -> Iso'       s a -> Expectation
 shouldView ::           (Show s, Show a, Eq a) => s -> a -> Lens'      s a -> Expectation
 shouldView :: (Monoid m, Show s, Show a, Eq a) => s -> a -> Traversal' s m -> Expectation
 shouldView :: (Monoid m, Show s, Show a, Eq a) => s -> a -> Prism'     s m -> Expectation

shouldPreview :: (Show s, Show a, Eq a) => s -> a -> Getting (First a) s a -> ExpectationSource

s `shouldPreview` t `through` l sets the expectation that you y is the first target of the Fold l in s

 shouldPreview :: (Show s, Show a, Eq a) => s -> a -> Getter     s a -> Expectation
 shouldPreview :: (Show s, Show a, Eq a) => s -> a -> Fold       s a -> Expectation
 shouldPreview :: (Show s, Show a, Eq a) => s -> a -> Lens'      s a -> Expectation
 shouldPreview :: (Show s, Show a, Eq a) => s -> a -> Iso'       s a -> Expectation
 shouldPreview :: (Show s, Show a, Eq a) => s -> a -> Traversal' s a -> Expectation
 shouldPreview :: (Show s, Show a, Eq a) => s -> a -> Prism'     s a -> Expectation

shouldList :: (Show s, Show a, Eq a) => s -> [a] -> Getting (Endo [a]) s a -> ExpectationSource

s `shouldList` ts `through` l sets the expectation that ts is a list of the Fold l targets in x

 shouldList :: (Show s, Show a, Eq a) => s -> [a] -> Getter     s a -> Expectation
 shouldList :: (Show s, Show a, Eq a) => s -> [a] -> Fold       s a -> Expectation
 shouldList :: (Show s, Show a, Eq a) => s -> [a] -> Lens'      s a -> Expectation
 shouldList :: (Show s, Show a, Eq a) => s -> [a] -> Iso'       s a -> Expectation
 shouldList :: (Show s, Show a, Eq a) => s -> [a] -> Traversal' s a -> Expectation
 shouldList :: (Show s, Show a, Eq a) => s -> [a] -> Prism'     s a -> Expectation

shouldThrow :: IO a -> Getting (First b) SomeException b -> ExpectationSource

a `shouldThrow` l sets the expectation that a throws an exception that Fold l can catch

Test.Hspec exports shouldThrow too; it only allows e -> Bool selectors, which is less general and often less convenient

 shouldThrow :: IO a -> Getter     s b -> Expectation
 shouldThrow :: IO a -> Fold       s b -> Expectation
 shouldThrow :: IO a -> Lens'      s b -> Expectation
 shouldThrow :: IO a -> Iso'       s b -> Expectation
 shouldThrow :: IO a -> Traversal' s b -> Expectation
 shouldThrow :: IO a -> Prism'     s b -> Expectation

shouldPerform :: (Show a, Eq a) => IO s -> a -> Acting IO (Leftmost a) s a -> ExpectationSource

a `shouldPerform` t `through` l sets the expectation that t is a target of the MonadicFold l applied to the result of action a

 shouldPerform :: (Show a, Eq a) => IO s -> a -> Action      IO s a -> Expectation
 shouldPerform :: (Show a, Eq a) => IO s -> a -> MonadicFold IO s a -> Expectation

through :: a -> aSource

A helper to fight parentheses

 through ≡ id
 through :: Int -> Int
 through :: Char -> Char