hspec-discover 2.8.5 → 2.11.17
raw patch · 7 files changed
Files
- LICENSE +1/−1
- hspec-discover.cabal +7/−7
- src/Test/Hspec/Discover/Config.hs +3/−3
- src/Test/Hspec/Discover/Run.hs +7/−9
- src/Test/Hspec/Discover/Sort.hs +2/−2
- test/Test/Hspec/Discover/RunSpec.hs +25/−3
- version.yaml +7/−1
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2012-2021 Simon Hengel <sol@typeful.net>+Copyright (c) 2012-2026 Simon Hengel <sol@typeful.net> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
hspec-discover.cabal view
@@ -1,25 +1,25 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4.+-- This file has been generated from package.yaml by hpack version 0.39.1. -- -- see: https://github.com/sol/hpack name: hspec-discover-version: 2.8.5+version: 2.11.17 license: MIT license-file: LICENSE-copyright: (c) 2012-2021 Simon Hengel+copyright: (c) 2012-2026 Simon Hengel author: Simon Hengel <sol@typeful.net> maintainer: Simon Hengel <sol@typeful.net> build-type: Simple category: Testing stability: experimental bug-reports: https://github.com/hspec/hspec/issues-homepage: http://hspec.github.io/+homepage: https://hspec.github.io/ synopsis: Automatically discover and run Hspec tests description: Automatically discover and run Hspec tests .- <http://hspec.github.io/hspec-discover.html>+ <https://hspec.github.io/hspec-discover.html> extra-source-files: version.yaml @@ -77,8 +77,8 @@ , directory , filepath , hspec-discover- , hspec-meta ==2.7.8- , mockery+ , hspec-meta ==2.11.17+ , mockery >=0.3.5 build-tool-depends: hspec-meta:hspec-meta-discover default-language: Haskell2010
src/Test/Hspec/Discover/Config.hs view
@@ -1,6 +1,6 @@ -- | -- /NOTE:/ This module is not meant for public consumption. For user--- documentation look at http://hspec.github.io/hspec-discover.html.+-- documentation look at https://hspec.github.io/hspec-discover.html. module Test.Hspec.Discover.Config ( Config (..) , defaultConfig@@ -35,9 +35,9 @@ parseConfig :: String -> [String] -> Either String Config parseConfig prog args = case getOpt Permute options args of (opts, [], []) -> let- c = (foldl (flip id) defaultConfig opts)+ c = foldl (flip id) defaultConfig opts in- if (configNoMain c && isJust (configFormatter c))+ if configNoMain c && isJust (configFormatter c) then formatError "option `--formatter=<fmt>' does not make sense with `--no-main'\n" else
src/Test/Hspec/Discover/Run.hs view
@@ -1,9 +1,9 @@-{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, OverloadedStrings #-}+{-# LANGUAGE FlexibleInstances, OverloadedStrings #-} {-# OPTIONS_GHC -fno-warn-orphans #-} -- | A preprocessor that finds and combines specs. -- -- /NOTE:/ This module is not meant for public consumption. For user--- documentation look at http://hspec.github.io/hspec-discover.html.+-- documentation look at https://hspec.github.io/hspec-discover.html. module Test.Hspec.Discover.Run ( run @@ -61,8 +61,8 @@ mkSpecModule src conf nodes = ( "{-# LINE 1 " . shows src . " #-}\n" . showString "{-# LANGUAGE NoImplicitPrelude #-}\n"- . showString "{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}\n"- . showString ("module " ++ moduleName src conf ++" where\n")+ . showString "{-# OPTIONS_GHC -w -Wall -fno-warn-warnings-deprecations #-}\n"+ . showString ("module " ++ moduleName src conf ++ " where\n") . importList nodes . showString "import Test.Hspec.Discover\n" . maybe driver driverWithFormatter (configFormatter conf)@@ -86,7 +86,7 @@ pathToModule f = toUpper m:ms where fileName = last $ splitDirectories f- m:ms = takeWhile (/='.') fileName+ m:ms = takeWhile (/= '.') fileName driverWithFormatter :: String -> ShowS driverWithFormatter f =@@ -121,9 +121,7 @@ sequenceS = foldr (.) "" . intersperse " >> " formatSpecs :: Maybe [Spec] -> ShowS-formatSpecs specs = case specs of- Nothing -> "return ()"- Just xs -> fromForest xs+formatSpecs = maybe "return ()" fromForest where fromForest :: [Spec] -> ShowS fromForest = sequenceS . map fromTree@@ -151,7 +149,7 @@ mkModule :: [String] -> String mkModule = intercalate "." . reverse --- See `Cabal.Distribution.ModuleName` (http://git.io/bj34)+-- See `Cabal.Distribution.ModuleName` (https://git.io/bj34) isValidModuleName :: String -> Bool isValidModuleName [] = False isValidModuleName (c:cs) = isUpper c && all isValidModuleChar cs
src/Test/Hspec/Discover/Sort.hs view
@@ -1,6 +1,6 @@ -- | -- /NOTE:/ This module is not meant for public consumption. For user--- documentation look at http://hspec.github.io/hspec-discover.html.+-- documentation look at https://hspec.github.io/hspec-discover.html. module Test.Hspec.Discover.Sort ( sortNaturallyBy , NaturalSortKey@@ -15,7 +15,7 @@ sortNaturallyBy :: (a -> (String, Int)) -> [a] -> [a] sortNaturallyBy f = sortBy (comparing ((\ (k, t) -> (naturalSortKey k, t)) . f)) -data NaturalSortKey = NaturalSortKey [Chunk]+newtype NaturalSortKey = NaturalSortKey [Chunk] deriving (Eq, Ord) data Chunk = Numeric Integer Int | Textual [(Char, Char)]
test/Test/Hspec/Discover/RunSpec.hs view
@@ -17,7 +17,7 @@ readFile "out" `shouldReturn` unlines [ "{-# LINE 1 \"test/Spec.hs\" #-}" , "{-# LANGUAGE NoImplicitPrelude #-}"- , "{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}"+ , "{-# OPTIONS_GHC -w -Wall -fno-warn-warnings-deprecations #-}" , "module Main where" , "import qualified FooSpec" , "import qualified Foo.BarSpec"@@ -33,6 +33,28 @@ ] ] + it "generates a test driver with no Main/main" $ do+ touch "test/FooSpec.hs"+ touch "test/Foo/Bar/BazSpec.hs"+ touch "test/Foo/BarSpec.hs"+ run ["test/Spec.hs", "", "out", "--no-main"]+ readFile "out" `shouldReturn` unlines [+ "{-# LINE 1 \"test/Spec.hs\" #-}"+ , "{-# LANGUAGE NoImplicitPrelude #-}"+ , "{-# OPTIONS_GHC -w -Wall -fno-warn-warnings-deprecations #-}"+ , "module Spec where"+ , "import qualified FooSpec"+ , "import qualified Foo.BarSpec"+ , "import qualified Foo.Bar.BazSpec"+ , "import Test.Hspec.Discover"+ , "spec :: Spec"+ , "spec = " ++ unwords [+ "describe \"Foo\" FooSpec.spec"+ , ">> describe \"Foo.Bar\" Foo.BarSpec.spec"+ , ">> describe \"Foo.Bar.Baz\" Foo.Bar.BazSpec.spec"+ ]+ ]+ it "generates a test driver with hooks" $ do touch "test/FooSpec.hs" touch "test/Foo/Bar/BazSpec.hs"@@ -43,7 +65,7 @@ readFile "out" `shouldReturn` unlines [ "{-# LINE 1 \"test/Spec.hs\" #-}" , "{-# LANGUAGE NoImplicitPrelude #-}"- , "{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}"+ , "{-# OPTIONS_GHC -w -Wall -fno-warn-warnings-deprecations #-}" , "module Main where" , "import qualified SpecHook" , "import qualified FooSpec"@@ -67,7 +89,7 @@ readFile "out" `shouldReturn` unlines [ "{-# LINE 1 \"test/Spec.hs\" #-}" , "{-# LANGUAGE NoImplicitPrelude #-}"- , "{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}"+ , "{-# OPTIONS_GHC -w -Wall -fno-warn-warnings-deprecations #-}" , "module Main where" , "import Test.Hspec.Discover" , "main :: IO ()"
version.yaml view
@@ -1,1 +1,7 @@-&version 2.8.5+version: &version 2.11.17+synopsis: A Testing Framework for Haskell+author: Simon Hengel <sol@typeful.net>+maintainer: Simon Hengel <sol@typeful.net>+category: Testing+stability: experimental+homepage: https://hspec.github.io/