gitlib-test 2.1.0.0 → 2.2.0.0
raw patch · 2 files changed
+40/−59 lines, 2 filesdep +conduitdep ~bytestringdep ~gitlib
Dependencies added: conduit
Dependency ranges changed: bytestring, gitlib
Files
- Git/Smoke.hs +36/−34
- gitlib-test.cabal +4/−25
Git/Smoke.hs view
@@ -10,35 +10,37 @@ module Git.Smoke where -import Control.Applicative-import Control.Exception-import Control.Monad-import Control.Monad.IO.Class-import Control.Monad.Trans.Class-import Control.Monad.Trans.Control-import Data.List (sort)-import Data.Monoid-import Data.Tagged-import Data.Text (Text)-import Data.Time-import Data.Time.Clock.POSIX-import Data.Typeable-import Git-import Prelude hiding (putStr)-import Test.HUnit-import Test.Hspec (Spec, Example, describe, it)-import Test.Hspec.Expectations-import Test.Hspec.HUnit ()+import Control.Applicative+import Control.Exception+import Control.Monad+import Control.Monad.IO.Class+import Control.Monad.Trans.Class+import Control.Monad.Trans.Control+import qualified Data.ByteString.Lazy as BL+import qualified Data.Conduit.Binary as CB+import Data.List (sort)+import Data.Monoid+import Data.Tagged+import Data.Text (Text)+import Data.Time+import Data.Time.Clock.POSIX+import Data.Typeable+import Git+import Prelude hiding (putStr)+import Test.HUnit+import Test.Hspec (Spec, Example, describe, it)+import Test.Hspec.Expectations+import Test.Hspec.HUnit () sampleCommit :: Repository m => TreeOid m -> Signature -> m (Commit m) sampleCommit tr sig = createCommit [] tr sig sig "Sample log message.\n" Nothing -smokeTestSpec :: (Repository (t IO), MonadGit (t IO), MonadTrans t,- Repository (t2 (t IO)), MonadGit (t2 (t IO)), MonadTrans t2,- MonadBaseControl IO (t IO))+smokeTestSpec :: (Repository t, MonadGit t,+ Repository t2, MonadGit t2,+ MonadBaseControl IO t) => RepositoryFactory t IO c- -> RepositoryFactory t2 (t IO) c2+ -> RepositoryFactory t2 t c2 -> Spec smokeTestSpec pr _pr2 = describe "Smoke tests" $ do it "create a single blob" $ withNewRepository pr "singleBlob.git" $ do@@ -182,13 +184,13 @@ let x = renderObjOid (commitOid c2) liftIO $ x @?= "967b647bd11990d1bb15ff5209ad44a002779454" - updateReference "refs/heads/master" (RefObj (commitOid c2))+ updateReference "refs/heads/master" (RefObj (untag (commitOid c2))) hasSymRefs <- hasSymbolicReferences <$> facts when hasSymRefs $ updateReference "HEAD" (RefSymbolic "refs/heads/master") Just c3 <- resolveReference "refs/heads/master"- let x = renderObjOid c3+ let x = renderOid c3 liftIO $ x @?= "967b647bd11990d1bb15ff5209ad44a002779454" refs <- listReferences@@ -388,11 +390,13 @@ instance Exception TreeitException mkBlob :: Repository m => TreeFilePath -> TreeT m ()-mkBlob path = putBlob path =<< lift (createBlob $ BlobString $ path <> "\n")+mkBlob path = putBlob path+ =<< lift (createBlob $ BlobStream $+ CB.sourceLbs (BL.fromChunks [path <> "\n"])) doTreeit :: (MonadBaseControl IO m, MonadIO m,- MonadTrans t, MonadGit (t m), Repository (t m))- => String -> RepositoryFactory t m c -> [Kind] -> TreeT (t m) a -> m ()+ MonadGit t, Repository t)+ => String -> RepositoryFactory t m c -> [Kind] -> TreeT t a -> m () doTreeit label pr kinds action = withNewRepository pr fullPath $ do tref <- createTree action tree <- lookupTree tref@@ -417,14 +421,12 @@ fullPath = normalize label <> ".git" normalize = map (\x -> if x == ' ' then '-' else x) -treeit :: (Example (m ()), MonadTrans t, MonadGit m,- MonadGit (t m), Repository (t m))- => String -> RepositoryFactory t m c -> [Kind] -> TreeT (t m) a -> Spec+treeit :: (Example (m ()), MonadGit m, MonadGit t, Repository t)+ => String -> RepositoryFactory t m c -> [Kind] -> TreeT t a -> Spec treeit label pr kinds action = it label $ doTreeit label pr kinds action -treeitFail :: (MonadTrans t,- MonadGit (t IO), Repository (t IO))- => String -> RepositoryFactory t IO c -> [Kind] -> TreeT (t IO) a+treeitFail :: (MonadGit t, Repository t)+ => String -> RepositoryFactory t IO c -> [Kind] -> TreeT t a -> Spec treeitFail label pr kinds action = it label $ doTreeit label pr kinds action
gitlib-test.cabal view
@@ -1,5 +1,5 @@ Name: gitlib-test-Version: 2.1.0.0+Version: 2.2.0.0 Synopsis: Test library for confirming gitlib backend compliance License-file: LICENSE License: MIT@@ -15,39 +15,18 @@ type: git location: git://github.com/fpco/gitlib.git --- Test-suite sanity--- Default-language: Haskell98--- Type: exitcode-stdio-1.0--- Main-is: Sanity.hs--- Hs-source-dirs: test--- Build-depends: --- base >=3--- , gitlib >= 2.1.0.0--- , gitlib-test >= 2.1.0.0--- , HUnit >= 1.2.5--- , SHA >= 2.0.0.0--- , bytestring >= 0.9.2.1--- , failure >= 0.2.0.1--- , hex >= 0.1.2--- , hspec >= 1.4.4--- , hspec-expectations >= 0.3--- , system-filepath >= 0.4.7--- , tagged >= 0.4.4--- , text >= 0.11.2--- , transformers >= 0.3--- , unordered-containers >= 0.2.3- Library default-language: Haskell98 default-extensions: ForeignFunctionInterface ghc-options: -Wall build-depends: base >= 3 && < 5- , gitlib >= 2.1.0.0+ , gitlib >= 2.2.0.0 , HUnit >= 1.2.5 , hspec >= 1.4.4 , hspec-expectations >= 0.3- , bytestring >= 0.9.2+ , bytestring+ , conduit , monad-control >= 0.3.1 , tagged >= 0.4.4 , text >= 0.11.2