[commit: packages/filepath] master: Move isRelativeDrive tests to isRelative (db0d2ff)
git at git.haskell.org
git at git.haskell.org
Thu Mar 19 11:33:47 UTC 2015
Repository : ssh://git@git.haskell.org/filepath
On branch : master
Link : http://git.haskell.org/packages/filepath.git/commitdiff/db0d2ff7d934de41a3be6c16b5acd298e614e54d
>---------------------------------------------------------------
commit db0d2ff7d934de41a3be6c16b5acd298e614e54d
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date: Sun Sep 14 16:52:40 2014 +0200
Move isRelativeDrive tests to isRelative
Those tests were commented out, because isRelativeDrive is not normally
exported from the module. Instead of doing a special testing compilation by
passing the TESTING=1 environment variable, it seemed easier to rewrite the
tests to use isRelative.
Only the following trivial test is not accounted for:
isRelativeDrive "" == True
>---------------------------------------------------------------
db0d2ff7d934de41a3be6c16b5acd298e614e54d
System/FilePath/Internal.hs | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/System/FilePath/Internal.hs b/System/FilePath/Internal.hs
index 18a4ee4..16790fc 100644
--- a/System/FilePath/Internal.hs
+++ b/System/FilePath/Internal.hs
@@ -79,11 +79,6 @@ module System.FilePath.MODULE_NAME
makeRelative,
isRelative, isAbsolute,
isValid, makeValid
-
-#ifdef TESTING
- , isRelativeDrive
-#endif
-
)
where
@@ -813,23 +808,18 @@ makeValid path = joinDrive drv $ validElements $ validChars pth
-- > Windows: isRelative "path\\test" == True
-- > Windows: isRelative "c:\\test" == False
-- > Windows: isRelative "c:test" == True
+-- > Windows: isRelative "c:\\" == False
+-- > Windows: isRelative "c:/" == False
-- > Windows: isRelative "c:" == True
-- > Windows: isRelative "\\\\foo" == False
-- > Windows: isRelative "/foo" == True
-- > Posix: isRelative "test/path" == True
-- > Posix: isRelative "/test" == False
+-- > Posix: isRelative "/" == False
isRelative :: FilePath -> Bool
isRelative = isRelativeDrive . takeDrive
--- Disable these tests for now, as we want to be able to run the
--- testsuite without doing a special TESTING compilation
--- -- > isRelativeDrive "" == True
--- -- > Windows: isRelativeDrive "c:\\" == False
--- -- > Windows: isRelativeDrive "c:/" == False
--- -- > Windows: isRelativeDrive "c:" == True
--- -- > Windows: isRelativeDrive "\\\\foo" == False
--- -- > Posix: isRelativeDrive "/" == False
isRelativeDrive :: String -> Bool
isRelativeDrive x = null x ||
maybe False (not . isPathSeparator . last . fst) (readDriveLetter x)
More information about the ghc-commits
mailing list