| Safe Haskell | None |
|---|
Test.Hspec.Expectations.Lens
Contents
Description
Hspec expectations for the lens stuff
- shouldHave :: Show s => s -> Getting Any s a -> Expectation
- shouldNotHave :: Show s => s -> Getting All s a -> Expectation
- shouldView :: (Show s, Show a, Eq a) => s -> a -> Getting a s a -> Expectation
- shouldPreview :: (Show s, Show a, Eq a) => s -> a -> Getting (First a) s a -> Expectation
- shouldList :: (Show s, Show a, Eq a) => s -> [a] -> Getting (Endo [a]) s a -> Expectation
- shouldThrow :: IO a -> Getting (First b) SomeException b -> Expectation
- shouldPerform :: (Show a, Eq a) => IO s -> a -> Acting IO (Leftmost a) s a -> Expectation
- through :: a -> a
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 ::Shows => s ->Getters a ->ExpectationshouldHave ::Shows => s ->Folds a ->ExpectationshouldHave ::Shows => s ->Iso's a ->ExpectationshouldHave ::Shows => s ->Lens's a ->ExpectationshouldHave ::Shows => s ->Traversal's a ->ExpectationshouldHave ::Shows => 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 ::Shows => s ->Getters a ->ExpectationshouldNotHave ::Shows => s ->Folds a ->ExpectationshouldNotHave ::Shows => s ->Iso's a ->ExpectationshouldNotHave ::Shows => s ->Lens's a ->ExpectationshouldNotHave ::Shows => s ->Traversal's a ->ExpectationshouldNotHave ::Shows => 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 :: (Shows,Showa,Eqa) => s -> a ->Getters a ->ExpectationshouldView :: (Monoidm,Shows,Showa,Eqa) => s -> a ->Folds m ->ExpectationshouldView :: (Shows,Showa,Eqa) => s -> a ->Iso's a ->ExpectationshouldView :: (Shows,Showa,Eqa) => s -> a ->Lens's a ->ExpectationshouldView :: (Monoidm,Shows,Showa,Eqa) => s -> a ->Traversal's m ->ExpectationshouldView :: (Monoidm,Shows,Showa,Eqa) => 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 :: (Shows,Showa,Eqa) => s -> a ->Getters a ->ExpectationshouldPreview :: (Shows,Showa,Eqa) => s -> a ->Folds a ->ExpectationshouldPreview :: (Shows,Showa,Eqa) => s -> a ->Lens's a ->ExpectationshouldPreview :: (Shows,Showa,Eqa) => s -> a ->Iso's a ->ExpectationshouldPreview :: (Shows,Showa,Eqa) => s -> a ->Traversal's a ->ExpectationshouldPreview :: (Shows,Showa,Eqa) => 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 :: (Shows,Showa,Eqa) => s -> [a] ->Getters a ->ExpectationshouldList :: (Shows,Showa,Eqa) => s -> [a] ->Folds a ->ExpectationshouldList :: (Shows,Showa,Eqa) => s -> [a] ->Lens's a ->ExpectationshouldList :: (Shows,Showa,Eqa) => s -> [a] ->Iso's a ->ExpectationshouldList :: (Shows,Showa,Eqa) => s -> [a] ->Traversal's a ->ExpectationshouldList :: (Shows,Showa,Eqa) => 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 ::IOa ->Getters b ->ExpectationshouldThrow ::IOa ->Folds b ->ExpectationshouldThrow ::IOa ->Lens's b ->ExpectationshouldThrow ::IOa ->Iso's b ->ExpectationshouldThrow ::IOa ->Traversal's b ->ExpectationshouldThrow ::IOa ->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 :: (Showa,Eqa) =>IOs -> a ->ActionIOs a ->ExpectationshouldPerform :: (Showa,Eqa) =>IOs -> a ->MonadicFoldIOs a ->Expectation