stack-hpc-coveralls 0.0.2.0 → 0.0.3.0
raw patch · 3 files changed
+20/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ SHC.Utils: verifyVersion :: String -> Version -> Bool
Files
- src/SHC/Utils.hs +13/−1
- stack-hpc-coveralls.cabal +1/−1
- test/SHCSpec.hs +6/−0
src/SHC/Utils.hs view
@@ -14,9 +14,11 @@ import Control.Monad (guard) import Data.Function (on) import Data.List+import Data.Version #if __GLASGOW_HASKELL__ < 710 import Control.Applicative ((<$>), (<*>)) #endif+import Text.ParserCombinators.ReadP import System.FilePath ((</>)) import System.Process (readProcess) @@ -54,7 +56,17 @@ -- | Verify that the required Stack is present. checkStackVersion :: IO Bool-checkStackVersion = ("0.1.7.0" <=) <$> stack ["--numeric-version"]+checkStackVersion = do+ let lowerBound = Version [0,1,7,0] []+ stackVersion <- stack ["--numeric-version"]+ return $ verifyVersion stackVersion lowerBound++-- | Check whether a string is a version and if it is+-- greater than or equal to a specified version.+verifyVersion :: String -> Version -> Bool+verifyVersion ver lowerBound =+ let parses = readP_to_S parseVersion ver+ in not (null parses) && (lowerBound <= fst (last parses)) -- | Return the HPC data directory, given the package name. getHpcDir :: String -> IO FilePath
stack-hpc-coveralls.cabal view
@@ -1,5 +1,5 @@ name: stack-hpc-coveralls-version: 0.0.2.0+version: 0.0.3.0 synopsis: Initial project template from stack description: Please see README.md homepage: http://github.com/rubik/stack-hpc-coveralls
test/SHCSpec.hs view
@@ -10,6 +10,7 @@ import Data.Aeson import qualified Data.Map.Strict as M import Data.Time.Clock (getCurrentTime)+import Data.Version import System.IO.Unsafe (unsafePerformIO) import Test.Hspec import Test.Hspec.Contrib.HUnit@@ -89,6 +90,11 @@ it "toLix" $ toLix 4 covEntries `shouldBe` [Partial, Full, Irrelevant, None] describe "SHC.Utils" $ do+ it "verifyVersion" $+ let ver = Version [0,1,7,0] []+ in (not (verifyVersion "0.1.6.0" ver) &&+ verifyVersion "0.1.7.0" ver &&+ verifyVersion "1.100.4.56" ver) `shouldBe` True it "fst3" $ fst3 (1, 2, 3) `shouldBe` 1 it "snd3" $ snd3 (1, 2, 3) `shouldBe` 2 it "trd3" $ trd3 (1, 2, 3) `shouldBe` 3