gitlib-test 3.0.1 → 3.1.0
raw patch · 2 files changed
+54/−17 lines, 2 filesdep +conduit-combinatorsdep +exceptionsdep −failuredep ~conduit
Dependencies added: conduit-combinators, exceptions
Dependencies removed: failure
Dependency ranges changed: conduit
Files
- Git/Smoke.hs +50/−14
- gitlib-test.cabal +4/−3
Git/Smoke.hs view
@@ -10,14 +10,11 @@ module Git.Smoke where +import Conduit 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@@ -36,22 +33,33 @@ sampleCommit tr sig = createCommit [] tr sig sig "Sample log message.\n" Nothing -smokeTestSpec :: (MonadGit r m, MonadIO m, MonadBaseControl IO m,- MonadGit s n, MonadIO n, MonadBaseControl IO n)+smokeTestSpec :: (MonadGit r m, MonadIO m, MonadBaseControl IO m, MonadThrow m,+ MonadGit s n, MonadIO n, MonadBaseControl IO n, MonadThrow n) => RepositoryFactory m IO r -> RepositoryFactory n m s -> Spec smokeTestSpec pr _pr2 = describe "Smoke tests" $ do- it "create a single blob" $ withNewRepository pr "singleBlob.git" $ do- createBlobUtf8 "Hello, world!\n"+ it "hash without persisting" $ withNewRepository pr "hashObject.git" $ do+ r <- hashContents $ BlobString "flim-flam"+ liftIO $ renderObjOid r @?= "5cc144cc0c3c101342b3f0c546c014d1e0e66da9" - x <- catBlob =<< parseObjOid "af5626b4a114abcb82d63db7c8082c3c4756e51b"- liftIO $ x @?= "Hello, world!\n"+ -- it "create a single blob" $ withNewRepository pr "singleBlob.git" $ do+ -- createBlobUtf8 "Hello, world!\n" - -- jww (2013-02-01): Restore when S3 support prefix lookups- -- x <- catBlob "af5626b"- -- liftIO $ x @?= "Hello, world!\n"+ -- oid <- parseObjOid "af5626b4a114abcb82d63db7c8082c3c4756e51b"+ -- x <- catBlob oid+ -- liftIO $ x @?= "Hello, world!\n" + -- e1 <- existsObject $ untag oid+ -- liftIO $ e1 @? "Expected object doesn't exist."++ -- e2 <- existsObject =<< parseOid "efefefefefefefefefefefefefefefefefefefef"+ -- liftIO $ not e2 @? "Unexpected object exists."++ -- -- jww (2013-02-01): Restore when S3 support prefix lookups+ -- -- x <- catBlob "af5626b"+ -- -- liftIO $ x @?= "Hello, world!\n"+ it "create a single tree" $ withNewRepository pr "singleTree.git" $ do hello <- createBlobUtf8 "Hello, world!\n" tr <- createTree $ putBlob "hello/world.txt" hello@@ -118,6 +126,31 @@ let x = renderObjOid (commitOid c) liftIO $ x @?= "4e0529eb30f53e65c1e13836e73023c9d23c25ae" + -- it "tag a single commit" $ withNewRepository pr "tagCommit.git" $ do+ -- hello <- createBlobUtf8 "Hello, world!\n"+ -- tr <- createTree $ putBlob "hello/world.txt" hello++ -- goodbye <- createBlobUtf8 "Goodbye, world!\n"+ -- tr <- mutateTreeOid tr $ putBlob "goodbye/files/world.txt" goodbye+ -- let x = renderObjOid tr+ -- liftIO $ x @?= "98c3f387f63c08e1ea1019121d623366ff04de7a"++ -- -- The Oid has been cleared in tr, so this tests that it gets+ -- -- written as needed.+ -- let sig = Signature {+ -- signatureName = "John Wiegley"+ -- , signatureEmail = "johnw@fpcomplete.com"+ -- , signatureWhen = fakeTime 1348980883 }++ -- c <- commitOid <$> sampleCommit tr sig+ -- t <- tagOid <$> createTag c sig "good" "name"+ -- let x = renderObjOid t+ -- liftIO $ x @?= "f2e15fe8138a30f663007005c59ab40e55857e24"++ -- Tag ti ci <- lookupTag t+ -- liftIO $ ti @?= t+ -- liftIO $ ci @?= c+ it "modify a commit" $ withNewRepository pr "modifyCommit.git" $ do hello <- createBlobUtf8 "Hello, world!\n" tr <- createTree $ putBlob "hello/world.txt" hello@@ -195,6 +228,9 @@ refs <- listReferences liftIO $ show refs @?= "[\"refs/heads/master\"]" + deleteReference "refs/heads/master"+ deleteReference "HEAD"+ -- jww (2013-01-27): Restore -- ehist <- commitHistoryFirstParent c2 -- Prelude.putStrLn $ "ehist: " ++ show ehist@@ -391,7 +427,7 @@ mkBlob :: MonadGit r m => TreeFilePath -> TreeT r m () mkBlob path = putBlob path =<< lift (createBlob $ BlobStream $- CB.sourceLbs (BL.fromChunks [path <> "\n"]))+ sourceLazy (BL.fromChunks [path <> "\n"])) doTreeit :: (MonadBaseControl IO m, MonadIO m, MonadGit r n, MonadBaseControl IO n, MonadIO n)
gitlib-test.cabal view
@@ -1,5 +1,5 @@ Name: gitlib-test-Version: 3.0.1+Version: 3.1.0 Synopsis: Test library for confirming gitlib backend compliance License-file: LICENSE License: MIT@@ -26,8 +26,9 @@ , hspec >= 1.4.4 , hspec-expectations >= 0.3 , bytestring- , failure >= 0.2.0- , conduit+ , exceptions >= 0.5+ , conduit >= 1.1.0+ , conduit-combinators >= 0.2.4 , monad-control >= 0.3.1 , tagged >= 0.4.4 , text >= 0.11.2