add newtypes for QuickCheck to avoid LANG=C issues

All properties changed to use them, except for
prop_encode_c_decode_c_roundtrip, which already filtered to ascii
for other reasons.

A few modules had to be split out, because Setup does not build-depend
on QuickCheck.
This commit is contained in:
Joey Hess 2020-11-09 20:07:31 -04:00
parent aad4129669
commit 885974be99
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
17 changed files with 211 additions and 130 deletions

View file

@ -17,6 +17,7 @@ module Annex.View.ViewedFile (
) where
import Annex.Common
import Utility.QuickCheck
import qualified Data.ByteString as S
@ -78,11 +79,12 @@ dirFromViewedFile = joinPath . drop 1 . sep [] ""
[] -> sep l curr cs
| otherwise = sep l (c:curr) cs
prop_viewedFile_roundtrips :: FilePath -> Bool
prop_viewedFile_roundtrips f
prop_viewedFile_roundtrips :: TestableFilePath -> Bool
prop_viewedFile_roundtrips tf
-- Relative filenames wanted, not directories.
| any (isPathSeparator) (end f ++ beginning f) = True
| isAbsolute f = True
| otherwise = dir == dirFromViewedFile (viewedFileFromReference f)
where
f = fromTestableFilePath tf
dir = joinPath $ beginning $ splitDirectories f