test if magic library works
(When built with it.) I saw John Thorvald Wodder II doing this in https://github.com/datalad/datalad-extensions/blob/master/.github/workflows/build-git-annex-windows.yaml and it seemed like a good idea. John used an empty file for the binary file, but I think it's slightly suprising file picks that mime type for it, so opted to instead use something less ambiguous.
This commit is contained in:
parent
64e7bac810
commit
37054e0946
1 changed files with 23 additions and 0 deletions
23
Test.hs
23
Test.hs
|
@ -298,6 +298,7 @@ unitTests note = testGroup ("Unit Tests " ++ note)
|
||||||
, testCase "export_import_subdir" test_export_import_subdir
|
, testCase "export_import_subdir" test_export_import_subdir
|
||||||
, testCase "shared clone" test_shared_clone
|
, testCase "shared clone" test_shared_clone
|
||||||
, testCase "log" test_log
|
, testCase "log" test_log
|
||||||
|
, testCase "magic" test_magic
|
||||||
, testCase "import" test_import
|
, testCase "import" test_import
|
||||||
, testCase "reinject" test_reinject
|
, testCase "reinject" test_reinject
|
||||||
, testCase "unannex (no copy)" test_unannex_nocopy
|
, testCase "unannex (no copy)" test_unannex_nocopy
|
||||||
|
@ -446,6 +447,28 @@ test_log :: Assertion
|
||||||
test_log = intmpclonerepo $ do
|
test_log = intmpclonerepo $ do
|
||||||
git_annex "log" [annexedfile] @? "log failed"
|
git_annex "log" [annexedfile] @? "log failed"
|
||||||
|
|
||||||
|
test_magic :: Assertion
|
||||||
|
test_magic = intmpclonerepo $ do
|
||||||
|
#ifdef WITH_MAGICMIME
|
||||||
|
boolSystem "git"
|
||||||
|
[ Param "config"
|
||||||
|
, Param "annex.largefiles"
|
||||||
|
, Param "mimeencoding=binary"
|
||||||
|
] @? "git config annex.largefiles failed"
|
||||||
|
writeFile "binary" "\127"
|
||||||
|
writeFile "text" "test\n"
|
||||||
|
git_annex "add" ["binary", "text"]
|
||||||
|
@? "git-annex add failed with mimeencoding in largefiles"
|
||||||
|
git_annex "sync" []
|
||||||
|
@? "git-annex sync failed"
|
||||||
|
(isJust <$> annexeval (Annex.CatFile.catKeyFile (encodeBS "binary")))
|
||||||
|
@? "binary file not added to annex despite mimeencoding config"
|
||||||
|
(isNothing <$> annexeval (Annex.CatFile.catKeyFile (encodeBS "text")))
|
||||||
|
@? "non-binary file got added to annex despite mimeencoding config"
|
||||||
|
#else
|
||||||
|
return ()
|
||||||
|
#endif
|
||||||
|
|
||||||
test_import :: Assertion
|
test_import :: Assertion
|
||||||
test_import = intmpclonerepo $ Utility.Tmp.Dir.withTmpDir "importtest" $ \importdir -> do
|
test_import = intmpclonerepo $ Utility.Tmp.Dir.withTmpDir "importtest" $ \importdir -> do
|
||||||
(toimport1, importf1, imported1) <- mktoimport importdir "import1"
|
(toimport1, importf1, imported1) <- mktoimport importdir "import1"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue