TLT 0.1.0.1 → 0.2.0.0
raw patch · 3 files changed
+36/−18 lines, 3 filesdep −HUnitdep −eitherdep −symbolPVP ok
version bump matches the API change (PVP)
Dependencies removed: HUnit, either, symbol
API changes (from Hackage documentation)
+ Test.TLT: tltCore :: MonadIO m => TLT m r -> m (TLTopts, [TestResult])
Files
- ChangeLog.md +11/−0
- TLT.cabal +5/−14
- src/Test/TLT.hs +20/−4
ChangeLog.md view
@@ -1,3 +1,14 @@ # Changelog for TLT +- 0.2.0 :: Divided the `tlt` function for running tests, to separate+ `tltCore` for just running tests from formatted output of test+ results. The former is intended for running TLT in other+ frameworks.++ - Release 0.2.0.0 also prunes some unneeded dependencies.++- 0.1.0 :: First release. Patch 1 re-arranged documentation.+ ## Unreleased changes++None in this version.
TLT.cabal view
@@ -5,9 +5,9 @@ -- see: https://github.com/sol/hpack name: TLT-version: 0.1.0.1+version: 0.2.0.0 synopsis: Testing in monads and transformers without explicit specs-description: A small unit test system oriented with an emphasis on examining intermediate results of computations in monad transformers. The Test.TLT Haddock page is the main piece of documentation; or see also the GitHub repository <https://github.com/jphmrst/TLT/>.+description: A quick-and-dirty unit test system without test specifications, motivated by easy examination of intermediate results of computations in monad transformers. See the GitHub repository <https://github.com/jphmrst/TLT/> for documentation, or the Haddock page for additional examples. category: Test homepage: https://github.com/jphmrst/TLT#readme bug-reports: https://github.com/jphmrst/TLT/issues@@ -33,15 +33,12 @@ hs-source-dirs: src build-depends:- HUnit >=1.6.2 && <1.7- , STMonadTrans >=0.4.6 && <0.5+ STMonadTrans >=0.4.6 && <0.5 , ansi-terminal >=0.11.1 && <0.12 , base (>=4.14.1 && <4.15) || (>=4.15.1 && <4.16) || (>=4.16.0 && <4.17)- , either >=5.0.1 && <5.1 , free >=5.1.7 && <5.2 , mtl >=2.2.2 && <2.3 , resourcet >=1.2.4 && <1.3- , symbol >=0.2.4 && <0.3 , transformers >=0.5.6 && <0.6 default-language: Haskell2010 @@ -53,16 +50,13 @@ app ghc-options: -threaded -rtsopts -with-rtsopts=-N build-depends:- HUnit >=1.6.2 && <1.7- , STMonadTrans >=0.4.6 && <0.5+ STMonadTrans >=0.4.6 && <0.5 , TLT , ansi-terminal >=0.11.1 && <0.12 , base (>=4.14.1 && <4.15) || (>=4.15.1 && <4.16) || (>=4.16.0 && <4.17)- , either >=5.0.1 && <5.1 , free >=5.1.7 && <5.2 , mtl >=2.2.2 && <2.3 , resourcet >=1.2.4 && <1.3- , symbol >=0.2.4 && <0.3 , transformers >=0.5.6 && <0.6 default-language: Haskell2010 @@ -75,15 +69,12 @@ test ghc-options: -threaded -rtsopts -with-rtsopts=-N build-depends:- HUnit >=1.6.2 && <1.7- , STMonadTrans >=0.4.6 && <0.5+ STMonadTrans >=0.4.6 && <0.5 , TLT , ansi-terminal >=0.11.1 && <0.12 , base (>=4.14.1 && <4.15) || (>=4.15.1 && <4.16) || (>=4.16.0 && <4.17)- , either >=5.0.1 && <5.1 , free >=5.1.7 && <5.2 , mtl >=2.2.2 && <2.3 , resourcet >=1.2.4 && <1.3- , symbol >=0.2.4 && <0.3 , transformers >=0.5.6 && <0.6 default-language: Haskell2010
src/Test/TLT.hs view
@@ -28,7 +28,7 @@ module Test.TLT ( -- * The TLT transformer- TLT, tlt, MonadTLT, liftTLT,+ TLT, tlt, MonadTLT, liftTLT, tltCore, -- ** Session options reportAllTestResults, setExitAfterFailDisplay, -- * Writing tests@@ -281,12 +281,28 @@ {- ------------------------------------------------------------ -} -- |Execute the tests specified in a `TLT` monad, and report the--- results.+-- results as text output.+--+-- When using TLT from some other package (as opposed to using TLT+-- itself as your test framework, and wishing to see its+-- human-oriented output directly), consider using `tltCore` instead. tlt :: MonadIO m => TLT m r -> m ()-tlt (TLT t) = do+tlt tlt = do liftIO $ putStrLn "Running tests:"+ (opts, results) <- tltCore tlt+ liftIO $ report opts $ results++-- |Execute the tests specified in a `TLT` monad without output+-- side-effects, returning the final options and result reports.+--+-- This function is primarily useful when calling TLT from some other+-- package. If you are using TLT itself as your test framework, and+-- wishing to see its human-oriented output directly, consider using+-- `tlt` instead.+tltCore :: MonadIO m => TLT m r -> m (TLTopts, [TestResult])+tltCore (TLT t) = do (_, (opts, resultsBuf)) <- runStateT t $ (defaultOpts, Top 0 0 [])- liftIO $ report opts $ closeTRBuf resultsBuf+ return (opts, closeTRBuf resultsBuf) -- |This function controls whether `tlt` will report only tests which -- fail, suppressing any display of tests which pass, or else report