Skip to content

Commit 51501db

Browse files
committed
Fix property test for normalise
1 parent 9721aa6 commit 51501db

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/filepath-equivalent-tests/TestEquiv.hs

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{-# LANGUAGE CPP #-}
2-
{-# LANGUAGE TypeApplications #-}
32

43
module Main where
54

@@ -11,6 +10,7 @@ import qualified System.FilePath.Windows as W
1110
import qualified System.FilePath.Posix as P
1211
import qualified Legacy.System.FilePath.Windows as LW
1312
import qualified Legacy.System.FilePath.Posix as LP
13+
import Data.Char (isAsciiLower, isAsciiUpper)
1414

1515

1616
main :: IO ()
@@ -189,7 +189,14 @@ equivalentTests =
189189
)
190190
,
191191
( "normalise (windows)"
192-
, property $ \p -> W.normalise p == LW.normalise p
192+
, property $ \p -> case p of
193+
(l:':':rs)
194+
-- new filepath normalises "a:////////" to "A:\\"
195+
-- see https://github.com/haskell/filepath/commit/cb4890aa03a5ee61f16f7a08dd2d964fffffb385
196+
| isAsciiLower l || isAsciiUpper l
197+
, let (seps, path) = span LW.isPathSeparator rs
198+
, length seps > 1 -> let np = l : ':' : LW.pathSeparator : path in W.normalise np == LW.normalise np
199+
_ -> W.normalise p == LW.normalise p
193200
)
194201
,
195202
( "equalFilePath (windows)"

0 commit comments

Comments
 (0)