hspec-meta 2.4.4 → 2.4.6
raw patch · 5 files changed
+75/−27 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Test.Hspec.Meta: class Example e where type Arg e type Arg e = () where {
+ Test.Hspec.Meta: class Example e where {
Files
- CHANGES.markdown +9/−0
- hspec-core/src/Test/Hspec/Core/Runner.hs +5/−0
- hspec-discover/src/Test/Hspec/Discover/Run.hs +3/−1
- hspec-discover/src/Test/Hspec/Discover/Sort.hs +30/−0
- hspec-meta.cabal +28/−26
CHANGES.markdown view
@@ -1,3 +1,12 @@+## Changes in 2.4.6+ - compatibility with the upcoming version `4.11.0.0` of `base`++## Changes in 2.4.5+ - `hspec-discover`: Sort specs using natural sort order++## Changes in 2.4.4+ - Require quickcheck-io >= 0.2.0+ ## Changes in 2.4.3 - Read command-line options from environment variable `HSPEC_OPTIONS`
hspec-core/src/Test/Hspec/Core/Runner.hs view
@@ -228,4 +228,9 @@ instance Monoid Summary where mempty = Summary 0 0+#if !MIN_VERSION_base(4,11,0) (Summary x1 x2) `mappend` (Summary y1 y2) = Summary (x1 + y1) (x2 + y2)+#else+instance Semigroup Summary where+ (Summary x1 x2) <> (Summary y1 y2) = Summary (x1 + y1) (x2 + y2)+#endif
hspec-discover/src/Test/Hspec/Discover/Run.hs view
@@ -30,6 +30,7 @@ import System.FilePath hiding (combine) import Test.Hspec.Discover.Config+import Test.Hspec.Discover.Sort instance IsString ShowS where fromString = showString@@ -141,7 +142,8 @@ isValidModuleChar c = isAlphaNum c || c == '_' || c == '\'' getFilesRecursive :: FilePath -> IO [FilePath]-getFilesRecursive baseDir = sort <$> go []+getFilesRecursive baseDir = sortNaturally <$> go []+ where go :: FilePath -> IO [FilePath] go dir = do
+ hspec-discover/src/Test/Hspec/Discover/Sort.hs view
@@ -0,0 +1,30 @@+module Test.Hspec.Discover.Sort (+ sortNaturally+, NaturalSortKey+, naturalSortKey+) where++import Control.Arrow+import Data.Char+import Data.List+import Data.Ord++sortNaturally :: [String] -> [String]+sortNaturally = sortBy (comparing naturalSortKey)++data NaturalSortKey = NaturalSortKey [Chunk]+ deriving (Eq, Ord)++data Chunk = Numeric Integer Int | Textual [(Char, Char)]+ deriving (Eq, Ord)++naturalSortKey :: String -> NaturalSortKey+naturalSortKey = NaturalSortKey . chunks+ where+ chunks [] = []+ chunks s@(c:_)+ | isDigit c = Numeric (read num) (length num) : chunks afterNum+ | otherwise = Textual (map (toLower &&& id) str) : chunks afterStr+ where+ (num, afterNum) = span isDigit s+ (str, afterStr) = break isDigit s
hspec-meta.cabal view
@@ -1,9 +1,11 @@--- This file has been generated from package.yaml by hpack version 0.18.0.+-- This file has been generated from package.yaml by hpack version 0.21.2. -- -- see: https://github.com/sol/hpack+--+-- hash: a127653a989c7ff69649480ddd6226dd61f3e9eded4419b7214fa6deb0da8f7c name: hspec-meta-version: 2.4.4+version: 2.4.6 license: MIT license-file: LICENSE copyright: (c) 2011-2017 Simon Hengel,@@ -34,22 +36,22 @@ hspec-core/src hspec-core/vendor/ build-depends:- base == 4.*- , transformers >= 0.2.2.0- , QuickCheck >= 2.5.1- , hspec-expectations >= 0.8.0- , HUnit- , setenv- , deepseq- , random- , quickcheck-io+ HUnit+ , QuickCheck >=2.5.1 , ansi-terminal- , time+ , array , async+ , base ==4.* , call-stack- , array+ , deepseq , directory , filepath+ , hspec-expectations >=0.8.0+ , quickcheck-io+ , random+ , setenv+ , time+ , transformers >=0.2.2.0 exposed-modules: Test.Hspec.Meta other-modules:@@ -91,25 +93,25 @@ hspec-discover/driver ghc-options: -Wall build-depends:- base == 4.*- , transformers >= 0.2.2.0- , QuickCheck >= 2.5.1- , hspec-expectations >= 0.8.0- , HUnit- , setenv- , deepseq- , random- , quickcheck-io+ HUnit+ , QuickCheck >=2.5.1 , ansi-terminal- , time+ , array , async+ , base ==4.* , call-stack- , array+ , deepseq , directory , filepath- , filepath- , directory+ , hspec-expectations >=0.8.0+ , quickcheck-io+ , random+ , setenv+ , time+ , transformers >=0.2.2.0 other-modules: Test.Hspec.Discover.Config Test.Hspec.Discover.Run+ Test.Hspec.Discover.Sort+ Paths_hspec_meta default-language: Haskell2010