MIT licensed by Joachim Breitner, Andrew Lelechenko
Maintained by Andrew Lelechenko
This version can be pinned in stack with:tasty-inspection-testing-0.2.1@sha256:365113b85b7df030813e35241e74e5990897cfbfeb29430277010dec21a02a7d,1394

Module documentation for 0.2.1

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://hackage.haskell.org/package/sized-1.0.0.1/src/test/opt-test.hs
  • https://hackage.haskell.org/package/vector-0.13.0.0/src/tests-inspect/Inspect/DerivingVia.hs
  • https://hackage.haskell.org/package/infinite-list-0.1/src/test/Fusion.hs

Changes

0.2.1

  • Skip inspection tests if executed under ghci.

0.2

  • Support inspection-testing-0.5.

0.1.0.1

  • Support GHC 9.4.

0.1

  • Initial release.