Skip to content

Commit d1be9f1

Browse files
dalpdvrom911
authored andcommitted
[#187] Remove tasty* dependencies (#198)
* [#187] Remove tasty* dependencies * Remove imports made redundant by [#187] * [#187] Update CHANGELOG * [#187] Replace tasty functions in tests. * fix indentation, naming * Use checkParellel instead of checkSequential * Refactor to use membrain style
1 parent cb02810 commit d1be9f1

File tree

4 files changed

+36
-31
lines changed

4 files changed

+36
-31
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The changelog is available [on GitHub][2].
55

66
## Unreleased: 0.6.0.0
77

8+
* [#187](https://github.com/kowainik/relude/issues/187):
9+
Remove `tasty` and `tasty-hedgehog` dependencies and their redundant imports.
810
* [#195](https://github.com/kowainik/relude/pull/195):
911
Implement `foldMap1` for `NonEmpty` in terms of `foldr`.
1012
* [#194](https://github.com/kowainik/relude/pull/194):

relude.cabal

-2
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,6 @@ test-suite relude-test
188188
, bytestring
189189
, text
190190
, hedgehog ^>= 1.0
191-
, tasty
192-
, tasty-hedgehog ^>= 1.0
193191

194192
ghc-options: -threaded
195193

test/Spec.hs

+11-4
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,16 @@ module Main where
1010

1111
import Relude
1212

13-
import Test.Tasty (defaultMain)
14-
15-
import Test.Relude.Property (hedgehogTestTree)
13+
import Hedgehog (checkParallel)
14+
import System.IO (hSetEncoding, utf8)
15+
import Test.Relude.Property (hedgehogTestList)
1616

1717
main :: IO ()
18-
main = defaultMain hedgehogTestTree
18+
main = do
19+
-- fix terminal encoding
20+
hSetEncoding stdout utf8
21+
hSetEncoding stderr utf8
22+
23+
mapM checkParallel hedgehogTestList >>= \p -> if and p then exitSuccess else exitFailure
24+
25+

test/Test/Relude/Property.hs

+23-25
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,31 @@ Maintainer: Kowainik <xrom.xkov@gmail.com>
77
-}
88

99
module Test.Relude.Property
10-
( hedgehogTestTree
10+
( hedgehogTestList
1111
) where
1212

1313
import Relude
1414

1515
import Data.List (nub)
16-
import Hedgehog (Gen, Property, assert, forAll, property, (===))
17-
import Test.Tasty (TestTree, testGroup)
18-
import Test.Tasty.Hedgehog
16+
import Hedgehog (Gen, Property, Group (..), assert, forAll, property, (===))
1917

2018
import qualified Hedgehog.Gen as Gen
2119
import qualified Hedgehog.Range as Range
2220

23-
hedgehogTestTree :: TestTree
24-
hedgehogTestTree = testGroup "Tests" [utfProps, listProps, boolMProps]
21+
hedgehogTestList :: [Group]
22+
hedgehogTestList = [utfProps, listProps, logicProps]
2523

2624
----------------------------------------------------------------------------
2725
-- utf8 conversion
2826
----------------------------------------------------------------------------
2927

30-
utfProps :: TestTree
31-
utfProps = testGroup "utf8 conversion property tests"
32-
[ testProperty "String to ByteString invertible" prop_StringToBytes
33-
, testProperty "Text to ByteString invertible" prop_TextToBytes
34-
, testProperty "ByteString to Text or String invertible" prop_BytesTo
28+
utfProps :: Group
29+
utfProps = Group "utf8 conversion property tests"
30+
[ ("String to ByteString invertible:", prop_StringToBytes)
31+
, ("Text to ByteString invertible:", prop_TextToBytes)
32+
, ("ByteString to Text or String invertible:" , prop_BytesTo)
3533
]
36-
34+
3735
utf8String :: Gen String
3836
utf8String = Gen.string (Range.linear 0 1000) Gen.unicode
3937

@@ -72,14 +70,14 @@ prop_BytesTo = property $ do
7270
-- ordNub
7371
----------------------------------------------------------------------------
7472

75-
listProps :: TestTree
76-
listProps = testGroup "list function property tests"
77-
[ testProperty "ordNub xs == nub xs" prop_ordNubCorrect
78-
, testProperty "hashNub xs == nub xs" prop_hashNubCorrect
79-
, testProperty "sortNub xs == sort (nub xs)" prop_sortNubCorrect
80-
, testProperty "sort (unstableNub xs) == sort (nub xs)" prop_unstableNubCorrect
73+
listProps :: Group
74+
listProps = Group "list function property tests"
75+
[ ("ordNub xs == nub xs:", prop_ordNubCorrect)
76+
, ("hashNub xs == nub xs:", prop_hashNubCorrect)
77+
, ("sortNub xs == sort (nub xs):" , prop_sortNubCorrect)
78+
, ("sort (unstableNub xs) == sort (nub xs):" , prop_unstableNubCorrect)
8179
]
82-
80+
8381
genIntList :: Gen [Int]
8482
genIntList = Gen.list (Range.linear 0 1000) Gen.enumBounded
8583

@@ -107,15 +105,15 @@ prop_unstableNubCorrect = property $ do
107105
-- logicM
108106
----------------------------------------------------------------------------
109107

108+
logicProps :: Group
109+
logicProps = Group "lifted logic function property tests"
110+
[ ("andM:", prop_andM)
111+
, ("orM:", prop_orM)
112+
]
113+
110114
genBoolList :: Gen [Bool]
111115
genBoolList = Gen.list (Range.linear 0 1000) Gen.bool
112116

113-
boolMProps :: TestTree
114-
boolMProps = testGroup "lifted logic function property tests"
115-
[ testProperty "andM" prop_andM
116-
, testProperty "orM" prop_orM
117-
]
118-
119117
prop_andM :: Property
120118
prop_andM = property $ do
121119
bs <- forAll genBoolList

0 commit comments

Comments
 (0)