Skip to content

Commit 4c4073a

Browse files
committed
Merge branch 'tasty'
2 parents 4dd36ad + d651a59 commit 4c4073a

File tree

8 files changed

+829
-855
lines changed

8 files changed

+829
-855
lines changed

filepath.cabal

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ test-suite filepath-tests
117117
, bytestring >=0.11.3.0
118118
, filepath
119119
, os-string >=2.0.1
120-
, QuickCheck >=2.7 && <2.15
120+
, tasty
121+
, tasty-quickcheck
121122

122123
default-language: Haskell2010
123124
ghc-options: -Wall
@@ -133,6 +134,7 @@ test-suite filepath-equivalent-tests
133134
Legacy.System.FilePath.Posix
134135
Legacy.System.FilePath.Windows
135136
TestUtil
137+
Gen
136138

137139
build-depends:
138140
, base
@@ -141,7 +143,6 @@ test-suite filepath-equivalent-tests
141143
, generic-random
142144
, generic-deriving
143145
, os-string >=2.0.1
144-
, QuickCheck >=2.7 && <2.15
145146
, tasty
146147
, tasty-quickcheck
147148

@@ -162,8 +163,9 @@ test-suite abstract-filepath
162163
, deepseq
163164
, filepath
164165
, os-string >=2.0.1
165-
, QuickCheck >=2.7 && <2.15
166166
, quickcheck-classes-base ^>=0.6.2
167+
, tasty
168+
, tasty-quickcheck
167169

168170
benchmark bench-filepath
169171
default-language: Haskell2010

tests/TestUtil.hs

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
module TestUtil(
66
module TestUtil,
7-
module Test.QuickCheck,
7+
module Test.Tasty.QuickCheck,
88
module Data.List,
99
module Data.Maybe
1010
) where
1111

12-
import Test.QuickCheck hiding ((==>))
12+
import Test.Tasty.QuickCheck hiding ((==>))
1313
import Data.ByteString.Short (ShortByteString)
1414
import Data.List
1515
import Data.Maybe
@@ -29,7 +29,6 @@ import System.OsString.Encoding.Internal
2929
import GHC.IO.Encoding.UTF16 ( mkUTF16le )
3030
import GHC.IO.Encoding.UTF8 ( mkUTF8 )
3131
import GHC.IO.Encoding.Failure
32-
import System.Environment
3332

3433

3534
infixr 0 ==>
@@ -158,31 +157,3 @@ instance Arbitrary PosixChar where
158157
arbitrary = PW <$> arbitrary
159158
#endif
160159

161-
runTests :: [(String, Property)] -> IO ()
162-
runTests tests = do
163-
args <- getArgs
164-
let count = case args of i:_ -> read i; _ -> 10000
165-
let testNum = case args of
166-
_:i:_
167-
| let num = read i
168-
, num < 0 -> drop (negate num) tests
169-
| let num = read i
170-
, num > 0 -> take num tests
171-
| otherwise -> []
172-
_ -> tests
173-
putStrLn $ "Testing with " ++ show count ++ " repetitions"
174-
let total' = length testNum
175-
let showOutput x = show x{output=""} ++ "\n" ++ output x
176-
bad <- fmap catMaybes $ forM (zip @Integer [1..] testNum) $ \(i,(msg,prop)) -> do
177-
putStrLn $ "Test " ++ show i ++ " of " ++ show total' ++ ": " ++ msg
178-
res <- quickCheckWithResult stdArgs{chatty=False, maxSuccess=count} prop
179-
case res of
180-
Success{} -> pure Nothing
181-
bad -> do putStrLn $ showOutput bad; putStrLn "TEST FAILURE!"; pure $ Just (msg,bad)
182-
if null bad then
183-
putStrLn $ "Success, " ++ show total' ++ " tests passed"
184-
else do
185-
putStrLn $ show (length bad) ++ " FAILURES\n"
186-
forM_ (zip @Integer [1..] bad) $ \(i,(a,b)) ->
187-
putStrLn $ "FAILURE " ++ show i ++ ": " ++ a ++ "\n" ++ showOutput b ++ "\n"
188-
fail $ "FAILURE, failed " ++ show (length bad) ++ " of " ++ show total' ++ " tests"

tests/abstract-filepath/Arbitrary.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import qualified System.OsString.Posix as Posix
1010
import qualified System.OsString.Windows as Windows
1111
import Data.ByteString ( ByteString )
1212
import qualified Data.ByteString as ByteString
13-
import Test.QuickCheck
13+
import Test.Tasty.QuickCheck
1414

1515

1616
instance Arbitrary OsString where

0 commit comments

Comments
 (0)