From 52cb8fd3003fa1c91324ced300d865f6168c6f4f Mon Sep 17 00:00:00 2001 From: Neil Mitchell <ndmitchell@gmail.com> Date: Mon, 14 Nov 2016 21:29:34 +0000 Subject: [PATCH] #54, document the behaviour of <.> with an empty extension --- System/FilePath/Internal.hs | 1 + changelog.md | 2 ++ tests/TestGen.hs | 2 ++ 3 files changed, 5 insertions(+) diff --git a/System/FilePath/Internal.hs b/System/FilePath/Internal.hs index df4b39c..4a376b3 100644 --- a/System/FilePath/Internal.hs +++ b/System/FilePath/Internal.hs @@ -292,6 +292,7 @@ dropExtension = fst . splitExtension -- > addExtension "file." ".bib" == "file..bib" -- > addExtension "file" ".bib" == "file.bib" -- > addExtension "/" "x" == "/.x" +-- > addExtension x "" == x -- > Valid x => takeFileName (addExtension (addTrailingPathSeparator x) "ext") == ".ext" -- > Windows: addExtension "\\\\share" ".txt" == "\\\\share\\.txt" addExtension :: FilePath -> String -> FilePath diff --git a/changelog.md b/changelog.md index eeee736..038f72e 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,8 @@ _Note: below all `FilePath` values are unquoted, so `\\` really means two backslashes._ + * Documentation improvements + * Allow QuickCheck-2.9 ## 1.4.1.0 *Dec 2015* diff --git a/tests/TestGen.hs b/tests/TestGen.hs index e01a55d..848ae5b 100755 --- a/tests/TestGen.hs +++ b/tests/TestGen.hs @@ -96,6 +96,8 @@ tests = ,("W.addExtension \"file\" \".bib\" == \"file.bib\"", property $ W.addExtension "file" ".bib" == "file.bib") ,("P.addExtension \"/\" \"x\" == \"/.x\"", property $ P.addExtension "/" "x" == "/.x") ,("W.addExtension \"/\" \"x\" == \"/.x\"", property $ W.addExtension "/" "x" == "/.x") + ,("P.addExtension x \"\" == x", property $ \(QFilePath x) -> P.addExtension x "" == x) + ,("W.addExtension x \"\" == x", property $ \(QFilePath x) -> W.addExtension x "" == x) ,("P.takeFileName (P.addExtension (P.addTrailingPathSeparator x) \"ext\") == \".ext\"", property $ \(QFilePathValidP x) -> P.takeFileName (P.addExtension (P.addTrailingPathSeparator x) "ext") == ".ext") ,("W.takeFileName (W.addExtension (W.addTrailingPathSeparator x) \"ext\") == \".ext\"", property $ \(QFilePathValidW x) -> W.takeFileName (W.addExtension (W.addTrailingPathSeparator x) "ext") == ".ext") ,("W.addExtension \"\\\\\\\\share\" \".txt\" == \"\\\\\\\\share\\\\.txt\"", property $ W.addExtension "\\\\share" ".txt" == "\\\\share\\.txt") -- GitLab