Skip to content

Commit

Permalink
Fix property test for normalise
Browse files Browse the repository at this point in the history
  • Loading branch information
hasufell committed Oct 19, 2023
1 parent 9721aa6 commit 51501db
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/filepath-equivalent-tests/TestEquiv.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE TypeApplications #-}

module Main where

Expand All @@ -11,6 +10,7 @@ import qualified System.FilePath.Windows as W
import qualified System.FilePath.Posix as P
import qualified Legacy.System.FilePath.Windows as LW
import qualified Legacy.System.FilePath.Posix as LP
import Data.Char (isAsciiLower, isAsciiUpper)


main :: IO ()
Expand Down Expand Up @@ -189,7 +189,14 @@ equivalentTests =
)
,
( "normalise (windows)"
, property $ \p -> W.normalise p == LW.normalise p
, property $ \p -> case p of
(l:':':rs)
-- new filepath normalises "a:////////" to "A:\\"
-- see https://github.com/haskell/filepath/commit/cb4890aa03a5ee61f16f7a08dd2d964fffffb385
| isAsciiLower l || isAsciiUpper l
, let (seps, path) = span LW.isPathSeparator rs
, length seps > 1 -> let np = l : ':' : LW.pathSeparator : path in W.normalise np == LW.normalise np
_ -> W.normalise p == LW.normalise p
)
,
( "equalFilePath (windows)"
Expand Down

0 comments on commit 51501db

Please sign in to comment.