[commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Add tests for makeAbsolute (4366a08)
git at git.haskell.org
git at git.haskell.org
Mon Apr 17 21:34:40 UTC 2017
- Previous message: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #65 from dterei/safe710fixes (09ae752)
- Next message: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #67 from hvr/pr-deepseq-14 (c802c36)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Repository : ssh://git@git.haskell.org/directory
On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master
Link : http://ghc.haskell.org/trac/ghc/changeset/4366a08895bff22a16151f9e43055ac2937bc5ab/directory
>---------------------------------------------------------------
commit 4366a08895bff22a16151f9e43055ac2937bc5ab
Author: Phil Ruffwind <rf at rufflewind.com>
Date: Mon Nov 28 22:46:00 2016 -0500
Add tests for makeAbsolute
Precaution to make sure nothing was broken by the previous commit.
>---------------------------------------------------------------
4366a08895bff22a16151f9e43055ac2937bc5ab
directory.cabal | 1 +
tests/Main.hs | 2 ++
tests/MakeAbsolute.hs | 34 ++++++++++++++++++++++++++++++++++
3 files changed, 37 insertions(+)
diff --git a/directory.cabal b/directory.cabal
index 86652a4..06c4d0d 100644
--- a/directory.cabal
+++ b/directory.cabal
@@ -96,6 +96,7 @@ test-suite test
GetHomeDirectory001
GetPermissions001
IsSymbolicLink
+ MakeAbsolute
RemoveDirectoryRecursive001
RemovePathForcibly
RenameDirectory
diff --git a/tests/Main.hs b/tests/Main.hs
index e4a867a..6fb34dc 100644
--- a/tests/Main.hs
+++ b/tests/Main.hs
@@ -18,6 +18,7 @@ import qualified GetFileSize
import qualified GetHomeDirectory001
import qualified GetPermissions001
import qualified IsSymbolicLink
+import qualified MakeAbsolute
import qualified RemoveDirectoryRecursive001
import qualified RemovePathForcibly
import qualified RenameDirectory
@@ -47,6 +48,7 @@ main = T.testMain $ \ _t -> do
T.isolatedRun _t "GetHomeDirectory001" GetHomeDirectory001.main
T.isolatedRun _t "GetPermissions001" GetPermissions001.main
T.isolatedRun _t "IsSymbolicLink" IsSymbolicLink.main
+ T.isolatedRun _t "MakeAbsolute" MakeAbsolute.main
T.isolatedRun _t "RemoveDirectoryRecursive001" RemoveDirectoryRecursive001.main
T.isolatedRun _t "RemovePathForcibly" RemovePathForcibly.main
T.isolatedRun _t "RenameDirectory" RenameDirectory.main
diff --git a/tests/MakeAbsolute.hs b/tests/MakeAbsolute.hs
new file mode 100644
index 0000000..4303017
--- /dev/null
+++ b/tests/MakeAbsolute.hs
@@ -0,0 +1,34 @@
+{-# LANGUAGE CPP #-}
+module MakeAbsolute where
+#include "util.inl"
+import System.Directory
+import System.FilePath ((</>), addTrailingPathSeparator,
+ dropTrailingPathSeparator, normalise)
+
+main :: TestEnv -> IO ()
+main _t = do
+ dot <- makeAbsolute ""
+ dot2 <- makeAbsolute "."
+ dot3 <- makeAbsolute "./."
+ T(expectEq) () dot (dropTrailingPathSeparator dot)
+ T(expectEq) () dot dot2
+ T(expectEq) () dot dot3
+
+ sdot <- makeAbsolute "./"
+ sdot2 <- makeAbsolute "././"
+ T(expectEq) () sdot (addTrailingPathSeparator sdot)
+ T(expectEq) () sdot sdot2
+
+ foo <- makeAbsolute "foo"
+ foo2 <- makeAbsolute "foo/."
+ foo3 <- makeAbsolute "./foo"
+ T(expectEq) () foo (normalise (dot </> "foo"))
+ T(expectEq) () foo foo2
+ T(expectEq) () foo foo3
+
+ sfoo <- makeAbsolute "foo/"
+ sfoo2 <- makeAbsolute "foo/./"
+ sfoo3 <- makeAbsolute "./foo/"
+ T(expectEq) () sfoo (normalise (dot </> "foo/"))
+ T(expectEq) () sfoo sfoo2
+ T(expectEq) () sfoo sfoo3
- Previous message: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #65 from dterei/safe710fixes (09ae752)
- Next message: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #67 from hvr/pr-deepseq-14 (c802c36)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the ghc-commits
mailing list