[commit: packages/filepath] master: Remove the QChar type, rewrite an arbitraryFilePath type (66f7c57)
git at git.haskell.org
git at git.haskell.org
Thu Mar 19 11:36:56 UTC 2015
Repository : ssh://git@git.haskell.org/filepath
On branch : master
Link : http://git.haskell.org/packages/filepath.git/commitdiff/66f7c574456c3570a2ba49963dfaa39a9925c248
>---------------------------------------------------------------
commit 66f7c574456c3570a2ba49963dfaa39a9925c248
Author: Neil Mitchell <ndmitchell at gmail.com>
Date: Sun Nov 2 21:47:09 2014 +0000
Remove the QChar type, rewrite an arbitraryFilePath type
>---------------------------------------------------------------
66f7c574456c3570a2ba49963dfaa39a9925c248
tests/TestUtil.hs | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tests/TestUtil.hs b/tests/TestUtil.hs
index 83f2d48..1c1718c 100644
--- a/tests/TestUtil.hs
+++ b/tests/TestUtil.hs
@@ -7,23 +7,23 @@ module TestUtil(
import Test.QuickCheck hiding ((==>))
import Data.List
+import Control.Monad
infixr 0 ==>
a ==> b = not a || b
-newtype QFilePath = QFilePath FilePath
- deriving Show
+newtype QFilePath = QFilePath FilePath deriving Show
instance Arbitrary QFilePath where
- arbitrary = fmap (QFilePath . map fromQChar) arbitrary
+ arbitrary = fmap QFilePath arbitraryFilePath
shrink (QFilePath x) = map QFilePath $ shrink x
-newtype QChar = QChar {fromQChar :: Char}
-
-instance Arbitrary QChar where
- arbitrary = fmap QChar $ elements "?./:\\a ;_"
+arbitraryFilePath :: Gen FilePath
+arbitraryFilePath = sized $ \n -> do
+ k <- choose (0,n)
+ replicateM k $ elements "?./:\\a ;_"
test :: Testable a => a -> IO ()
More information about the ghc-commits
mailing list