test case for addurl file://

This commit is contained in:
Joey Hess 2015-02-10 15:20:07 -04:00
parent 000ec8d096
commit 8fe7d6c0a7

11
Test.hs
View file

@ -227,6 +227,7 @@ unitTests note = testGroup ("Unit Tests " ++ note)
, testCase "crypto" test_crypto , testCase "crypto" test_crypto
, testCase "preferred content" test_preferred_content , testCase "preferred content" test_preferred_content
, testCase "add subdirs" test_add_subdirs , testCase "add subdirs" test_add_subdirs
, testCase "addurl" test_addurl
] ]
-- this test case create the main repo -- this test case create the main repo
@ -1356,6 +1357,16 @@ test_add_subdirs = intmpclonerepo $ do
setCurrentDirectory "dir" setCurrentDirectory "dir"
git_annex "add" [".." </> "dir2"] @? "add of ../subdir failed" git_annex "add" [".." </> "dir2"] @? "add of ../subdir failed"
test_addurl :: Assertion
test_addurl = intmpclonerepo $ do
-- file:// only; this test suite should not hit the network
f <- absPath "myurl"
writeFile f "foo"
git_annex "addurl" ["file://" ++ f] @? "addurl failed on file:// url"
let dest = "addurlurldest"
git_annex "addurl" ["--file", dest, "file://" ++ f] @? "addurl failed on file:// url with --file"
doesFileExist dest @? (dest ++ " missing after addurl --file")
-- This is equivilant to running git-annex, but it's all run in-process -- This is equivilant to running git-annex, but it's all run in-process
-- so test coverage collection works. -- so test coverage collection works.
git_annex :: String -> [String] -> IO Bool git_annex :: String -> [String] -> IO Bool