[commit: packages/filepath] RyanGlScott-patch-1, master: Removed manual tests and haddock explanations (2145c08)
git at git.haskell.org
git at git.haskell.org
Thu Sep 13 14:51:11 UTC 2018
Repository : ssh://git@git.haskell.org/filepath
On branches: RyanGlScott-patch-1,master
Link : http://git.haskell.org/packages/filepath.git/commitdiff/2145c082222435c73d432ed1ff5f3ef86465d013
>---------------------------------------------------------------
commit 2145c082222435c73d432ed1ff5f3ef86465d013
Author: Jonatan H Sundqvist <jonatanhsundqvist at gmail.com>
Date: Fri Aug 18 22:12:10 2017 +0200
Removed manual tests and haddock explanations
>---------------------------------------------------------------
2145c082222435c73d432ed1ff5f3ef86465d013
System/FilePath/Internal.hs | 11 -----------
tests/TestGen.hs | 14 --------------
2 files changed, 25 deletions(-)
diff --git a/System/FilePath/Internal.hs b/System/FilePath/Internal.hs
index 8840555..12f1fb4 100644
--- a/System/FilePath/Internal.hs
+++ b/System/FilePath/Internal.hs
@@ -315,22 +315,11 @@ hasExtension = any isExtSeparator . takeFileName
-- | Does the given filename have the specified extension?
--
--- The extension may exclude the separator
-- > "png" `isExtensionOf` "/directory/file.png" == True
---
--- And it may include it
-- > ".png" `isExtensionOf` "/directory/file.png" == True
---
--- Multiple extensions are allowed
-- > ".tar.gz" `isExtensionOf` "bar/foo.tar.gz" == True
---
--- But partial matches are not
-- > "ar.gz" `isExtensionOf` "bar/foo.tar.gz" == False
---
--- Extensions are matched from the end, so the following yields @False@
-- > "png" `isExtensionOf` "/directory/file.png.jpg" == False
-
--- The argument cannot simply be a suffix, it has to be to a valid extension
-- > "csv/table.csv" `isExtensionOf` "/data/csv/table.csv" == False
isExtensionOf :: String -> FilePath -> Bool
isExtensionOf ext@('.':_) = isSuffixOf ext . takeExtensions
diff --git a/tests/TestGen.hs b/tests/TestGen.hs
index 7342871..7bc914e 100755
--- a/tests/TestGen.hs
+++ b/tests/TestGen.hs
@@ -106,20 +106,6 @@ tests =
,("W.hasExtension \"/directory/path.ext\" == True", property $ W.hasExtension "/directory/path.ext" == True)
,("P.hasExtension \"/directory/path\" == False", property $ P.hasExtension "/directory/path" == False)
,("W.hasExtension \"/directory/path\" == False", property $ W.hasExtension "/directory/path" == False)
-
- ,("W.isExtensionOf \"png\" \"/directory/file.png\" == True", property $ W.isExtensionOf "png" "/directory/file.png" == True)
- ,("P.isExtensionOf \"png\" \"/directory/file.png\" == True", property $ W.isExtensionOf "png" "/directory/file.png" == True)
- ,("W.isExtensionOf \".png\" \"/directory/file.png\" == True", property $ W.isExtensionOf ".png" "/directory/file.png" == True)
- ,("P.isExtensionOf \".png\" \"/directory/file.png\" == True", property $ W.isExtensionOf ".png" "/directory/file.png" == True)
- ,("W.isExtensionOf \".tar.gz\" \"bar/foo.tar.gz\" == True", property $ W.isExtensionOf ".tar.gz" "bar/foo.tar.gz" == True)
- ,("P.isExtensionOf \".tar.gz\" \"bar/foo.tar.gz\" == True", property $ W.isExtensionOf ".tar.gz" "bar/foo.tar.gz" == True)
- ,("W.isExtensionOf \"ar.gz\" \"bar/foo.tar.gz\" == False", property $ W.isExtensionOf "ar.gz" "bar/foo.tar.gz" == False)
- ,("P.isExtensionOf \"ar.gz\" \"bar/foo.tar.gz\" == False", property $ W.isExtensionOf "ar.gz" "bar/foo.tar.gz" == False)
- ,("W.isExtensionOf \"png\" \"/directory/file.png.jpg\" == False", property $ W.isExtensionOf "png" "/directory/file.png.jpg" == False)
- ,("P.isExtensionOf \"png\" \"/directory/file.png.jpg\" == False", property $ W.isExtensionOf "png" "/directory/file.png.jpg" == False)
- ,("W.isExtensionOf \"csv/table.csv\" \"/data/csv/table.csv\" == False", property $ W.isExtensionOf "csv/table.csv" "/data/csv/table.csv" == False)
- ,("P.isExtensionOf \"csv/table.csv\" \"/data/csv/table.csv\" == False", property $ W.isExtensionOf "csv/table.csv" "/data/csv/table.csv" == False)
-
,("null (P.takeExtension x) == not (P.hasExtension x)", property $ \(QFilePath x) -> null (P.takeExtension x) == not (P.hasExtension x))
,("null (W.takeExtension x) == not (W.hasExtension x)", property $ \(QFilePath x) -> null (W.takeExtension x) == not (W.hasExtension x))
,("P.stripExtension \"hs.o\" \"foo.x.hs.o\" == Just \"foo.x\"", property $ P.stripExtension "hs.o" "foo.x.hs.o" == Just "foo.x")
More information about the ghc-commits
mailing list