[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36
John Goerzen
jgoerzen at complete.org
Fri Apr 23 15:09:47 UTC 2010
The following commit has been merged in the master branch:
commit fc8f8e7f859c6d5322d2d9e4806cee65db7cf238
Author: John Goerzen <jgoerzen at complete.org>
Date: Mon Apr 10 22:43:50 2006 +0100
Finished glob tests and fixed a glob bug they found
716 unit tests now pass
diff --git a/MissingH/Path/Glob.hs b/MissingH/Path/Glob.hs
index 556a7cf..a8d8076 100644
--- a/MissingH/Path/Glob.hs
+++ b/MissingH/Path/Glob.hs
@@ -85,7 +85,9 @@ expandGlob fs fn =
expandNormalBase :: FilePath -> IO [FilePath]
expandNormalBase dname =
do isdir <- vDoesDirectoryExist fs dname
- if (basename /= "." && basename /= "") || isdir
+ let newname = dname ++ "/" ++ basename
+ isexists <- vDoesExist fs newname
+ if isexists && ((basename /= "." && basename /= "") || isdir)
then return [dname ++ "/" ++ basename]
else return []
diff --git a/testsrc/Globtest.hs b/testsrc/Globtest.hs
index 9163993..57e4a0f 100644
--- a/testsrc/Globtest.hs
+++ b/testsrc/Globtest.hs
@@ -75,9 +75,27 @@ test_nested_dir =
glob (preppath "a/bcd/*g") >>= eq "a/bcd/*g" [preppath "a/bcd/efg"]
]
+test_dirnames =
+ map f
+ [glob (preppath "*/D") >>= eq "*/D" [preppath "a/D"],
+ glob (preppath "*/*a") >>= eq "*/*a" [],
+ glob (preppath "a/*/*/*a") >>= eq "a/*/*/*a" [preppath "a/bcd/efg/ha"],
+ glob (preppath "?a?/*F") >>= eq "?a?/*F" (map preppath ["aaa/zzzF", "aab/F"])
+ ]
+
+test_brokensymlinks =
+ map f
+ [glob (preppath "sym*") >>= eq "sym*" (map preppath ["sym1", "sym2"]),
+ glob (preppath "sym1") >>= eq "sym1" [preppath "sym1"],
+ glob (preppath "sym2") >>= eq "sym2" [preppath "sym2"]
+ ]
+
+
tests = TestList [TestLabel "test_literal" (TestList test_literal),
TestLabel "test_one_dir" (TestList test_one_dir),
- TestLabel "test_nested_dir" (TestList test_nested_dir)]
+ TestLabel "test_nested_dir" (TestList test_nested_dir),
+ TestLabel "test_dirnames" (TestList test_dirnames),
+ TestLabel "test_brokensymlinks" (TestList test_brokensymlinks)]
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list