Popularity
5.1
Declining
Activity
0.0
Stable
5
5
1
Monthly Downloads: 20
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Tags:
Testing
Latest version: v1.1.0
th-test-utils alternatives and similar packages
Based on the "Testing" category.
Alternatively, view th-test-utils alternatives based on common mentions on social networks and blogs.
-
hedgehog
Release with confidence, state-of-the-art property testing for Haskell. -
quickcheck-state-machine
Test monadic programs using state machine based models -
smallcheck
Test your Haskell code by exhaustively checking its properties -
curl-runnings
A declarative test framework for quickly and easily writing integration tests against JSON APIs. -
ghc-prof-flamegraph
Generates data to be used with flamegraph.pl from .prof files. -
monad-mock
A Haskell package that provides a monad transformer for mocking mtl-style typeclasses -
test-framework
Framework for running and organising QuickCheck test properties and HUnit test cases -
fuzzcheck
A library for testing monadic code in the spirit of QuickCheck -
tasty-hedgehog
Tasty integration for the Hedgehog property testing library -
should-not-typecheck
A HUnit/hspec assertion to verify that an expression does not typecheck -
hspec-expectations-json
Hspec expectations on JSON Values -
quickcheck-arbitrary-adt
Typeclass for generating a list of each instance of a sum type's constructors -
hspec-golden-aeson
Use tests to monitor changes in Aeson serialization -
test-framework-th
Automagically (using Template Haskell) generates the Haskell-code you need when using HUnit -
tasty-expected-failure
Mark test cases as expected-failure -
tasty-rerun
Rerun previous test suite runs to run only failing tests -
test-framework-sandbox
test-sandbox support for the test-framework package
Collect and Analyze Billions of Data Points in Real Time
Manage all types of time series data in a single, purpose-built database. Run at any scale in any environment in the cloud, on-premises, or at the edge.
Promo
www.influxdata.com
Do you think we are missing an alternative of th-test-utils or a related project?
README
th-test-utils
This package implements tryTestQ
and related helpers in order to better test Template Haskell code. It supports returning the actual error message that recover
doesn't currently return as well as mocking out Q
actions, so that you can run Template Haskell code at runtime.
Usage
-- e.g. $(showInfo "Bool") generates a string corresponding
-- to the reify `Info` for `Bool`.
showInfo :: String -> Q Exp
showInfo s = do
mName <- lookupTypeName s
case mName of
Nothing -> fail $ "Unknown type: " ++ s
Just name -> do
info <- reify name
lift $ show info
-- example using tasty-hunit
main :: IO ()
main = defaultMain $ testGroup "my-project"
[ testCase "showInfo unmocked" $(do
result1 <- tryTestQ unmockedState $ showInfo "Bool"
runIO $ isRight result1 @? ("Unexpected error: " ++ show result1)
result2 <- tryTestQ unmockedState $ showInfo "Foo"
runIO $ result2 @?= Left "Unknown type: Foo"
[| return () |]
)
, testCase "showInfo mocked success" $ do
let state = QState
{ mode = MockQ
, knownNames = [("Bool", ''Bool)]
, reifyInfo = $(loadNames [''Bool])
}
let result1 = tryTestQ state $ showInfo "Bool"
isRight result1 @? ("Unexpected error: " ++ show result1)
let result2 = tryTestQ state $ showInfo "Foo"
result2 @?= Left "Unknown type: Foo"
]