diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index f6c0707..fa61540 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.19.20241223 +# version: 0.19.20250216 # -# REGENDATA ("0.19.20241223",["github","cabal.project"]) +# REGENDATA ("0.19.20250216",["github","cabal.project"]) # name: Haskell-CI on: @@ -23,7 +23,7 @@ on: jobs: linux: name: Haskell-CI - Linux - ${{ matrix.compiler }} - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 60 container: @@ -111,8 +111,8 @@ jobs: chmod a+x "$HOME/.ghcup/bin/ghcup" - name: Install cabal-install run: | - "$HOME/.ghcup/bin/ghcup" install cabal 3.14.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - echo "CABAL=$HOME/.ghcup/bin/cabal-3.14.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" + "$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + echo "CABAL=$HOME/.ghcup/bin/cabal-3.12.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" - name: Install GHC (GHCup) if: matrix.setup-method == 'ghcup' run: | diff --git a/.gitignore b/.gitignore index 3cfda68..bb45d17 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ /.ghc.environment.* /dist/ /dist-newstyle/ +.stack-work/ +stack*.yaml.lock diff --git a/core/ChangeLog.md b/core/ChangeLog.md index 4f31a52..537d34a 100644 --- a/core/ChangeLog.md +++ b/core/ChangeLog.md @@ -1,3 +1,10 @@ +#### 0.8.2.1 + +- Support `random-1.3` +- Drop support for GHC 7 +- Drop support for dependency versions that predate Stackage LTS 9.21 +- Tested building with GHC 8.0 - 9.12.1 + ### 0.8.2.0 - Add `Semigroup` instances diff --git a/core/README.md b/core/README.md new file mode 100644 index 0000000..ce3afeb --- /dev/null +++ b/core/README.md @@ -0,0 +1,4 @@ +This package is legacy and no longer developed. + +Users are encouraged to look into more actively developed test frameworks, +e.g. [tasty](https://hackage.haskell.or/package/tasty). diff --git a/core/Setup.hs b/core/Setup.hs deleted file mode 100644 index 9a994af..0000000 --- a/core/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/core/src/Test/Framework/Core.hs b/core/src/Test/Framework/Core.hs index aa2f5bf..9f96900 100644 --- a/core/src/Test/Framework/Core.hs +++ b/core/src/Test/Framework/Core.hs @@ -5,8 +5,8 @@ import Test.Framework.Improving import Test.Framework.Options import Control.Arrow (first, second) -import Control.Concurrent.MVar -import Data.Typeable +import Control.Concurrent.MVar ( withMVar, newMVar, MVar ) +import Data.Typeable ( Typeable ) -- | Something like the result of a test: works in concert with 'Testlike'. diff --git a/core/src/Test/Framework/Improving.hs b/core/src/Test/Framework/Improving.hs index 851ac6e..b92bf81 100644 --- a/core/src/Test/Framework/Improving.hs +++ b/core/src/Test/Framework/Improving.hs @@ -5,10 +5,11 @@ module Test.Framework.Improving ( ) where import Control.Concurrent + ( yield, getChanContents, newChan, writeChan, Chan ) import Control.Monad import Control.Applicative as App -import System.Timeout +import System.Timeout ( timeout ) data i :~> f = Finished f diff --git a/core/src/Test/Framework/Options.hs b/core/src/Test/Framework/Options.hs index 054072d..4dd0a7c 100644 --- a/core/src/Test/Framework/Options.hs +++ b/core/src/Test/Framework/Options.hs @@ -3,8 +3,8 @@ module Test.Framework.Options where import Test.Framework.Seed import Test.Framework.Utilities -import Data.Monoid -import Data.Semigroup as Sem hiding (Last(..)) +import Data.Monoid ( Last(Last, getLast) ) +import Data.Semigroup as Sem ( Semigroup((<>)) ) type TestOptions = TestOptions' Maybe @@ -43,5 +43,5 @@ instance Monoid (TestOptions' Maybe) where topt_maximum_test_depth = Nothing, topt_timeout = Nothing } - + mappend = (Sem.<>) diff --git a/core/src/Test/Framework/Runners/Console.hs b/core/src/Test/Framework/Runners/Console.hs index 32d28eb..a247788 100644 --- a/core/src/Test/Framework/Runners/Console.hs +++ b/core/src/Test/Framework/Runners/Console.hs @@ -17,16 +17,15 @@ import Test.Framework.Utilities import Control.Monad (when) import System.Console.GetOpt -import System.Environment + ( getOpt, + usageInfo, + ArgDescr(NoArg, ReqArg), + ArgOrder(Permute), + OptDescr(..) ) +import System.Environment ( getArgs, getProgName ) import System.Exit -import System.IO - -#if !MIN_VERSION_base(4,8,0) -import Data.Monoid -#endif -#if !(MIN_VERSION_base(4,7,0)) -import Data.Orphans () -#endif + ( exitSuccess, exitWith, ExitCode(ExitFailure, ExitSuccess) ) +import System.IO ( hIsTerminalDevice, hPutStrLn, stderr, stdout ) -- | @Nothing@ signifies that usage information should be displayed. -- @Just@ simply gives us the contribution to overall options by the command line option. diff --git a/core/src/Test/Framework/Runners/Console/Colors.hs b/core/src/Test/Framework/Runners/Console/Colors.hs index 25bdaaa..8b18974 100644 --- a/core/src/Test/Framework/Runners/Console/Colors.hs +++ b/core/src/Test/Framework/Runners/Console/Colors.hs @@ -1,6 +1,6 @@ module Test.Framework.Runners.Console.Colors where -import Text.PrettyPrint.ANSI.Leijen +import Text.PrettyPrint.ANSI.Leijen ( green, red, Doc ) colorFail, colorPass :: Doc -> Doc diff --git a/core/src/Test/Framework/Runners/Console/ProgressBar.hs b/core/src/Test/Framework/Runners/Console/ProgressBar.hs index c187e6e..bc47cdb 100644 --- a/core/src/Test/Framework/Runners/Console/ProgressBar.hs +++ b/core/src/Test/Framework/Runners/Console/ProgressBar.hs @@ -2,7 +2,7 @@ module Test.Framework.Runners.Console.ProgressBar ( Progress(..), progressBar ) where -import Text.PrettyPrint.ANSI.Leijen hiding (width) +import Text.PrettyPrint.ANSI.Leijen ( char, text, Doc ) data Progress = Progress Int Int diff --git a/core/src/Test/Framework/Runners/Console/Run.hs b/core/src/Test/Framework/Runners/Console/Run.hs index 622b1d3..404538c 100644 --- a/core/src/Test/Framework/Runners/Console/Run.hs +++ b/core/src/Test/Framework/Runners/Console/Run.hs @@ -13,14 +13,20 @@ import Test.Framework.Runners.Statistics import Test.Framework.Runners.TimedConsumption import Test.Framework.Utilities -import System.Console.ANSI -import System.IO +import System.Console.ANSI ( clearLine, cursorUpLine ) +import System.IO ( hFlush, stdout ) import Text.PrettyPrint.ANSI.Leijen - -#if !MIN_VERSION_base(4,8,0) -import Data.Monoid (mempty) -#endif + ( (<+>), + brackets, + char, + empty, + indent, + linebreak, + plain, + putDoc, + text, + Doc ) import Control.Arrow (second, (&&&)) import Control.Monad (unless) @@ -31,11 +37,11 @@ showRunTestsTop isplain hide_successes running_tests = (if isplain then id else -- Show those test results to the user as we get them. Gather statistics on the fly for a progress bar let test_statistics = initialTestStatistics (totalRunTestsList running_tests) (test_statistics', finished_tests) <- showRunTests isplain hide_successes 0 test_statistics running_tests - + -- Show the final statistics putStrLn "" putDoc $ possiblyPlain isplain $ showFinalTestStatistics test_statistics' - + return finished_tests @@ -74,7 +80,7 @@ showImprovingTestResult isplain hide_successes indent_level test_name progress_b unless (success && hide_successes) $ do let (result_doc, extra_doc) | success = (brackets $ colorPass (text result), empty) | otherwise = (brackets (colorFail (text "Failed")), text result <> linebreak) - + -- Output the final test status and a trailing newline putTestHeader indent_level test_name (possiblyPlain isplain result_doc) -- Output any extra information that may be required, e.g. to show failure reason @@ -97,7 +103,7 @@ showImprovingTestResultProgress erase indent_level test_name progress_bar improv showImprovingTestResultProgress' :: IO () -> Int -> String -> Doc -> (String :~> (String, Bool)) -> IO (String, Bool) showImprovingTestResultProgress' erase _ _ _ (Finished result) = do erase - -- There may still be a progress bar on the line below the final test result, so + -- There may still be a progress bar on the line below the final test result, so -- remove it as a precautionary measure in case this is the last test in a group -- and hence it will not be erased in the normal course of test display. putStrLn "" diff --git a/core/src/Test/Framework/Runners/Console/Statistics.hs b/core/src/Test/Framework/Runners/Console/Statistics.hs index 2cbf81a..ef40b91 100644 --- a/core/src/Test/Framework/Runners/Console/Statistics.hs +++ b/core/src/Test/Framework/Runners/Console/Statistics.hs @@ -6,9 +6,9 @@ import Test.Framework.Runners.Statistics import Test.Framework.Runners.Console.Colors import Test.Framework.Runners.Console.Table -import Text.PrettyPrint.ANSI.Leijen +import Text.PrettyPrint.ANSI.Leijen ( empty, text, Doc ) -import Data.List +import Data.List ( sort ) -- | Displays statistics as a string something like this: @@ -23,14 +23,14 @@ showFinalTestStatistics :: TestStatistics -> Doc showFinalTestStatistics ts = renderTable $ [Column label_column] ++ (map Column test_type_columns) ++ [Column total_column] where test_types = sort $ testCountTestTypes (ts_total_tests ts) - + label_column = [TextCell empty, TextCell (text "Passed"), TextCell (text "Failed"), TextCell (text "Total")] total_column = [TextCell (text "Total"), testStatusTotal colorPass ts_passed_tests, testStatusTotal colorFail ts_failed_tests, testStatusTotal (colorPassOrFail (ts_no_failures ts)) ts_total_tests] test_type_columns = [ [TextCell (text test_type), testStat colorPass (countTests ts_passed_tests), testStat colorFail failures, testStat (colorPassOrFail (failures <= 0)) (countTests ts_total_tests)] | test_type <- test_types , let countTests = testCountForType test_type . ($ ts) failures = countTests ts_failed_tests ] - + testStatusTotal color status_accessor = TextCell (coloredNumber color (testCountTotal (status_accessor ts))) testStat color number = TextCell (coloredNumber color number) diff --git a/core/src/Test/Framework/Runners/Console/Table.hs b/core/src/Test/Framework/Runners/Console/Table.hs index dba2213..33fd45f 100644 --- a/core/src/Test/Framework/Runners/Console/Table.hs +++ b/core/src/Test/Framework/Runners/Console/Table.hs @@ -6,11 +6,8 @@ module Test.Framework.Runners.Console.Table ( import Test.Framework.Utilities -#if MIN_VERSION_ansi_wl_pprint(0,6,6) -import Text.PrettyPrint.ANSI.Leijen hiding (column, columns) -#else -import Text.PrettyPrint.ANSI.Leijen hiding (column) -#endif +import Text.PrettyPrint.ANSI.Leijen + ( char, empty, fill, hcat, line, text, Doc ) data Cell = TextCell Doc | SeperatorCell @@ -65,7 +62,7 @@ renderFirstColumnCell column_width (Column cells) _ = case cells of [] -> text $ replicate (column_width + 2) ' ' (SeperatorCell:_) -> text $ replicate (column_width + 2) '-' (TextCell contents:_) -> char ' ' <> fill column_width contents <> char ' ' -renderFirstColumnCell _ SeperatorColumn either_side_seperator +renderFirstColumnCell _ SeperatorColumn either_side_seperator = if either_side_seperator then char '+' else char '|' columnFinished :: Column -> Bool diff --git a/core/src/Test/Framework/Runners/Console/Utilities.hs b/core/src/Test/Framework/Runners/Console/Utilities.hs index 752a74b..68de44b 100644 --- a/core/src/Test/Framework/Runners/Console/Utilities.hs +++ b/core/src/Test/Framework/Runners/Console/Utilities.hs @@ -2,8 +2,8 @@ module Test.Framework.Runners.Console.Utilities ( hideCursorDuring ) where -import System.Console.ANSI -import System.IO +import System.Console.ANSI ( hideCursor, showCursor ) +import System.IO ( hFlush, stdout ) import Control.Exception (bracket) diff --git a/core/src/Test/Framework/Runners/Core.hs b/core/src/Test/Framework/Runners/Core.hs index 4f23ab4..dc4ccfe 100644 --- a/core/src/Test/Framework/Runners/Core.hs +++ b/core/src/Test/Framework/Runners/Core.hs @@ -12,14 +12,11 @@ import Test.Framework.Runners.ThreadPool import Test.Framework.Seed import Test.Framework.Utilities -import Control.Concurrent.MVar +import Control.Concurrent.MVar ( newEmptyMVar, putMVar, takeMVar ) import Control.Exception (mask, finally, onException) -import Control.Monad -import Data.Maybe -#if !MIN_VERSION_base(4,8,0) -import Data.Monoid -#endif -import Data.Typeable +import Control.Monad ( liftM, forM ) +import Data.Maybe ( catMaybes ) +import Data.Typeable ( Typeable ) -- | A test that has been executed or is in the process of execution diff --git a/core/src/Test/Framework/Runners/Options.hs b/core/src/Test/Framework/Runners/Options.hs index 79ec5c9..be7dddd 100644 --- a/core/src/Test/Framework/Runners/Options.hs +++ b/core/src/Test/Framework/Runners/Options.hs @@ -7,8 +7,8 @@ import Test.Framework.Options import Test.Framework.Utilities import Test.Framework.Runners.TestPattern -import Data.Monoid -import Data.Semigroup as Sem hiding (Last(..)) +import Data.Monoid ( Last(Last, getLast) ) +import Data.Semigroup as Sem ( Semigroup((<>)) ) data ColorMode = ColorAuto | ColorNever | ColorAlways diff --git a/core/src/Test/Framework/Runners/Statistics.hs b/core/src/Test/Framework/Runners/Statistics.hs index fc8bf7a..c1066d8 100644 --- a/core/src/Test/Framework/Runners/Statistics.hs +++ b/core/src/Test/Framework/Runners/Statistics.hs @@ -10,10 +10,7 @@ import Test.Framework.Runners.Core import Data.Map (Map) import qualified Data.Map as Map -#if !MIN_VERSION_base(4,8,0) -import Data.Monoid -#endif -import Data.Semigroup as Sem +import Data.Semigroup as Sem ( Semigroup((<>)) ) -- | Records a count of the various kinds of test that have been run diff --git a/core/src/Test/Framework/Runners/TestPattern.hs b/core/src/Test/Framework/Runners/TestPattern.hs index 39924bb..3f1cd5c 100644 --- a/core/src/Test/Framework/Runners/TestPattern.hs +++ b/core/src/Test/Framework/Runners/TestPattern.hs @@ -4,10 +4,10 @@ module Test.Framework.Runners.TestPattern ( import Test.Framework.Utilities -import Text.Regex.Posix.Wrap +import Text.Regex.Posix.Wrap ( (=~) ) import Text.Regex.Posix.String() -import Data.List +import Data.List ( inits, intersperse ) data Token = SlashToken @@ -65,7 +65,7 @@ testPatternMatches test_pattern path = not_maybe $ any (=~ tokens_regex) things_ path_to_consider | tp_categories_only test_pattern = dropLast 1 path | otherwise = path tokens_regex = buildTokenRegex (tp_tokens test_pattern) - + things_to_match = case tp_match_mode test_pattern of -- See if the tokens match any single path component TestMatchMode -> path_to_consider @@ -79,7 +79,7 @@ buildTokenRegex (token:tokens) = concat (firstTokenToRegex token : map tokenToRe where firstTokenToRegex SlashToken = "^" firstTokenToRegex other = tokenToRegex other - + tokenToRegex SlashToken = "/" tokenToRegex WildcardToken = "[^/]*" tokenToRegex DoubleWildcardToken = "*" diff --git a/core/src/Test/Framework/Runners/ThreadPool.hs b/core/src/Test/Framework/Runners/ThreadPool.hs index a41e681..0bcaeff 100644 --- a/core/src/Test/Framework/Runners/ThreadPool.hs +++ b/core/src/Test/Framework/Runners/ThreadPool.hs @@ -3,11 +3,19 @@ module Test.Framework.Runners.ThreadPool ( ) where import Control.Concurrent -import Control.Monad + ( forkIO, + myThreadId, + getChanContents, + newChan, + readChan, + writeChan, + writeList2Chan, + Chan ) +import Control.Monad ( forM_ ) import qualified Data.IntMap as IM -import Foreign.StablePtr +import Foreign.StablePtr ( newStablePtr ) data WorkerEvent token a = WorkerTermination @@ -24,13 +32,13 @@ executeOnPool n actions = do -- Prepare the channels input_chan <- newChan output_chan <- newChan - + -- Write the actions as items to the channel followed by one termination per thread -- that indicates they should terminate. We do this on another thread for -- maximum laziness (in case one the actions we are going to run depend on the -- output from previous actions..) _ <- forkIO $ writeList2Chan input_chan (zipWith WorkerItem [0..] actions ++ replicate n WorkerTermination) - + -- Spawn workers forM_ [1..n] (const $ forkIO $ poolWorker input_chan output_chan) @@ -53,7 +61,7 @@ executeOnPool n actions = do -- lazily-demanded tail of the list, but its a bit of a pain. For now, just -- grit our teeth and accept the leak. _stablePtr <- myThreadId >>= newStablePtr - + -- Return the results generated by the worker threads lazily and in -- the same order as we got the inputs fmap (reorderFrom 0 . takeWhileWorkersExist n) $ getChanContents output_chan diff --git a/core/src/Test/Framework/Runners/TimedConsumption.hs b/core/src/Test/Framework/Runners/TimedConsumption.hs index 8aa3e2d..bb45fee 100644 --- a/core/src/Test/Framework/Runners/TimedConsumption.hs +++ b/core/src/Test/Framework/Runners/TimedConsumption.hs @@ -4,7 +4,7 @@ module Test.Framework.Runners.TimedConsumption ( import Test.Framework.Utilities -import System.CPUTime +import System.CPUTime ( getCPUTime ) -- | Evaluates the given list for the given number of microseconds. After the time limit diff --git a/core/src/Test/Framework/Runners/XML.hs b/core/src/Test/Framework/Runners/XML.hs index eaa15f3..55b3bae 100644 --- a/core/src/Test/Framework/Runners/XML.hs +++ b/core/src/Test/Framework/Runners/XML.hs @@ -8,12 +8,7 @@ import Test.Framework.Runners.XML.JUnitWriter ( RunDescription(..), serialize ) import Data.Time.Format ( formatTime ) import Data.Time.LocalTime ( getZonedTime ) - -#if MIN_VERSION_time(1,5,0) import Data.Time.Format ( defaultTimeLocale ) -#else -import System.Locale ( defaultTimeLocale ) -#endif import Network.HostName ( getHostName ) diff --git a/core/src/Test/Framework/Seed.hs b/core/src/Test/Framework/Seed.hs index 442abdf..864a8f5 100644 --- a/core/src/Test/Framework/Seed.hs +++ b/core/src/Test/Framework/Seed.hs @@ -4,7 +4,7 @@ import Test.Framework.Utilities import System.Random (StdGen, mkStdGen, randomIO) -import Data.Char +import Data.Char ( toLower ) data Seed = FixedSeed Int diff --git a/core/src/Test/Framework/Utilities.hs b/core/src/Test/Framework/Utilities.hs index 34b2ff6..02013a9 100644 --- a/core/src/Test/Framework/Utilities.hs +++ b/core/src/Test/Framework/Utilities.hs @@ -3,10 +3,7 @@ module Test.Framework.Utilities where import Control.Arrow (first, second) import Data.Function (on) -import Data.Maybe -#if !MIN_VERSION_base(4,8,0) -import Data.Monoid -#endif +import Data.Maybe ( fromMaybe, listToMaybe ) import Data.List (intercalate) diff --git a/core/test-framework.cabal b/core/test-framework.cabal index 395901c..46808ba 100644 --- a/core/test-framework.cabal +++ b/core/test-framework.cabal @@ -1,6 +1,6 @@ +Cabal-Version: 1.18 Name: test-framework -Version: 0.8.2.0 -Cabal-Version: >= 1.10 +Version: 0.8.2.1 Category: Testing Synopsis: Framework for running and organising tests, with HUnit and QuickCheck support Description: Allows tests such as QuickCheck properties and HUnit test cases to be assembled into test groups, run in @@ -9,7 +9,7 @@ Description: Allows tests such as QuickCheck properties and HUnit test c License: BSD3 License-File: LICENSE Author: Max Bolingbroke -Maintainer: Libraries List +Maintainer: Andreas Abel Homepage: http://haskell.github.io/test-framework/ Bug-Reports: https://github.com/haskell/test-framework/issues Build-Type: Simple @@ -29,7 +29,9 @@ Tested-With: GHC == 8.2.2 GHC == 8.0.2 -Extra-Source-Files: ChangeLog.md +Extra-Doc-Files: + ChangeLog.md + README.md Library hs-source-dirs: src @@ -59,23 +61,17 @@ Library Test.Framework.Runners.XML Test.Framework.Utilities - Build-Depends: base >= 4.3 && < 5 + Build-Depends: base >= 4.9 && < 5 , ansi-terminal >= 0.4.0 && < 1.2 - , ansi-wl-pprint >= 0.5.1 && < 1.1 - , random >= 1.0 && < 1.4 + , ansi-wl-pprint >= 0.6.7 && < 1.1 + , random >= 1.1 && < 1.4 , containers >= 0.1 && < 0.8 , regex-posix >= 0.72 && < 0.97 , old-locale >= 1.0 && < 1.1 - , time >= 1.1.2 && < 1.15 + , time >= 1.6 && < 1.15 , xml >= 1.3.5 && < 1.4 , hostname >= 1.0 && < 1.1 - if !impl(ghc >= 7.8) - Build-Depends: base-orphans >= 0.1 && < 0.9 - - if !impl(ghc >= 8.0) - Build-Depends: semigroups >= 0.18 && < 0.20 - Default-Language: Haskell2010 Default-Extensions: CPP PatternGuards @@ -86,17 +82,17 @@ Library TypeOperators FunctionalDependencies MultiParamTypeClasses + NondecreasingIndentation + -- workaround https://github.com/haskell/cabal/issues/4443 - -- workaround https://github.com/haskell/cabal/issues/4443 - if impl(ghc >= 7.2) - Default-Extensions: NondecreasingIndentation Ghc-Options: -Wall + -Wcompat + -Wnoncanonical-monad-instances + -Wnoncanonical-monadfail-instances if impl(ghc) - Cpp-Options: -DCOMPILER_GHC + Cpp-Options: -DCOMPILER_GHC - if impl(ghc >= 8.0) - Ghc-Options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances Test-Suite test-framework-tests hs-source-dirs: test src @@ -116,17 +112,19 @@ Test-Suite test-framework-tests Main-Is: Tests.hs Type: exitcode-stdio-1.0 + -- Doe to libxml dependency, the testsuite is not buildable on e.g. MacOS -- Buildable: False - Build-Depends: HUnit >= 1.2 - , QuickCheck >= 2.3 && < 2.16 - , base >= 4.3 && < 5 - , random >= 1.0 + + Build-Depends: HUnit >= 1.5.0.0 + , QuickCheck >= 2.9.2 && < 2.16 + , base >= 4.9 && < 5 + , random >= 1.1 , containers >= 0.1 , ansi-terminal >= 0.4.0 - , ansi-wl-pprint >= 0.5.1 + , ansi-wl-pprint >= 0.6.7 , regex-posix >= 0.72 , old-locale >= 1.0 - , time >= 1.1.2 + , time >= 1.6 , xml >= 1.3.5 , hostname >= 1.0 , libxml >= 0.1.1 @@ -144,16 +142,14 @@ Test-Suite test-framework-tests TypeOperators FunctionalDependencies MultiParamTypeClasses - - if impl(ghc >= 7.2) - Default-Extensions: NondecreasingIndentation + NondecreasingIndentation Cpp-Options: -DTEST Ghc-Options: -Wall -threaded if impl(ghc) - Cpp-Options: -DCOMPILER_GHC + Cpp-Options: -DCOMPILER_GHC Source-Repository head Type: git diff --git a/core/test/Test/Framework/Tests/Runners/XMLTests.hs b/core/test/Test/Framework/Tests/Runners/XMLTests.hs index d6a30ee..3bbd1ef 100644 --- a/core/test/Test/Framework/Tests/Runners/XMLTests.hs +++ b/core/test/Test/Framework/Tests/Runners/XMLTests.hs @@ -20,15 +20,7 @@ import qualified Text.XML.Light as XML ( findAttr, unqual ) import qualified Text.XML.LibXML.Parser as XML ( parseMemory_ ) import qualified Text.XML.LibXML.Types as XML ( Document ) - --- #ifdef MIN_VERSION_QuickCheck(2, 4, 0) import Test.QuickCheck.Property as P (morallyDubiousIOProperty) --- #else --- import qualified Test.QuickCheck.Property as P (succeeded, failed, liftIOResult) - --- morallyDubiousIOProperty :: IO Bool -> Property --- morallyDubiousIOProperty it = P.liftIOResult $ fmap (\err -> if err then P.failed else P.succeeded) it --- #endif -- | `Arbitrary` instance for `TestResult` generation. instance Arbitrary FinishedTest where diff --git a/example/Setup.hs b/example/Setup.hs deleted file mode 100644 index 9a994af..0000000 --- a/example/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/example/test-framework-example.cabal b/example/test-framework-example.cabal index a75d822..9b385f3 100644 --- a/example/test-framework-example.cabal +++ b/example/test-framework-example.cabal @@ -1,6 +1,6 @@ +Cabal-Version: 1.18 Name: test-framework-example Version: 0.2.1 -Cabal-Version: >= 1.10 Category: Testing Synopsis: Example test suite for the test-framework package Description: Example test suite for the @test-framework@ package. @@ -35,8 +35,8 @@ Executable test-framework-example , test-framework-quickcheck2 == 0.3.* , test-framework-hunit == 0.3.* - Build-Depends: base >= 3 && < 5 - , HUnit >= 1.2 && < 1.7 - , QuickCheck >= 2.4 && < 2.16 + Build-Depends: base >= 4.9 && < 5 + , HUnit >= 1.5.0.0 && < 1.7 + , QuickCheck >= 2.9.2 && < 2.16 Ghc-Options: -threaded diff --git a/hunit/README.md b/hunit/README.md new file mode 100644 index 0000000..34a3563 --- /dev/null +++ b/hunit/README.md @@ -0,0 +1,4 @@ +This package is legacy and no longer developed. + +Users are encouraged to look into more actively developed test frameworks, +e.g. `tasty` which has [tasty-hunit](https://hackage.haskell.or/package/tasty-hunit). diff --git a/hunit/Setup.hs b/hunit/Setup.hs deleted file mode 100644 index 9a994af..0000000 --- a/hunit/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/hunit/Test/Framework/Providers/HUnit.hs b/hunit/Test/Framework/Providers/HUnit.hs index 1351015..21c8de9 100644 --- a/hunit/Test/Framework/Providers/HUnit.hs +++ b/hunit/Test/Framework/Providers/HUnit.hs @@ -75,12 +75,6 @@ myPerformTestCase :: Assertion -> IO TestCaseResult myPerformTestCase assertion = do result <- performTestCase assertion return $ case result of -#if MIN_VERSION_HUnit(1,3,0) Success -> TestCasePassed Failure _loc message -> TestCaseFailed message Error _loc message -> TestCaseError message -#else - Nothing -> TestCasePassed - Just (True, message) -> TestCaseFailed message - Just (False, message) -> TestCaseError message -#endif diff --git a/hunit/test-framework-hunit.cabal b/hunit/test-framework-hunit.cabal index 9f239c2..b3d22fc 100644 --- a/hunit/test-framework-hunit.cabal +++ b/hunit/test-framework-hunit.cabal @@ -1,12 +1,12 @@ +Cabal-Version: 1.18 Name: test-framework-hunit Version: 0.3.0.2 -Cabal-Version: >= 1.10 Category: Testing Synopsis: HUnit support for the test-framework package. License: BSD3 License-File: LICENSE Author: Max Bolingbroke -Maintainer: Haskell Libraries +Maintainer: Andreas Abel Homepage: http://haskell.github.io/test-framework/ Bug-Reports: https://github.com/haskell/test-framework/issues Build-Type: Simple @@ -27,6 +27,9 @@ Tested-With: GHC == 8.2.2 GHC == 8.0.2 +extra-doc-files: + README.md + Library Default-Language: Haskell2010 Default-Extensions: TypeOperators @@ -35,9 +38,9 @@ Library Exposed-Modules: Test.Framework.Providers.HUnit Build-Depends: test-framework == 0.8.* - , base >= 4.3 && < 5 - , HUnit >= 1.2 && < 1.7 - , extensible-exceptions >= 0.1.1 && < 0.2.0 + , base >= 4.9 && < 5 + , HUnit >= 1.5.0.0 && < 1.7 + , extensible-exceptions >= 0.1.1 && < 0.2.0 Ghc-Options: -Wall diff --git a/quickcheck/Setup.hs b/quickcheck/Setup.hs deleted file mode 100644 index 9a994af..0000000 --- a/quickcheck/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/quickcheck2/ChangeLog.md b/quickcheck2/ChangeLog.md index 38b0e7f..cfb74a0 100644 --- a/quickcheck2/ChangeLog.md +++ b/quickcheck2/ChangeLog.md @@ -1,3 +1,10 @@ +## 0.3.0.6 + +- Support `random-1.3` +- Drop support for GHC 7 +- Drop support for dependency versions that predate Stackage LTS 9.21 +- Tested building with GHC 8.0 - 9.12.1 + ## 0.3.0.5 - Add support for `QuickCheck-2.12` diff --git a/quickcheck2/README.md b/quickcheck2/README.md new file mode 100644 index 0000000..85289bc --- /dev/null +++ b/quickcheck2/README.md @@ -0,0 +1,4 @@ +This package is legacy and no longer developed. + +Users are encouraged to look into more actively developed test frameworks, +e.g. `tasty` which has [tasty-quickcheck](https://hackage.haskell.or/package/tasty-quickcheck). diff --git a/quickcheck2/Setup.hs b/quickcheck2/Setup.hs deleted file mode 100644 index 9a994af..0000000 --- a/quickcheck2/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/quickcheck2/Test/Framework/Providers/QuickCheck2.hs b/quickcheck2/Test/Framework/Providers/QuickCheck2.hs index 7f24a02..a89a56a 100644 --- a/quickcheck2/Test/Framework/Providers/QuickCheck2.hs +++ b/quickcheck2/Test/Framework/Providers/QuickCheck2.hs @@ -17,9 +17,7 @@ import Test.Framework.Providers.API import Test.QuickCheck.Property (Testable, Callback(PostTest), CallbackKind(NotCounterexample), callback) import Test.QuickCheck.State (numSuccessTests) import Test.QuickCheck.Test -#if MIN_VERSION_QuickCheck(2,7,0) import Test.QuickCheck.Random (QCGen, mkQCGen) -#endif import System.Random (randomIO) import Data.Typeable @@ -49,7 +47,7 @@ data PropertyStatus = PropertyOK -- ^ The property is tru | PropertyFalsifiable String String -- ^ The property was not true. The strings are the reason and the output. | PropertyNoExpectedFailure -- ^ We expected that a property would fail but it didn't | PropertyTimedOut -- ^ The property timed out during execution -#if MIN_VERSION_QuickCheck(2,8,0) && !MIN_VERSION_QuickCheck(2,12,0) +#if !MIN_VERSION_QuickCheck(2,12,0) | PropertyInsufficientCoverage -- ^ The tests passed but a use of 'cover' had insufficient coverage. #endif @@ -61,7 +59,7 @@ instance Show PropertyResult where PropertyFalsifiable _rsn otpt -> otpt ++ "(used seed " ++ show used_seed ++ ")" PropertyNoExpectedFailure -> "No expected failure with seed " ++ show used_seed ++ ", after " ++ tests_run_str ++ " tests" PropertyTimedOut -> "Timed out after " ++ tests_run_str ++ " tests" -#if MIN_VERSION_QuickCheck(2,8,0) && !MIN_VERSION_QuickCheck(2,12,0) +#if !MIN_VERSION_QuickCheck(2,12,0) PropertyInsufficientCoverage -> "Insufficient coverage after " ++ tests_run_str ++ " tests" #endif where @@ -81,21 +79,12 @@ instance Testlike PropertyTestCount PropertyResult Property where runTest topts (Property testable) = runProperty topts testable testTypeName _ = "Properties" -#if MIN_VERSION_QuickCheck(2,7,0) - newSeededQCGen :: Seed -> IO (QCGen, Int) newSeededQCGen (FixedSeed seed) = return $ (mkQCGen seed, seed) newSeededQCGen RandomSeed = do seed <- randomIO return (mkQCGen seed, seed) -#else - -newSeededQCGen :: Seed -> IO (StdGen, Int) -newSeededQCGen = newSeededStdGen - -#endif - runProperty :: Testable a => CompleteTestOptions -> a -> IO (PropertyTestCount :~> PropertyResult, IO ()) runProperty topts testable = do (gen, seed) <- newSeededQCGen (unK $ topt_seed topts) @@ -103,11 +92,7 @@ runProperty topts testable = do max_discard = unK $ topt_maximum_unsuitable_generated_tests topts args = stdArgs { replay = Just (gen, 0) -- NB: the 0 is the saved size. Defaults to 0 if you supply "Nothing" for "replay". , maxSuccess = max_success -#if MIN_VERSION_QuickCheck(2,5,0) , maxDiscardRatio = (max_discard `div` max_success) + 1 -#else - , maxDiscard = max_discard -#endif , maxSize = unK $ topt_maximum_test_size topts , chatty = False } -- FIXME: yield gradual improvement after each test @@ -127,6 +112,6 @@ runProperty topts testable = do toPropertyStatus (GaveUp {}) = PropertyArgumentsExhausted toPropertyStatus (Failure { reason = rsn, output = otpt }) = PropertyFalsifiable rsn otpt toPropertyStatus (NoExpectedFailure {}) = PropertyNoExpectedFailure -#if MIN_VERSION_QuickCheck(2,8,0) && !MIN_VERSION_QuickCheck(2,12,0) +#if !MIN_VERSION_QuickCheck(2,12,0) toPropertyStatus (InsufficientCoverage _ _ _) = PropertyInsufficientCoverage #endif diff --git a/quickcheck2/test-framework-quickcheck2.cabal b/quickcheck2/test-framework-quickcheck2.cabal index 1a37c0f..c2dbf75 100644 --- a/quickcheck2/test-framework-quickcheck2.cabal +++ b/quickcheck2/test-framework-quickcheck2.cabal @@ -1,13 +1,13 @@ -Cabal-Version: >= 1.10 +Cabal-Version: 1.18 Name: test-framework-quickcheck2 -Version: 0.3.0.5 +Version: 0.3.0.6 Category: Testing Synopsis: QuickCheck-2 support for the test-framework package. License: BSD3 License-File: LICENSE Author: Max Bolingbroke -Maintainer: Haskell Libraries +Maintainer: Andreas Abel Homepage: http://haskell.github.io/test-framework/ Bug-Reports: https://github.com/haskell/test-framework/issues Build-Type: Simple @@ -28,7 +28,9 @@ Tested-With: GHC == 8.2.2 GHC == 8.0.2 -extra-source-files: ChangeLog.md +extra-doc-files: + ChangeLog.md + README.md Library Default-Language: Haskell2010 @@ -42,8 +44,8 @@ Library Exposed-Modules: Test.Framework.Providers.QuickCheck2 Build-Depends: test-framework == 0.8.* - , QuickCheck >= 2.4 && < 2.16 - , base >= 4.3 && < 5 + , QuickCheck >= 2.9.2 && < 2.16 + , base >= 4.9 && < 5 , extensible-exceptions >= 0.1.1 && < 0.2.0 , random >= 1 && < 1.4