sync-mht 0.3.6.0 → 0.3.7.0
raw patch · 3 files changed
+33/−10 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- src/Sync/MerkleTree/Client.hs +1/−1
- src/Sync/MerkleTree/Test.hs +30/−7
- sync-mht.cabal +2/−2
src/Sync/MerkleTree/Client.hs view
@@ -95,7 +95,7 @@ forM_ (reverse $ sort delEntries) $ \e -> case e of FileEntry f -> liftIO $ removeFile $ toFilePath fp $ f_name f- DirectoryEntry p -> liftIO $ removeDirectory $ toFilePath fp p+ DirectoryEntry p -> liftIO $ removeDirectoryRecursive $ toFilePath fp p let updateEntries = [ e | cs_add cs, e <- newEntries ] ++ [ e | cs_update cs, e <- changedEntries ] progressEntries <- liftIO $ newIORef $ length updateEntries
src/Sync/MerkleTree/Test.hs view
@@ -29,6 +29,8 @@ , testEntry , testIgnoreBoring , testSync+ , testDoesThrowIOError+ , testDirsEqual ] testIgnoreBoring :: H.Test@@ -78,17 +80,20 @@ destDir = testDir </> "dest" data_ = show [1..(2^17)] createDirectory srcDir+ forM_ [1..20] $ \i ->+ do createDirectory $ srcDir </> (show i)+ forM_ [1..20] $ \j ->+ writeFile (srcDir </> (show i) </> ("new.txt"++show j)) data_ createDirectory destDir- forM_ [1..400] $ \i -> writeFile (srcDir </> ("new.txt"++show i)) data_ runSync $ defaultSyncOptions { so_source = Just $ srcDir , so_destination = Just $ destDir , so_add = True }- dataNew1 <- readFile $ destDir </> "new.txt123"- dataNew2 <- readFile $ destDir </> "new.txt234"- dataNew3 <- readFile $ destDir </> "new.txt345"+ dataNew1 <- readFile $ destDir </> "1" </> "new.txt19"+ dataNew2 <- readFile $ destDir </> "17" </> "new.txt13"+ dataNew3 <- readFile $ destDir </> "12" </> "new.txt1" data_ H.@=? dataNew1 data_ H.@=? dataNew2 data_ H.@=? dataNew3@@ -171,15 +176,13 @@ createDirectory srcDir createDirectory destDir writeFile (srcDir </> "new.txt") data_- res <- (flip catchIOError) (\_ -> return True) $+ shouldFail $ do runSync $ defaultSyncOptions { so_source = Just $ "remote:" ++ srcDir , so_destination = Just $ destDir , so_remote = Just $ RemoteCmd "exit" , so_add = True }- return False- True H.@=? res testOptions :: H.Test testOptions = H.TestLabel "testOptions" $ H.TestCase $@@ -272,6 +275,26 @@ forM_ fps $ \fp -> do writeFile (fp </> n) (show d) setModificationTime (fp </> n) (utcTimeFrom d)++doesThrowIOError :: IO () -> IO Bool+doesThrowIOError a = catchIOError (a >>= (return . (`seq` False))) (return . (`seq` True))++shouldFail :: IO () -> IO ()+shouldFail action = doesThrowIOError action >>= (True H.@=?)++testDoesThrowIOError :: H.Test+testDoesThrowIOError = H.TestLabel "testDoesThrowIOError" $ H.TestCase $+ do r1 <- doesThrowIOError $ return ()+ False H.@=? r1++testDirsEqual :: H.Test+testDirsEqual = H.TestLabel "testDirsEqual" $ H.TestCase $+ shouldFail $ withSystemTempDirectory "sync-mht" $ \testDir ->+ do createDirectory $ testDir </> "a"+ createDirectory $ testDir </> "b"+ writeFile (testDir </> "a" </> "x") "x"+ writeFile (testDir </> "b" </> "x") "y"+ areDirsEqual (testDir </> "a") (testDir </> "b") areDirsEqual :: FilePath -> FilePath -> IO () areDirsEqual fp1 fp2 =
sync-mht.cabal view
@@ -8,7 +8,7 @@ extra-doc-files: README.md cabal-version: >= 1.18 build-type: Simple-version: 0.3.6.0+version: 0.3.7.0 homepage: https://github.com/ekarayel/sync-mht bug-reports: https://github.com/ekarayel/sync-mht/issues package-url: https://github.com/ekarayel/sync-mht@@ -29,7 +29,7 @@ location: https://github.com/ekarayel/sync-mht --recursive source-repository this type: git- tag: 0.3.6.0+ tag: 0.3.7.0 location: https://github.com/ekarayel/sync-mht --recursive test-suite main type: exitcode-stdio-1.0