[commit: packages/directory] master: Add more canonicalizePath tests (cdcc450)
git at git.haskell.org
git at git.haskell.org
Mon Apr 17 21:35:36 UTC 2017
Repository : ssh://git@git.haskell.org/directory
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/cdcc45059b02f2ddabae04aee5ee14759d9d83bb/directory
>---------------------------------------------------------------
commit cdcc45059b02f2ddabae04aee5ee14759d9d83bb
Author: Phil Ruffwind <rf at rufflewind.com>
Date: Thu Mar 2 03:22:36 2017 -0500
Add more canonicalizePath tests
>---------------------------------------------------------------
cdcc45059b02f2ddabae04aee5ee14759d9d83bb
tests/CanonicalizePath.hs | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tests/CanonicalizePath.hs b/tests/CanonicalizePath.hs
index 07ba771..ab74c7b 100644
--- a/tests/CanonicalizePath.hs
+++ b/tests/CanonicalizePath.hs
@@ -81,10 +81,18 @@ main _t = do
T(expectEq) () bar =<< canonicalizePath "lfoo/bar"
T(expectEq) () barQux =<< canonicalizePath "lfoo/bar/qux"
+ -- create a haphazard chain of links
+ createDirectoryLink "./../foo/../foo/." "./foo/./somelink3"
+ createDirectoryLink ".././foo/somelink3" "foo/somelink2"
+ createDirectoryLink "./foo/somelink2" "somelink"
+ T(expectEq) () foo =<< canonicalizePath "somelink"
+
-- regression test for #64
createFileLink "../foo/non-existent" "foo/qux"
+ removeDirectoryLink "foo/somelink3" -- break the chain made earlier
qux <- canonicalizePath "foo/qux"
T(expectEq) () qux =<< canonicalizePath "foo/non-existent"
+ T(expectEq) () (foo </> "somelink3") =<< canonicalizePath "somelink"
-- make sure it can handle loops
createFileLink "loop1" "loop2"
More information about the ghc-commits
mailing list