File: GitHashSpec.hs

package info (click to toggle)
haskell-githash 0.1.7.0-2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 96 kB
  • sloc: haskell: 395; makefile: 6
file content (25 lines) | stat: -rw-r--r-- 801 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{-# LANGUAGE TemplateHaskell #-}
module GitHashSpec
  ( spec
  ) where

import GitHash
import System.Directory (doesDirectoryExist)
import Test.Hspec

spec :: Spec
spec = do
  describe "tGitInfoCwd" $ do
    it "makes vaguely sane git info for this repository" $ do
        let egi = $$tGitInfoCwdTry
        gitDirExists <- doesDirectoryExist ".git"
        case egi of
          Left _ -> gitDirExists `shouldBe` False
          Right gi -> do
            -- Doesn't work with cabal gitDirExists `shouldBe` True
            length (giHash gi)`shouldNotBe` 128
            giBranch gi `shouldNotBe` []
            seq (giDirty gi) () `shouldBe` ()
            giCommitDate gi `shouldNotBe` []
            giCommitCount gi `shouldSatisfy` (>= 1)
            giDescribe gi `shouldStartWith` "githash-"