packages feed

prop-unit 0.1.1 → 0.1.2

raw patch · 5 files changed

+38/−22 lines, 5 filesdep ~hedgehogdep ~tasty-hedgehogsetup-changedPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hedgehog, tasty-hedgehog

API changes (from Hackage documentation)

Files

README.md view
@@ -1,7 +1,5 @@ # prop-unit -[![CircleCI](https://circleci.com/gh/ejconlon/prop-unit/tree/master.svg?style=svg)](https://circleci.com/gh/ejconlon/prop-unit/tree/master)- Conveniences for using Hedgehog as a unit test runner  It's a pain to share assertions between Hedgehog and HUnit. My solution is to basically turn unit tests into really simple property-based tests!
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
prop-unit.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.0.+-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack  name:           prop-unit-version:        0.1.1+version:        0.1.2 synopsis:       Conveniences for using Hedgehog as a unit test runner description:    Please see the README on GitHub at <https://github.com/ejconlon/prop-unit#readme> category:       Testing@@ -60,9 +60,9 @@   ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wpartial-fields -Wredundant-constraints -fno-warn-unused-top-binds -fwrite-ide-info -hiedir=.hie   build-depends:       base >=4.12 && <5-    , hedgehog >=1.0 && <1.2+    , hedgehog >=1.0 && <1.3     , tasty ==1.4.*-    , tasty-hedgehog >=1.1 && <1.4+    , tasty-hedgehog >=1.1 && <1.5   default-language: Haskell2010  test-suite prop-unit-test@@ -101,9 +101,9 @@   ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wpartial-fields -Wredundant-constraints -fno-warn-unused-top-binds -fwrite-ide-info -hiedir=.hie -threaded -rtsopts -with-rtsopts=-N   build-depends:       base >=4.12 && <5-    , hedgehog >=1.0 && <1.2+    , hedgehog >=1.0 && <1.3     , prop-unit     , tasty-    , tasty-hedgehog >=1.1 && <1.4+    , tasty-hedgehog >=1.1 && <1.5     , tasty-hunit   default-language: Haskell2010
src/PropUnit.hs view
@@ -20,11 +20,30 @@   , testGroup   , testMain   , withResource-  ) where+  )+where  import Control.Monad (when)-import Hedgehog (DiscardLimit, Gen, MonadTest, Property, PropertyT, Range, ShrinkLimit, ShrinkRetries, TestLimit,-                 assert, forAll, property, withDiscards, withRetries, withShrinks, withTests, (/==), (===))+import Hedgehog+  ( DiscardLimit+  , Gen+  , MonadTest+  , Property+  , PropertyT+  , Range+  , ShrinkLimit+  , ShrinkRetries+  , TestLimit+  , assert+  , forAll+  , property+  , withDiscards+  , withRetries+  , withShrinks+  , withTests+  , (/==)+  , (===)+  ) import System.Environment (lookupEnv, setEnv) import System.IO (BufferMode (..), hSetBuffering, stderr, stdout) import Test.Tasty (DependencyType (..), TestName, TestTree, after, defaultMain, testGroup, withResource)@@ -32,11 +51,11 @@  unitProperty :: PropertyT IO () -> Property unitProperty =-  withTests (1 :: TestLimit) .-  withDiscards (1 :: DiscardLimit) .-  withShrinks (0 :: ShrinkLimit) .-  withRetries (0 :: ShrinkRetries) .-  property+  withTests (1 :: TestLimit)+    . withDiscards (1 :: DiscardLimit)+    . withShrinks (0 :: ShrinkLimit)+    . withRetries (0 :: ShrinkRetries)+    . property  testUnit :: TestName -> PropertyT IO () -> TestTree testUnit name = testProperty name . unitProperty
test/Main.hs view
@@ -6,9 +6,9 @@  testAsUnit :: TestTree testAsUnit = testUnit "as unit" $ do-    let actual = (1 + 1) :: Int-        expected = 2 :: Int-    actual === expected+  let actual = (1 + 1) :: Int+      expected = 2 :: Int+  actual === expected  testAsProp :: TestLimit -> TestTree testAsProp lim = testProp "as gen" lim $ do@@ -17,7 +17,8 @@  main :: IO () main = testMain $ \lim ->-  testGroup "PropUnit"+  testGroup+    "PropUnit"     [ testAsUnit     , testAsProp lim     ]