@hackage tasty-inspection-testing0.2
Inspection testing support for tasty
Categories
License
MIT
Maintainer
Andrew Lelechenko <andrew.lelechenko@gmail.com>
Links
Versions
Installation
Tested Compilers
Dependencies (5)
- base <4.20
- ghc
- inspection-testing >=0.5 && <0.6
- tasty
- template-haskell Show all…
Dependents (10)
@hackage/random, @hackage/infinite-list, @hackage/sized, @hackage/fixed-vector, @hackage/linear-base, @hackage/vector, Show all…
tasty-inspection-tasting
Integrate inspection-testing
into tasty test suites.
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -O -dsuppress-all -dno-suppress-type-signatures -fplugin=Test.Tasty.Inspection.Plugin #-}
import Test.Tasty
import Test.Tasty.Inspection
lhs :: (a -> b) -> Maybe a -> Bool
lhs f x = case fmap f x of
Nothing -> True
Just{} -> False
rhs :: (a -> b) -> Maybe a -> Bool
rhs _ Nothing = True
rhs _ Just{} = False
main :: IO ()
main = defaultMain $(inspectTest $ 'lhs === 'rhs)
Real world examples:
- https://hackage.haskell.org/package/random-1.2.1/src/test-inspection/Spec/Inspection.hs
- https://hackage.haskell.org/package/linear-base-0.2.0/src/test/Test/Data/V.hs
- https://hackage.haskell.org/package/text-2.0/src/tests/Tests/Properties/LowLevel.hs
- https://hackage.haskell.org/package/text-1.2.5.0/src/tests/Tests/Inspection/Strict.hs
- https://github.com/konn/sized/blob/676c2b81e55e708e7938acdf8c4d7db68db1c1cb/test/opt-test.hs